return false;
/* top down parsing */
- while (util_getline(&back, &size, fp) != EOF) {
+ while (file_getline(&back, &size, fp) != EOF) {
/* skip whitespace */
data = back;
if (*data && (*data == ' ' || *data == '\t'))
memset (fullfile, 0, sizeof(fullfile));
snprintf(fullfile, sizeof(fullfile), "%s/%s", dir, file);
- tempfile = fopen(fullfile, "r");
+ tempfile = file_open(fullfile, "r");
template = mem_a(sizeof(task_template_t));
task_template_nullify(template);
}
success:
- fclose(tempfile);
+ file_close(tempfile);
return template;
failure:
* so the check to see if it's not null here is required.
*/
if (tempfile)
- fclose(tempfile);
+ file_close(tempfile);
mem_d (template);
return NULL;
memset (buf,0,sizeof(buf));
snprintf(buf, sizeof(buf), "%s.stdout", template->tempfilename);
task.stdoutlogfile = util_strdup(buf);
- if (!(task.stdoutlog = fopen(buf, "w"))) {
+ if (!(task.stdoutlog = file_open(buf, "w"))) {
con_err("error opening %s for stdout\n", buf);
continue;
}
memset (buf,0,sizeof(buf));
snprintf(buf, sizeof(buf), "%s.stderr", template->tempfilename);
task.stderrlogfile = util_strdup(buf);
- if (!(task.stderrlog = fopen(buf, "w"))) {
+ if (!(task.stderrlog = file_open(buf, "w"))) {
con_err("error opening %s for stderr\n", buf);
continue;
}
* annoying to have to do all this cleanup work.
*/
if (task_tasks[i].runhandles) task_pclose(task_tasks[i].runhandles);
- if (task_tasks[i].stdoutlog) fclose (task_tasks[i].stdoutlog);
- if (task_tasks[i].stderrlog) fclose (task_tasks[i].stderrlog);
+ if (task_tasks[i].stdoutlog) file_close (task_tasks[i].stdoutlog);
+ if (task_tasks[i].stderrlog) file_close (task_tasks[i].stderrlog);
/*
* Only remove the log files if the test actually compiled otherwise
char *data = NULL;
size_t size = 0;
size_t compare = 0;
- while (util_getline(&data, &size, execute) != EOF) {
+ while (file_getline(&data, &size, execute) != EOF) {
if (!strcmp(data, "No main function found\n")) {
con_err("test failure: `%s` [%s] (No main function found)\n",
template->description,
* Read data from stdout first and pipe that stuff into a log file
* then we do the same for stderr.
*/
- while (util_getline(&data, &size, task_tasks[i].runhandles[1]) != EOF) {
- fputs(data, task_tasks[i].stdoutlog);
+ while (file_getline(&data, &size, task_tasks[i].runhandles[1]) != EOF) {
+ file_puts(task_tasks[i].stdoutlog, data);
if (strstr(data, "failed to open file")) {
task_tasks[i].compiled = false;
fflush(task_tasks[i].stdoutlog);
}
- while (util_getline(&data, &size, task_tasks[i].runhandles[2]) != EOF) {
+ while (file_getline(&data, &size, task_tasks[i].runhandles[2]) != EOF) {
/*
* If a string contains an error we just dissalow execution
* of it in the vm.
task_tasks[i].compiled = false;
}
- fputs(data, task_tasks[i].stderrlog);
+ file_puts(task_tasks[i].stderrlog, data);
fflush(task_tasks[i].stdoutlog);
}