diff options
author | Miles Bader <miles@gnu.org> | 1996-05-07 00:31:33 +0000 |
---|---|---|
committer | Miles Bader <miles@gnu.org> | 1996-05-07 00:31:33 +0000 |
commit | b8171ffe044333eabec841dfe1acc0b529a64e30 (patch) | |
tree | f90419e4c3b8f6b7886fc4d162aac3bcd949b5be /utils | |
parent | 8fb4aca9acc73f53e6cf03a1092ff01861853964 (diff) |
(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.
Diffstat (limited to 'utils')
-rw-r--r-- | utils/psout.c | 17 |
1 files changed, 11 insertions, 6 deletions
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. */ |