blob: 669e6c6e86b805ab148435ac1edf2b1062bf4e89 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
|
#include <stdio.h>
#include <stdlib.h>
#include "port.h"
int main( int argc, char *argv[] )
{
if( argc != 2 ) {
fprintf( stderr, "Usage: workertest [seconds to run]\n" );
return 1;
}
int run_time = atoi( argv[1] );
for( int i = 0; i < run_time; i++ ) {
char msg[1024];
snprintf( msg, sizeof( msg ), "Msg %d\n", i );
if( i % 3 == 0 ) {
fputs( msg, stderr );
fflush( stderr );
} else {
fputs( msg, stdout );
fflush( stdout );
}
sleep( 1 );
}
return 0;
}
|