home *** CD-ROM | disk | FTP | other *** search
/ CP/M / CPM_CDROM.iso / jsage / zsus / progpack / cforz02.lbr / CSPOP.CZ / CSPOP.C
Encoding:
C/C++ Source or Header  |  1992-05-13  |  640 b   |  28 lines

  1. /* Test shpush(), shpop() */
  2.  
  3. #include <stdio.h>
  4. main(argc,argv)
  5.     int argc;
  6.     char *argv[];
  7. {
  8.     if(argc < 2) {
  9.         printf("What would you have me do?\n");
  10.         exit(0);
  11.     }
  12.     if(strcmp(argv[1],"/P")== 0) {
  13.         if(shempty())
  14.             printf("Shell stack empty!");
  15.         else
  16.             printf("Shell stack pop %s\n",shpop()?"OK":"Failed");
  17.         exit(0);
  18.     }
  19.     if(shfull())
  20.         printf("Shell stack full!\n");
  21.     else {
  22.         if(shpush(argv[1]))
  23.             printf("Pushing command on shell stack => %s\n",argv[1]);
  24.         else
  25.             printf("Shell push failed!\n");
  26.     }
  27. }
  28.