diff options
Diffstat (limited to '')
| -rw-r--r-- | 4init/4init.c | 9 | ||||
| -rw-r--r-- | 4init/Makefile | 21 | ||||
| -rw-r--r-- | 4init/build.ninja | 41 | ||||
| -rw-r--r-- | 4init/config.h | 11 |
4 files changed, 48 insertions, 34 deletions
diff --git a/4init/4init.c b/4init/4init.c index 50807b6..14cfbba 100644 --- a/4init/4init.c +++ b/4init/4init.c | |||
| @@ -8,14 +8,13 @@ | |||
| 8 | 8 | ||
| 9 | #include "config.h" | 9 | #include "config.h" |
| 10 | 10 | ||
| 11 | static void reap(void) | 11 | static void reap(void) { |
| 12 | { | ||
| 13 | int status; | 12 | int status; |
| 14 | while (waitpid(-1, &status, WNOHANG) > 0) {} | 13 | while (waitpid(-1, &status, WNOHANG) > 0) { |
| 14 | } | ||
| 15 | } | 15 | } |
| 16 | 16 | ||
| 17 | int main(void) | 17 | int main(void) { |
| 18 | { | ||
| 19 | int sigfd = -1; | 18 | int sigfd = -1; |
| 20 | pid_t pid = -1; | 19 | pid_t pid = -1; |
| 21 | sigset_t set; | 20 | sigset_t set; |
diff --git a/4init/Makefile b/4init/Makefile deleted file mode 100644 index e56e105..0000000 --- a/4init/Makefile +++ /dev/null | |||
| @@ -1,21 +0,0 @@ | |||
| 1 | include config.mk | ||
| 2 | |||
| 3 | BIN = 4init | ||
| 4 | OBJ = 4init.o | ||
| 5 | |||
| 6 | all: $(BIN) | ||
| 7 | |||
| 8 | $(BIN): $(OBJ) | ||
| 9 | $(CC) $(LDFLAGS) -o $@ $(OBJ) | ||
| 10 | |||
| 11 | $(OBJ): config.h | ||
| 12 | |||
| 13 | install: all | ||
| 14 | mkdir -pv $(DESTDIR)$(PREFIX)/bin | ||
| 15 | cp -fv $(BIN) $(DESTDIR)$(PREFIX)/bin | ||
| 16 | |||
| 17 | uninstall: all | ||
| 18 | rm -f $(DESTDIR)$(PREFIX)/bin/$(BIN) | ||
| 19 | |||
| 20 | clean: all | ||
| 21 | rm -f 4init.o 4init | ||
diff --git a/4init/build.ninja b/4init/build.ninja new file mode 100644 index 0000000..41f1d7d --- /dev/null +++ b/4init/build.ninja | |||
| @@ -0,0 +1,41 @@ | |||
| 1 | # this file was generated from a makefile by shinobi | ||
| 2 | build __shin_always_build__: phony | ||
| 3 | |||
| 4 | build all: phony 4init | ||
| 5 | |||
| 6 | rule r1 | ||
| 7 | command = musl-gcc -s -static -o 4init 4init.o | ||
| 8 | generator = 1 | ||
| 9 | |||
| 10 | build 4init: r1 4init.o | ||
| 11 | description = build 4init | ||
| 12 | |||
| 13 | rule r2 | ||
| 14 | command = musl-gcc -std=c99 -Wextra -Wall -Os -fhardened -c 4init.c | ||
| 15 | generator = 1 | ||
| 16 | |||
| 17 | build 4init.o: r2 4init.c config.h | ||
| 18 | description = build 4init.o | ||
| 19 | |||
| 20 | rule r3 | ||
| 21 | command = sh -c 'mkdir -pv /usr/local/bin' && sh -c 'cp -fv 4init /usr/local/bin' | ||
| 22 | generator = 1 | ||
| 23 | |||
| 24 | build install: r3 | ||
| 25 | description = build install | ||
| 26 | |||
| 27 | rule r4 | ||
| 28 | command = rm -f /usr/local/bin/4init | ||
| 29 | generator = 1 | ||
| 30 | |||
| 31 | build uninstall: r4 | ||
| 32 | description = build uninstall | ||
| 33 | |||
| 34 | rule r5 | ||
| 35 | command = rm -f 4init.o 4init | ||
| 36 | generator = 1 | ||
| 37 | |||
| 38 | build clean: r5 | ||
| 39 | description = build clean | ||
| 40 | |||
| 41 | default all | ||
diff --git a/4init/config.h b/4init/config.h index 6c36ccf..3798447 100644 --- a/4init/config.h +++ b/4init/config.h | |||
| @@ -3,15 +3,10 @@ | |||
| 3 | 3 | ||
| 4 | static const char *rc_path = "/usr/bin/4rc"; | 4 | static const char *rc_path = "/usr/bin/4rc"; |
| 5 | 5 | ||
| 6 | static char *const rc_argv[] = { | 6 | static char *const rc_argv[] = {"4rc", NULL}; |
| 7 | "4rc", | ||
| 8 | NULL | ||
| 9 | }; | ||
| 10 | 7 | ||
| 11 | static char *const rc_envp[] = { | 8 | static char *const rc_envp[] = { |
| 12 | "PATH=/usr/local/sbin:/usr/local/bin:/usr/bin:/bin:/sbin", | 9 | "PATH=/usr/local/sbin:/usr/local/bin:/usr/bin:/bin:/sbin", "TERM=linux", |
| 13 | "TERM=linux", | 10 | NULL}; |
| 14 | NULL | ||
| 15 | }; | ||
| 16 | 11 | ||
| 17 | #endif // CONFIG_H | 12 | #endif // CONFIG_H |
