Update contrib.
3 * Portions Copyright (c) 1990-2005 Nokia Corporation and/or its subsidiary(-ies).
8 * Copyright (c) 1990 The Regents of the University of California.
11 * Redistribution and use in source and binary forms are permitted
12 * provided that the above copyright notice and this paragraph are
13 * duplicated in all such forms and that any documentation,
14 * advertising materials, and other materials related to such
15 * distribution and use acknowledge that the software was developed
16 * by the University of California, Berkeley. The name of the
17 * University may not be used to endorse or promote products derived
18 * from this software without specific prior written permission.
19 * THIS SOFTWARE IS PROVIDED ``AS IS'' AND WITHOUT ANY EXPRESS OR
20 * IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED
21 * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
28 <<gets>>---get character string (obsolete, use <<fgets>> instead)
37 char *gets(char *<[buf]>);
39 char *_gets_r(void *<[reent]>, char *<[buf]>);
47 char *_gets_r(<[reent]>, <[buf]>)
52 Reads characters from standard input until a newline is found.
53 The characters up to the newline are stored in <[buf]>. The
54 newline is discarded, and the buffer is terminated with a 0.
56 This is a @emph{dangerous} function, as it has no way of checking
57 the amount of space available in <[buf]>. One of the attacks
58 used by the Internet Worm of 1988 used this to overrun a
59 buffer allocated on the stack of the finger daemon and
60 overwrite the return address, causing the daemon to execute
61 code downloaded into it over the connection.
63 The alternate function <<_gets_r>> is a reentrant version. The extra
64 argument <[reent]> is a pointer to a reentrancy structure.
68 <<gets>> returns the buffer passed to it, with the data filled
69 in. If end of file occurs with some data already accumulated,
70 the data is returned with no other indication. If end of file
71 occurs with no data in the buffer, NULL is returned.
73 Supporting OS subroutines required: <<close>>, <<fstat>>, <<isatty>>,
74 <<lseek>>, <<read>>, <<sbrk>>, <<write>>.
81 A reentrant version of gets().
84 _gets_r (struct _reent *ptr, char *buf)
87 register char *s = buf;
89 while ((c = _getchar_r (ptr)) != '\n')
104 Get a string from stdin.
105 Reads characters from stdin and stores them into buffer
106 until a newline (\n) or EOF character is encountered.
107 @return On success, the buffer parameter is returned.
108 On end-of-file or error, a null pointer is returned.
109 @param pointer to a buffer where to receive the resulting string.
114 return _gets_r (_REENT, buf);