commit 41841eabd5116c1e045c2023900c7ce7850a2480
parent 27326b71197a4f73e422f388d5aa3d1b3ea24bac
Author: sin <sin@2f30.org>
Date: Sat, 8 Mar 2014 17:16:44 +0000
Remove util/
Diffstat:
4 files changed, 9 insertions(+), 82 deletions(-)
diff --git 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
@@ -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
@@ -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
@@ -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);
- }
-}