home *** CD-ROM | disk | FTP | other *** search
/ Usenet 1994 January / usenetsourcesnewsgroupsinfomagicjanuary1994.iso / sources / unix / volume27 / clc / part01 / libs / src / sio / suite / buftest.c next >
Encoding:
C/C++ Source or Header  |  1993-11-28  |  748 b   |  40 lines

  1. /*
  2.  * (c) Copyright 1992, 1993 by Panagiotis Tsirigotis
  3.  * All rights reserved.  The file named COPYRIGHT specifies the terms 
  4.  * and conditions for redistribution.
  5.  */
  6.  
  7. static char RCSid[] = "$Id: buftest.c,v 8.1 1993/03/13 01:23:09 panos Exp $" ;
  8.  
  9. #include "sio.h"
  10.  
  11. main()
  12. {
  13.     int i ;
  14.     int sleep_interval = 3 ;
  15.  
  16.     if ( Sbuftype( 1, SIO_LINEBUF ) == SIO_ERR )
  17.     {
  18.         Sprint( 2, "Sbuftype failed\n" ) ;
  19.         exit( 1 ) ;
  20.     }
  21.  
  22.     for ( i = 0 ; i < 10 ; i++ )
  23.     {
  24.         Sprint( 1, "Line %d\n", i ) ;
  25.         if ( i == 5 )
  26.         {
  27.             Sprint( 1, "Now switching to full buffering\n" ) ;
  28.             sleep_interval = 2 ;
  29.             if ( Sbuftype( 1, SIO_FULLBUF ) == SIO_ERR )
  30.             {
  31.                 Sprint( 2, "2nd Sbuftype failed\n" ) ;
  32.                 exit( 1 ) ;
  33.             }
  34.         }
  35.         sleep( sleep_interval ) ;
  36.     }
  37.     exit( 0 ) ;
  38. }
  39.  
  40.