diff options
| author | Laurent Bercot <ska-skaware@skarnet.org> | 2025-12-24 12:08:56 +0000 |
|---|---|---|
| committer | Laurent Bercot <ska-skaware@skarnet.org> | 2025-12-24 12:08:56 +0000 |
| commit | d831d111b8176875cd0e83de798d6c3f5ec593c6 (patch) | |
| tree | cc733233488c0738cbce7fe440bf9b9f392a1696 | |
| parent | 50fd489b3dd53740ac2e2b024244b98967859d7b (diff) | |
| download | s6-frontend-d831d111b8176875cd0e83de798d6c3f5ec593c6.tar.gz | |
Help system seems to work
| -rw-r--r-- | package/deps.mak | 9 | ||||
| -rw-r--r-- | package/targets.mak | 2 | ||||
| -rw-r--r-- | src/s6-frontend/deps-exe/s6-frontend | 2 | ||||
| -rw-r--r-- | src/s6-frontend/main_version.c | 17 | ||||
| -rw-r--r-- | src/s6-frontend/s6-frontend-internal.h | 9 | ||||
| -rw-r--r-- | src/s6-frontend/s6-frontend.c | 8 |
6 files changed, 28 insertions, 19 deletions
diff --git a/package/deps.mak b/package/deps.mak index e5affd7..3293ada 100644 --- a/package/deps.mak +++ b/package/deps.mak @@ -9,22 +9,19 @@ src/libs6f/s6f_equote.o src/libs6f/s6f_equote.lo: src/libs6f/s6f_equote.c src/in src/libs6f/s6f_lock.o src/libs6f/s6f_lock.lo: src/libs6f/s6f_lock.c src/include-local/s6f.h src/libs6f/s6f_report_state_change.o src/libs6f/s6f_report_state_change.lo: src/libs6f/s6f_report_state_change.c src/include-local/s6f.h src/libs6f/s6f_user_get_confdirs.o src/libs6f/s6f_user_get_confdirs.lo: src/libs6f/s6f_user_get_confdirs.c src/include-local/s6f.h -src/s6-frontend/help.o src/s6-frontend/help.lo: src/s6-frontend/help.c src/s6-frontend/s6-frontend-internal.h src/include/s6-frontend/config.h src/s6-frontend/live.o src/s6-frontend/live.lo: src/s6-frontend/live.c src/s6-frontend/s6-frontend-internal.h -src/s6-frontend/live_help.o src/s6-frontend/live_help.lo: src/s6-frontend/live_help.c src/s6-frontend/s6-frontend-internal.h src/s6-frontend/live_install.o src/s6-frontend/live_install.lo: src/s6-frontend/live_install.c src/s6-frontend/s6-frontend-internal.h src/s6-frontend/live_start_everything.o src/s6-frontend/live_start_everything.lo: src/s6-frontend/live_start_everything.c src/s6-frontend/s6-frontend-internal.h src/include/s6-frontend/config.h src/s6-frontend/live_startstop.o src/s6-frontend/live_startstop.lo: src/s6-frontend/live_startstop.c src/s6-frontend/s6-frontend-internal.h src/s6-frontend/live_status.o src/s6-frontend/live_status.lo: src/s6-frontend/live_status.c src/s6-frontend/s6-frontend-internal.h src/include/s6-frontend/config.h src/s6-frontend/live_stop_everything.o src/s6-frontend/live_stop_everything.lo: src/s6-frontend/live_stop_everything.c src/s6-frontend/s6-frontend-internal.h +src/s6-frontend/main_version.o src/s6-frontend/main_version.lo: src/s6-frontend/main_version.c src/s6-frontend/s6-frontend-internal.h src/include/s6-frontend/config.h src/s6-frontend/process.o src/s6-frontend/process.lo: src/s6-frontend/process.c src/s6-frontend/s6-frontend-internal.h -src/s6-frontend/process_help.o src/s6-frontend/process_help.lo: src/s6-frontend/process_help.c src/s6-frontend/s6-frontend-internal.h src/s6-frontend/process_kill.o src/s6-frontend/process_kill.lo: src/s6-frontend/process_kill.c src/s6-frontend/s6-frontend-internal.h src/include-local/s6f.h src/s6-frontend/process_restart.o src/s6-frontend/process_restart.lo: src/s6-frontend/process_restart.c src/s6-frontend/s6-frontend-internal.h src/s6-frontend/process_startstop.o src/s6-frontend/process_startstop.lo: src/s6-frontend/process_startstop.c src/s6-frontend/s6-frontend-internal.h src/s6-frontend/process_status.o src/s6-frontend/process_status.lo: src/s6-frontend/process_status.c src/s6-frontend/s6-frontend-internal.h src/s6-frontend/repository.o src/s6-frontend/repository.lo: src/s6-frontend/repository.c src/s6-frontend/s6-frontend-internal.h -src/s6-frontend/repository_help.o src/s6-frontend/repository_help.lo: src/s6-frontend/repository_help.c src/s6-frontend/s6-frontend-internal.h src/s6-frontend/repository_init.o src/s6-frontend/repository_init.lo: src/s6-frontend/repository_init.c src/s6-frontend/s6-frontend-internal.h src/include/s6-frontend/config.h src/s6-frontend/repository_list.o src/s6-frontend/repository_list.lo: src/s6-frontend/repository_list.c src/s6-frontend/s6-frontend-internal.h src/s6-frontend/repository_sync.o src/s6-frontend/repository_sync.lo: src/s6-frontend/repository_sync.c src/s6-frontend/s6-frontend-internal.h @@ -35,12 +32,10 @@ src/s6-frontend/set_change.o src/s6-frontend/set_change.lo: src/s6-frontend/set_ src/s6-frontend/set_check.o src/s6-frontend/set_check.lo: src/s6-frontend/set_check.c src/s6-frontend/s6-frontend-internal.h src/include/s6-frontend/config.h src/s6-frontend/set_commit.o src/s6-frontend/set_commit.lo: src/s6-frontend/set_commit.c src/s6-frontend/s6-frontend-internal.h src/s6-frontend/set_copy.o src/s6-frontend/set_copy.lo: src/s6-frontend/set_copy.c src/s6-frontend/s6-frontend-internal.h -src/s6-frontend/set_help.o src/s6-frontend/set_help.lo: src/s6-frontend/set_help.c src/s6-frontend/s6-frontend-internal.h src/s6-frontend/set_list.o src/s6-frontend/set_list.lo: src/s6-frontend/set_list.c src/s6-frontend/s6-frontend-internal.h src/s6-frontend/set_status.o src/s6-frontend/set_status.lo: src/s6-frontend/set_status.c src/s6-frontend/s6-frontend-internal.h src/include/s6-frontend/config.h src/s6-frontend/system.o src/s6-frontend/system.lo: src/s6-frontend/system.c src/s6-frontend/s6-frontend-internal.h src/s6-frontend/system_boot.o src/s6-frontend/system_boot.lo: src/s6-frontend/system_boot.c src/s6-frontend/s6-frontend-internal.h src/include/s6-frontend/config.h -src/s6-frontend/system_help.o src/s6-frontend/system_help.lo: src/s6-frontend/system_help.c src/s6-frontend/s6-frontend-internal.h src/s6-frontend/system_hpr.o src/s6-frontend/system_hpr.lo: src/s6-frontend/system_hpr.c src/s6-frontend/s6-frontend-internal.h src/include/s6-frontend/config.h s6-frontend-helper-kill: EXTRA_LIBS := @@ -53,5 +48,5 @@ endif s6: EXTRA_LIBS := s6: src/s6-frontend/s6.o -lskarnet s6-frontend: EXTRA_LIBS := ${MAYBEPTHREAD_LIB} -s6-frontend: src/s6-frontend/s6-frontend.o src/s6-frontend/help.o src/s6-frontend/live.o src/s6-frontend/live_help.o src/s6-frontend/live_install.o src/s6-frontend/live_startstop.o src/s6-frontend/live_status.o src/s6-frontend/live_start_everything.o src/s6-frontend/live_stop_everything.o src/s6-frontend/process.o src/s6-frontend/process_help.o src/s6-frontend/process_kill.o src/s6-frontend/process_restart.o src/s6-frontend/process_startstop.o src/s6-frontend/process_status.o src/s6-frontend/repository.o src/s6-frontend/repository_help.o src/s6-frontend/repository_init.o src/s6-frontend/repository_list.o src/s6-frontend/repository_sync.o src/s6-frontend/set.o src/s6-frontend/set_change.o src/s6-frontend/set_check.o src/s6-frontend/set_commit.o src/s6-frontend/set_copy.o src/s6-frontend/set_help.o src/s6-frontend/set_list.o src/s6-frontend/set_status.o src/s6-frontend/system.o src/s6-frontend/system_boot.o src/s6-frontend/system_help.o src/s6-frontend/system_hpr.o libs6f.a.xyzzy ${LIBNSSS} -ls6rc -ls6 -lskarnet +s6-frontend: src/s6-frontend/s6-frontend.o src/s6-frontend/live.o src/s6-frontend/live_help.o src/s6-frontend/live_install.o src/s6-frontend/live_startstop.o src/s6-frontend/live_status.o src/s6-frontend/live_start_everything.o src/s6-frontend/live_stop_everything.o src/s6-frontend/main_help.o src/s6-frontend/main_version.o src/s6-frontend/process.o src/s6-frontend/process_help.o src/s6-frontend/process_kill.o src/s6-frontend/process_restart.o src/s6-frontend/process_startstop.o src/s6-frontend/process_status.o src/s6-frontend/repository.o src/s6-frontend/repository_help.o src/s6-frontend/repository_init.o src/s6-frontend/repository_list.o src/s6-frontend/repository_sync.o src/s6-frontend/set.o src/s6-frontend/set_change.o src/s6-frontend/set_check.o src/s6-frontend/set_commit.o src/s6-frontend/set_copy.o src/s6-frontend/set_help.o src/s6-frontend/set_list.o src/s6-frontend/set_status.o src/s6-frontend/system.o src/s6-frontend/system_boot.o src/s6-frontend/system_help.o src/s6-frontend/system_hpr.o libs6f.a.xyzzy ${LIBNSSS} -ls6rc -ls6 -lskarnet INTERNAL_LIBS := libs6f.a.xyzzy diff --git a/package/targets.mak b/package/targets.mak index 25321a7..8b2a86a 100644 --- a/package/targets.mak +++ b/package/targets.mak @@ -14,4 +14,4 @@ src/s6-frontend/set_help.c \ src/s6-frontend/system_help.c \ %_help.c: %.help.txt - exec ./tools/help2c.sh $* < $< > $@ + exec ./tools/help2c.sh $(*F) < $< > $@ diff --git a/src/s6-frontend/deps-exe/s6-frontend b/src/s6-frontend/deps-exe/s6-frontend index 3c55079..14038f5 100644 --- a/src/s6-frontend/deps-exe/s6-frontend +++ b/src/s6-frontend/deps-exe/s6-frontend @@ -1,4 +1,3 @@ -help.o live.o live_help.o live_install.o @@ -7,6 +6,7 @@ live_status.o live_start_everything.o live_stop_everything.o main_help.o +main_version.o process.o process_help.o process_kill.o diff --git a/src/s6-frontend/main_version.c b/src/s6-frontend/main_version.c new file mode 100644 index 0000000..c7d7e68 --- /dev/null +++ b/src/s6-frontend/main_version.c @@ -0,0 +1,17 @@ +/* ISC license. */ + +#include <unistd.h> + +#include <skalibs/buffer.h> +#include <skalibs/strerr.h> + +#include <s6-frontend/config.h> +#include "s6-frontend-internal.h" + +void main_version (char const *const *argv) +{ + if (!buffer_putsflush(buffer_1, "s6-frontend v" S6_FRONTEND_VERSION "\n")) + strerr_diefu1sys(111, "write to stdout") ; + (void)argv ; + _exit(0) ; +} diff --git a/src/s6-frontend/s6-frontend-internal.h b/src/s6-frontend/s6-frontend-internal.h index 0004646..c7ee0e2 100644 --- a/src/s6-frontend/s6-frontend-internal.h +++ b/src/s6-frontend/s6-frontend-internal.h @@ -19,12 +19,6 @@ #define BSEARCH(type, key, array) bsearch(key, (array), sizeof(array)/sizeof(type), sizeof(type), &stringkey_bcmp) - /* help */ - -extern void help (char const *const *) gccattr_noreturn ; -extern void version (char const *const *) gccattr_noreturn ; - - /* live */ extern void exec_live_start_everything (unsigned int, int, char const *) gccattr_noreturn ; @@ -105,6 +99,9 @@ extern void system_reboot (char const *const *) gccattr_noreturn ; /* main */ +extern void main_help (char const *const *) gccattr_noreturn ; +extern void main_version (char const *const *) gccattr_noreturn ; + struct global_s { unsigned int verbosity ; diff --git a/src/s6-frontend/s6-frontend.c b/src/s6-frontend/s6-frontend.c index cb9835c..2b78dbf 100644 --- a/src/s6-frontend/s6-frontend.c +++ b/src/s6-frontend/s6-frontend.c @@ -67,13 +67,13 @@ int main (int argc, char const *const *argv) } ; static struct command_s const commands[] = { - { .s = "help", .f = &help }, + { .s = "help", .f = &main_help }, { .s = "live", .f = &live }, { .s = "process", .f = &process }, { .s = "repository", .f = &repository }, { .s = "set", .f = &set }, { .s = "system", .f = &s6system }, - { .s = "version", .f = &version }, + { .s = "version", .f = &main_version }, } ; struct global_s globals_in_the_stack = GLOBAL_ZERO ; @@ -99,8 +99,8 @@ int main (int argc, char const *const *argv) if (wgola[GOLA_VERBOSITY] && !uint0_scan(wgola[GOLA_VERBOSITY], &g->verbosity)) strerr_dief1x(100, "verbosity must be an unsigned integer") ; - if (wgolb & GOLB_VERSION) version(argv) ; - if (wgolb & GOLB_HELP) help(argv) ; + if (wgolb & GOLB_VERSION) main_version(argv) ; + if (wgolb & GOLB_HELP) main_help(argv) ; if (wgolb & (GOLB_VERSION | GOLB_HELP)) return 0 ; if (wgola[GOLA_SCANDIR]) g->dirs.scan = wgola[GOLA_SCANDIR] ; |
