aboutsummaryrefslogtreecommitdiffstats
path: root/src/loglevel.c
diff options
context:
space:
mode:
authorBill Nottingham <notting@redhat.com>1999-02-04 20:19:40 +0000
committerBill Nottingham <notting@redhat.com>1999-02-04 20:19:40 +0000
commit75b00704a85e1575a033246122292bb6a3044037 (patch)
tree7cd4c7a3e1eea686f4cd5818a397cd1c6613c18f /src/loglevel.c
parent14ac181bc961bd8691fe4db9225f8e13f672ff74 (diff)
downloadinitscripts-75b00704a85e1575a033246122292bb6a3044037.tar
initscripts-75b00704a85e1575a033246122292bb6a3044037.tar.gz
initscripts-75b00704a85e1575a033246122292bb6a3044037.tar.bz2
initscripts-75b00704a85e1575a033246122292bb6a3044037.tar.xz
initscripts-75b00704a85e1575a033246122292bb6a3044037.zip
add loglevel.c, document LOGLEVEL setting
Diffstat (limited to 'src/loglevel.c')
-rw-r--r--src/loglevel.c26
1 files changed, 26 insertions, 0 deletions
diff --git a/src/loglevel.c b/src/loglevel.c
new file mode 100644
index 00000000..04de2e46
--- /dev/null
+++ b/src/loglevel.c
@@ -0,0 +1,26 @@
+
+/* Change the default console loglevel */
+
+#include <stdio.h>
+#include <stdlib.h>
+#include <unistd.h>
+#include <linux/unistd.h>
+
+_syscall3(int,syslog,int,type,char *,bufp,int,len);
+
+int main(int argc, char **argv) {
+ int level;
+
+ if (!argv[1]) exit(0);
+ level=atoi(argv[1]);
+ if ( (level<1) || (level>8) ) {
+ fprintf(stderr,"invalid log level %d\n",level);
+ exit(-1);
+ }
+ if (!syslog(8,NULL,level)) {
+ exit(0);
+ } else {
+ perror("syslog");
+ exit(-1);
+ }
+}