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

Subversion Repositories openrisc

[/] [openrisc/] [trunk/] [gnu-old/] [newlib-1.17.0/] [newlib/] [libc/] [stdio/] [fputs.c] - Blame information for rev 158

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
/*
19
FUNCTION
20
<<fputs>>---write a character string in a file or stream
21
 
22
INDEX
23
        fputs
24
INDEX
25
        _fputs_r
26
 
27
ANSI_SYNOPSIS
28
        #include <stdio.h>
29
        int fputs(const char *<[s]>, FILE *<[fp]>);
30
 
31
        #include <stdio.h>
32
        int _fputs_r(struct _reent *<[ptr]>, const char *<[s]>, FILE *<[fp]>);
33
 
34
TRAD_SYNOPSIS
35
        #include <stdio.h>
36
        int fputs(<[s]>, <[fp]>)
37
        char *<[s]>;
38
        FILE *<[fp]>;
39
 
40
        #include <stdio.h>
41
        int _fputs_r(<[ptr]>, <[s]>, <[fp]>)
42
        struct _reent *<[ptr]>;
43
        char *<[s]>;
44
        FILE *<[fp]>;
45
 
46
DESCRIPTION
47
<<fputs>> writes the string at <[s]> (but without the trailing null)
48
to the file or stream identified by <[fp]>.
49
 
50
<<_fputs_r>> is simply the reentrant version of <<fputs>> that takes
51
an additional reentrant struct pointer argument: <[ptr]>.
52
 
53
RETURNS
54
If successful, the result is <<0>>; otherwise, the result is <<EOF>>.
55
 
56
PORTABILITY
57
ANSI C requires <<fputs>>, but does not specify that the result on
58
success must be <<0>>; any non-negative value is permitted.
59
 
60
Supporting OS subroutines required: <<close>>, <<fstat>>, <<isatty>>,
61
<<lseek>>, <<read>>, <<sbrk>>, <<write>>.
62
*/
63
 
64
#include <_ansi.h>
65
#include <stdio.h>
66
#include <string.h>
67
#include "fvwrite.h"
68
#include "local.h"
69
 
70
/*
71
 * Write the given string to the given file.
72
 */
73
 
74
int
75
_DEFUN(_fputs_r, (ptr, s, fp),
76
       struct _reent * ptr _AND
77
       char _CONST * s _AND
78
       FILE * fp)
79
{
80
  int result;
81
  struct __suio uio;
82
  struct __siov iov;
83
 
84
  iov.iov_base = s;
85
  iov.iov_len = uio.uio_resid = strlen (s);
86
  uio.uio_iov = &iov;
87
  uio.uio_iovcnt = 1;
88
 
89
  CHECK_INIT(ptr, fp);
90
 
91
  _flockfile (fp);
92
  ORIENT (fp, -1);
93
  result = __sfvwrite_r (ptr, fp, &uio);
94
  _funlockfile (fp);
95
  return result;
96
}
97
 
98
#ifndef _REENT_ONLY
99
int
100
_DEFUN(fputs, (s, fp),
101
       char _CONST * s _AND
102
       FILE * fp)
103
{
104
  return _fputs_r (_REENT, s, fp);
105
}
106
#endif /* !_REENT_ONLY */

powered by: WebSVN 2.1.0

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