- case 'd': /* inc debug level */
- if(optarg)
- debug_level = atoi(optarg);
- else
- debug_level++;
- break;
-
- case 'n': /* net name given */
- netname = xstrdup(optarg);
- break;
-
- case 'o': /* option */
- cfg = parse_config_line(optarg, NULL, ++lineno);
- if (!cfg)
- return false;
- list_insert_tail(cmdline_conf, cfg);
- break;
-
- case 'R': /* chroot to NETNAME dir */
- do_chroot = true;
- break;
-
- case 'U': /* setuid to USER */
- switchuser = optarg;
- break;
-
- case 1: /* show help */
- show_help = true;
- break;
-
- case 2: /* show version */
- show_version = true;
- break;
-
- case 3: /* bypass security */
- bypass_security = true;
- break;
-
- case 4: /* write log entries to a file */
- use_logfile = true;
- if(optarg)
- logfilename = xstrdup(optarg);
- break;
-
- case 5: /* open control socket here */
- pidfilename = xstrdup(optarg);
- break;
-
- case '?': /* wrong options */
- usage(true);
- return false;
-
- default:
- break;
+ case 'd': /* increase debug level */
+ if(!optarg && optind < argc && *argv[optind] != '-') {
+ optarg = argv[optind++];
+ }
+
+ if(optarg) {
+ debug_level = atoi(optarg);
+ } else {
+ debug_level++;
+ }
+
+ break;
+
+ case 'n': /* net name given */
+ free(netname);
+ netname = xstrdup(optarg);
+ break;
+
+ case 's': /* syslog */
+ use_logfile = false;
+ use_syslog = true;
+ break;
+
+ case 'o': /* option */
+ cfg = parse_config_line(optarg, NULL, ++lineno);
+
+ if(!cfg) {
+ goto exit_fail;
+ }
+
+ list_insert_tail(&cmdline_conf, cfg);
+ break;
+
+#ifdef HAVE_WINDOWS
+
+ case 'R':
+ case 'U':
+ logger(DEBUG_ALWAYS, LOG_ERR, "The %s option is not supported on this platform.", argv[optind - 1]);
+ goto exit_fail;
+#else
+
+ case 'R': /* chroot to NETNAME dir */
+ do_chroot = true;
+ break;
+
+ case 'U': /* setuid to USER */
+ switchuser = optarg;
+ break;
+#endif
+
+ case 1: /* show help */
+ show_help = true;
+ break;
+
+ case 2: /* show version */
+ show_version = true;
+ break;
+
+ case 3: /* bypass security */
+ bypass_security = true;
+ break;
+
+ case 4: /* write log entries to a file */
+ use_syslog = false;
+ use_logfile = true;
+
+ if(!optarg && optind < argc && *argv[optind] != '-') {
+ optarg = argv[optind++];
+ }
+
+ if(optarg) {
+ free(logfilename);
+ logfilename = xstrdup(optarg);
+ }
+
+ break;
+
+ case 5: /* open control socket here */
+ free(pidfilename);
+ pidfilename = xstrdup(optarg);
+ break;
+
+ case '?': /* wrong options */
+ usage(true);
+ goto exit_fail;
+
+ default:
+ break;