hi.

diff to reduce verbosity in rdist(1) usage. before:

$ /usr/bin/rdist -Z
rdist: unknown option -- Z
usage: rdist [-DFnV] [-A num] [-a num] [-c mini_distfile]
        [-d var=value] [-f distfile] [-L remote_logopts] [-l local_logopts]
        [-M maxproc] [-m host] [-o distopts] [-P rsh-path] [-p rdistd-path]
        [-t timeout] [name ...]

The values for <distopts> are:
        
chknfs,chkreadonly,chksym,compare,defgroup,defowner,follow,history,ignlnks,nochkgroup,nochkmode,nochkowner,nodescend,noexec,numchkgroup,numchkowner,quiet,remove,savetargets,sparse,updateperm,verify,whole,younger

Where <msgopt> is of form
        <facility1>=<type1>,<type2>,...:<facility2>=<type1>,<type2>...
Valid <facility> names: stdout file syslog notify
Valid <type> names: change info notice nerror ferror warning verbose all debug

after:

$ /usr/obj/usr.bin/rdist -Z
rdist: unknown option -- Z
usage: rdist [-DFnV] [-A num] [-a num] [-c mini_distfile] [-d var=value]
        [-f distfile] [-L remote_logopts] [-l local_logopts] [-M maxproc]
        [-m host] [-o distopts] [-P rsh-path] [-p rdistd-path] [-t timeout]
        [name ...]

this one is more problematic. it uses two functions, getdistoptlist and
msgprusage, which i think are only used within usage. so i killed them
too.

ok?
jmc

Index: usr.bin/rdist/client.h
===================================================================
RCS file: /cvs/src/usr.bin/rdist/client.h,v
retrieving revision 1.3
diff -u -p -r1.3 client.h
--- usr.bin/rdist/client.h      30 Aug 2017 07:42:52 -0000      1.3
+++ usr.bin/rdist/client.h      22 Jun 2021 12:54:54 -0000
@@ -161,7 +161,6 @@ int install(char *, char *, int, int , o
 
 /* distopt.c */
 int parsedistopts(char *, opt_t *, int);
-char *getdistoptlist(void);
 char *getondistoptlist(opt_t);
 
 /* docmd.c */
Index: usr.bin/rdist/defs.h
===================================================================
RCS file: /cvs/src/usr.bin/rdist/defs.h,v
retrieving revision 1.38
diff -u -p -r1.38 defs.h
--- usr.bin/rdist/defs.h        21 Sep 2018 19:00:45 -0000      1.38
+++ usr.bin/rdist/defs.h        22 Jun 2021 12:54:54 -0000
@@ -206,7 +206,6 @@ char *xbasename(char *);
 char *searchpath(char *);
 
 /* message.c */
-void msgprusage(void);
 void msgprconfig(void);
 char *msgparseopts(char *, int);
 void checkhostname(void);
Index: usr.bin/rdist/distopt.c
===================================================================
RCS file: /cvs/src/usr.bin/rdist/distopt.c,v
retrieving revision 1.13
diff -u -p -r1.13 distopt.c
--- usr.bin/rdist/distopt.c     20 Jan 2015 09:00:16 -0000      1.13
+++ usr.bin/rdist/distopt.c     22 Jun 2021 12:54:54 -0000
@@ -134,27 +134,6 @@ parsedistopts(char *str, opt_t *optptr, 
 }
 
 /*
- * Get a list of the Distfile Option Entries.
- */
-char *
-getdistoptlist(void)
-{
-       int i;
-       static char buf[1024];
-
-       for (i = 0, buf[0] = CNULL; distoptinfo[i].do_name; ++i) {
-               if (buf[0] == CNULL)
-                       (void) strlcpy(buf, distoptinfo[i].do_name, sizeof buf);
-               else {
-                       (void) strlcat(buf, ",", sizeof buf);
-                       (void) strlcat(buf, distoptinfo[i].do_name, sizeof buf);
-               }
-       }
-
-       return(buf);
-}
-
-/*
  * Get a list of the Distfile Option Entries for each enabled 
  * value in "opts".
  */
Index: usr.bin/rdist/message.c
===================================================================
RCS file: /cvs/src/usr.bin/rdist/message.c,v
retrieving revision 1.29
diff -u -p -r1.29 message.c
--- usr.bin/rdist/message.c     28 Jun 2019 05:35:35 -0000      1.29
+++ usr.bin/rdist/message.c     22 Jun 2021 12:54:54 -0000
@@ -118,30 +118,6 @@ static void _error(const char *);
 static void _fatalerr(const char *);
 
 /*
- * Print message logging usage message
- */
-void
-msgprusage(void)
-{
-       int i, x;
-
-       (void) fprintf(stderr, "\nWhere <msgopt> is of form\n");
-       (void) fprintf(stderr, 
-       "\t<facility1>=<type1>,<type2>,...:<facility2>=<type1>,<type2>...\n");
-
-       (void) fprintf(stderr, "Valid <facility> names:");
-
-       for (i = 0; msgfacility[i].mf_name; ++i)
-               (void) fprintf(stderr, " %s", msgfacility[i].mf_name);
-
-       (void) fprintf(stderr, "\nValid <type> names:");
-       for (x = 0; msgtypes[x].mt_name; ++x)
-               (void) fprintf(stderr, " %s", msgtypes[x].mt_name);
-
-       (void) fprintf(stderr, "\n");
-}
-
-/*
  * Print enabled message logging info
  */
 void
Index: usr.bin/rdist/rdist.c
===================================================================
RCS file: /cvs/src/usr.bin/rdist/rdist.c,v
retrieving revision 1.31
diff -u -p -r1.31 rdist.c
--- usr.bin/rdist/rdist.c       9 Jul 2017 14:04:50 -0000       1.31
+++ usr.bin/rdist/rdist.c       22 Jun 2021 12:54:54 -0000
@@ -337,19 +337,13 @@ usage(void)
        extern char *__progname;
 
        (void) fprintf(stderr,
-               "usage: %s [-DFnV] [-A num] [-a num] "
-               "[-c mini_distfile]\n"
-               "\t[-d var=value] [-f distfile] [-L remote_logopts] "
-               "[-l local_logopts]\n"
-               "\t[-M maxproc] [-m host] [-o distopts] [-P rsh-path] "
-               "[-p rdistd-path]\n"
-               "\t[-t timeout] [name ...]\n", __progname);
-
-
-       (void) fprintf(stderr, "\nThe values for <distopts> are:\n\t%s\n",
-                      getdistoptlist());
-
-       msgprusage();
+               "usage: %s [-DFnV] [-A num] [-a num] [-c mini_distfile]"
+               " [-d var=value]\n"
+               "\t[-f distfile] [-L remote_logopts] [-l local_logopts]"
+               " [-M maxproc]\n"
+               "\t[-m host] [-o distopts] [-P rsh-path] [-p rdistd-path]"
+               " [-t timeout]\n"
+               "\t[name ...]\n", __progname);
 
        exit(1);
 }

Reply via email to