home *** CD-ROM | disk | FTP | other *** search
/ Super PC 34 / Super PC 34 (Shareware).iso / spc / UTIL / DJGPP2 / V2 / DJTST200.ZIP / tests / libc / ansi / stdlib / shell.c < prev    next >
Encoding:
C/C++ Source or Header  |  1995-08-05  |  421 b   |  24 lines

  1. #include <process.h>
  2. #include <stdio.h>
  3. #include <stdlib.h>
  4.  
  5. int
  6. main(void)
  7. {
  8.   char line[2000];
  9.   int rv;
  10.   while (1)
  11.   {
  12.     printf("$ ");
  13.     fflush(stdout);
  14.     if (fgets(line, 2000, stdin) == 0)
  15.       break;
  16.     line[strlen(line)-1] = 0;
  17.     printf("line = `%s'\n", line);
  18.     rv = system(line);
  19. /*    rv = spawnlp(P_WAIT, line, line, 0); */
  20.     printf("══%c %d\n", 16, rv);
  21.   }
  22.   return 0;
  23. }
  24.