summary refs log tree commit diff
diff options
context:
space:
mode:
authorHerbert Xu <herbert@gondor.apana.org.au>2005-10-29 21:43:45 +1000
committerHerbert Xu <herbert@gondor.apana.org.au>2005-10-29 21:43:45 +1000
commit156deb8fa7c56e4809d6bc0b4f1075742cdde5e4 (patch)
treeae526c0b6759beafd74240b623395e2c0e028051
parent[BUILTIN] Removed standalone/csh support from test (diff)
downloaddash-156deb8fa7c56e4809d6bc0b4f1075742cdde5e4.tar.gz
dash-156deb8fa7c56e4809d6bc0b4f1075742cdde5e4.zip
[SYSTEM] Added dummy sysconf implementation
Add a dummy sysconf implementation that always fails for klibc.
-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
onfigOpen and dataOpen. 2021-01-26Expand the opening paragraph of the manualJune McEnroe 2021-01-25Disable notify in restricted modeJune McEnroe catgirl shouldn't try to execute a command if it is misconfigured with both restrict and notify. 2021-01-25Don't print timestamps for blank lines in bufferListJune McEnroe 2021-01-25Do not copy time to wrapped linesJune McEnroe 2021-01-25Add protocol coverage to non-features listJune McEnroe I don't feel that 100% protocol extension support should at all be a goal. 2021-01-25Move mention of pledge(2) and unveil(2) to READMEJune McEnroe The manual is the wrong place to document platform support. 2021-01-23Preserve order of filters when removingJune McEnroe Filters should be kept in order since the first one that matches, wins. This lets highlights or ignores take priority over each other, if desired. 2021-01-23Fix /unignore commandJune McEnroe Yikes, copy-paste fail. 2021-01-23Remove use of "%n" to appease de RaadtJune McEnroe Sure, it was completely unnecessary, but I resent being told how to use snprintf. https://cvsweb.openbsd.org/src/lib/libc/stdio/vfprintf.c?rev=1.79&content-type=text/x-cvsweb-markup 2021-01-23Drop filesystem access iff possibleKlemens Nanni Log files and state save/restore both require read/write access to the filesystem, both during start and exit. If neither features are used, catgirl may run with "stdio tty". 2021-01-23Drop exec capability iff restrictedKlemens Nanni Nothing must be executed when running /copy, et al. 2021-01-23Drop network capability after ircConnect()Klemens Nanni catgirl has no reconnect feature and generally must not do anything but read/write from/to the connected socket which does not require "inet" or "dns" promises. 2021-01-23Call pledge(2) after unveil(2)Klemens Nanni Simplify logic, be more idiomatic and finalize by pledging after all unveiling is done by omitting the "unveil" promise and thereby not allowing further calls to it. 2021-01-23Separate kiosk mode from restrict modeJune McEnroe Restrict mode will focus on sandboxing, while kiosk will continue to restrict IRC access through a public kiosk. Kiosk mode without restrict mode allows execution of man 1 catgirl with /help, assuming external sandboxing. The /list and /part commands are also added to the list of disabled commands in kiosk mode, since they are pointless without access to /join. 2021-01-21Simplify windowUpdate loops and factor out windowTopJune McEnroe No idea why I made that more complicated than it had to be looping backwards. 2021-01-21Document that M-l shows timestampsJune McEnroe 2021-01-19Don't lose swapped window when navigating to current bufferJeremy O'Brien 2021-01-19Use Warm heat for manually inserted blank linesJune McEnroe Oops, forgot about these. 2021-01-18Add example tmux(1) configKlemens Nanni Spawn one catgirl per network and handle reconnects through tmux, no extra tool required. 2021-01-17Use Warm heat for blank linesJune McEnroe So they're not hidden by M-+. 2021-01-16Add -I highlight option and /highlightJune McEnroe