mirror of
https://github.com/nmap/nmap.git
synced 2025-12-27 18:09:01 +00:00
Changes from flight back from ShmooCon
This commit is contained in:
17
utils.cc
17
utils.cc
@@ -209,6 +209,23 @@ char *chomp(char *string) {
|
||||
return string;
|
||||
}
|
||||
|
||||
/* Compare a canonical option name (e.g. "max-scan-delay") with a
|
||||
user-generated option such as "max_scan_delay" and returns 0 if the
|
||||
two values are considered equivalant (for example, - and _ are
|
||||
considered to be the same), nonzero otherwise. */
|
||||
int optcmp(const char *a, const char *b) {
|
||||
while(*a && *b) {
|
||||
if ((*a == '_' || *a == '-') && (*b != '_' && *b != '-'))
|
||||
return 1;
|
||||
if (*a != *b)
|
||||
return 1;
|
||||
a++; b++;
|
||||
}
|
||||
if (*a || *b)
|
||||
return 1;
|
||||
return 0;
|
||||
}
|
||||
|
||||
/* Convert a comma-separated list of ASCII u16-sized numbers into the
|
||||
given 'dest' array, which is of total size (meaning sizeof() as
|
||||
opposed to numelements) of destsize. If min_elem and max_elem are
|
||||
|
||||
Reference in New Issue
Block a user