diff --git a/src/66/66-boot.c b/src/66/66-boot.c index 9f4f2a2bf00d49f13cba884028cdc27116959577..f7c0089aa4e4aadcf747c940601dca72d08244a0 100644 --- a/src/66/66-boot.c +++ b/src/66/66-boot.c @@ -33,7 +33,6 @@ #include <oblibs/environ.h> #include <oblibs/sastr.h> -#include <skalibs/buffer.h> #include <skalibs/djbunix.h> #include <skalibs/stralloc.h> #include <skalibs/types.h> @@ -94,7 +93,6 @@ static void sulogin(char const *msg,char const *arg) static inline void info_help (void) { static char const *help = -"66-boot <options>\n" "\n" "options :\n" " -h: print this help\n" @@ -107,7 +105,7 @@ static inline void info_help (void) " -b: banner to display\n" ; - if (buffer_putsflush(buffer_1, help) < 0) sulogin("","") ; + log_info(USAGE,"\n",help) ; } static int read_line(stralloc *dst, char const *line) diff --git a/src/66/66-hpr.c b/src/66/66-hpr.c index a7082144c216e817c3332edc3350ab452e9e3cb3..65ee7d7207725562a2794abd6c3acd005344a73a 100644 --- a/src/66/66-hpr.c +++ b/src/66/66-hpr.c @@ -30,7 +30,6 @@ #include <skalibs/sig.h> #include <skalibs/tai.h> #include <skalibs/djbunix.h> -#include <skalibs/buffer.h> #include <66/hpr.h> #include <66/config.h> @@ -55,7 +54,6 @@ char const *live = 0 ; static inline void info_help (void) { static char const *help = -"66-hpr <options>\n" "\n" "options :\n" " -H: print this help\n" @@ -70,9 +68,10 @@ static inline void info_help (void) " -w: only write wtmp shutdown entry\n" " -W: do not send a wall message\n" ; - if (buffer_putsflush(buffer_1, help) < 0) - log_dieusys(LOG_EXIT_SYS, "write to stdout") ; + + log_info(USAGE,"\n",help) ; } + int main (int argc, char const *const *argv) { int what = 0 ; diff --git a/src/66/66-inresolve.c b/src/66/66-inresolve.c index ff231f5ff3d5f0894ae4a3a5943d21987e3cb148..81f89bfc7ac0abc99b0bd34369ce17412b3fc8ec 100644 --- a/src/66/66-inresolve.c +++ b/src/66/66-inresolve.c @@ -21,10 +21,10 @@ #include <oblibs/obgetopt.h> #include <oblibs/types.h> -#include <skalibs/buffer.h> #include <skalibs/types.h> #include <skalibs/stralloc.h> #include <skalibs/lolstdio.h> +#include <skalibs/buffer.h> #include <66/resolve.h> #include <66/info.h> @@ -41,7 +41,6 @@ static char fields[INFO_NKEY][INFO_FIELD_MAXLEN] = {{ 0 }} ; static inline void info_help (void) { static char const *help = -"66-inresolve <options> service \n" "\n" "options :\n" " -h: print this help\n" @@ -50,8 +49,7 @@ static inline void info_help (void) " -l: prints information of the associated logger if exist\n" ; - if (buffer_putsflush(buffer_1, help) < 0) - log_dieusys(LOG_EXIT_SYS, "write to stdout") ; + log_info(USAGE,"\n",help) ; } static void info_display_string(char const *field,char const *str) diff --git a/src/66/66-inservice.c b/src/66/66-inservice.c index 87358235946b47fe76d3491e1bed0c0d7f83a0aa..9bcdc3e120a2d75e1fb595f97e234ebd78fc063e 100644 --- a/src/66/66-inservice.c +++ b/src/66/66-inservice.c @@ -31,8 +31,8 @@ #include <skalibs/genalloc.h> #include <skalibs/lolstdio.h> #include <skalibs/bytestr.h> -#include <skalibs/buffer.h> #include <skalibs/djbunix.h> +#include <skalibs/buffer.h> #include <66/info.h> #include <66/utils.h> @@ -109,7 +109,6 @@ info_opts_map_t const opts_sv_table[] = static inline void info_help (void) { static char const *help = -"66-inservice <options> service \n" "\n" "options :\n" " -h: print this help\n" @@ -145,8 +144,7 @@ static inline void info_help (void) " logfile: displays the contents of the log file\n" ; - if (buffer_putsflush(buffer_1, help) < 0) - log_dieusys(LOG_EXIT_SYS, "write to stdout") ; + log_info(USAGE,"\n",help) ; } char *print_nlog(char *str, int n) diff --git a/src/66/66-instate.c b/src/66/66-instate.c index cd116842c634957887ef6d84461bcbabca493452..73cc87c813e8c3044a5b8bb95d2c414d5281407c 100644 --- a/src/66/66-instate.c +++ b/src/66/66-instate.c @@ -21,10 +21,10 @@ #include <oblibs/obgetopt.h> #include <oblibs/types.h> -#include <skalibs/buffer.h> #include <skalibs/types.h> #include <skalibs/stralloc.h> #include <skalibs/lolstdio.h> +#include <skalibs/buffer.h> #include <66/resolve.h> #include <66/info.h> @@ -42,7 +42,6 @@ static char fields[INFO_NKEY][INFO_FIELD_MAXLEN] = {{ 0 }} ; static inline void info_help (void) { static char const *help = -"66-instate <options> service \n" "\n" "options :\n" " -h: print this help\n" @@ -51,8 +50,7 @@ static inline void info_help (void) " -l: prints information of the associated logger if exist\n" ; - if (buffer_putsflush(buffer_1, help) < 0) - log_dieusys(LOG_EXIT_SYS, "write to stdout") ; + log_info(USAGE,"\n",help) ; } static void info_display_string(char const *field,char const *str) diff --git a/src/66/66-intree.c b/src/66/66-intree.c index 97ebc572e4b79d376e791cd9af5521faadb9d489..c8e8019c0f5b0e25f3d3e3e5d85b33e2c6941f3f 100644 --- a/src/66/66-intree.c +++ b/src/66/66-intree.c @@ -85,7 +85,6 @@ info_opts_map_t const opts_tree_table[] = static inline void info_help (void) { static char const *help = -"66-intree <options> tree \n" "\n" "options :\n" " -h: print this help\n" @@ -110,8 +109,7 @@ static inline void info_help (void) " contents: displays the contents of the tree\n" ; - if (buffer_putsflush(buffer_1, help) < 0) - log_dieusys(LOG_EXIT_SYS, "write to stdout") ; + log_info(USAGE,"\n",help) ; } static int info_cmpnsort(stralloc *sa) diff --git a/src/66/66-parser.c b/src/66/66-parser.c index 8abcd22edfb3695b4234e016c15a11113c6a0422..ca40cb503c7cb4fdce87542bc60fb5752ce5cc3b 100644 --- a/src/66/66-parser.c +++ b/src/66/66-parser.c @@ -25,7 +25,6 @@ #include <oblibs/string.h> #include <oblibs/sastr.h> -#include <skalibs/buffer.h> #include <skalibs/stralloc.h> #include <skalibs/djbunix.h> @@ -38,7 +37,6 @@ static inline void info_help (void) { static char const *help = -"66-parser <options> service destination\n" "\n" "options :\n" " -h: print this help\n" @@ -48,8 +46,7 @@ static inline void info_help (void) " -I: do not import modified configuration files from previous version\n" ; - if (buffer_putsflush(buffer_1, help) < 0) - log_dieusys(LOG_EXIT_SYS, "write to stdout") ; + log_info(USAGE,"\n",help) ; } static void check_dir(char const *dir,uint8_t force,int main) diff --git a/src/66/66-scanctl.c b/src/66/66-scanctl.c index fcdb50672a048b9e50f2660e18098cb6458aa14a..0575077b8d5630ae6a22273c69ae54cc9efd1041 100644 --- a/src/66/66-scanctl.c +++ b/src/66/66-scanctl.c @@ -20,7 +20,6 @@ #include <oblibs/string.h> #include <oblibs/environ.h> -#include <skalibs/buffer.h> #include <skalibs/stralloc.h> #include <skalibs/types.h> #include <skalibs/djbunix.h> @@ -36,7 +35,6 @@ static char TMPENV[MAXENV + 1] ; static inline void info_help (void) { static char const *help = -"66-scanctl <options> signal\n" "\n" "options :\n" " -h: print this help\n" @@ -49,8 +47,7 @@ static inline void info_help (void) " -o: handles scandir of owner\n" ; - if (buffer_putsflush(buffer_1, help) < 0) - log_dieusys(LOG_EXIT_SYS, "write to stdout") ; + log_info(USAGE,"\n",help) ; } static inline unsigned int lookup (char const *const *table, char const *signal) diff --git a/src/66/66-scandir.c b/src/66/66-scandir.c index 73845a8793e0df5e0a89c677b277d119822ed6e9..799ff93aecb693cf76e3a522da7f4a9af157ae4b 100644 --- a/src/66/66-scandir.c +++ b/src/66/66-scandir.c @@ -26,7 +26,6 @@ #include <oblibs/string.h> #include <oblibs/environ.h> -#include <skalibs/buffer.h> #include <skalibs/stralloc.h> #include <skalibs/djbunix.h> #include <skalibs/types.h> @@ -71,7 +70,6 @@ static unsigned int CATCH_LOG = SS_BOOT_CATCH_LOG ; static inline void info_help (void) { static char const *help = -"66-scandir <options> create|remove\n" "\n" "options :\n" " -h: print this help\n" @@ -86,8 +84,7 @@ static inline void info_help (void) " -o: handles owner scandir\n" ; - if (buffer_putsflush(buffer_1, help) < 0) - log_dieusys(LOG_EXIT_SYS, "write to stdout") ; + log_info(USAGE,"\n",help) ; } static inline unsigned int lookup (char const *const *table, char const *signal) diff --git a/src/66/66-shutdown.c b/src/66/66-shutdown.c index 26797ffcfa63e96afba271bb4525bd98570d0199..9bc6cec9bb4fb70065e7b45f0cd39a6407eb5135 100644 --- a/src/66/66-shutdown.c +++ b/src/66/66-shutdown.c @@ -55,7 +55,6 @@ static char const *live = 0 ; static inline void info_help (void) { static char const *help = -"66-shutdown <options> time [message] or 66-shutdown -c [ message ]\n" "\n" "options :\n" " -H: print this help\n" @@ -71,9 +70,10 @@ static inline void info_help (void) " -t: grace time between the SIGTERM and the SIGKILL\n" " -c: cancel planned shutdown\n" ; - if (buffer_putsflush(buffer_1, help) < 0) - log_dieusys(LOG_EXIT_SYS, "write to stdout") ; + + log_info(USAGE,"\n",help) ; } + /* shutdown 01:23: date/time format parsing */ static inline void add_one_day (struct tm *tm) diff --git a/src/66/66-shutdownd.c b/src/66/66-shutdownd.c index 916a22682e5fe5c8873dcb54a02b3fe517da919c..1d3e776e5bbcc6666eba0c74c7b885a7ba94a47a 100644 --- a/src/66/66-shutdownd.c +++ b/src/66/66-shutdownd.c @@ -35,7 +35,6 @@ #include <skalibs/types.h> #include <skalibs/allreadwrite.h> #include <skalibs/bytestr.h> -#include <skalibs/buffer.h> #include <skalibs/sgetopt.h> #include <skalibs/sig.h> #include <skalibs/tai.h> @@ -68,7 +67,6 @@ static int nologger = 0 ; static inline void info_help (void) { static char const *help = -"66-shutdownd <options>\n" "\n" "options :\n" " -h: print this help\n" @@ -79,8 +77,7 @@ static inline void info_help (void) " -c: the catch-all logger do not exist\n" ; - if (buffer_putsflush(buffer_1, help) < 0) - log_dieusys(LOG_EXIT_SYS, "write to stdout") ; + log_info(USAGE,"\n",help) ; } static void restore_console (void) diff --git a/src/66/66-tree.c b/src/66/66-tree.c index 3542326c02a0909f3a583f3c96f8422d64e5b309..57edcb62d7141eec58954428a8202ea77c55730a 100644 --- a/src/66/66-tree.c +++ b/src/66/66-tree.c @@ -29,7 +29,6 @@ #include <skalibs/stralloc.h> #include <skalibs/djbunix.h> -#include <skalibs/buffer.h> #include <skalibs/bytestr.h>//byte_count #include <66/config.h> @@ -52,7 +51,6 @@ static char const *cleantree = 0 ; static inline void info_help (void) { static char const *help = -"66-tree <options> tree\n" "\n" "options :\n" " -h: print this help\n" @@ -71,8 +69,7 @@ static inline void info_help (void) " -U: unsupervise the tree\n" ; - if (buffer_putsflush(buffer_1, help) < 0) - log_dieusys(111,"write to stdout") ; + log_info(USAGE,"\n",help) ; } static void cleanup(void) diff --git a/src/66/66-update.c b/src/66/66-update.c index 60c3a97506f2be2409a1796e54c7828966b451a7..c79f43dbcae1746b5d31c8bcc8559cd1ba17c199 100644 --- a/src/66/66-update.c +++ b/src/66/66-update.c @@ -25,7 +25,6 @@ #include <oblibs/files.h> #include <skalibs/stralloc.h> -#include <skalibs/buffer.h> #include <skalibs/sgetopt.h> #include <skalibs/djbunix.h> #include <skalibs/unix-transactional.h> @@ -48,8 +47,9 @@ static uint8_t DRYRUN = 0 ; static char *drun = "dry run do: " ; static inline void info_help (void) { + DEFAULT_MSG = 0 ; + static char const *help = -"66-update <options> tree(s)\n" "\n" "options :\n" " -h: print this help\n" @@ -61,8 +61,7 @@ static inline void info_help (void) "if no tree is given, all trees will be processed.\n" ; - if (buffer_putsflush(buffer_1, help) < 0) - log_dieusys(LOG_EXIT_SYS, "write to stdout") ; + log_info(USAGE,"\n",help) ; } static void cleanup(void) diff --git a/src/extra-tools/66-echo.c b/src/extra-tools/66-echo.c index d484a95583c52306df1b7964fdb693c74e762991..85878e16a85a15eddbb506883849f292f18acac0 100644 --- a/src/extra-tools/66-echo.c +++ b/src/extra-tools/66-echo.c @@ -26,15 +26,14 @@ static inline void info_help (void) { static char const *help = -"66-echo <options> args\n" "\n" "options :\n" " -h: print this help\n" " -n: do not output a trailing newline\n" " -s: use as character separator\n" ; - if (buffer_putsflush(buffer_1, help) < 0) - log_dieusys(LOG_EXIT_SYS, "write to stdout") ; + + log_info(USAGE,"\n",help) ; } int main (int argc, char const *const *argv) diff --git a/src/extra-tools/execl-envfile.c b/src/extra-tools/execl-envfile.c index 976f3925db14e695d7a414cb7418813bd3a6474f..a7265f242a94e4dcf971f292e26e2c8408db60a2 100644 --- a/src/extra-tools/execl-envfile.c +++ b/src/extra-tools/execl-envfile.c @@ -38,15 +38,13 @@ static inline void info_help (void) { static char const *help = -"execl-envfile <options> src prog\n" "\n" "options :\n" " -h: print this help\n" " -l: loose\n" ; - if (buffer_putsflush(buffer_1, help) < 0) - log_dieusys(LOG_EXIT_SYS, "write to stdout") ; + log_info(USAGE,"\n",help) ; } void clean_n_unexport(stralloc *modifs, stralloc *dst, stralloc *src,char const *file) diff --git a/src/lib66/ssexec_help.c b/src/lib66/ssexec_help.c index f30fc149afd101bb0ae1dac7a85950068b238662..ffec677662f0541540755b519f5ce17d1182d4e7 100644 --- a/src/lib66/ssexec_help.c +++ b/src/lib66/ssexec_help.c @@ -17,7 +17,6 @@ char const *usage_enable = "66-enable [ -h ] [ -z ] [ -v verbosity ] [ - l live ] [ -t tree ] [ -f|F ] [ -I ] [ -S ] service(s)" ; char const *help_enable = -"66-enable <options> service(s)\n" "\n" "options :\n" " -h: print this help\n" @@ -34,7 +33,6 @@ char const *help_enable = char const *usage_dbctl = "66-dbctl [ -h ] [ -z ] [ -v verbosity ] [ -T timeout ] [ -l live ] [ -t tree ] [ -u | d | r ] service(s)" ; char const *help_dbctl = -"66-dbctl <options> tree\n" "\n" "options :\n" " -h: print this help\n" @@ -51,7 +49,6 @@ char const *help_dbctl = char const *usage_disable = "66-disable [ -h ] [ -z ] [ -v verbosity ] [ - l live ] [ -t tree ] [ -S ] [ -F ] [ -R ] service(s)" ; char const *help_disable = -"66-disable <options> service(s)\n" "\n" "options :\n" " -h: print this help\n" @@ -67,7 +64,6 @@ char const *help_disable = char const *usage_init = "66-init [ -h ] [ -z ] [ -v verbosity ] [ -l live ] [ -t tree ] classic|database|both" ; char const *help_init = -"66-init <options> classic|database|both\n" "\n" "options :\n" " -h: print this help\n" @@ -80,7 +76,6 @@ char const *help_init = char const *usage_start = "66-start [ -h ] [ -z ] [ -v verbosity ] [ -l live ] [ -t tree ] [ -T timeout ] [ -r | R ] service(s)" ; char const *help_start = -"66-start <options> service(s)\n" "\n" "options :\n" " -h: print this help\n" @@ -96,7 +91,6 @@ char const *help_start = char const *usage_stop = "66-stop [ -h ] [ -z ] [ -v verbosity ] [ -T timeout ] [ -l live ] [ -t tree ] [ -u ] [ -X ] [ -K ] service(s)" ; char const *help_stop = -"66-stop <options> service(s)\n" "\n" "options :\n" " -h: print this help\n" @@ -113,7 +107,6 @@ char const *help_stop = char const *usage_svctl = "66-svctl [ -h ] [ -z ] [ -v verbosity ] [ -l live ] [ -t tree ] [ -T timeout ] [ -n death ] [ -u | d | r | K | X ] service(s)" ; char const *help_svctl = -"66-svctl <options> tree\n" "\n" "options :\n" " -h: print this help\n" @@ -133,7 +126,6 @@ char const *help_svctl = char const *usage_env = "66-env [ -h ] [ -z ] [ -v verbosity ] [ -t tree ] [ -c version ] [ -s version ] [ -V|L ] [ -r key=value ] [ -i src,dst ] [ -e ] service" ; char const *help_env = -"66-env <options> service\n" "\n" "options :\n" " -h: print this help\n" @@ -152,7 +144,6 @@ char const *help_env = char const *usage_all = "66-all [ -h ] [ -z ] [ -v verbosity ] [ -T timeout ] [ -l live ] [ -t tree ] [ -f ] up|down|unsupervise" ; char const *help_all = -"66-all <options> up|down|unsupervise\n" "\n" "options :\n" " -h: print this help\n" diff --git a/src/lib66/ssexec_main.c b/src/lib66/ssexec_main.c index 615480e27605a686b846953eac55a0e571968fdf..17f303fec0ec2cc3d36c4e868297ce028f7dbfa6 100644 --- a/src/lib66/ssexec_main.c +++ b/src/lib66/ssexec_main.c @@ -16,7 +16,6 @@ #include <oblibs/log.h> #include <oblibs/string.h> -#include <skalibs/buffer.h> #include <skalibs/sgetopt.h> #include <skalibs/types.h> @@ -64,12 +63,13 @@ void set_ssinfo(ssexec_t *info) if(r < 0) log_die(LOG_EXIT_SYS,"scandir: ",info->scandir.s," must be an absolute path") ; } -static inline void info_help (char const *help) +static inline void info_help (char const *help,char const *usage) { log_flow() ; - if (buffer_putsflush(buffer_1, help) < 0) - log_dieusys(LOG_EXIT_SYS, "write to stdout") ; + DEFAULT_MSG = 0 ; + + log_info(usage,"\n",help) ; } int ssexec_main(int argc, char const *const *argv,char const *const *envp,ssexec_func_t *func, ssexec_t *info) @@ -93,7 +93,7 @@ int ssexec_main(int argc, char const *const *argv,char const *const *envp,ssexec if (opt == -1) break ; switch (opt) { - case 'h' : info_help(info->help); return 0 ; + case 'h' : info_help(info->help,info->usage); return 0 ; case 'v' : if (!uint0_scan(l.arg, &VERBOSITY)) log_usage(info->usage) ; info->opt_verbo = 1 ; break ;