From 22a2982afcab0422ea9d5099bd45d9980ef323aa Mon Sep 17 00:00:00 2001 From: obarun <eric@obarun.org> Date: Tue, 31 Mar 2020 14:39:47 +1100 Subject: [PATCH] deprecated -c option and use -z instead. This change is made to be consistent with option between tools --- src/66/66-inservice.c | 9 +++++---- src/66/66-intree.c | 9 +++++---- src/66/66-update.c | 9 +++++---- 3 files changed, 15 insertions(+), 12 deletions(-) diff --git a/src/66/66-inservice.c b/src/66/66-inservice.c index 5db351ea..c603fd2e 100644 --- a/src/66/66-inservice.c +++ b/src/66/66-inservice.c @@ -103,7 +103,7 @@ info_opts_map_t const opts_sv_table[] = #define checkopts(n) if (n >= MAXOPTS) strerr_dief1x(100, "too many options") #define DELIM ',' -#define USAGE "66-inservice [ -h ] [ -v verbosity ] [ -c ] [ -n ] [ -o name,intree,status,... ] [ -g ] [ -d depth ] [ -r ] [ -t tree ] [ -p nline ] service" +#define USAGE "66-inservice [ -h ] [ -z ] [ -v verbosity ] [ -n ] [ -o name,intree,status,... ] [ -g ] [ -d depth ] [ -r ] [ -t tree ] [ -p nline ] service" static inline void info_help (void) { @@ -112,8 +112,8 @@ static inline void info_help (void) "\n" "options :\n" " -h: print this help\n" -" -v: increase/decrease verbosity\n" " -c: use color\n" +" -v: increase/decrease verbosity\n" " -n: do not display the field name\n" " -o: comma separated list of field to display\n" " -g: displays the contents field as graph\n" @@ -643,14 +643,14 @@ int main(int argc, char const *const *argv, char const *const *envp) for (;;) { - int opt = getopt_args(argc,argv, ">hv:cno:grd:t:p:", &l) ; + int opt = getopt_args(argc,argv, ">hzv:cno:grd:t:p:", &l) ; if (opt == -1) break ; if (opt == -2) log_die(LOG_EXIT_USER,"options must be set first") ; switch (opt) { case 'h' : info_help(); return 0 ; case 'v' : if (!uint0_scan(l.arg, &VERBOSITY)) log_usage(USAGE) ; break ; - case 'c' : log_color = !isatty(1) ? &log_color_disable : &log_color_enable ; break ; + case 'z' : log_color = !isatty(1) ? &log_color_disable : &log_color_enable ; break ; case 'n' : NOFIELD = 0 ; break ; case 'o' : legacy = 0 ; info_parse_options(l.arg,what) ; break ; case 'g' : GRAPH = 1 ; break ; @@ -658,6 +658,7 @@ int main(int argc, char const *const *argv, char const *const *envp) case 'd' : if (!uint0_scan(l.arg, &MAXDEPTH)) log_usage(USAGE) ; break ; case 't' : tname = l.arg ; break ; case 'p' : if (!uint0_scan(l.arg, &nlog)) log_usage(USAGE) ; break ; + case 'c' : log_die(LOG_EXIT_SYS,"deprecated option -- please use -z instead") ; default : log_usage(USAGE) ; } } diff --git a/src/66/66-intree.c b/src/66/66-intree.c index 6065b076..bd7fc5b8 100644 --- a/src/66/66-intree.c +++ b/src/66/66-intree.c @@ -79,7 +79,7 @@ info_opts_map_t const opts_tree_table[] = #define checkopts(n) if (n >= MAXOPTS) log_die(100, "too many options") #define DELIM ',' -#define USAGE "66-intree [ -h ] [ -v verbosity ] [ -l live ] [ -c ] [ -n ] [ -o name,init,enabled,... ] [ -g ] [ -d depth ] [ -r ] tree" +#define USAGE "66-intree [ -h ] [ -z ] [ -v verbosity ] [ -l live ] [ -n ] [ -o name,init,enabled,... ] [ -g ] [ -d depth ] [ -r ] tree" static inline void info_help (void) { @@ -88,9 +88,9 @@ static inline void info_help (void) "\n" "options :\n" " -h: print this help\n" +" -z: use color\n" " -v: increase/decrease verbosity\n" " -l: live directory\n" -" -c: use color\n" " -n: do not display the names of fields\n" " -o: comma separated list of field to display\n" " -g: displays the contents field as graph\n" @@ -498,14 +498,14 @@ int main(int argc, char const *const *argv, char const *const *envp) for (;;) { - int opt = getopt_args(argc,argv, ">hv:cno:grd:l:", &l) ; + int opt = getopt_args(argc,argv, ">hzv:no:grd:l:c", &l) ; if (opt == -1) break ; if (opt == -2) log_die(LOG_EXIT_USER,"options must be set first") ; switch (opt) { case 'h' : info_help(); return 0 ; case 'v' : if (!uint0_scan(l.arg, &VERBOSITY)) log_usage(USAGE) ; break ; - case 'c' : log_color = !isatty(1) ? &log_color_disable : &log_color_enable ; break ; + case 'z' : log_color = !isatty(1) ? &log_color_disable : &log_color_enable ; break ; case 'n' : NOFIELD = 0 ; break ; case 'o' : legacy = 0 ; info_parse_options(l.arg,what) ; break ; case 'g' : GRAPH = 1 ; break ; @@ -514,6 +514,7 @@ int main(int argc, char const *const *argv, char const *const *envp) case 'l' : if (!stralloc_cats(&live,l.arg)) log_usage(USAGE) ; if (!stralloc_0(&live)) log_usage(USAGE) ; break ; + case 'c' : log_die(LOG_EXIT_SYS,"deprecated option -- please use -z instead") ; default : log_usage(USAGE) ; } } diff --git a/src/66/66-update.c b/src/66/66-update.c index 459fe1e5..9057d2d6 100644 --- a/src/66/66-update.c +++ b/src/66/66-update.c @@ -38,7 +38,7 @@ #include <66/resolve.h> #include <66/parser.h> -#define USAGE "66-update [ -h ] [ -c ] [ -v verbosity ] [ -l live ] [ -d ] tree(s)" +#define USAGE "66-update [ -h ] [ -z ] [ -v verbosity ] [ -l live ] [ -d ] tree(s)" static stralloc WORKDIR = STRALLOC_ZERO ; static uint8_t DRYRUN = 0 ; @@ -50,7 +50,7 @@ static inline void info_help (void) "\n" "options :\n" " -h: print this help\n" -" -c: use color\n" +" -z: use color\n" " -v: increase/decrease verbosity\n" " -l: live directory\n" " -d: dry run\n" @@ -195,7 +195,7 @@ int main(int argc, char const *const *argv,char const *const *envp) subgetopt_t l = SUBGETOPT_ZERO ; for (;;) { - int opt = subgetopt_r(argc,argv, "hv:l:cd", &l) ; + int opt = subgetopt_r(argc,argv, "hzv:l:dc", &l) ; if (opt == -1) break ; switch (opt) @@ -205,8 +205,9 @@ int main(int argc, char const *const *argv,char const *const *envp) case 'l' : if (!stralloc_cats(&info.live,l.arg)) log_die_nomem("stralloc") ; if (!stralloc_0(&info.live)) log_die_nomem("stralloc") ; break ; - case 'c' : log_color = !isatty(1) ? &log_color_disable : &log_color_enable ; break ; + case 'z' : log_color = !isatty(1) ? &log_color_disable : &log_color_enable ; break ; case 'd' : DRYRUN = 1 ; break ; + case 'c' : log_die(LOG_EXIT_SYS,"deprecated option -- please use -z instead") ; default : log_usage(USAGE) ; } } -- GitLab