home *** CD-ROM | disk | FTP | other *** search
/ The C Users' Group Library 1994 August / wc-cdrom-cusersgrouplibrary-1994-08.iso / vol_300 / 328_01 / wdos.c < prev    next >
C/C++ Source or Header  |  1991-03-17  |  1KB  |  76 lines

  1. /*! wdos.c    run SYSTEM COMMAND
  2.  *
  3.  */
  4. #include "wsys.h"
  5.  
  6. #ifndef __TURBOC__
  7.     #include <direct.h>
  8. #else 
  9.     #include <dir.h>
  10. #endif
  11.  
  12.  
  13.  
  14. /*! wdos
  15.  *    DOS interface
  16.  */
  17. void wdos(void)
  18.     {
  19.     char     command[60];
  20.     char    curr_path[81];
  21.     char    message[81];
  22.  
  23.  
  24.  
  25.     int     more =1;
  26.  
  27.     #ifndef TEXTONLY
  28.     if (wmode == 'G' )
  29.         {
  30.         wpromptc (NULL,  "DOS not available in graphics mode", NULL);
  31.         return;
  32.         }
  33.     #endif
  34.  
  35.  
  36.     command[0]= '0';
  37.  
  38.  
  39.     while (more != ESCAPE)
  40.         {
  41.         /* get a command */
  42.         getcwd(curr_path, 80);
  43.         strcpy ( message, "enter DOS COMMAND at the prompt:\n\n\r");
  44.         strcat ( message, curr_path );
  45.         strcat ( message, ">" );
  46.  
  47.         more = wprompts ("DOS", message, command,sizeof(command) );
  48.  
  49.  
  50.  
  51.         /* several alternate ways to signal quit
  52.          */
  53.         if (        stricmp(command, "exit") ==0
  54.             || stricmp(command, "quit") ==0
  55.             || more == ESCAPE   )
  56.             {
  57.             break;   /*terminate  while() loop*/
  58.             }
  59.  
  60.         /* do the command */
  61.         wopen(0,0, wxabsmax, wyabsmax, GREEN, NO_BORDER, 0,
  62.             WSAVE2RAM);
  63.         wprintf("%s> %s\n",curr_path, command);
  64.         system(command);
  65.         wgoto ( 0,wyabsmax );
  66.         wscroll ();
  67.         wprintf("Press any key to continue...");
  68.         wgetc();
  69.         wclose();
  70.  
  71.         } /*end while*/
  72.  
  73.     return;
  74.     } /* end of wdos */
  75.  
  76.