1: # include   <stdio.h>
   2: # include   <sgtty.h>
   3: # include   <ingres.h>
   4: # include   <sccs.h>
   5: 
   6: SCCSID(@(#)set_so_buf.c	8.1	12/31/84)
   7: 
   8: /*
   9: **  SET_SO_BUF -- set standard output buffer conditionally
  10: **
  11: **	This routine sets the standard output buffer conditionally,
  12: **	based on whether or not it is a terminal.  If it is, it
  13: **	does not set the output; otherwise, it buffers the output.
  14: **	The buffer is contained internally.
  15: **
  16: **	Parameters:
  17: **		none
  18: **
  19: **	Returns:
  20: **		TRUE -- if buffer was set
  21: **		FALSE -- otherwise
  22: **
  23: **	Side Effects:
  24: **		The standard output is left buffered or unchanged.
  25: */
  26: 
  27: set_so_buf()
  28: {
  29:     extern int  errno;
  30:     struct sgttyb   gttybuf;
  31:     static char buffer[BUFSIZ];
  32: 
  33:     /* check for standard output is tty */
  34:     if (gtty(fileno(stdout), &gttybuf))
  35:     {
  36:         /* no: reset errno and buffer */
  37:         errno = 0;
  38:         setbuf(stdout, buffer);
  39: 
  40:         return (TRUE);
  41:     }
  42: 
  43:     return (FALSE);
  44: }

Defined functions

set_so_buf defined in line 6; never used
Last modified: 1986-04-17
Generated: 2016-12-26
Generated by src2html V0.67
page hit count: 901
Valid CSS Valid XHTML 1.0 Strict