summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMiles Bader <miles@gnu.org>1995-11-21 18:57:20 +0000
committerMiles Bader <miles@gnu.org>1995-11-21 18:57:20 +0000
commit5cc2b69d1f97b641d840a2f91804a1ce08667cb3 (patch)
tree99f0094edcbd9580cef552b83cfb9d5f82d76ac7
parent37d07991dcab93c94c241f32ee4259559ff767b0 (diff)
(main): Use new libps stream type.
-rw-r--r--utils/ps.c13
1 files changed, 9 insertions, 4 deletions
diff --git a/utils/ps.c b/utils/ps.c
index dcb0d7aa..8a195287 100644
--- a/utils/ps.c
+++ b/utils/ps.c
@@ -363,6 +363,7 @@ main(int argc, char *argv[])
unsigned num_tty_names = 0, tty_names_alloced = 0;
proc_stat_list_t procset;
ps_context_t context;
+ ps_stream_t output;
ps_fmt_t fmt;
char *fmt_string = "default", *sort_key_name = NULL;
unsigned filter_mask =
@@ -691,20 +692,24 @@ main(int argc, char *argv[])
ps_fmt_squash (fmt, nominal);
}
+ err = ps_stream_create (stdout, &output);
+ if (err)
+ error (5, err, "Can't make output stream");
+
if (print_heading)
if (proc_stat_list_num_procs(procset) > 0)
{
- err = ps_fmt_write_titles(fmt, stdout, NULL);
+ err = ps_fmt_write_titles (fmt, output);
if (err)
error(0, err, "Can't print titles");
- putc('\n', stdout);
+ ps_stream_newline (output);
}
else
error(0, 0, "No applicable processes");
- err = proc_stat_list_fmt(procset, fmt, stdout, NULL);
+ err = proc_stat_list_fmt (procset, fmt, output);
if (err)
- error(5, err, "Couldn't output process status");
+ error (5, err, "Couldn't output process status");
exit(0);
}