const char *CliGetFullVersionDescriptor(void) { static char buffer[10+32+sizeof("v"CLIENT_VERSIONSTRING"-XXX-99071523-*dev* client for "CLIENT_OS_NAME_EXTENDED)]; struct timeval tv; tv.tv_usec = 0; tv.tv_sec = CliGetNewestModuleTime(); sprintf( buffer, "%s v" CLIENT_VERSIONSTRING "-" "%c" /* GUI == "G", CLI == "C" */ #ifdef CLIENT_SUPPORTS_SMP #ifdef HAVE_MULTICRUNCH_VIA_FORK "F" /* fork() */ #else "T" /* threads */ #endif #else "P" /* polling */ #endif "%c" /* limited release or dev branch or public release */ "-%s" /* date is in bugzilla format yymmddhh */ "%s" /* "-*dev*" or "" */ " for "CLIENT_OS_NAME_EXTENDED, utilGetAppName(), ((ConIsGUI())?('G'):('C')), ((CliIsDevelVersion())?('L'):('R')), CliGetTimeString(&tv,4), ((CliIsDevelVersion())?("-*dev*"):("")) ); return buffer; }
void GenerateManPage( void ) { #if defined(__unix__) char buffer[80]; const char *appname = utilGetAppName(); FILE *manp; strncpy(buffer,appname,sizeof(buffer)-2); buffer[sizeof(buffer)-2-1] = '\0'; strcat( buffer, ".1" ); manp = fopen(buffer,"w"); if (!manp) fprintf(stderr,"Unable to create %s", buffer ); else { unsigned int linelen, pos; char *p; const char *cp; time_t t = CliGetNewestModuleTime(); struct tm *gmt = gmtime(&t); fprintf(manp, ".\\\"\n"); fprintf(manp, ".\\\" %s\n", CliGetFullVersionDescriptor() ); fprintf(manp, ".\\\" Copyright (c) 1996-%d\n", gmt->tm_year+1900 ); fprintf(manp, ".\\\" distributed.net. All rights reserved.\n" ); fprintf(manp, ".\\\"\n"); fprintf(manp, ".Id %cId: %s.1%s\n", '$', appname, strchr(disphelp_cpp(),',')); fprintf(manp, ".Dd %s", ctime(&t)); strncpy(buffer, appname,sizeof(buffer)); buffer[sizeof(buffer)-1] = '\0'; for (pos=0;buffer[pos];pos++) buffer[pos]=(char)toupper(buffer[pos]); fprintf(manp, ".Dt %s 1\n", buffer ); //fprintf(manp, ".Os "CLIENT_OS_NAME_EXTENDED"\n"); fprintf(manp, ".Sh NAME\n"); fprintf(manp, ".Nm %s\n", appname); fprintf(manp, ".Nd distributed.net distributed computing client for " CLIENT_OS_NAME_EXTENDED"\n" ); fprintf(manp, ".Sh SYNOPSIS\n"); fprintf(manp, ".Nm %s\n", appname); for (pos=0;pos<(sizeof(helpbody)/sizeof(helpbody[0]));pos++) { cp = helpbody[pos]; if (*cp == '-') { strncpy(buffer,helpbody[pos]+1,sizeof(buffer)); buffer[sizeof(buffer)-1]='\0'; p = &buffer[0]; while (*p && *p!=' ') p++; while (*p==' ' && (p[1]=='<' || p[1]=='[')) { while (*p && *p!='>' && *p!=']') p++; while (*p && *p!=' ') p++; } *p='\0'; fprintf(manp,".Op \"\\-"); for (linelen=0;buffer[linelen];linelen++) { if (buffer[linelen]=='\"') buffer[linelen] = '\''; else if (_istrofspecial(buffer[linelen])) fputc('\\', manp); fputc(buffer[linelen],manp); } fprintf(manp,"\"\n"); } } fprintf(manp, ".Sh DESCRIPTION\n"); fprintf(manp, ".Ar %s\nis a distributed computing client that coordinates with servers " "operated by\n.Ar distributed.net\nto cooperate with other network-connected " "computers to work on a common task. It communicates over public networks " "and processes work assigned by the\n.Ar distributed.net\nkeyservers. " "It is designed to run in idle time so as to not impact the normal operation " "of the computer.\n", appname); fprintf(manp, ".Sh INSTALLATION\n"); fprintf(manp, "Since you are already reading this, I assume you know how to " "unpack an archive into a directory of your choice. :)\n" ".sp 1\n" "Now, simply fire up the client...\n" ".sp 1\n" "If you have never run the client before, it will initiate the " "menu-driven configuration. Save and quit when done, the configuration " "file will be saved \\fBin the same directory as the client\\fP. " "Now, simply restart the client. From that point on it will use the " "saved configuration.\n" ".sp 1\n" "The configuration options are fairly self-explanatory and can be run " "at any time by starting the client with the '-config' option. " "A list of command line options is listed below.\n" ); fprintf(manp, ".Sh OPTIONS\n" "In addition to the conventional command line passed to the client from " "a shell, options may also be passed to the client using either or both " "of the following methods:\n" ".sp 0\n\\-\tusing the \\fB%s_opt\\fP= environment variable.\n" ".sp 0\n\tIf set, this is parsed before the normal command line.\n" ".sp 0\n\\-\tusing the \\fB/usr/local/etc/%s.opt\\fP and/or \\fB/etc/%s.opt\\fP\n" ".sp 0\n\tcommand files. If found, these are parsed after the normal\n" ".sp 0\n\tcommand line.\n" ".sp 0\n\"Mode commands\" (see below) cannot be executed using these " "methods, and there is no run-time display of modified settings (unless " "the settings are also modified using the conventional command line, in " "which case the last effective change is displayed).\n", appname, appname, appname ); for (pos=0;pos<(sizeof(helpbody)/sizeof(helpbody[0]));pos++) { cp = helpbody[pos]; if (*cp=='-') /* switch */ { fprintf(manp,".It Fl "); cp++; while (*cp && *cp != ' ') /* while in keyword */ { if (*cp == '\"') { cp++; fputc('\'', manp); } else { if (_istrofspecial(*cp)) fputc('\\', manp); fputc(*cp++,manp); } } while (*cp == ' ') cp++; while (*cp == '<' || *cp == '[') /* while arguments */ { const char closure = ((*cp == '<')?('>'):(']')); fprintf(manp, (*cp++ == '<')?(" Ar <"):(" Op ")); while (*cp && *cp != closure) fputc(*cp++,manp); if (closure == '>') fputc('>',manp); while (*cp == ' ' || *cp == '>' || *cp == ']') cp++; } fputc('\n',manp); if (!*cp) /* keyword description */ { fprintf(manp,"(no description available)\n"); } else { while (*cp) { if (*cp == '\"') { cp++; fputc('\'', manp); } else { if (_istrofspecial(*cp)) fputc('\\', manp); fputc(*cp++,manp); } if (!*cp && (pos+1)<(sizeof(helpbody)/sizeof(helpbody[0]))) { if (*helpbody[pos+1] == ' ') /* continuation */ { cp = helpbody[++pos]; fprintf(manp,"\n.sp 0\n"); while (*cp == ' ') cp++; } } } } fprintf(manp,"\n"); } else if (*cp) /* new section */ { if (pos) fprintf(manp,".El\n"); /* fprintf(manp, ".sp 2\n"); */ fprintf(manp,".Ss \""); while (*cp) { if (*cp == '\"') { cp++; fputc('\'', manp); } else { if (_istrofspecial(*cp)) fputc('\\', manp); fputc(*cp++,manp); } } fprintf(manp,"\"\n"); fprintf(manp,".Bl -tag -width Fl\n"); } } fprintf(manp,".El\n"); fprintf(manp,".Sh BUGS\n" "distributed.net maintains a database to assist with the tracking " "and resolution of bugs in dnetc and related software.\n" ".Sp\n" "If you believe you have found a bug, please submit it to the " "distributed.net bug tracking database at " "http://bugs.distributed.net/\n" ".sp 1\n" "Please provide the entire version descriptor as displayed on client start " "when doing so. For example, the client version this manpage was " "generated for was \"%s\".\n", CliGetFullVersionDescriptor() ); fprintf(manp,".Sh ENVIRONMENT\n" ".Pp\n" #if 0 "\\fBRC5INI\\fP\n" "Full path to alternate .ini file\n" #endif "\\fB%s_opt\\fP (or the upper\\-case version thereof)\n" ".sp 0\nAdditional source of command line options (parsed first)\n", appname ); fprintf(manp,".Sh FILES\n" ".Pp\n" "\\fB/usr/local/etc/%s.opt\\fP\n" ".sp 0\n\\fB/etc/%s.opt\\fP\n" ".sp 0\nAdditional sources of command line options (parsed last)\n", appname, appname ); fprintf(manp,".Sh \"SEE ALSO\"\n" ".Pp\n" "Client documentation: %s.txt and http://faq.distributed.net/\n", appname); fprintf(manp,".Sh AUTHOR\n" "distributed.net\n" "http://www.distributed.net/\n"); fclose(manp); } #endif /* __unix__ */ return; }