summary refs log tree commit diff
diff options
context:
space:
mode:
-rw-r--r--ChangeLog1
-rw-r--r--configure.ac2
-rw-r--r--src/bltin/times.c5
-rw-r--r--src/system.c8
-rw-r--r--src/system.h5
5 files changed, 17 insertions, 4 deletions
diff --git a/ChangeLog b/ChangeLog
index 91f92a8..df38cf6 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -19,6 +19,7 @@
 	* Removed standalone/csh support from printf.
 	* Added dummy strtod implementation.
 	* Removed standalone/csh support from test.
+	* Added dummy sysconf implementation.
 
 2005-10-26  Herbert Xu <herbert@gondor.apana.org.au>
 
diff --git a/configure.ac b/configure.ac
index ed2ab02..d361369 100644
--- a/configure.ac
+++ b/configure.ac
@@ -24,7 +24,7 @@ dnl Checks for header files.
 
 dnl Checks for library functions.
 AC_CHECK_FUNCS(bsearch getpwnam getrlimit killpg mempcpy sigsetmask stpcpy \
-	       strchrnul strsignal strtod strtoimax strtoumax)
+	       strchrnul strsignal strtod strtoimax strtoumax sysconf)
 
 dnl Check for klibc signal.
 AC_CHECK_FUNC(signal)
diff --git a/src/bltin/times.c b/src/bltin/times.c
index aca579f..8eabc1f 100644
--- a/src/bltin/times.c
+++ b/src/bltin/times.c
@@ -10,10 +10,9 @@
 #else
 #include "bltin.h"
 #endif
+#include "system.h"
 
-#define main timescmd
-
-int main() {
+int timescmd() {
 	struct tms buf;
 	long int clk_tck = sysconf(_SC_CLK_TCK);
 
diff --git a/src/system.c b/src/system.c
index d986efd..4c281ed 100644
--- a/src/system.c
+++ b/src/system.c
@@ -28,6 +28,7 @@
 
 #include <signal.h>
 #include <string.h>
+#include "error.h"
 #include "output.h"
 #include "system.h"
 
@@ -89,3 +90,10 @@ void *bsearch(const void *key, const void *base, size_t nmemb,
 	return 0;
 }
 #endif
+
+#ifndef HAVE_SYSCONF
+long sysconf(int name)
+{
+	sh_error("no sysconf for: %d", name);
+}
+#endif
diff --git a/src/system.h b/src/system.h
index 2737e9f..b8853e6 100644
--- a/src/system.h
+++ b/src/system.h
@@ -92,3 +92,8 @@ static inline int killpg(pid_t pid, int signal)
 	return kill(-pid, signal);
 }
 #endif
+
+#ifndef HAVE_SYSCONF
+#define _SC_CLK_TCK 2
+long sysconf(int) __attribute__((__noreturn__));
+#endif