home *** CD-ROM | disk | FTP | other *** search
/ Black Box 4 / BlackBox.cdr / batch / call.arj / CALL.C next >
Encoding:
C/C++ Source or Header  |  1991-07-25  |  709 b   |  35 lines

  1. /*
  2.     call.c - a program that will allow execution of .BAT files from
  3.         within other .BAT files. Similar to CALL in MS-DOS 4.x
  4. */
  5.  
  6. #include <stdio.h>
  7. #include <process.h>
  8.  
  9. char *pdnotice1 = "Placed in the public domain by the author.\n",
  10.       *pdnotice2 = "Gene McManus, gmcmanus@dsac.dla.mil\n";
  11.  
  12. main(argc, argv)
  13. int argc;
  14. char *argv[];
  15.     {
  16.     register int i = 1;
  17.     char *command, *malloc();
  18.  
  19.     command = malloc(256);
  20.     if(command == NULL)
  21.         {
  22.         fputs("Cannot allocate memory for command line buffer\n", stderr);
  23.         exit(3);
  24.         }
  25.     command[0] = '\0';
  26.     for(; i <= argc; i++)
  27.         {
  28.         strcat(command, argv[i]);
  29.         strcat(command, " ");
  30.         }
  31.     i = system(command);
  32.     free(command);
  33.     exit(i);
  34.     }
  35.