(int, struct file_magic *, char *, int);
void print_collect_error
(void);
-int set_default_file
+void set_default_file
(char *, int, int);
int skip_extra_struct
(int, int, int);
*
* OUT:
* @datafile Name of daily data file.
- *
- * RETURNS:
- * 1 if an output error has been encountered or if datafile name has been
- * truncated, or 0 otherwise.
***************************************************************************
*/
-int set_default_file(char *datafile, int d_off, int sa_name)
+void set_default_file(char *datafile, int d_off, int sa_name)
{
char sa_dir[MAX_FILE_LEN];
struct tm rectime = {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, NULL};
rectime.tm_mday);
}
datafile[MAX_FILE_LEN - 1] = '\0';
+
+ if ((err < 0) || (err >= MAX_FILE_LEN)) {
+ fprintf(stderr, "%s: %s\n", __FUNCTION__, datafile);
+ exit(1);
+ }
+
default_file_used = TRUE;
#ifdef DEBUG
fprintf(stderr, "%s: Datafile: %s\n", __FUNCTION__, datafile);
#endif
-
- return ((err < 0) || (err >= MAX_FILE_LEN));
}
/*
*
* RETURNS:
* 1 if EOF has been reached,
- * 2 if an unexpected EOF has been reached,
+ * 2 if an unexpected EOF has been reached, or an error occurred.
* 0 otherwise.
***************************************************************************
*/
return 2;
if (action & SET_TIMESTAMPS) {
- sa_get_record_timestamp_struct(flags, &record_hdr[curr],
- rectime);
+ if (sa_get_record_timestamp_struct(flags, &record_hdr[curr],
+ rectime))
+ return 2;
}
}
else {
return 2;
}
if (action & SET_TIMESTAMPS) {
- sa_get_record_timestamp_struct(flags, &record_hdr[curr], rectime);
+ if (sa_get_record_timestamp_struct(flags, &record_hdr[curr], rectime))
+ return 2;
}
}
else {
if (read_file_stat_bunch(act, curr, ifd, file_hdr.sa_act_nr, file_actlst,
endian_mismatch, arch_64, file, file_magic, oneof) > 0)
return 2;
- sa_get_record_timestamp_struct(flags, &record_hdr[curr], rectime);
+ if (sa_get_record_timestamp_struct(flags, &record_hdr[curr], rectime))
+ return 2;
}
return 0;
if (rtype != R_COMMENT) {
/* Read the extra fields since it's not a special record */
- read_file_stat_bunch(act, *curr, ifd, file_hdr.sa_act_nr, file_actlst,
- endian_mismatch, arch_64, file, file_magic, UEOF_STOP);
+ if (read_file_stat_bunch(act, *curr, ifd, file_hdr.sa_act_nr, file_actlst,
+ endian_mismatch, arch_64, file, file_magic, UEOF_STOP))
+ /* Error or unexpected EOF */
+ break;
}
else {
/* Display comment */
* OK: Previous record was not a special one.
* So read now the extra fields.
*/
- read_file_stat_bunch(act, 0, ifd, file_hdr.sa_act_nr,
- file_actlst, endian_mismatch, arch_64,
- from_file, &file_magic, UEOF_STOP);
+ if (read_file_stat_bunch(act, 0, ifd, file_hdr.sa_act_nr,
+ file_actlst, endian_mismatch, arch_64,
+ from_file, &file_magic, UEOF_STOP))
+ /* Possible unexpected EOF */
+ return;
+
if (sa_get_record_timestamp_struct(flags + S_F_LOCAL_TIME,
&record_hdr[0], &rectime))
/*
break;
if (rtype != R_COMMENT) {
- read_file_stat_bunch(act, curr, ifd, file_hdr.sa_act_nr,
- file_actlst, endian_mismatch, arch_64,
- from_file, &file_magic, UEOF_STOP);
+ if (read_file_stat_bunch(act, curr, ifd, file_hdr.sa_act_nr,
+ file_actlst, endian_mismatch, arch_64,
+ from_file, &file_magic, UEOF_STOP))
+ /* Possible unexpected EOF */
+ break;
}
else {
/* This was a COMMENT record: Print it */
for (j = 0; (j <= (2 * v_gridnr)) && (stamp.ust_time <= svg_p->ust_time_end); j++) {
/* Display vertical lines */
- sa_get_record_timestamp_struct(flags, &stamp, &rectime);
+ if (sa_get_record_timestamp_struct(flags, &stamp, &rectime)) {
+#ifdef DEBUG
+ fprintf(stderr, "%s: ust_time: %llu\n", __FUNCTION__, stamp.ust_time);
+#endif
+ exit(1);
+ }
set_record_timestamp_string(flags, &stamp, NULL, cur_time, TIMESTAMP_LEN, &rectime);
printf("<polyline points=\"%ld,0 %ld,%d\" style=\"vector-effect: non-scaling-stroke; "
"stroke: #%06x\" transform=\"scale(%f,1)\"/>\n",