home *** CD-ROM | disk | FTP | other *** search
/ Power-Programmierung / CD1.mdf / icon / dos / src / runtests.c < prev    next >
C/C++ Source or Header  |  1988-09-24  |  846b  |  33 lines

  1. #include <stdio.h>
  2.  
  3. /*
  4.  * Run sequence of tests of Icon programs from list of names contained
  5.  *  in file given as argument
  6.  */
  7.  
  8. main(argc,argv)
  9. int argc;
  10. char *argv[];
  11.    {
  12.    int system();
  13.    char sbuf[15];
  14.    char name[10];
  15.    FILE *infile;
  16.    FILE *in;
  17.  
  18.    if (argc != 2) {        /* one argument + program name */
  19.       fprintf(stderr,"wrong number of arguments: %d\n", argc);
  20.       exit(-1);
  21.       }
  22.    in = fopen(argv[1],"r");    /* open file of program names */
  23.    if (in == NULL) {
  24.       fprintf(stderr,"cannot open input\n");
  25.       exit(-1);
  26.       }
  27.    while (fgets(name,10,in) != NULL) {    /* get the next file name */
  28.       name[strlen(name) - 1] = ' ';    /* change newline to blank :-( */
  29.       sprintf(sbuf, "itest %s", name);    /* construct the command */
  30.       system(sbuf);            /* perform the test */
  31.       }
  32.    }
  33.