struct file_magic *file_magic, struct file_activity *file_actlst,
struct tm *rectime, struct tm *loctime)
{
- int eosaf;
char rec_hdr_tmp[MAX_RECORD_HEADER_SIZE];
/* Read current record */
- eosaf = read_record_hdr(ifd, rec_hdr_tmp, &record_hdr[curr], &file_hdr,
- arch_64, endian_mismatch);
+ if (read_record_hdr(ifd, rec_hdr_tmp, &record_hdr[curr], &file_hdr,
+ arch_64, endian_mismatch))
+ /* End of sa file */
+ return TRUE;
+
*rtype = record_hdr[curr].record_type;
- if (!eosaf) {
- if (*rtype == R_COMMENT) {
- if (action & IGNORE_COMMENT) {
- /* Ignore COMMENT record */
- if (lseek(ifd, MAX_COMMENT_LEN, SEEK_CUR) < MAX_COMMENT_LEN) {
- perror("lseek");
- }
- if (action & SET_TIMESTAMPS) {
- sa_get_record_timestamp_struct(flags, &record_hdr[curr],
- rectime, loctime);
- }
+ if (*rtype == R_COMMENT) {
+ if (action & IGNORE_COMMENT) {
+ /* Ignore COMMENT record */
+ if (lseek(ifd, MAX_COMMENT_LEN, SEEK_CUR) < MAX_COMMENT_LEN) {
+ perror("lseek");
}
- else {
- /* Display COMMENT record */
- print_special_record(&record_hdr[curr], flags, &tm_start, &tm_end,
- *rtype, ifd, rectime, loctime, file, tab,
- file_magic, &file_hdr, act, fmt[f_position],
- endian_mismatch, arch_64);
+ if (action & SET_TIMESTAMPS) {
+ sa_get_record_timestamp_struct(flags, &record_hdr[curr],
+ rectime, loctime);
}
}
- else if (*rtype == R_RESTART) {
- if (action & IGNORE_RESTART) {
- /*
- * Ignore RESTART record (don't display it)
- * but anyway we have to read the CPU number that follows it
- * (unless we don't want to do it now).
- */
- if (!(action & DONT_READ_CPU_NR)) {
- file_hdr.sa_cpu_nr = read_nr_value(ifd, file, file_magic,
- endian_mismatch, arch_64, TRUE);
- }
- if (action & SET_TIMESTAMPS) {
- sa_get_record_timestamp_struct(flags, &record_hdr[curr],
- rectime, loctime);
- }
+ else {
+ /* Display COMMENT record */
+ print_special_record(&record_hdr[curr], flags, &tm_start, &tm_end,
+ *rtype, ifd, rectime, loctime, file, tab,
+ file_magic, &file_hdr, act, fmt[f_position],
+ endian_mismatch, arch_64);
+ }
+ }
+ else if (*rtype == R_RESTART) {
+ if (action & IGNORE_RESTART) {
+ /*
+ * Ignore RESTART record (don't display it)
+ * but anyway we have to read the CPU number that follows it
+ * (unless we don't want to do it now).
+ */
+ if (!(action & DONT_READ_CPU_NR)) {
+ file_hdr.sa_cpu_nr = read_nr_value(ifd, file, file_magic,
+ endian_mismatch, arch_64, TRUE);
}
- else {
- /* Display RESTART record */
- print_special_record(&record_hdr[curr], flags, &tm_start, &tm_end,
- *rtype, ifd, rectime, loctime, file, tab,
- file_magic, &file_hdr, act, fmt[f_position],
- endian_mismatch, arch_64);
+ if (action & SET_TIMESTAMPS) {
+ sa_get_record_timestamp_struct(flags, &record_hdr[curr],
+ rectime, loctime);
}
}
else {
- /*
- * OK: Previous record was not a special one.
- * So read now the extra fields.
- */
- read_file_stat_bunch(act, curr, ifd, file_hdr.sa_act_nr,
- file_actlst, endian_mismatch, arch_64, file, file_magic);
- sa_get_record_timestamp_struct(flags, &record_hdr[curr], rectime, loctime);
+ /* Display RESTART record */
+ print_special_record(&record_hdr[curr], flags, &tm_start, &tm_end,
+ *rtype, ifd, rectime, loctime, file, tab,
+ file_magic, &file_hdr, act, fmt[f_position],
+ endian_mismatch, arch_64);
}
}
+ else {
+ /*
+ * OK: Previous record was not a special one.
+ * So read now the extra fields.
+ */
+ read_file_stat_bunch(act, curr, ifd, file_hdr.sa_act_nr,
+ file_actlst, endian_mismatch, arch_64, file, file_magic);
+ sa_get_record_timestamp_struct(flags, &record_hdr[curr], rectime, loctime);
+ }
- return eosaf;
+ return FALSE;
}
/*