Skip to content

Commit

Permalink
remove cr and lf at each line of config files
Browse files Browse the repository at this point in the history
  • Loading branch information
clowwindy committed Sep 14, 2014
1 parent 886a6f4 commit dec51ca
Showing 1 changed file with 11 additions and 1 deletion.
12 changes: 11 additions & 1 deletion src/chinadns.c
Original file line number Diff line number Diff line change
Expand Up @@ -340,6 +340,11 @@ static int parse_ip_list() {
return -1;
}
while ((line = fgets(line_buf, len, fp))) {
char *sp_pos;
sp_pos = strchr(line, '\r');
if (sp_pos) *sp_pos = 0;
sp_pos = strchr(line, '\n');
if (sp_pos) *sp_pos = 0;
inet_aton(line, &ip_list.ips[i]);
i++;
}
Expand Down Expand Up @@ -391,7 +396,12 @@ static int parse_chnroute() {
return -1;
}
while ((line = fgets(line_buf, len, fp))) {
char *sp_pos = strchr(line, '/');
char *sp_pos;
sp_pos = strchr(line, '\r');
if (sp_pos) *sp_pos = 0;
sp_pos = strchr(line, '\n');
if (sp_pos) *sp_pos = 0;
sp_pos = strchr(line, '/');
if (sp_pos) {
*sp_pos = 0;
chnroute_list.nets[i].mask = (1 << (32 - atoi(sp_pos + 1))) - 1;
Expand Down

0 comments on commit dec51ca

Please sign in to comment.