OpenCores
URL https://opencores.org/ocsvn/openrisc_me/openrisc_me/trunk

Subversion Repositories openrisc_me

[/] [openrisc/] [trunk/] [gnu-src/] [newlib-1.17.0/] [newlib/] [libc/] [stdio/] [setbuffer.c] - Blame information for rev 179

Go to most recent revision | Details | Compare with Previous | View Log

Line No. Rev Author Line
1 148 jeremybenn
/*
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 the setbuffer function
19
defined as part of BSD.
20
Modifications by Gareth Pearce, 2001.
21
*/
22
 
23
/*
24
FUNCTION
25
<<setbuffer>>---specify full buffering for a file or stream with size
26
 
27
INDEX
28
        setbuffer
29
 
30
ANSI_SYNOPSIS
31
        #include <stdio.h>
32
        void setbuffer(FILE *<[fp]>, char *<[buf]>, int <[size]>);
33
 
34
TRAD_SYNOPSIS
35
        #include <stdio.h>
36
        void setbuffer(<[fp]>, <[buf]>, <[size]>)
37
        FILE *<[fp]>;
38
        char *<[buf]>;
39
        int <[size]>;
40
 
41
DESCRIPTION
42
<<setbuffer>> specifies that output to the file or stream identified by
43
<[fp]> should be fully buffered.  All output for this file will go to a
44
buffer (of size <[size]>).  Output will be passed on to the host system
45
only when the buffer is full, or when an input operation intervenes.
46
 
47
You may, if you wish, supply your own buffer by passing a pointer to
48
it as the argument <[buf]>.  It must have size <[size]>.  You can
49
also use <<NULL>> as the value of <[buf]>, to signal that the
50
<<setbuffer>> function is to allocate the buffer.
51
 
52
WARNINGS
53
You may only use <<setbuffer>> before performing any file operation
54
other than opening the file.
55
 
56
If you supply a non-null <[buf]>, you must ensure that the associated
57
storage continues to be available until you close the stream
58
identified by <[fp]>.
59
 
60
RETURNS
61
<<setbuffer>> does not return a result.
62
 
63
PORTABILITY
64
This function comes from BSD not ANSI or POSIX.
65
 
66
Supporting OS subroutines required: <<close>>, <<fstat>>, <<isatty>>,
67
<<lseek>>, <<read>>, <<sbrk>>, <<write>>.
68
*/
69
 
70
#include <_ansi.h>
71
#include <stdio.h>
72
#include "local.h"
73
 
74
_VOID
75
_DEFUN(setbuffer, (fp, buf, size),
76
       FILE * fp _AND
77
       char *buf _AND
78
       int size)
79
{
80
  _CAST_VOID setvbuf (fp, buf, buf ? _IOFBF : _IONBF, (size_t) size);
81
}

powered by: WebSVN 2.1.0

© copyright 1999-2024 OpenCores.org, equivalent to Oliscience, all rights reserved. OpenCores®, registered trademark.