summaryrefslogtreecommitdiff
path: root/libps
diff options
context:
space:
mode:
authorMiles Bader <miles@gnu.org>1996-05-28 21:49:31 +0000
committerMiles Bader <miles@gnu.org>1996-05-28 21:49:31 +0000
commitb8a7f7aa9b350ebe558aed74d8fffc0277be81e0 (patch)
tree4e4242c0ea099ea6045512364690eda09ee49ceb /libps
parent8b538854bd938f84982f913289af6425b3e0d72c (diff)
(ps_fmt_write_proc_stat): Call the output function correctly.
(_fmt_create): Get FIELD's precision, not width, from its spec.
Diffstat (limited to 'libps')
-rw-r--r--libps/fmt.c12
1 files changed, 4 insertions, 8 deletions
diff --git a/libps/fmt.c b/libps/fmt.c
index 2d0fbe40..3c1d9342 100644
--- a/libps/fmt.c
+++ b/libps/fmt.c
@@ -251,7 +251,7 @@ _fmt_create (char *src, int posix, struct ps_fmt_specs *fmt_specs,
if (! explicit_width)
field->width = field->spec->width;
if (! explicit_precision)
- field->width = field->spec->precision;
+ field->precision = field->spec->precision;
field->flags = (field->spec->flags & ~clr_flags) ^ inv_flags;
@@ -394,19 +394,15 @@ ps_fmt_write_proc_stat (struct ps_fmt *fmt, struct proc_stat *ps, struct ps_stre
if (spec != NULL && !err)
{
int need = ps_getter_needs (ps_fmt_spec_getter (spec));
- int width = ps_fmt_field_width (field);
/* do we have the resources to print this field? */
if ((need & have) == need)
/* Yup */
- {
- int (*output_fn)() = (int (*)())ps_fmt_spec_output_fn (spec);
- const struct ps_getter *getter = ps_fmt_spec_getter (spec);
- err = output_fn (ps, getter, width, stream);
- }
+ err = (*spec->output_fn) (ps, field, stream);
else
/* Something to display in invalid fields. */
- err = ps_stream_write_field (stream, fmt->inval ?: "", width);
+ err = ps_stream_write_field (stream, fmt->inval ?: "",
+ ps_fmt_field_width (field));
}
field++;