X-Git-Url: https://git.librecmc.org/?a=blobdiff_plain;f=sysklogd%2Flogger.c;h=1e0384c09e2de50e33ed3308e032aaea6ee237b5;hb=9c143ce52da11ec3d21a3491c3749841d3dc10f0;hp=0fabd97ca6068efe42303d8bfae474f9c1099560;hpb=5bc8c005a8e15c43285bc595a8d404de67a482ac;p=oweals%2Fbusybox.git diff --git a/sysklogd/logger.c b/sysklogd/logger.c index 0fabd97ca..1e0384c09 100644 --- a/sysklogd/logger.c +++ b/sysklogd/logger.c @@ -6,12 +6,24 @@ * * Licensed under GPLv2 or later, see file LICENSE in this source tree. */ +//config:config LOGGER +//config: bool "logger (6.4 kb)" +//config: default y +//config: select FEATURE_SYSLOG +//config: help +//config: The logger utility allows you to send arbitrary text +//config: messages to the system log (i.e. the 'syslogd' utility) so +//config: they can be logged. This is generally used to help locate +//config: problems that occur within programs and scripts. + +//applet:IF_LOGGER(APPLET(logger, BB_DIR_USR_BIN, BB_SUID_DROP)) + +//kbuild:lib-$(CONFIG_LOGGER) += syslogd_and_logger.o //usage:#define logger_trivial_usage //usage: "[OPTIONS] [MESSAGE]" //usage:#define logger_full_usage "\n\n" //usage: "Write MESSAGE (or stdin) to syslog\n" -//usage: "\nOptions:" //usage: "\n -s Log to stderr as well as the system log" //usage: "\n -t TAG Log using the specified tag (defaults to user name)" //usage: "\n -p PRIO Priority (numeric or facility.level pair)" @@ -65,14 +77,14 @@ static int pencode(char *s) ; if (*s) { *s = '\0'; - fac = decode(save, facilitynames); + fac = decode(save, bb_facilitynames); if (fac < 0) bb_error_msg_and_die("unknown %s name: %s", "facility", save); *s++ = '.'; } else { s = save; } - lev = decode(s, prioritynames); + lev = decode(s, bb_prioritynames); if (lev < 0) bb_error_msg_and_die("unknown %s name: %s", "priority", save); return ((lev & LOG_PRIMASK) | (fac & LOG_FACMASK)); @@ -87,6 +99,8 @@ int logger_main(int argc UNUSED_PARAM, char **argv) int opt; int i = 0; + setup_common_bufsiz(); + /* Fill out the name string early (may be overwritten later) */ str_t = uid2uname_utoa(geteuid()); @@ -153,7 +167,7 @@ int logger_main(int argc UNUSED_PARAM, char **argv) * may be used to endorse or promote products derived from this software * without specific prior written permission. * - * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND + * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ''AS IS'' AND * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE