]> pd.if.org Git - pdclib/blob - functions/stdio/fputc.c
Re-import from Subversion.
[pdclib] / functions / stdio / fputc.c
1 /* ----------------------------------------------------------------------------
2  * $Id$
3  * ----------------------------------------------------------------------------
4  * Public Domain C Library - http://pdclib.sourceforge.net
5  * This code is Public Domain. Use, modify, and redistribute at will.
6  * --------------------------------------------------------------------------*/
7
8 int fputc( int c, FILE * stream ) { /* TODO */ };
9
10 /* PDPC code - unreviewed
11 {
12     char buf[1];
13
14 #ifndef __MVS__
15     stream->quickBin = 0;
16     if ((stream->upto < (stream->endbuf - 2))
17         && (stream->bufTech != _IONBF))
18     {
19         if (stream->textMode)
20         {
21             if (c == '\n')
22             {
23                 if (stream->bufTech == _IOFBF)
24                 {
25                     *stream->upto++ = '\r';
26                     *stream->upto++ = '\n';
27                 }
28                 else
29                 {
30                     buf[0] = (char)c;
31                     if (fwrite(buf, 1, 1, stream) != 1)
32                     {
33                         return (EOF);
34                     }
35                 }
36             }
37             else
38             {
39                 *stream->upto++ = (char)c;
40             }
41         }
42         else
43         {
44             *stream->upto++ = (char)c;
45         }
46     }
47     else
48 #endif
49     {
50         buf[0] = (char)c;
51         if (fwrite(buf, 1, 1, stream) != 1)
52         {
53             return (EOF);
54         }
55     }
56     return (c);
57 }
58 */