Subversion Repositories Kolibri OS

Rev

Blame | Last modification | View Log | RSS feed

  1. /*
  2.  * Copyright (c) 1990 The Regents of the University of California.
  3.  * All rights reserved.
  4.  *
  5.  * Redistribution and use in source and binary forms are permitted
  6.  * provided that the above copyright notice and this paragraph are
  7.  * duplicated in all such forms and that any documentation,
  8.  * advertising materials, and other materials related to such
  9.  * distribution and use acknowledge that the software was developed
  10.  * by the University of California, Berkeley.  The name of the
  11.  * University may not be used to endorse or promote products derived
  12.  * from this software without specific prior written permission.
  13.  * THIS SOFTWARE IS PROVIDED ``AS IS'' AND WITHOUT ANY EXPRESS OR
  14.  * IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED
  15.  * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
  16.  */
  17. /*
  18. Modified copy of setbuf.c to support setlinebuf function
  19. defined as part of BSD.
  20. Modifications by Gareth Pearce, 2001.
  21. */
  22.  
  23. /*
  24. FUNCTION
  25. <<setlinebuf>>---specify line buffering for a file or stream
  26.  
  27. INDEX
  28.         setlinebuf
  29.  
  30. ANSI_SYNOPSIS
  31.         #include <stdio.h>
  32.         void setlinebuf(FILE *<[fp]>);
  33.  
  34. TRAD_SYNOPSIS
  35.         #include <stdio.h>
  36.         void setlinebuf(<[fp]>)
  37.         FILE *<[fp]>;
  38.  
  39. DESCRIPTION
  40. <<setlinebuf>> specifies that output to the file or stream identified by
  41. <[fp]> should be line buffered.  This causes the file or stream to pass
  42. on output to the host system at every newline, as well as when the
  43. buffer is full, or when an input operation intervenes.
  44.  
  45. WARNINGS
  46. You may only use <<setlinebuf>> before performing any file operation
  47. other than opening the file.
  48.  
  49. RETURNS
  50. <<setlinebuf>> returns as per setvbuf.
  51.  
  52. PORTABILITY
  53. This function comes from BSD not ANSI or POSIX.
  54.  
  55. Supporting OS subroutines required: <<close>>, <<fstat>>, <<isatty>>,
  56. <<lseek>>, <<read>>, <<sbrk>>, <<write>>.
  57. */
  58.  
  59. #include <_ansi.h>
  60. #include <stdio.h>
  61. #include "local.h"
  62.  
  63. int
  64. _DEFUN(setlinebuf, (fp),
  65.        FILE * fp)
  66. {
  67.   return (setvbuf (fp, (char *) NULL, _IOLBF, (size_t) 0));
  68. }
  69.