chiark
/
gitweb
/
~ian
/
userv.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
@@ -1,6 +1,7 @@
[userv.git]
/
client.c
diff --git
a/client.c
b/client.c
index 3d70f2bcb6a01cc8b09d50722e5212032fb1d3a4..7f120134107c756f6fb5f82efbec34db6d50ce6b 100644
(file)
--- a/
client.c
+++ b/
client.c
@@
-415,7
+415,7
@@
struct optioninfo {
optionfunction *fn;
};
optionfunction *fn;
};
-static void usage(
void
) {
+static void usage(
FILE *stream
) {
if (fputs(
"usage: userv <options> [--] <service-user> <service-name> [<argument> ...]\n"
"usage: userv <options> -B|--builtin [--] <builtin-service> [<info-argument> ...]\n"
if (fputs(
"usage: userv <options> [--] <service-user> <service-name> [<argument> ...]\n"
"usage: userv <options> -B|--builtin [--] <builtin-service> [<info-argument> ...]\n"
@@
-424,7
+424,7
@@
static void usage(void) {
" -t|--timeout <seconds>\n"
" -S|--signals <status>|number|number-nocore|highbit|stdout\n"
" -w|--fdwait <fd>=wait|nowait|close\n"
" -t|--timeout <seconds>\n"
" -S|--signals <status>|number|number-nocore|highbit|stdout\n"
" -w|--fdwait <fd>=wait|nowait|close\n"
- " -P|--sigpipe -H|--hidecwd -h|--help --copyright\n"
+ " -P|--sigpipe -H|--hidecwd -h|--help
|--version
--copyright\n"
" --override <configuration-data> } available only\n"
" --override-file <filename> } to root\n"
" --spoof-user <username> } or same user\n"
" --override <configuration-data> } available only\n"
" --override-file <filename> } to root\n"
" --spoof-user <username> } 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",
" 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",
- st
derr
) < 0)
- syscallerror("write usage
to stderr
");
+ st
ream
) < 0)
+ syscallerror("write usage
message
");
}
static void NONRETURNPRINTFFORMAT(1,2) usageerror(const char *fmt, ...) {
}
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);
fputs("userv: ",stderr);
vfprintf(stderr,fmt,al);
fputs("\n\n",stderr);
- usage();
+ usage(
stderr
);
exit(-1);
}
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) {
}
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);
}
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 },
{ '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 },
{ 0, "copyright", 0, of_copyright },
{ 0, "override", 1, of_override },
{ 0, "override-file", 1, of_overridefile },