Commit Graph

341 Commits

Author SHA1 Message Date
yamt
fa787c7eba g/c #if 0. 2001-12-07 12:18:53 +00:00
yamt
a510b02e77 add files forgotten in my previous commit. 2001-12-07 12:02:07 +00:00
yamt
17f3654a64 - make FILE structure extensible without breaking binary-compatibility.
- add fputwc, fgetwc, fwide and related functions.
- add hooks needed to maintain the orientation of file stream.
2001-12-07 11:47:40 +00:00
kleink
2a6842fe56 C99: Recognize %F here, too. 2001-12-02 20:53:49 +00:00
kleink
f2c0cf9cec Fix a mis-pasting in previous; pointed out by Thomas Klausner. 2001-12-02 20:41:12 +00:00
kleink
dcf4ce2588 C99:
* Recognize %F.
* Convert {Infinity,NaN} to {"inf","nan"} for %[efg], and to
  {"INF","NAN"} for %[EFG].
2001-12-02 20:12:03 +00:00
kleink
80f30d4de0 Since we're returned the sign of a floating-point number by __dtoa(),
use that to decide whether to include a minus sign in the result.
Fixes printing -0.0, and thus PR lib/3137.
2001-11-28 11:58:22 +00:00
augustss
0d3aa2aa07 Ugh, back out last commit. It makes vfprintf depend on -lm. 2001-11-27 18:05:30 +00:00
augustss
a928006fbb Print sign of -0.0 correctly. Fixes PR 3137 (mine). 2001-11-27 18:00:55 +00:00
lukem
50f5afd52e fix WARNS=2 (-Wshadow) warnings 2001-11-04 13:57:29 +00:00
kleink
aea3dece2d Drop a VAX/Tahoe reference (the VAX case wasn't true with the current compiler
either).
2001-10-17 13:27:15 +00:00
wiz
4c99916337 va_{start,end} audit:
Make sure that each va_start has one and only one matching va_end,
especially in error cases.
If the va_list is used multiple times, do multiple va_starts/va_ends.
If a function gets va_list as argument, don't let it use va_end (since
it's the callers responsibility).

Improved by comments from enami and christos -- thanks!

Heimdal/krb4/KAME changes already fed back, rest to follow.

Inspired by, but not not based on, OpenBSD.
2001-09-24 13:22:25 +00:00
wiz
71bd158b54 Mainly sort SEE ALSO, but also sort sections, and some punctuation and
paragraph fixes.
2001-09-16 02:17:15 +00:00
wiz
72b9df9677 Boring whitespace fixes. 2001-09-16 02:08:55 +00:00
abs
185d31ea9e Do not xref pc(1) 2001-07-06 18:15:36 +00:00
aymeric
58237d3d65 Draw attention to the fact that the created file/dir may not be readable
or writable due to a weird umask.
2001-06-22 20:09:05 +00:00
christos
096152524b casts to size_t 2001-06-21 21:17:10 +00:00
kleink
a251b29d5a Clarify C standards situation a bit. 2001-04-30 08:47:59 +00:00
kleink
fe3c9ceaf7 * Move definitions of exact-width integer types from <machine/types.h>
to <sys/types.h> and <sys/stdint.h>.
* Add a new C99 <stdint.h> header, which provides integer types of
  explicit width, related limits and integer constant macros.
* Extend <inttypes.h> to provide <stdint.h> definitions and format
  macros for printf() and scanf().
* Add C99 strtoimax() and strtoumax() functions.
* Use the latter within scanf().
* Add C99 %j, %t and %z printf()/scanf() conversions for
  intmax_t, pointer-type and size_t arguments.
