Subversion Repositories DevTools

Rev

Go to most recent revision | Details | Last modification | View Log | RSS feed

Rev Author Line No. Line
267 dpurdie 1
/*============================================================================
2
**
3
**    ERG TRANSIT SYSTEMS      Licensed software
4
**    (C) 2008                 All rights reserved
5
**
6
**============================================================================
7
**
8
**  Project/Product : 
9
**  Filename        : stdouterr.c
10
**  Author(s)       : DDP
11
**
12
**  Description     : Test utility
13
**                    Generate data on stdout and stderr
14
**                    May take two arguments
15
**                      Messages for stdout
16
**                      Messages for stderr
17
**
18
**
19
**
20
**  Information     :
21
**   Compiler       : ANSI C
22
**   Target         : Test
23
**
24
**
25
**==========================================================================*/
26
 
27
#include "stdio.h"
28
#include <stdlib.h>
29
 
30
int main( int argc, char *argv[] )
31
{
32
    int i;
33
    int ocount = 10;
34
    int ecount = 10;
35
    int count;
36
 
37
    if (argc > 1)
38
    {
39
        char *endp;
40
        ocount = strtol(argv[1], &endp, 10);
41
        if (argc > 2)
42
        {
43
            ecount = strtol(argv[2], &endp, 10);
44
        }
45
        else
46
        {
47
            ecount = ocount;
48
        }
49
    }
50
 
51
    count = ecount > ocount ? ecount : ocount;
52
 
53
 
54
    for ( i = 0; i < count; i++ )
55
    {
56
        if ( i < ecount )
57
        {
58
            fprintf (stderr, "This is STDERR(%d)\n", i);
59
            fflush (stderr);
60
        }
61
 
62
        if ( i < ocount )
63
        {
64
            fprintf (stdout, "This is STDOUT(%d)\n", i);
65
            fflush (stdout);
66
        }
67
    }
68
    fflush (stdout);
69
    fflush (stderr);
70
 
71
    exit (7);
72
}