From: ian Date: Sun, 13 Aug 2000 12:23:44 +0000 (+0000) Subject: @@ -1,6 +1,7 @@ X-Git-Tag: debian_version_1_0_1_99_0~17 X-Git-Url: http://www.chiark.greenend.org.uk/ucgi/~ian/git?p=userv.git;a=commitdiff_plain;h=26f06c01c4cb357d9e4fb6d0cd0386e70f7e6b6e;hp=ae541decab234d800211990e9f077b1aada92d06 @@ -1,6 +1,7 @@ + * --help and --version behaviour made to conform to GNU standards. --- diff --git a/client.c b/client.c index 3d70f2b..7f12013 100644 --- a/client.c +++ b/client.c @@ -415,7 +415,7 @@ struct optioninfo { optionfunction *fn; }; -static void usage(void) { +static void usage(FILE *stream) { if (fputs( "usage: userv [--] [ ...]\n" "usage: userv -B|--builtin [--] [ ...]\n" @@ -424,7 +424,7 @@ static void usage(void) { " -t|--timeout \n" " -S|--signals |number|number-nocore|highbit|stdout\n" " -w|--fdwait =wait|nowait|close\n" - " -P|--sigpipe -H|--hidecwd -h|--help --copyright\n" + " -P|--sigpipe -H|--hidecwd -h|--help|--version --copyright\n" " --override } available only\n" " --override-file } to root\n" " --spoof-user } or same user\n" @@ -434,8 +434,8 @@ static void usage(void) { " for help, type `userv -B help'; remember to quote multi-word X\n" "userv and uservd version " VERSION VEREXT "; copyright (C)1996-1999 Ian Jackson.\n" "there is NO WARRANTY; type `userv --copyright' for details.\n", - stderr) < 0) - syscallerror("write usage to stderr"); + stream) < 0) + syscallerror("write usage message"); } static void NONRETURNPRINTFFORMAT(1,2) usageerror(const char *fmt, ...) { @@ -444,7 +444,7 @@ static void NONRETURNPRINTFFORMAT(1,2) usageerror(const char *fmt, ...) { fputs("userv: ",stderr); vfprintf(stderr,fmt,al); fputs("\n\n",stderr); - usage(); + usage(stderr); exit(-1); } @@ -671,7 +671,14 @@ static void of_hidecwd(const struct optioninfo *oip, const char *value, char *ke } static void of_help(const struct optioninfo *oip, const char *value, char *key) { - usage(); + usage(stdout); + if (fclose(stdout)) syscallerror("fclose stdout after writing usage message"); + exit(0); +} + +static void of_version(const struct optioninfo *oip, const char *value, char *key) { + if (puts(VERSION VEREXT) == EOF || fclose(stdout)) + syscallerror("write version number"); exit(0); } @@ -724,6 +731,7 @@ const struct optioninfo optioninfos[]= { { 'H', "hidecwd", 0, of_hidecwd }, { 'B', "builtin", 0, of_builtin }, { 'h', "help", 0, of_help }, + { 0, "version", 0, of_version }, { 0, "copyright", 0, of_copyright }, { 0, "override", 1, of_override }, { 0, "override-file", 1, of_overridefile }, diff --git a/debian/changelog b/debian/changelog index 04031e2..35444c8 100644 --- a/debian/changelog +++ b/debian/changelog @@ -1,6 +1,7 @@ userv (1.0.2) unstable; urgency=low * Specification's usage notes section improved. + * --help and --version behaviour made to conform to GNU standards. --