253
254
"***other" category */
254
255
int always_yes = 0; /* nonzero means always answer yes to
259
void give_usage PARAMS((void));
260
void write_savacct_file PARAMS((char *));
261
void write_usracct_file PARAMS((char *));
262
void parse_savacct_entries PARAMS((char *));
263
void parse_usracct_entries PARAMS((char *));
264
void parse_acct_entries PARAMS((void));
265
void init_flags_and_data PARAMS((void));
266
unsigned long hash_name PARAMS((char *));
267
void update_command_list PARAMS((char *, struct stats *, short fork_flag));
268
void update_user_list PARAMS((char *, struct stats *));
269
int compare_sum_entry PARAMS((struct hashtab_elem **, struct hashtab_elem **));
270
int compare_user_entry PARAMS((struct hashtab_elem **,
271
struct hashtab_elem **));
272
int compare_stats_entry PARAMS((struct stats *, struct stats *));
273
void print_command_list PARAMS((void));
274
void print_user_list PARAMS((void));
275
int non_printable PARAMS((char *, int));
276
int ask_if_junkable PARAMS((char *, int));
257
static unsigned int hzval;
259
void write_savacct_file (char *);
260
void write_usracct_file (char *);
261
void parse_savacct_entries (char *);
262
void parse_usracct_entries (char *);
263
void parse_acct_entries (void);
264
void init_flags_and_data (void);
265
unsigned long hash_name (char *);
266
void update_command_list (char *, struct stats *, short fork_flag);
267
void update_user_list (char *, struct stats *);
268
int compare_sum_entry (struct hashtab_elem **, struct hashtab_elem **);
269
int compare_user_entry (struct hashtab_elem **,
270
struct hashtab_elem **);
271
int compare_stats_entry (struct stats *, struct stats *);
272
void print_command_list (void);
273
void print_user_list (void);
274
int non_printable (char *, int);
275
int ask_if_junkable (char *, int);
302
302
int option_index = 0;
304
304
static struct option long_options[] =
306
{ "debug", no_argument, NULL, 1
308
{ "version", no_argument, NULL, 2 },
309
{ "help", no_argument, NULL, 3 },
310
{ "other-acct-file", required_argument, NULL, 4 },
311
{ "print-seconds", no_argument, NULL, 5 },
312
{ "dont-read-summary-files", no_argument, NULL, 6 },
313
{ "list-all-names", no_argument, NULL, 7 },
314
{ "other-savacct-file", 1, NULL, 9 },
315
{ "print-users", no_argument, NULL, 12 },
316
{ "percentages", no_argument, NULL, 14 },
317
{ "not-interactive", no_argument, NULL, 19 },
318
{ "user-summary", no_argument, NULL, 20 },
319
{ "reverse-sort", no_argument, NULL, 21 },
320
{ "merge", no_argument, NULL, 22 },
321
{ "threshold", required_argument, NULL, 23 },
322
{ "separate-forks", no_argument, NULL, 24 },
323
{ "other-usracct-file", required_argument, NULL, 25 },
306
{ "debug", no_argument, NULL, 1
308
{ "version", no_argument, NULL, 2 },
309
{ "help", no_argument, NULL, 3 },
310
{ "other-acct-file", required_argument, NULL, 4 },
311
{ "print-seconds", no_argument, NULL, 5 },
312
{ "dont-read-summary-files", no_argument, NULL, 6 },
313
{ "list-all-names", no_argument, NULL, 7 },
314
{ "other-savacct-file", 1, NULL, 9 },
315
{ "print-users", no_argument, NULL, 12 },
316
{ "percentages", no_argument, NULL, 14 },
317
{ "not-interactive", no_argument, NULL, 19 },
318
{ "user-summary", no_argument, NULL, 20 },
319
{ "reverse-sort", no_argument, NULL, 21 },
320
{ "merge", no_argument, NULL, 22 },
321
{ "threshold", required_argument, NULL, 23 },
322
{ "separate-forks", no_argument, NULL, 24 },
323
{ "other-usracct-file", required_argument, NULL, 25 },
325
325
#if defined(HAVE_ACUTIME) && defined(HAVE_ACSTIME)
326
{ "separate-times", no_argument, NULL, 8
326
{ "separate-times", no_argument, NULL, 8
330
330
#if defined(HAVE_ACSTIME) && defined(HAVE_ACUTIME) && defined(HAVE_ACMEM)
331
{ "sort-ksec", no_argument, NULL, 10
331
{ "sort-ksec", no_argument, NULL, 10
335
335
#if defined(HAVE_ACUTIME) && defined(HAVE_ACSTIME) && defined(HAVE_ACETIME)
336
{ "print-ratio", no_argument, NULL, 11
336
{ "print-ratio", no_argument, NULL, 11
341
{ "sort-tio", no_argument, NULL, 13 },
341
{ "sort-tio", no_argument, NULL, 13 },
344
344
#if defined(HAVE_ACSTIME) && defined(HAVE_ACUTIME)
345
{ "sort-sys-user-div-calls", no_argument, NULL, 15
345
{ "sort-sys-user-div-calls", no_argument, NULL, 15
350
{ "sort-avio", no_argument, NULL, 16 },
350
{ "sort-avio", no_argument, NULL, 16 },
353
353
#ifdef HAVE_ACMEM
354
{ "sort-cpu-avmem", no_argument, NULL, 17 },
354
{ "sort-cpu-avmem", no_argument, NULL, 17 },
357
357
#if defined(HAVE_ACSTIME) && defined(HAVE_ACUTIME)
358
/* Don't want this if it's the default */
359
{ "sort-num-calls", no_argument, NULL, 18
358
/* Don't want this if it's the default */
359
{ "sort-num-calls", no_argument, NULL, 18
362
362
#ifdef HAVE_ACETIME
363
{ "sort-real-time", no_argument, NULL, 26 },
363
{ "sort-real-time", no_argument, NULL, 26 },
365
{ "ahz", required_argument, NULL, 27 },
365
{ "ahz", required_argument, NULL, 27 },
366
366
#ifdef HAVE_PAGING
367
{ "show-paging", no_argument, NULL, 28 },
368
{ "show-paging-avg", no_argument, NULL, 29 },
367
{ "show-paging", no_argument, NULL, 28 },
368
{ "show-paging-avg", no_argument, NULL, 29 },
373
373
c = getopt_long (argc, argv,