2001-04-28 15:41:28 +00:00
kleink
568e812267 Fix an ... interesting pasto in the description of the l length modifier
that's been here forever.
2001-04-26 19:25:12 +00:00
kleink
6213f73707 Document getc_unlocked(3), getchar_unlocked(3), putc_unlocked(3) and
putchar_unlocked(3); fixes PR lib/11340.
2001-04-25 22:06:53 +00:00
kleink
3432ed7203 Need an internal name for asprintf(3). 2001-04-13 14:18:09 +00:00
jhawk
404ef082e4 Xr printf(9) 2001-04-03 13:59:22 +00:00
lukem
fa11ebb133 apparently ansi c only required fread(3) to return 0 if size or nmembs == 0.
however, susv2 adds the same to fwrite(3), so add the explicit check.
document this for both fread & fwrite. move diagassert for buf!=NULL to after
the (size * nmembs) == 0 check.

this has the helpful side effect of preventing the _DIAGASSERT()ion in
fwrite() being triggered by lots of 3rdparty code that calls fwrite() with
buf=NULL count=0
2001-01-25 02:06:25 +00:00
itojun
bb0bfe5b30 initialize mbstate_t properly. 2000-12-30 04:13:25 +00:00
kleink
81ab746b71 Sprinkle some __restrict into stdio. 2000-12-29 15:22:48 +00:00
itojun
1da6122f1e make printf-variant work with stateful encodings. 2000-12-23 13:19:31 +00:00
christos
86af4f2cf9 fix duplicate declaration of __glue. 2000-12-10 04:17:28 +00:00
christos
ebb980fc21 This is for completeness only (to make fdopen symmetric with fopen and freopen)
and to match the documentation. Return an error if "f" was specified and the
file descriptor does not refer to a plain file.
2000-11-29 15:36:42 +00:00
christos
8955e88e2f Add checks for O_NDELAY [which indicates that we only want plain files],
and return an error if the file was not plain.
2000-11-29 15:31:10 +00:00
christos
2a213d0e9a make sure we preserve errno. 2000-11-29 15:30:20 +00:00
kleink
78eeef4b49 Actually EINVAL fits the circumstances better. 2000-10-19 09:47:43 +00:00
kleink
20b0e10891 C99: Passing a null pointer as the buffer argument to snprintf() and
vsnprintf() is permitted when the size argument is zero as well; mostly
from Peter Seebach in PR standards/9603.
2000-10-19 09:45:31 +00:00
kim
6ec737498a Make "f" standout better. 2000-10-18 15:40:52 +00:00
kleink
9c477a4e4e XCU5 -> XSH5. 2000-07-26 08:57:34 +00:00
kleink
7d93b767c2 Oops, forgot to define weak aliases for public names.
Fixes PR {pkg,lib}/10655.
2000-07-26 08:52:57 +00:00
jdolecek
5451455d06 v*scanf() are hardly 'new to this release' when they have
been around since 386BSD-0.1 import; they have been present in 4.4BSD-Lite
at least, can't currently check if even in 4.3BSD
put note aboud eventual removing of compatibility formats to NOTES, it's
   hardly a bug description
