home *** CD-ROM | disk | FTP | other *** search
/ OS/2 Shareware BBS: 11 Util / 11-Util.zip / iplpau.zip / iplpause.c next >
Text File  |  1993-12-05  |  3KB  |  81 lines

  1. /**********************************************************************/
  2. /*  PROGRAM:  IPLPAUSE.EXE - config.sys timer utility.              */
  3. /*  BY:  Knight Research - Copyright (c) 1993 All Rights Reserved.    */
  4. /*  Version: 1.1  Last Update: December 5, 1993               */
  5. /**********************************************************************/
  6. /* Compiled with MSC 6.0 */
  7. #define INCL_DOSPROCESS
  8. #define INCL_DOSMISC
  9. #include <os2.h>
  10. #include <stdlib.h>
  11. #include <stdio.h>
  12. #include <string.h>
  13. #include <conio.h>
  14.  
  15. int    key;
  16. char    szInput[80];
  17. USHORT    usRC, usSeconds=0;
  18. RESULTCODES resc;
  19. UCHAR szFailName[CCHMAXPATH];
  20. UCHAR szCommandLine[] = { "cmd\0 /K \0" };
  21. UCHAR szDefault_ComSpec[]     = { "C:\\OS2\\CMD.EXE" };
  22. UCHAR *pszComSpec;
  23.  
  24. /***************************************************************************/
  25. void main (int argc, char *argv[])
  26. /***************************************************************************/
  27. {
  28.  if (argc > 1) {
  29.      strcpy(szInput,argv[1]);
  30.      strupr(szInput);
  31.      usSeconds = atoi(szInput);
  32.      }
  33.  if (usSeconds == 0)
  34.      usSeconds = 10;
  35.  
  36.  /*************************** Try to find CMD.EXE **************************/
  37.  if (argc > 2) { /* CMD.EXE Passed as a Parm */
  38.      pszComSpec = &argv[2][0];
  39.      printf("\nMSG:1 Parm Passed COMSPEC=%s\n",pszComSpec);
  40.      }
  41.  else if (0 == (DosScanEnv("COMSPEC", &pszComSpec))) { /* from Environment */
  42.      printf("\nMSG:2 Found COMSPEC=%s\n",pszComSpec);
  43.      } /* Using CMD.EXE pointed to in environment 'SET COMSPEC=' parm */
  44.  else { /* take default location */
  45.      pszComSpec = &szDefault_ComSpec[0];
  46.      printf("\nMSG:3 Using Default COMSPEC=%s\n",pszComSpec);
  47.      }
  48.  
  49.    printf("┌─────────────────────────────────────────────────────────────────────┐\n");
  50.    printf("│IPLPAUSE:  Knight Research - Copyright \(c\) 1993 All Rights Reserved. │\n");
  51.    printf("└─────────────────────────────────────────────────────────────── 1.1 ─┘\n");
  52.  printf("Press ANY KEY to PAUSE System Startup...OR Press <ESC> to Continue NOW.\n\n");
  53.  
  54.  while (usSeconds > 0) {
  55.      if (kbhit()) {
  56.      key = getch();
  57.      if (key != 27) {
  58.          printf("\n\nIPL has been Paused....type EXIT to continue system startup.\n\n");
  59.          usRC = DosExecPgm(szFailName, sizeof(szFailName), EXEC_SYNC,
  60.             szCommandLine, (PSZ) NULL, &resc, pszComSpec);
  61.          if (usRC != 0) {
  62.          printf("\n\aIPL has NOT been Paused. BAD RC=%d\n", usRC);
  63.          printf("COMSPEC USED WAS: %s\n", pszComSpec);
  64.          }
  65.          printf("\n\nOS/2 Presentation Manager will now start.\n\n");
  66.          exit(1);
  67.          }
  68.      else {
  69.          printf("\n\nOS/2 Presentation Manager will now start.\n\n");
  70.          exit(0);  /* Boot Immediately */
  71.          }
  72.      }
  73.      DosSleep(1000L);
  74.      usSeconds--;
  75.      printf("===> COUNTDOWN TO PM STARTUP: %d \r", usSeconds);
  76.      }
  77.  
  78.  printf("\n\nOS/2 Presentation Manager will now start.\n\n");
  79.  exit(0);
  80. }
  81.