version 1.50, 2012/05/15 19:32:02 |
version 1.51, 2013/11/26 13:19:07 |
|
|
break; |
break; |
case 'D': |
case 'D': |
do_defines = true; |
do_defines = true; |
if (!isalpha(*optarg) && *optarg != '_') |
if (!isalpha((unsigned char)*optarg) && *optarg != '_') |
fatal("argument to -D is not an identifier\n"); |
fatal("argument to -D is not an identifier\n"); |
snprintf(if_defined, sizeof if_defined, |
snprintf(if_defined, sizeof if_defined, |
"#ifdef %s\n", optarg); |
"#ifdef %s\n", optarg); |
|
|
similar(const char *a, const char *b, int len) |
similar(const char *a, const char *b, int len) |
{ |
{ |
while (len) { |
while (len) { |
if (isspace(*b)) { /* whitespace (or \n) to match? */ |
if (isspace((unsigned char)*b)) { /* whitespace (or \n) to match? */ |
if (!isspace(*a)) /* no corresponding whitespace? */ |
if (!isspace((unsigned char)*a)) |
return false; |
return false; /* no corresponding whitespace */ |
while (len && isspace(*b) && *b != '\n') |
while (len && isspace((unsigned char)*b) && *b != '\n') |
b++, len--; /* skip pattern whitespace */ |
b++, len--; /* skip pattern whitespace */ |
while (isspace(*a) && *a != '\n') |
while (isspace((unsigned char)*a) && *a != '\n') |
a++; /* skip target whitespace */ |
a++; /* skip target whitespace */ |
if (*a == '\n' || *b == '\n') |
if (*a == '\n' || *b == '\n') |
return (*a == *b); /* should end in sync */ |
return (*a == *b); /* should end in sync */ |