projects
/
tinc
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Clarify StrictSubnets.
[tinc]
/
src
/
tincd.c
diff --git
a/src/tincd.c
b/src/tincd.c
index
aaad1da
..
7416d11
100644
(file)
--- a/
src/tincd.c
+++ b/
src/tincd.c
@@
-178,7
+178,9
@@
static bool parse_options(int argc, char **argv) {
break;
#endif
break;
#endif
- case 'd': /* inc debug level */
+ case 'd': /* increase debug level */
+ if(!optarg && optind < argc && *argv[optind] != '-')
+ optarg = argv[optind++];
if(optarg)
debug_level = atoi(optarg);
else
if(optarg)
debug_level = atoi(optarg);
else
@@
-187,6
+189,8
@@
static bool parse_options(int argc, char **argv) {
case 'k': /* kill old tincds */
#ifndef HAVE_MINGW
case 'k': /* kill old tincds */
#ifndef HAVE_MINGW
+ if(!optarg && optind < argc && *argv[optind] != '-')
+ optarg = argv[optind++];
if(optarg) {
if(!strcasecmp(optarg, "HUP"))
kill_tincd = SIGHUP;
if(optarg) {
if(!strcasecmp(optarg, "HUP"))
kill_tincd = SIGHUP;
@@
-225,8
+229,7
@@
static bool parse_options(int argc, char **argv) {
case 'n': /* net name given */
/* netname "." is special: a "top-level name" */
case 'n': /* net name given */
/* netname "." is special: a "top-level name" */
- netname = strcmp(optarg, ".") != 0 ?
- xstrdup(optarg) : NULL;
+ netname = strcmp(optarg, ".") != 0 ? xstrdup(optarg) : NULL;
break;
case 'o': /* option */
break;
case 'o': /* option */
@@
-237,6
+240,8
@@
static bool parse_options(int argc, char **argv) {
break;
case 'K': /* generate public/private keypair */
break;
case 'K': /* generate public/private keypair */
+ if(!optarg && optind < argc && *argv[optind] != '-')
+ optarg = argv[optind++];
if(optarg) {
generate_keys = atoi(optarg);
if(optarg) {
generate_keys = atoi(optarg);
@@
-274,6
+279,8
@@
static bool parse_options(int argc, char **argv) {
case 4: /* write log entries to a file */
use_logfile = true;
case 4: /* write log entries to a file */
use_logfile = true;
+ if(!optarg && optind < argc && *argv[optind] != '-')
+ optarg = argv[optind++];
if(optarg)
logfilename = xstrdup(optarg);
break;
if(optarg)
logfilename = xstrdup(optarg);
break;
@@
-291,6
+298,12
@@
static bool parse_options(int argc, char **argv) {
}
}
}
}
+ if(optind < argc) {
+ fprintf(stderr, "%s: unrecognized argument '%s'\n", argv[0], argv[optind]);
+ usage(true);
+ return false;
+ }
+
return true;
}
return true;
}