summaryrefslogtreecommitdiff
path: root/libps
diff options
context:
space:
mode:
authorMiles Bader <miles@gnu.org>1995-11-20 19:03:03 +0000
committerMiles Bader <miles@gnu.org>1995-11-20 19:03:03 +0000
commit905da0002edd0f96957a06cdc6049032906bcd3b (patch)
tree4741ea62d96a5102772107428070919772e4467c /libps
parentb5fcc392e237089a12983c224d35daaf5d988181 (diff)
(proc_stat_list_fmt): Use new write function names.
Use new STREAM parameter instead of old one and count.
Diffstat (limited to 'libps')
-rw-r--r--libps/proclist.c26
1 files changed, 8 insertions, 18 deletions
diff --git a/libps/proclist.c b/libps/proclist.c
index 17e62f46..85909f51 100644
--- a/libps/proclist.c
+++ b/libps/proclist.c
@@ -459,33 +459,23 @@ proc_stat_list_sort(proc_stat_list_t pp, ps_fmt_spec_t key, bool reverse)
/* ---------------------------------------------------------------- */
/* Format a description as instructed by FMT, of the processes in PP to
- STREAM, separated by newlines (and with a terminating newline). If COUNT
- is non-NULL, it points to an integer which is incremented by the number of
- characters output. If a fatal error occurs, the error code is returned,
- otherwise 0. */
+ STREAM, separated by newlines (and with a terminating newline). If a
+ fatal error occurs, the error code is returned, otherwise 0. */
error_t
-proc_stat_list_fmt(proc_stat_list_t pp,
- ps_fmt_t fmt, FILE *stream, unsigned *count)
+proc_stat_list_fmt (proc_stat_list_t pp, ps_fmt_t fmt, ps_stream_t stream)
{
unsigned nprocs = pp->num_procs;
proc_stat_t *procs = pp->proc_stats;
error_t err = proc_stat_list_set_flags(pp, ps_fmt_needs(fmt));
- if (err)
- return err;
-
- while (nprocs-- > 0)
+ while (!err && nprocs-- > 0)
{
- err = ps_fmt_write_proc_stat(fmt, *procs++, stream, count);
- if (err)
- return err;
-
- putc('\n', stream);
- if (count != NULL)
- (*count)++;
+ err = ps_fmt_write_proc_stat (fmt, *procs++, stream);
+ if (! err)
+ ps_stream_newline (stream);
}
- return 0;
+ return err;
}
/* ---------------------------------------------------------------- */