home *** CD-ROM | disk | FTP | other *** search
/ OS/2 Shareware BBS: 11 Util / 11-Util.zip / SHUTDWN4.ZIP / SHUTDOWN.C < prev    next >
Text File  |  1992-04-13  |  1KB  |  38 lines

  1. /***************************************************************************
  2.  * ShutDown.c
  3.  *
  4.  * Routine to perform OS/2 system shutdown from command line.
  5.  *
  6.  * Written by Chip James, Data Systems Technology, Inc.
  7.  *
  8.  * DISCLAIMER: This program is released into the public domain.  Neither
  9.  *             I nor DST assumes any responsibility what so ever for any
  10.  *             results do to the use of this utility.
  11.  ***************************************************************************/
  12. #include <os2def.h>
  13. #include <bsedos.h>     /*.. support for DosShutdown() .................*/
  14. #include <conio.h>
  15. #include <ctype.h>
  16. #include <stdio.h>
  17.  
  18. void main(void)
  19.   {
  20.   unsigned short usrc;
  21.   char ch;
  22.  
  23.   printf("\n\n\nAre you sure you want to perform shutdown? ");
  24.   ch = (char)getche();
  25.   ch = toupper(ch);
  26.  
  27.   if (ch == 'Y')
  28.     {
  29.     printf("\n\nShutdown is complete once drive access stops ...\n");
  30.     if (DosShutdown(0l) != 0)   /* performs shutdown only, not reboot */
  31.       {
  32.       fprintf(stderr,"\n\nError <%u> performing shutdown.\n", usrc);
  33.       }
  34.     }
  35.   return;
  36.   }
  37. /* eof: shutdown.c */
  38.