From 41841eabd5116c1e045c2023900c7ce7850a2480 Mon Sep 17 00:00:00 2001 From: sin Date: Sat, 8 Mar 2014 17:16:44 +0000 Subject: Remove util/ --- Makefile | 21 +++++---------------- sinit.c | 7 ++++--- util.h | 7 ------- util/eprintf.c | 56 -------------------------------------------------------- 4 files changed, 9 insertions(+), 82 deletions(-) delete mode 100644 util.h delete mode 100644 util/eprintf.c diff --git a/Makefile b/Makefile index 693da95..6f85121 100644 --- a/Makefile +++ b/Makefile @@ -3,15 +3,12 @@ include config.mk .POSIX: .SUFFIXES: .c .o -LIB = \ - util/eprintf.o - SRC = sinit.c -OBJ = $(SRC:.c=.o) $(LIB) +OBJ = $(SRC:.c=.o) BIN = $(SRC:.c=) -all: options binlib +all: options bin options: @echo sinit build options: @@ -19,12 +16,9 @@ options: @echo "LDFLAGS = $(LDFLAGS)" @echo "CC = $(CC)" -binlib: util.a - $(MAKE) bin - bin: $(BIN) -$(OBJ): config.h util.h config.mk +$(OBJ): config.h config.mk config.h: @echo creating $@ from config.def.h @@ -32,17 +26,12 @@ config.h: .o: @echo LD $@ - @$(LD) -o $@ $< util.a $(LDFLAGS) + @$(LD) -o $@ $< $(LDFLAGS) .c.o: @echo CC $< @$(CC) -c -o $@ $< $(CFLAGS) -util.a: $(LIB) - @echo AR $@ - @$(AR) -r -c $@ $(LIB) - @ranlib $@ - install: all @echo installing executable to $(DESTDIR)$(PREFIX)/bin @mkdir -p $(DESTDIR)$(PREFIX)/bin @@ -55,4 +44,4 @@ uninstall: clean: @echo cleaning - @rm -f $(BIN) $(OBJ) $(LIB) util.a + @rm -f $(BIN) $(OBJ) diff --git a/sinit.c b/sinit.c index 16ec868..45cf0ff 100644 --- a/sinit.c +++ b/sinit.c @@ -6,7 +6,8 @@ #include #include #include -#include "util.h" + +#define LEN(x) (sizeof (x) / sizeof *(x)) static void sigpoweroff(void); static void sigreap(void); @@ -81,13 +82,13 @@ spawn(char *const argv[]) pid = fork(); if (pid < 0) { - weprintf("sinit: fork:"); + perror("fork"); } else if (pid == 0) { sigprocmask(SIG_UNBLOCK, &set, NULL); setsid(); setpgid(0, 0); execvp(argv[0], argv); - weprintf("sinit: execvp %s:", argv[0]); + perror("execvp"); _exit(EXIT_FAILURE); } } diff --git a/util.h b/util.h deleted file mode 100644 index 3ce02d1..0000000 --- a/util.h +++ /dev/null @@ -1,7 +0,0 @@ -/* See LICENSE file for copyright and license details. */ - -#define LEN(x) (sizeof (x) / sizeof *(x)) - -void enprintf(int, const char *, ...); -void eprintf(const char *, ...); -void weprintf(const char *, ...); diff --git a/util/eprintf.c b/util/eprintf.c deleted file mode 100644 index 8da0651..0000000 --- a/util/eprintf.c +++ /dev/null @@ -1,56 +0,0 @@ -/* See LICENSE file for copyright and license details. */ - -#include -#include -#include -#include -#include "../util.h" - -static void venprintf(int, const char *, va_list); - -void -eprintf(const char *fmt, ...) -{ - va_list ap; - - va_start(ap, fmt); - venprintf(EXIT_FAILURE, fmt, ap); - va_end(ap); -} - -void -enprintf(int status, const char *fmt, ...) -{ - va_list ap; - - va_start(ap, fmt); - venprintf(status, fmt, ap); - va_end(ap); -} - -static void -venprintf(int status, const char *fmt, va_list ap) -{ - vfprintf(stderr, fmt, ap); - - if(fmt[0] && fmt[strlen(fmt)-1] == ':') { - fputc(' ', stderr); - perror(NULL); - } - - exit(status); -} - -void -weprintf(const char *fmt, ...) -{ - va_list ap; - - va_start(ap, fmt); - vfprintf(stderr, fmt, ap); - va_end(ap); - if (fmt[0] && fmt[strlen(fmt)-1] == ':') { - fputc(' ', stderr); - perror(NULL); - } -} -- cgit v1.2.3-70-g09d2