aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/s6-frontend/deps-exe/s6-frontend2
-rw-r--r--src/s6-frontend/main_version.c17
-rw-r--r--src/s6-frontend/s6-frontend-internal.h9
-rw-r--r--src/s6-frontend/s6-frontend.c8
4 files changed, 25 insertions, 11 deletions
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] ;