Changeset 919


Ignore:
Timestamp:
Jul 31, 2011, 6:50:17 PM (9 years ago)
Author:
Dmitry A. Kuminov
Message:

tests/process/child: Added two new modes: 3 and 4.

Mode 3 prints everything it reads on stdin to stdout until read()
returns a failure. Mode 4 is similar but uses feof() and ferror()
to detect the end of input condition.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • tests/process/child/child.c

    r908 r919  
    5959        }
    6060    }
     61    else if (argc == 2)
     62    {
     63        switch (atoi (argv[1]))
     64        {
     65        case 3:
     66            while ((n = fread (buffer, 1, sizeof (buffer), stdin)) > 0)
     67            {
     68                fwrite (buffer, 1, n, stdout);
     69            }
     70
     71            return 0;
     72
     73        case 4:
     74            while (!feof (stdin) && !ferror (stdin))
     75            {
     76                n = fread (buffer, 1, sizeof (buffer), stdin);
     77                fwrite (buffer, 1, n, stdout);
     78            }
     79
     80            return 0;
     81        }
     82    }
    6183
    6284    return -1;
Note: See TracChangeset for help on using the changeset viewer.