1991-07-24 22:58:20 +00:00
|
|
|
#include <ansidecl.h>
|
|
|
|
|
#include <stdio.h>
|
1991-08-08 01:12:26 +00:00
|
|
|
#include <stdlib.h>
|
1991-07-24 22:58:20 +00:00
|
|
|
|
|
|
|
|
void write_data (FILE *stream)
|
|
|
|
|
{
|
|
|
|
|
int i;
|
|
|
|
|
for (i=0; i<100; i++)
|
|
|
|
|
fprintf (stream, "%d\n", i);
|
|
|
|
|
if (ferror (stream)) {
|
|
|
|
|
fprintf (stderr, "Output to stream failed.\n");
|
|
|
|
|
exit (1);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void main (void)
|
|
|
|
|
{
|
|
|
|
|
FILE *output;
|
|
|
|
|
int status;
|
|
|
|
|
|
|
|
|
|
output = popen ("/usr/ucb/more", "w");
|
|
|
|
|
if (!output) {
|
|
|
|
|
fprintf (stderr, "Could not run more.\n");
|
|
|
|
|
exit (1);
|
|
|
|
|
}
|
|
|
|
|
write_data (output);
|
|
|
|
|
status = pclose (output);
|
|
|
|
|
fprintf (stderr, "pclose returned %d\n", status);
|
|
|
|
|
exit (0);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|