2000-07-16 11:08:53 +00:00
sommerfeld
007c516740 Attach __format__ attributes to local __sbprintf function 2000-07-08 14:57:57 +00:00
kleink
6c16ef0bd2 Elaborate a bit on fseeko() and ftello(). 2000-07-08 14:13:05 +00:00
kleink
723bc5321e Bump date for fseeko() and ftello(). 2000-07-08 13:59:24 +00:00
kleink
7c5b39585f In fgetpos() and fsetpos(), use ftello() and fseeko(), respectively, to avoid
truncating the value stored in the fpos_t object operated on to that of a
long integer; adresses PR lib/6637.
2000-07-08 13:51:27 +00:00
kleink
dae360611f XCU5: Add fseeko() and ftello() functions which provide the functionality of
fseek() and ftell(), respectively, but operate on file offsets of type off_t.
2000-07-08 13:46:33 +00:00
fair
dc17a3ff45 Comment out a paragraph describing behavior which NetBSD's fopen(3) does
not exhibit, per PR 6072.
2000-05-17 10:09:35 +00:00
kleink
3031020afe Replace internal use of strto{,u}q() with strto{,u}ll(). 2000-03-08 19:33:47 +00:00
mycroft
605490369c Delint.
Remove trailing ; from uses of __weak_alias().  The macro inserts this if
needed.
2000-01-22 22:19:07 +00:00
wrstuden
9c658d828e Need to include "reentrant.h" for FLOCKFILE macros. 2000-01-21 23:12:33 +00:00
mycroft
e70f76146b Do file locking. 2000-01-21 19:56:07 +00:00
mycroft
b714bb5102 Just call fflush() from _cleanup(), since it does the right locking. 2000-01-21 19:55:02 +00:00
mycroft
f9b319ca18 Call __sclearerr(), nor clearerr(), so we don\`t try to double lock. 2000-01-21 19:54:13 +00:00
mycroft
0b24b6555f Do the lock *after* checking that the fp is valid. 2000-01-21 19:53:02 +00:00
mycroft
442e96d230 Initialize f._file for locking primitives. 2000-01-21 19:51:36 +00:00
christos
fc1a83184b add and "f" flag to fopen that makes sure we are opening a plain file,
so that there is no chance to block.
2000-01-15 01:11:45 +00:00
explorer
5e5a72ffef missing ; 1999-11-14 18:19:57 +00:00
jdolecek
7d96f3efd3 xref symlink(7) 1999-09-26 21:00:25 +00:00
lukem
d896261208 back out the #ifdef _DIAGNOSTIC argument checks; too many people complained.
_DIAGASSERT() is still retained.
1999-09-20 04:38:56 +00:00
lukem
e0f82c3ae3 revert previous; if we examine SUS more closely we find that unless explictly specified, use of a NULL pointer is undefined 1999-09-17 13:03:46 +00:00
lukem
3471ac6647 return (0) if size or count == 0 before check for _DIAGASSERT(buf != NULL).
this is ok according to SUS.
1999-09-16 12:45:34 +00:00
lukem
b48252f365 * use _DIAGASSERT() to check pointer arguments against NULL and file
descriptors against -1 (as appropriate).
* add actual checks which to detect stuff that would trigger_DIAGASSERT(),
  and attempt to return a sane error condition.
* knf some code
* remove some `register' decls.

the first two items result in the addition of code similar to the
following in various functions:

		_DIAGASSERT(path != NULL)
	#ifdef _DIAGNOSTIC
		if (path == NULL) {
			errno = EFAULT;
			return (-1);
		}
	#endif
1999-09-16 11:44:54 +00:00
kleink
ddb97cdc5a No need for "namespace.h". 1999-08-22 12:52:28 +00:00
garbled
38c96853cf Last of the .Os cleanups. .Os is defined in the tmac.doc-common file,
so we shouldn't override it with versions in the manpages.  Wheee!
1999-03-22 19:44:33 +00:00
christos
1452d0f916 braces for gcc-2.8.1 1999-03-19 12:56:16 +00:00
christos
7d0129b726 include <fcntl.h> instead of <sys/file.h> 1999-03-19 12:55:52 +00:00
kleink
55cb8b09ce Functionally back out namespace.h revision 1.7 and perror.c revision 1.15;
perror() is an identifier reserved by ANSI/ISO C, and in case of a redefition
the behavior is undefined.
1999-03-09 13:14:36 +00:00
kleink
dde7993b2f Const poisoning. 1999-03-08 10:27:34 +00:00
kleink
d041717701 stderr is not always but initially unbuffered. 1999-01-28 20:25:32 +00:00
kleink
18949858f3 Per ANSI C, place the error message on the stderr stream rather than on
STDERR_FILENO.
1999-01-28 20:13:40 +00:00
kleink
3b7ac44e6c * Add const keywords to function arguments as appropriate.
* Clarify the description of the initial position of the stream (some confusion
  due to the way fdopen() was merged into a former ANSI-only document).
