- if (fprintf(stdout,
-" userv - user service daemon and client; copyright (C)1996-1997 Ian Jackson\n\n"
-" This is free software; you can redistribute it and/or modify it under the\n"
-" terms of the GNU General Public License as published by the Free Software\n"
-" Foundation; either version 2 of the License, or (at your option) any\n"
-" later version.\n\n"
-" This program is distributed in the hope that it will be useful, but\n"
-" WITHOUT ANY WARRANTY; without even the implied warranty of\n"
-" MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General\n"
-" Public License for more details.\n\n"
-" You should have received a copy of the GNU General Public License along\n"
-" with userv; if not, write to Ian Jackson <ian@chiark.greenend.org.uk> or\n"
-" to the Free Software Foundation, 59 Temple Place - Suite 330, Boston,\n"
-" MA 02111-1307, USA.\n"
- ) == EOF) syscallerror("write usage to stderr");
- exit(0);
-}
-
-static void of_override(const struct optioninfo *oip, const char *value, char *key) {
- overridetype= ot_string;
- overridevalue= value;
-}
-
-static void of_overridefile(const struct optioninfo *oip,
- const char *value, char *key) {
- overridetype= ot_file;
- overridevalue= value;
-}
-
-const struct optioninfo optioninfos[]= {
- { 'f', "file", 2, of_file },
- { 'w', "fdwait", 2, of_fdwait },
- { 'D', "defvar", 2, of_defvar },
- { 't', "timeout", 1, of_timeout },
- { 'S', "signals", 1, of_signals },
- { 'P', "sigpipe", 0, of_sigpipe },
- { 'H', "hidecwd", 0, of_hidecwd },
- { 'h', "help", 0, of_help },
- { 0, "copyright", 0, of_copyright },
- { 0, "override", 1, of_override },
- { 0, "override-file", 1, of_overridefile },
- { 0, 0 }
-};
-
-static void callvalueoption(const struct optioninfo *oip, char *arg) {
- char *equals;
- if (oip->values == 2) {
- equals= strchr(arg,'=');
- if (!equals)
- if (oip->abbrev)
- usageerror("option --%s (-%c) passed argument `%s' with no `='",
- oip->full,oip->abbrev,arg);
- else
- usageerror("option --%s passed argument `%s' with no `='",
- oip->full,arg);
- *equals++= 0;
- (oip->fn)(oip,equals,arg);
- } else {
- (oip->fn)(oip,arg,0);
- }
-}
-
-static void checkmagic(unsigned long was, unsigned long should, const char *when) {
- if (was != should)
- protoerror("magic number %s was %08lx, expected %08lx",when,was,should);
-}
-
-static void getprogress(struct progress_msg *progress_r, FILE *file) {
- int i, c;
- unsigned long ul;
-
- for (;;) {
- xfread(progress_r,sizeof(struct progress_msg),file);
- switch (progress_r->type) {
- case pt_failed:
- blocksignals(SIG_BLOCK);
- fputs("userv: uservd reports that service failed\n",stderr);
- exit(-1);
- case pt_errmsg:
- blocksignals(SIG_BLOCK);
- fputs("uservd: ",stderr);
- if (progress_r->data.errmsg.messagelen>4096)
- protoerror("stderr message length %d is far too long",
- progress_r->data.errmsg.messagelen);
- for (i=0; i<progress_r->data.errmsg.messagelen; i++) {
- c= getc(file); if (c==EOF) protoreaderror(file,"in error message");
- if (isprint(c)) putc(c,stderr);
- else fprintf(stderr,"\\x%02x",(unsigned char)c);
- }
- putc('\n',stderr);
- if (ferror(stderr)) syscallerror("printing error message");
- xfread(&ul,sizeof(ul),file);
- checkmagic(ul,PROGRESS_ERRMSG_END_MAGIC,"after error message");
- blocksignals(SIG_UNBLOCK);
- break;
- default:
- return;
- }
- }
+ if (fputs(
+" userv - user service daemon and client; copyright (C)1996-1997 Ian Jackson\n\n"
+" This is free software; you can redistribute it and/or modify it under the\n"
+" terms of the GNU General Public License as published by the Free Software\n"
+" Foundation; either version 2 of the License, or (at your option) any\n"
+" later version.\n\n"
+" This program is distributed in the hope that it will be useful, but\n"
+" WITHOUT ANY WARRANTY; without even the implied warranty of\n"
+" MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General\n"
+" Public License for more details.\n\n"
+" You should have received a copy of the GNU General Public License along\n"
+" with userv; if not, write to Ian Jackson <ian@chiark.greenend.org.uk> or\n"
+" to the Free Software Foundation, 59 Temple Place - Suite 330, Boston,\n"
+" MA 02111-1307, USA.\n",
+ stdout) < 0) syscallerror("write usage to stderr");
+ exit(0);