From: Ian Jackson Date: Fri, 29 Nov 2013 18:41:02 +0000 (+0000) Subject: watershed; Provide -h and --help options. Closes:#659989. X-Git-Tag: debian/4.3.0~23 X-Git-Url: http://www.chiark.greenend.org.uk/ucgi/~ian/git?p=chiark-utils.git;a=commitdiff_plain;h=1146f9aa939cd4f85cc4e1d8b5330b51f2679089;ds=sidebyside watershed; Provide -h and --help options. Closes:#659989. --- diff --git a/cprogs/watershed.c b/cprogs/watershed.c index 3bf9b07..580d220 100644 --- a/cprogs/watershed.c +++ b/cprogs/watershed.c @@ -270,6 +270,7 @@ static const struct option os[]= { { "--state-dir", 1,0,'d' }, { "--command-id",1,0,'i' }, + { "--help", 0,0,'h' }, { 0 } }; @@ -294,11 +295,17 @@ static int cohort_fd, lock_fd; }while(0) -static void badusage(void) { +static void printusage(FILE *f) { fputs(_("usage: watershed [] ...\n" - "options: -d|--state-dir -i|--command-id \n" + "options:\n" + " -d|--state-dir \n" + " -i|--command-id \n" + " -h|--help\n" "see /usr/share/doc/chiark-utils-bin/watershed.txt\n"), - stderr); + f); +} +static void badusage(void) { + printusage(stderr); exit(127); } static void die(const char *m) { @@ -330,11 +337,12 @@ static char *m_asprintf(const char *fmt, ...) { static void parse_args(int argc, char *const *argv) { int o; for (;;) { - o= getopt_long(argc, argv, "+d:i:", os,0); + o= getopt_long(argc, argv, "+d:i:h", os,0); if (o==-1) break; switch (o) { case 'd': state_dir= optarg; break; case 'i': command_id= optarg; break; + case 'h': printusage(stdout); exit(0); break; default: badusage(); } } diff --git a/debian/changelog b/debian/changelog index 4f71e9d..9627b0f 100644 --- a/debian/changelog +++ b/debian/changelog @@ -5,6 +5,7 @@ chiark-utils (4.2.1~~iwj4) unstable; urgency=low * really: Document need to be in the "root" group as well. (This is better than removing the restriction, because it would be dangerous to relax this security barrier in existing deployments.) Closes:#693356. + * watershed; Provide -h and --help options. Closes:#659989. --