Set the cut path properly when a non-default output path is specified
[atscap.git] / rzloop.c
blobda48793f8014b6894535d4803c98a5d23ab45dfa
1 /* loop on a command until the return code is non-zero */
2 #include <stdio.h>
3 #include <unistd.h>
4 #include <stdlib.h>
5 #include <string.h>
7 int
8 main( int argc, char **argv )
10 int ok, i,p;
11 char c[80];
12 if (argc < 2) { printf("Supply a command line to run\n"); exit(0); }
13 *c = 0;
14 for (i = 1; i < argc; i++) {
15 p = strlen(c);
16 if (p + strlen(argv[i]) > sizeof(c))
17 break;
18 snprintf( &c[p], sizeof(c), "%s ", argv[i] );
20 printf( "Command line: %s", c);
21 i = 0;
22 ok = 0;
23 while( 0 == ok ) {
24 ok = system( c );
25 printf( "\n\n# %d, %d = %s\n", i++, ok, c );
26 sleep(4);
28 return ok;