(char * [], int *, struct activity * []);
int parse_timestamp
(char * [], int *, struct tstamp *, const char *);
+void print_collect_error
+ (void);
void print_report_hdr
(unsigned int, struct tm *, struct file_header *);
void print_sar_comment
exit(3);
}
+/*
+ ***************************************************************************
+ * Display an error message then exit.
+ ***************************************************************************
+ */
+void print_collect_error(void)
+{
+ fprintf(stderr, _("Requested activities not available\n"));
+ exit(1);
+}
+
/*
***************************************************************************
* Move structures data.
}
}
- /* At least one activity must be collected (default is A_CPU) */
- if (!get_activity_nr(act, AO_COLLECTED, COUNT_ACTIVITIES)) {
- COLLECT_ACTIVITY(A_CPU);
- }
-
/* Process file entered on the command line */
if (WANT_SA_ROTAT(flags)) {
/* File name set to '-' */
/* Init structures according to machine architecture */
sa_sys_init();
+ /* At least one activity must be collected */
+ if (!get_activity_nr(act, AO_COLLECTED, COUNT_ACTIVITIES)) {
+ /* Requested activities not available: Exit */
+ print_collect_error();
+ }
+
if (!interval && !comment[0]) {
/*
* Interval (and count) not set, and no comment given
read_header_data();
if (!get_activity_nr(act, AO_SELECTED, COUNT_ACTIVITIES)) {
- fprintf(stderr, _("Requested activities not available\n"));
- exit(1);
+ /* Requested activities not available: Exit */
+ print_collect_error();
}
/* Determine if a stat line header has to be displayed */