- 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) {
- do {
- /* read from stdin */
- i = 0;
- while ((c = getc(stdin)) != EOF && c != '\n' &&
- i < (sizeof(buf)-1)) {
- buf[i++] = c;
- }
- if (i > 0) {
- buf[i++] = '\0';
- syslog(pri, "%s", buf);
+ getopt32(argc, argv, "p:st:", &opt_p, &opt_t);
+
+ if (option_mask32 & 0x2) /* -s */
+ i |= LOG_PERROR;
+ if (option_mask32 & 0x4) /* -t */
+ safe_strncpy(name, opt_t, sizeof(name));
+ openlog(name, i, 0);
+ if (ENABLE_FEATURE_CLEAN_UP)
+ RELEASE_CONFIG_BUFFER(name);
+ i = LOG_USER | LOG_NOTICE;
+ if (option_mask32 & 0x1) /* -p */
+ i = pencode(opt_p);
+
+ argc -= optind;
+ argv += optind;
+ if (!argc) {
+ while (fgets(bb_common_bufsiz1, BUFSIZ, stdin)) {
+ if (bb_common_bufsiz1[0]
+ && NOT_LONE_CHAR(bb_common_bufsiz1, '\n')
+ ) {
+ /* Neither "" nor "\n" */
+ syslog(i, "%s", bb_common_bufsiz1);