1999-01-12 15:27:28 +00:00
kleink
cb697ba0d0 When reopening in append mode, seek to the end of file in order to have the
internally kept offset pointer reflect this; ftell(3) would report an
incorrect current offset otherwise.  From Geoff C. Wing in lib/6381.
1999-01-06 13:57:14 +00:00
kleink
8e8595b01c Need to wrap stdio stream locking around the function body. On the bright
side, getchar_unlocked() can now be used instead of getchar().
1998-11-20 14:49:19 +00:00
kleink
71f3223468 Deploy stdio stream locking. 1998-11-20 14:44:14 +00:00
kleink
e0962e0eae Oops, don't need <errno.h> any more. 1998-11-18 21:13:46 +00:00
kleink
6de55982d6 * Wrap file locking around the function body in order to have fseek() and
clearerr() executed as a single unit.
* Remove clearing of errno; this fseek() error indicator must be visible to
  the caller.
1998-11-18 21:11:09 +00:00
christos
373acb7941 revert previous change; this reveals another bug in lints LINTED option. 1998-11-17 16:13:59 +00:00
christos
e7f7fdba9a delint 1998-11-15 17:19:53 +00:00
christos
d1d407360d This is ugly. There is a const castaway inside the print macro, so we cannot
use /* LINTED */ comments, since cpp will expand comments only at the macro
definition location, not at every expansion.
1998-11-15 17:19:05 +00:00
christos
6865d51c46 st_blksize cannot be negative 1998-11-15 17:16:27 +00:00
christos
56395b9694 change len from size_t to int so that len = fp->_r does not get promoted
to unsigned. cast len appropriately to size_t later.
1998-11-15 17:15:18 +00:00
kleink
56068ec670 Don't return immediately if EOF encountered while matching format string white
space in the input stream since there may be `conversion' specifiers following
the (format string) white space that do not operate on the input stream,
i.e. %n; from Chris Torek.
1998-10-25 18:25:43 +00:00
dbj
f9bda95727 Backed out previous fclose(NULL) change. 1998-10-18 23:48:18 +00:00
dbj
f8b2da8194 Fix pr lib/6322
fclose(NULL) used to segfault.  Now it returns EOF and sets errno to EBADF.
1998-10-18 19:27:33 +00:00
kleink
3e8c90f694 Replace use of getdtablesize() with (the non-deprecated) sysconf(), hence no
need for an internal name for the former any more; suggested by Matthew Green.
1998-10-18 13:56:21 +00:00
kleink
45f04f24af Need "namespace.h" for getdtablesize(). 1998-10-16 20:48:06 +00:00
kleink
73ef151b8c Need an internal name for fgetln(). 1998-10-16 12:39:54 +00:00
mycroft
ef3079f0ee Make sure we free the buffer in all error cases.
Do the final realloc(3) to the size of the string, not the size of the buffer
allocated for the string (which is a noop).
1998-10-15 07:36:09 +00:00
mycroft
285284da77 Allocate space exponentially, not linearly. 1998-10-15 07:10:38 +00:00
kleink
abc6d45e5c Need "namespace.h". 1998-10-14 11:56:28 +00:00
kleink
f5092a6c94 Need an internal name for isatty(). 1998-10-13 15:05:02 +00:00
kleink
d541ca6d80 Need internal names for isinf() and isnan(). 1998-10-13 14:43:36 +00:00
kleink
ee1afe8b7c Need internal names for snprintf() and vsnprintf(). 1998-10-13 14:19:21 +00:00
kleink
8b3da7b7a8 Need an internal name for fdopen(). 1998-10-13 14:07:04 +00:00
tv
ff03cd6580 Document %ll[diouxX] as requested by <bgrayson@ece.utexas.edu> in PR
standards/3527.  Also describe the argument to such a format as "quad_t",
not "quad int".
1998-09-14 21:10:18 +00:00
kleink
1d1861e253 Make the fseek() return value description match XSH5 (again). 1998-09-09 20:17:27 +00:00
kleink
36bf9c3062 Typo; from Michael Richardson <mcr@sandelman.ottawa.on.ca> in PR misc/6053. 1998-09-09 19:51:39 +00:00
kleink
127dfcd147 Since perror() must be reentrant, change the storage class of the buffer used
to hold the error message from static to automatic.
1998-09-09 12:15:55 +00:00
kleink
0cca1fcb27 Perform stdio stream locking as appropriate. 1998-09-09 12:08:05 +00:00
kleink
96deb0c4ec s/c_plusplus/__cplusplus/ 1998-09-08 15:10:12 +00:00
kleink
83d4043d4c s/NULL/NUL/ where appropriate. 1998-09-08 14:13:36 +00:00
kleink
100b813fad Deploy stdio stream locking as necessary. 1998-09-07 14:37:13 +00:00
kleink
caa80a1e72 Sloppy stdio stream lock tracking. 1998-09-07 14:31:57 +00:00
kleink
18a528c1cf Minor KNF nit. 1998-09-07 14:22:30 +00:00
kleink
77c6af31c7 Sloppy stdio stream lock tracking. 1998-09-06 16:37:27 +00:00
perry
315aabd347 make sure asprintf and vasprintf get MLINKS to printf.3 1998-08-30 23:29:18 +00:00
lukem
ce83c69e00 first pass at fixing up capitalization of function names and
arguments; ensure that each is correct with respect to the
implementation, rather than being correct as per english.
1998-08-29 08:32:32 +00:00
perry
05ffc15e02 document asprintf and vasprintf 1998-08-28 22:21:23 +00:00
perry
253ef37df2 add asprintf and vasprintf, originally written by Todd Miller for OpenBSD 1998-08-28 21:33:10 +00:00
mycroft
0816a4773b Update the date on this man page. 1998-07-28 17:11:12 +00:00
mycroft
f1f53ef7e8 Add an internal name for perror(3). 1998-07-28 12:22:31 +00:00
mycroft
0bbc075c20 Document mkdtemp(3). 1998-07-27 16:41:40 +00:00
mycroft
90cb894b40 Mention mkdtemp() in the warnings. 1998-07-27 16:39:11 +00:00
mycroft
cbb3325e89 Actually, FreeBSD calls this mkdtemp(). No point in creating a new name. 1998-07-27 16:12:01 +00:00
mycroft
7daf213c0f Add a mktempdir(), like mkstemp(), but it creates a directory. 1998-07-27 16:05:07 +00:00
mycroft
1b5106953f Delint (partially). 1998-07-27 14:04:01 +00:00
mycroft
201e4eaca0 If AUDIT, do not compile certain functions. 1998-07-27 13:42:27 +00:00
mycroft
c427e33070 If AUDIT, do not compile certain functions. 1998-07-27 13:36:43 +00:00
mycroft
c18a540460 Minor nit. 1998-07-26 13:55:44 +00:00
mycroft
eb69773cbb const poisoning. 1998-07-26 13:51:44 +00:00
mycroft
dae9fd960e const poisoning. 1998-07-26 12:35:24 +00:00
mycroft
be9c427d60 const poisoning. 1998-07-26 12:29:33 +00:00
jeremy
20de71c33e Changed HISTORY section to reflect that vsnprintf and snprintf first
appeared in 4.4BSD, rather than ``the current release''.
1998-06-08 23:45:37 +00:00
lukem
fc90756956 Implement a new manual page category ``SECURITY CONSIDERATIONS''
(suggested by mycroft)
1998-06-08 12:41:41 +00:00
kleink
01709792a9 Need <stdlib.h> for mkstemp() prototype. 1998-06-01 20:19:46 +00:00
kleink
c1d274c3ee Need <stdlib.h> for mkstemp() and mktemp() prototypes. 1998-06-01 20:17:50 +00:00
kleink
4c4cda3733 Prototypes have moved: change inclusion of <unistd.h> to <stdlib.h>. 1998-06-01 20:16:37 +00:00
fair
a27dd1341b "System V" -> ".At V" 1998-04-28 20:59:29 +00:00
fair
8e1d7f3de1 fix mdoc references and other mistakes 1998-04-28 20:58:00 +00:00
fair
dc026e0515 Change occurrences of "UNIX" to .Ux or .At as appropriate. 1998-04-28 06:00:51 +00:00
lukem
c197a64bba don't assume buf is NL_TEXTMAX long 1998-02-16 11:27:15 +00:00
perry
312aca536f add LIBRARY section to man page 1998-02-05 18:45:17 +00:00
perry
a16d9e868b .Bx'ize 1998-02-03 21:42:54 +00:00
perry
c8bafd6265 remove obsolete register declarations 1998-02-03 18:38:12 +00:00
mycroft
704290aaa1 Deal with GCC warning. 1998-02-03 01:40:49 +00:00
perry
3da5be9552 merge lite-2 1998-02-02 03:32:51 +00:00
jtc
a1de770ebd Use rwlocks as appropriate. 1998-01-22 08:21:45 +00:00
jtc
b559f98b9b Use FLOCKFILE() and FUNLOCKFILE() macros from reentrant.h so that stdio
can be made thread-safe.
1998-01-22 06:35:01 +00:00
jtc
da2013ac86 Use FLOCKFILE() and FUNLOCKFILE() macros from reentrant.h so that stdio
can be made thread-safe.
1998-01-19 07:38:41 +00:00
kleink
f47d490f87 Change several functions to return -1 instead of EOF, which was semantically
wrong.
1997-12-19 14:08:41 +00:00
mrg
4e252e8c4d add missing .Nm entries. from spz@serpens.swb.de. 1997-11-14 02:04:36 +00:00
thorpej
2a43f22095 __warn_references and __indr_reference semicolon fixups. From
Chris Demetriou <cgd@pa.dec.com>.
1997-11-04 23:52:05 +00:00
lukem
d0e23d974a - use CPPFLAGS instead of CFLAGS
- use ${COMPILE.C} ... instead of ${CC} ${CFLAGS} -c ...
1997-10-22 23:14:04 +00:00
mycroft
15de1c9fd2 Use S_IS*(), not S_IF*. 1997-10-19 17:54:18 +00:00
mycroft
3c891ba5b1 Fix a bizarre formatting error. 1997-10-14 07:27:57 +00:00
hubertf
26f31c2590 Partly backing out last change, only leaving lstat() instead of stat().
Pointed out by Enami Tsugutomo <enami@but-b.or.jp>.
1997-10-07 00:02:44 +00:00
hubertf
681b2f48bc remove(3) doesn't remove dangling links due to stat() returning an
error. Now try lstat() before really aborting.
OK'd by thorpej.
1997-10-06 00:28:14 +00:00
phil
a25ce426d4 Remove the flag test when seeing if _double is zero or not. We
are only testing for the cvt problem, not for alternate forms.
This change makes %#e and %e both correctly print 0.  It is just
a question of is it the proper number of zeros or not?
1997-08-29 05:31:11 +00:00
kleink
c213a3af8b Add missing `STANDARDS' compliance statements. As we #define _POSIX_VERSION
to 199009L, bump existing statements to 1003.1-1990.
1997-07-14 23:19:39 +00:00
christos
0c339c443a Fix RCSID's
Fix gcc warnings.
Add prototypes for functions that were declared in more than one place
to local.h or extern.h and use that instead.
1997-07-13 20:15:17 +00:00
christos
23312f88d4 Fix RCSID's
Fix gcc warnings.
Add prototypes for functions that were declared in more than one place
to local.h or extern.h and use that instead.
1997-07-13 20:14:49 +00:00
phil
4de11835a6 Modify to have _gettemp generate different names on repeated calls even if the
file was not created.  Tempnam modified to make use of full possibilities.
1997-07-07 17:47:00 +00:00
kleink
72a0532ba2 Add an Xref to rmdir(2). 1997-06-03 22:28:25 +00:00
kleink
5ddc3f534d Always use rmdir(2) to remove a directory, as the file system may prohibit
using unlink(2) on directories.
1997-06-03 22:26:38 +00:00