[klibc] [PATCH] sleep for klibc utils

Olaf Hering olh at suse.de
Sat Feb 21 23:25:16 PST 2004


This implements a sleep command.


diff -p -purN klibc-0.111/utils/Makefile klibc-0.111.utils/utils/Makefile
--- klibc-0.111/utils/Makefile	2004-02-10 00:18:15.000000000 +0100
+++ klibc-0.111.utils/utils/Makefile	2004-02-21 22:33:08.000000000 +0100
@@ -5,7 +5,7 @@ include ../MRULES
 MAKEDEPS = -Wp,-MD,.$(subst /,-,$*).d
 CFLAGS   = $(MAKEDEPS) $(OPTFLAGS) $(REQFLAGS) -W -Wall
 LIBS     = $(KLIBC) $(LIBGCC)
-PROGS    = chroot dd fstype mkdir mkfifo mount pivot_root umount true false
+PROGS    = chroot dd fstype mkdir mkfifo mount pivot_root umount true false sleep
 
 all:	$(PROGS)
 
@@ -39,6 +39,9 @@ true: true.o $(CRT0) $(LIBS)
 false: false.o $(CRT0) $(LIBS)
 	$(LD) $(LDFLAGS) -o $@ $(CRT0) false.o $(LIBS)
 
+sleep: sleep.o $(CRT0) $(LIBS)
+	$(LD) $(LDFLAGS) -o $@ $(CRT0) sleep.o $(LIBS)
+
 $(CRT0) $(LIBS):
 	@echo '*** error: $@ not up to date' || exit 1
 
diff -p -purN klibc-0.111/utils/sleep.c klibc-0.111.utils/utils/sleep.c
--- klibc-0.111/utils/sleep.c	1970-01-01 01:00:00.000000000 +0100
+++ klibc-0.111.utils/utils/sleep.c	2004-02-21 22:32:04.000000000 +0100
@@ -0,0 +1,16 @@
+#include <stdio.h>
+#include <stdlib.h>
+
+int main(int argc, char *argv[])
+{
+	unsigned long s;
+	char *p;
+	if (argc != 2) {
+		fprintf(stderr, "usage: sleep <n sec>\n");
+		return 1;
+	}
+	s = strtoul(argv[1], &p, 10);
+	sleep(s);
+
+	return 0;
+}
-- 
USB is for mice, FireWire is for men!

sUse lINUX ag, nÜRNBERG



More information about the klibc mailing list