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

fix help call of 66 resolve

parent 6cd6b3b7
No related branches found
No related tags found
No related merge requests found
......@@ -247,6 +247,8 @@ extern char const *help_halt ;
#define OPTS_ENV_LEN (sizeof OPTS_ENV - 1)
#define OPTS_STATE "h"
#define OPTS_STATE_LEN (sizeof OPTS_STATE - 1)
#define OPTS_RESOLVE "h"
#define OPTS_RESOVLE_LEN (sizeof OPTS_RESOLVE - 1)
#define OPTS_TREE_WRAPPER "h"
#define OPTS_TREE_WRAPPER_LEN (sizeof OPTS_TREE_WRAPPER - 1)
......
......@@ -47,7 +47,7 @@ char const *help_66 =
" disable: deactivate service for the next boot\n"
" environ: manage service environment variable\n"
" status: display services informations\n"
" resolve: display the resolve files contents of services\n"
" resolve: display the resolve file contents of services\n"
" state: display state files contents of services\n"
" remove: remove services and cleanup all files belong to it from the system\n"
" signal: send signal to service\n"
......@@ -231,7 +231,7 @@ char const *help_status =
char const *usage_resolve = "66 resolve [ -h ] service" ;
char const *help_resolve =
"\ndisplay the resolve files contents of services\n"
"\ndisplay the resolve file contents of services\n"
"\n"
"options:\n"
" -h: print this help\n"
......
......@@ -24,6 +24,7 @@
#include <skalibs/stralloc.h>
#include <skalibs/lolstdio.h>
#include <skalibs/buffer.h>
#include <skalibs/sgetopt.h>
#include <66/resolve.h>
#include <66/ssexec.h>
......@@ -167,14 +168,6 @@ int ssexec_resolve(int argc, char const *const *argv, ssexec_t *info)
resolve_service_t res = RESOLVE_SERVICE_ZERO ;
resolve_wrapper_t_ref wres = resolve_set_struct(DATA_SERVICE, &res) ;
argc-- ;
argv++ ;
if (argc < 1)
log_usage(info->usage, "\n", info->help) ;
svname = *argv ;
char service_buf[MAXOPTS][INFO_FIELD_MAXLEN] = {
"name",
"description" ,
......@@ -258,6 +251,32 @@ int ssexec_resolve(int argc, char const *const *argv, ssexec_t *info)
} ;
{
subgetopt l = SUBGETOPT_ZERO ;
for (;;)
{
int opt = subgetopt_r(argc, argv, OPTS_RESOLVE, &l) ;
if (opt == -1) break ;
switch (opt) {
case 'h' :
info_help(info->help, info->usage) ;
return 0 ;
default :
log_usage(info->usage, "\n", info->help) ;
}
}
argc -= l.ind ; argv += l.ind ;
}
if (argc < 1)
log_usage(info->usage, "\n", info->help) ;
svname = *argv ;
r = service_is_g(svname, STATE_FLAGS_ISPARSED) ;
if (r == -1)
......
......@@ -87,7 +87,7 @@ int ssexec_state(int argc, char const *const *argv, ssexec_t *info)
for (;;)
{
int opt = subgetopt_r(argc, argv, OPTS_ENABLE, &l) ;
int opt = subgetopt_r(argc, argv, OPTS_STATE, &l) ;
if (opt == -1) break ;
switch (opt) {
......
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