| 166 |
|
* for cygwin support etc. this hardcodes it to unix for now -db |
| 167 |
|
*/ |
| 168 |
|
if ((file = fbopen("/etc/resolv.conf", "r")) == NULL) |
| 169 |
< |
return(-1); |
| 169 |
> |
return -1; |
| 170 |
|
|
| 171 |
< |
while (fbgets(input, MAXLINE, file) != NULL) |
| 171 |
> |
while (fbgets(input, sizeof(input), file) != NULL) |
| 172 |
|
{ |
| 173 |
|
/* blow away any newline */ |
| 174 |
|
if ((p = strpbrk(input, "\r\n")) != NULL) |
| 175 |
|
*p = '\0'; |
| 176 |
|
|
| 177 |
– |
/* Ignore comment lines immediately */ |
| 178 |
– |
if (*input == '#') |
| 179 |
– |
continue; |
| 180 |
– |
|
| 177 |
|
p = input; |
| 178 |
+ |
|
| 179 |
|
/* skip until something thats not a space is seen */ |
| 180 |
|
while (IsSpace(*p)) |
| 181 |
< |
p++; |
| 181 |
> |
++p; |
| 182 |
> |
|
| 183 |
|
/* if at this point, have a '\0' then continue */ |
| 184 |
|
if (*p == '\0') |
| 185 |
|
continue; |
| 186 |
|
|
| 187 |
+ |
/* Ignore comment lines immediately */ |
| 188 |
+ |
if (*p == ';' || *p == '#') |
| 189 |
+ |
continue; |
| 190 |
+ |
|
| 191 |
|
/* skip until a space is found */ |
| 192 |
< |
opt = input; |
| 193 |
< |
while (!IsSpace(*p)) |
| 194 |
< |
if (*p++ == '\0') |
| 195 |
< |
continue; /* no arguments?.. ignore this line */ |
| 192 |
> |
opt = p; |
| 193 |
> |
while (!IsSpace(*p) && *p) |
| 194 |
> |
++p; |
| 195 |
> |
|
| 196 |
> |
if (*p == '\0') |
| 197 |
> |
continue; /* no arguments?.. ignore this line */ |
| 198 |
> |
|
| 199 |
|
/* blow away the space character */ |
| 200 |
|
*p++ = '\0'; |
| 201 |
|
|
| 202 |
|
/* skip these spaces that are before the argument */ |
| 203 |
|
while (IsSpace(*p)) |
| 204 |
< |
p++; |
| 204 |
> |
++p; |
| 205 |
> |
|
| 206 |
|
/* Now arg should be right where p is pointing */ |
| 207 |
|
arg = p; |
| 208 |
+ |
|
| 209 |
|
if ((p = strpbrk(arg, " \t")) != NULL) |
| 210 |
|
*p = '\0'; /* take the first word */ |
| 211 |
|
|
| 216 |
|
} |
| 217 |
|
|
| 218 |
|
fbclose(file); |
| 219 |
< |
return(0); |
| 219 |
> |
return 0; |
| 220 |
|
} |
| 221 |
|
|
| 222 |
|
/* add_nameserver() |