home *** CD-ROM | disk | FTP | other *** search
- /*
- * call.c allows return from batch files invoked by a batch file
- * simulates DOS 3.3 'call' command
- *
- * 06/06/88 George Palecek tc
- * CIS: 70206,332
- * UUCP: gpalecek@duorion.edu
- *
- */
-
- #include <stdio.h>
- #include <string.h>
- #include <stdlib.h>
-
- #define MAXPATHLEN 128
-
- /*----MAIN PROGRAM BEGINS HERE----------------------------------------------*/
- /*
- * Check for number of command line args if any. If no args, error message.
- */
-
- main ( argc, argv )
-
- int argc;
- char **argv;
- {
- char command [MAXPATHLEN];
- int i, ret_code;
-
- command [0] = '\0';
- if ( argc < 2 ) /* check for file name in command line arg */
- {
- fprintf ( stderr, "\nUsage: call {batch file} [parameters] ...\n\n" );
- ret_code = 1;
- }
- else
- {
- for ( i = 0; i < argc; ++i )
- {
- *argv++;
- strcat ( command, *argv );
- strcat ( command, " " );
- }
- ret_code = system ( command );
- }
- return ( ret_code );
- }