svn commit: trunk/busybox/sysklogd
vda at busybox.net
vda at busybox.net
Fri Sep 22 08:44:58 UTC 2006
Author: vda
Date: 2006-09-22 01:44:58 -0700 (Fri, 22 Sep 2006)
New Revision: 16180
Log:
logger: getopt_ulflags'isation
Modified:
trunk/busybox/sysklogd/logger.c
Changeset:
Modified: trunk/busybox/sysklogd/logger.c
===================================================================
--- trunk/busybox/sysklogd/logger.c 2006-09-22 08:42:06 UTC (rev 16179)
+++ trunk/busybox/sysklogd/logger.c 2006-09-22 08:44:58 UTC (rev 16180)
@@ -89,30 +89,21 @@
int logger_main(int argc, char **argv)
{
+ unsigned long opt;
+ char *opt_p, *opt_t;
int pri = LOG_USER | LOG_NOTICE;
int option = 0;
- int c, i, opt;
+ int c, i;
char buf[1024], name[128];
/* Fill out the name string early (may be overwritten later) */
bb_getpwuid(name, geteuid(), sizeof(name));
/* Parse any options */
- while ((opt = getopt(argc, argv, "p:st:")) > 0) {
- switch (opt) {
- case 's':
- option |= LOG_PERROR;
- break;
- case 'p':
- pri = pencode(optarg);
- break;
- case 't':
- safe_strncpy(name, optarg, sizeof(name));
- break;
- default:
- bb_show_usage();
- }
- }
+ opt = bb_getopt_ulflags(argc, argv, "p:st:", &opt_p, &opt_t);
+ if (opt & 0x1) pri = pencode(opt_p); // -p
+ if (opt & 0x2) option |= LOG_PERROR; // -s
+ if (opt & 0x4) safe_strncpy(name, opt_t, sizeof(name)); // -t
openlog(name, option, 0);
if (optind == argc) {
More information about the busybox-cvs
mailing list