Changeset 2725 in MondoRescue for branches/2.2.9/mindi-busybox/sysklogd/logger.c
- Timestamp:
- Feb 25, 2011, 9:26:54 PM (13 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/2.2.9/mindi-busybox/sysklogd/logger.c
r1772 r2725 5 5 * Copyright (C) 1999-2004 by Erik Andersen <andersen@codepoet.org> 6 6 * 7 * Licensed under GPLv2 or later, see file LICENSE in this tarball for details.7 * Licensed under GPLv2 or later, see file LICENSE in this source tree. 8 8 */ 9 9 10 /* 11 * Done in syslogd_and_logger.c: 10 12 #include "libbb.h" 11 12 #if !defined CONFIG_SYSLOGD13 14 13 #define SYSLOG_NAMES 15 #include <sys/syslog.h> 16 17 #else 18 #include <sys/syslog.h> 19 # ifndef __dietlibc__ 20 /* We have to do this since the header file defines static 21 * structures. Argh.... bad libc, bad, bad... 22 */ 23 typedef struct _code { 24 char *c_name; 25 int c_val; 26 } CODE; 27 extern CODE prioritynames[]; 28 extern CODE facilitynames[]; 29 # endif 30 #endif 14 #define SYSLOG_NAMES_CONST 15 #include <syslog.h> 16 */ 31 17 32 18 /* Decode a symbolic name to a numeric value … … 37 23 * Original copyright notice is retained at the end of this file. 38 24 */ 39 static int decode(char *name, CODE *codetab)25 static int decode(char *name, const CODE *codetab) 40 26 { 41 CODE *c;27 const CODE *c; 42 28 43 29 if (isdigit(*name)) … … 81 67 } 82 68 69 #define strbuf bb_common_bufsiz1 83 70 84 int logger_main(int argc, char **argv) ;85 int logger_main(int argc , char **argv)71 int logger_main(int argc, char **argv) MAIN_EXTERNALLY_VISIBLE; 72 int logger_main(int argc UNUSED_PARAM, char **argv) 86 73 { 87 74 char *str_p, *str_t; 75 int opt; 88 76 int i = 0; 89 char name[80];90 77 91 78 /* Fill out the name string early (may be overwritten later) */ 92 bb_getpwuid(name, sizeof(name), geteuid()); 93 str_t = name; 79 str_t = uid2uname_utoa(geteuid()); 94 80 95 81 /* Parse any options */ 96 getopt32(argv, "p:st:", &str_p, &str_t);82 opt = getopt32(argv, "p:st:", &str_p, &str_t); 97 83 98 if (opt ion_mask32& 0x2) /* -s */84 if (opt & 0x2) /* -s */ 99 85 i |= LOG_PERROR; 100 //if (opt ion_mask32& 0x4) /* -t */86 //if (opt & 0x4) /* -t */ 101 87 openlog(str_t, i, 0); 102 88 i = LOG_USER | LOG_NOTICE; 103 if (opt ion_mask32& 0x1) /* -p */89 if (opt & 0x1) /* -p */ 104 90 i = pencode(str_p); 105 91 106 argc -= optind;107 92 argv += optind; 108 if (!argc) { 109 #define strbuf bb_common_bufsiz1 93 if (!argv[0]) { 110 94 while (fgets(strbuf, COMMON_BUFSIZE, stdin)) { 111 95 if (strbuf[0] … … 133 117 } 134 118 119 /* Clean up. Needed because we are included from syslogd_and_logger.c */ 120 #undef strbuf 135 121 136 122 /*- 137 123 * Copyright (c) 1983, 1993 138 * 124 * The Regents of the University of California. All rights reserved. 139 125 * 140 126 * This is the original license statement for the decode and pencode functions. … … 149 135 * documentation and/or other materials provided with the distribution. 150 136 * 151 * 3. <BSD Advertising Clause omitted per the July 22, 1999 licensing change152 * ftp://ftp.cs.berkeley.edu/pub/4bsd/README.Impt.License.Change>137 * 3. BSD Advertising Clause omitted per the July 22, 1999 licensing change 138 * ftp://ftp.cs.berkeley.edu/pub/4bsd/README.Impt.License.Change 153 139 * 154 140 * 4. Neither the name of the University nor the names of its contributors
Note:
See TracChangeset
for help on using the changeset viewer.