home *** CD-ROM | disk | FTP | other *** search
/ OS/2 Shareware BBS: 10 Tools / 10-Tools.zip / PJ8_3.ZIP / IOCTLT.C < prev    next >
C/C++ Source or Header  |  1990-01-22  |  1KB  |  47 lines

  1. /*   ioctlt.c  tests  std_tst function
  2. *    Written by: B. H. Robinson
  3. *       Written: Jan 21, 1990
  4. *       Version: 001
  5. *    Compile on Turbo C
  6. *********************************************/
  7. #include <stdio.h>
  8. #include <io.h>
  9. #include <conio.h>
  10.  
  11. int std_tst( int channel );
  12. void check( int ch );
  13.  
  14. char *s_channel[] = {"STDIN" ,
  15.                    "STDOUT" ,
  16.                    " BAD CHANNEL " };
  17.  
  18. int main()
  19. {
  20.     check( 0 );   /* Check stdin channel  */
  21.     check( 1 );   /* Check stdout channel */
  22.     return 0;
  23. }
  24. /**********************************************/
  25. void check( int ch )
  26. {
  27.     int stat;
  28.                                     
  29.     if( (ch != 0) && (ch != 1) )
  30.         ch = 2;
  31.     stat = std_tst( ch );
  32.     switch( stat ){
  33.         case -1:
  34.             cprintf("Error in st_tst for %s.\n\r", s_channel[ ch ] );
  35.             break;
  36.         case 0:
  37.             cprintf("%s is a file.\n\r", s_channel[ ch ]);
  38.             break;
  39.         case 1:
  40.             cprintf("%s is a device.\n\r", s_channel[ ch ]);
  41.             break;
  42.         default:
  43.             break;
  44.     }
  45. }
  46. /***************** end of file ****************/
  47.