diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/loglevel.c | 26 |
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); + } +} |