home *** CD-ROM | disk | FTP | other *** search
/ Microsoft Programmer's Library 1.3 / Microsoft-Programers-Library-v1.3.iso / sampcode / prof_c / 04stdlib / run_once.c < prev    next >
Encoding:
C/C++ Source or Header  |  1988-08-11  |  596 b   |  29 lines

  1. /*
  2.  *    run_once -- run a program one time and then
  3.  *    "hang" the system to prevent unwanted use
  4.  */
  5.  
  6. #include <stdio.h>
  7. #include <stdlib.h>
  8. #include <process.h>
  9. #include <local\std.h>
  10.  
  11. main(argc, argv)
  12. int argc;
  13. char *argv[];
  14. {
  15.     extern void fatal(char *, char *, int);
  16.  
  17.     /* skip over the program name */
  18.     ++argv;
  19.  
  20.     /* run the specified command line [pgmname arg(s)] */
  21.     if (spawnvp(P_WAIT, *argv, argv) == -1)
  22.         fatal("run_once", "Error running specified program", 1);
  23.     fprintf(stderr, "Please turn off the power to the computer.\n");
  24.  
  25.     /* do nothing */
  26.     FOREVER
  27.         ;
  28. }
  29.