aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorsin <sin@2f30.org>2014-03-08 17:16:44 +0000
committersin <sin@2f30.org>2014-03-08 17:16:44 +0000
commit41841eabd5116c1e045c2023900c7ce7850a2480 (patch)
treef32d14f3b378801103611af0a6a04ec70930a58b
parent27326b71197a4f73e422f388d5aa3d1b3ea24bac (diff)
Remove util/
-rw-r--r--Makefile21
-rw-r--r--sinit.c7
-rw-r--r--util.h7
-rw-r--r--util/eprintf.c56
4 files changed, 9 insertions, 82 deletions
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 <sys/types.h>
#include <sys/wait.h>
#include <unistd.h>
-#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 <stdarg.h>
-#include <stdio.h>
-#include <stdlib.h>
-#include <string.h>
-#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);
- }
-}