make
# specific test output
if echo "i686-mingw64" | grep -i -e linux -e dragonfly >/dev/null; then echo yes; else echo no; fi
+ if echo "i686-mingw64" | grep -i -e linux >/dev/null; then echo yeslinux; else echo nolinux; fi
+ if echo "i686-mingw64" | grep -i -e dragonfly >/dev/null; then echo yesdragonfly; else echo nodragonfly; fi
make testbound.exe; ./testbound.exe -s
# make testbound; ./testbound.exe -p testdata/acl.rpl -o -vvvv
make testbound.exe; ./testbound.exe -p testdata/auth_nsec3_ent.rpl -o -vvvv
char *ctime_r(const time_t *timep, char *buf)
{
char* result;
+ printf("unbound_ctime_r called\n");
if(!ctime_r_init) {
/* still small race where this init can be done twice,
* which is mostly harmless */
log_err("should be: %s", p->str);
fatal_exit("autotrust_check failed");
}
- if(line[0]) line[strlen(line)-1] = 0; /* remove newline */
+ strip_end_white(line);
expanded = macro_process(runtime->vars, runtime, p->str);
if(!expanded)
fatal_exit("could not expand macro line %d", lineno);
log_err("should be: %s", p->str);
fatal_exit("tempfile_check failed");
}
- if(line[0]) line[strlen(line)-1] = 0; /* remove newline */
+ strip_end_white(line);
expanded = macro_process(runtime->vars, runtime, p->str);
if(!expanded)
fatal_exit("could not expand macro line %d", lineno);
addr_to_str((struct sockaddr_storage*)to_addr, to_addrlen,
addrbuf, sizeof(addrbuf));
if(verbosity >= VERB_ALGO) {
- if(buf[0] != 0) buf[strlen(buf)-1] = 0; /* del newline*/
+ strip_end_white(buf);
log_info("tcp to %s: %s", addrbuf, buf);
}
log_assert(sldns_buffer_limit(query)-LDNS_HEADER_SIZE >= 2);
addr_to_str((struct sockaddr_storage*)addr, addrlen,
addrbuf, sizeof(addrbuf));
if(verbosity >= VERB_ALGO) {
- if(buf[0] != 0) buf[strlen(buf)-1] = 0; /* del newline*/
+ strip_end_white(buf);
log_info("udp to %s: %s", addrbuf, buf);
}
log_assert(sldns_buffer_limit(packet)-LDNS_HEADER_SIZE >= 2);
free(rng);
}
-/** strip whitespace from end of string */
-static void
+void
strip_end_white(char* p)
{
size_t i;
if(strncmp(line, "FILE_END", 8) == 0) {
return;
}
- if(line[0]) line[strlen(line)-1] = 0; /* remove newline */
+ strip_end_white(line);
if(!cfg_strlist_insert(last, strdup(line)))
fatal_exit("malloc failure");
last = &( (*last)->next );
if(eq != '=')
fatal_exit("no '=' in assign: %s", remain);
remain += skip;
- if(remain[0]) remain[strlen(remain)-1]=0; /* remove newline */
+ strip_end_white(remain);
mom->string = strdup(remain);
if(!mom->variable || !mom->string)
fatal_exit("out of memory");
return NULL;
}
ctime_r(&tt, buf);
- if(buf[0]) buf[strlen(buf)-1]=0; /* remove trailing newline */
+ strip_end_white(buf);
return strdup(buf);
}
/** get oldest enabled fake timer */
struct fake_timer* replay_get_oldest_timer(struct replay_runtime* runtime);
+/** strip whitespace from end of string */
+void strip_end_white(char* p);
+
/**
* Create variable storage
* @return new or NULL on failure.
id++;
if(*id == '\0')
fatal_exit("TEMPFILE_NAME must have id, line %d", *lineno);
- id[strlen(id)-1]=0; /* remove newline */
+ strip_end_white(id);
fake_temp_file("_temp_", id, line, sizeof(line));
fprintf(cfg, "\"%s\"\n", line);
}
id++;
if(*id == '\0')
fatal_exit("TEMPFILE_CONTENTS must have id, line %d", *lineno);
- id[strlen(id)-1]=0; /* remove newline */
+ strip_end_white(id);
fake_temp_file("_temp_", id, line, sizeof(line));
/* open file and spool to it */
spool = fopen(line, "w");
char* tid = parse+17;
while(isspace((unsigned char)*tid))
tid++;
- tid[strlen(tid)-1]=0; /* remove newline */
+ strip_end_white(tid);
fake_temp_file("_temp_", tid, l2, sizeof(l2));
snprintf(line, sizeof(line), "$INCLUDE %s\n", l2);
}
id++;
if(*id == '\0')
fatal_exit("AUTROTRUST_FILE must have id, line %d", *lineno);
- id[strlen(id)-1]=0; /* remove newline */
+ strip_end_white(id);
fake_temp_file("_auto_", id, line, sizeof(line));
/* add option for the file */
fprintf(cfg, "server: auto-trust-anchor-file: \"%s\"\n", line);