From b8171ffe044333eabec841dfe1acc0b529a64e30 Mon Sep 17 00:00:00 2001 From: Miles Bader Date: Tue, 7 May 1996 00:31:33 +0000 Subject: (psout): Add posix_fmt arg. Use ps_fmt_creation_error to find out in detail why ps_fmt_create fails. (nominal): Take a field, not a spec. Honor PS_FMT_FIELD_KEEP. --- utils/psout.c | 17 +++++++++++------ 1 file changed, 11 insertions(+), 6 deletions(-) (limited to 'utils/psout.c') diff --git a/utils/psout.c b/utils/psout.c index 4df0d67d..e324bf8a 100644 --- a/utils/psout.c +++ b/utils/psout.c @@ -28,7 +28,7 @@ void psout (struct proc_stat_list *procs, - char *fmt_string, struct ps_fmt_specs *specs, + char *fmt_string, int posix_fmt, struct ps_fmt_specs *specs, char *sort_key_name, int sort_reverse, int output_width, int print_heading, int squash_bogus_fields, int squash_nominal_fields) @@ -37,9 +37,13 @@ psout (struct proc_stat_list *procs, struct ps_stream *output; struct ps_fmt *fmt; - err = ps_fmt_create (fmt_string, specs, &fmt); + err = ps_fmt_create (fmt_string, posix_fmt, specs, &fmt); if (err) - error (4, err, "Can't create output format"); + { + char *problem; + ps_fmt_creation_error (fmt_string, posix_fmt, specs, &problem); + error (4, err, "%s", problem); + } if (squash_bogus_fields) /* Remove any fields that we can't print anyway (because of system @@ -57,9 +61,10 @@ psout (struct proc_stat_list *procs, if (squash_nominal_fields) /* Remove any fields that contain only `uninteresting' information. */ { - int nominal (struct ps_fmt_spec *spec) + int nominal (struct ps_fmt_field *field) { - return proc_stat_list_spec_nominal (procs, spec); + return !(field->flags & PS_FMT_FIELD_KEEP) + && proc_stat_list_spec_nominal (procs, field->spec); } ps_fmt_squash (fmt, nominal); } @@ -67,7 +72,7 @@ psout (struct proc_stat_list *procs, if (sort_key_name) /* Sort on the given field. */ { - struct ps_fmt_spec *sort_key; + const struct ps_fmt_spec *sort_key; if (*sort_key_name == '-') /* Sort in reverse. */ -- cgit v1.2.3