Skip to content
Snippets Groups Projects
Commit 256c8a0c authored by Eric Vidal's avatar Eric Vidal :speech_balloon:
Browse files

repeat tool interface at help call

parent 838c1461
No related branches found
No related tags found
No related merge requests found
......@@ -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)
......
......@@ -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 ;
......
......@@ -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)
......
......@@ -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)
......
......@@ -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)
......
......@@ -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)
......
......@@ -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)
......
......@@ -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)
......
......@@ -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)
......
......@@ -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)
......
......@@ -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)
......
......@@ -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)
......
......@@ -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)
......
......@@ -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)
......
......@@ -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)
......
......@@ -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"
......
......@@ -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 ;
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment