Commit Graph

173 Commits

Author SHA1 Message Date
Tim J. Robbins
edafcb6d73 Add a Standards section, claiming conformance to IEEE Std. 1003.1-2001.
Also add a note to the Bugs section pointing out that strerror() and
perror() share the same static buffer.
2002-10-23 10:16:21 +00:00
Dag-Erling Smørgrav
02edf2208d Translate to English. 2002-10-23 08:55:14 +00:00
Tim J. Robbins
4bf546e192 Replace this wcsncpy() implementation with one based on strncpy.c to fix
two major bugs:
- off-by-one overflow when the length of the source string exceeds or
  equals the destination buffer size.
- old version was not padding the destination buffer with null wide chars
2002-10-23 04:35:25 +00:00
Tim J. Robbins
f7383f14ae C89 does not specifiy strsep(), so our strsep() implementation cannot
conform to it.

Obtained from:	OpenBSD
2002-10-19 13:41:22 +00:00
Tim J. Robbins
2fe3e5cda7 Add cross-references to the wide character counterparts of these functions. 2002-10-15 10:11:53 +00:00
Tim J. Robbins
616e099e5c Remove stray comma at the end of the See Also list. 2002-10-15 09:49:54 +00:00
Robert Drehmel
5d38e85ded Fix another spelling mistake. 2002-10-10 14:16:08 +00:00
Robert Drehmel
73fbee5795 Correct a spelling mistake. 2002-10-10 14:14:44 +00:00
Tim J. Robbins
fd4f1dd9fa Add a placeholder implementation of wcscoll() and wcsxfrm() which gives
locale-sensitive collation only in single-byte locales, and just does
binary comparison for the others with extended character sets.
2002-10-04 03:18:26 +00:00
David E. O'Brien
8269e8c887 Add stpcpy(3). 2002-10-03 19:39:20 +00:00
Tim J. Robbins
61d7477610 Add an example showing how to use wcstok(). Fix ordering of See Also section. 2002-10-02 14:28:26 +00:00
Tim J. Robbins
ce2a18008c Simplify by removing unneeded local variables and explicit null termination. 2002-09-26 09:28:55 +00:00
Tim J. Robbins
e2361b6f16 Simplify by removing useless local variables and explicit null termination. 2002-09-26 09:23:07 +00:00
Tim J. Robbins
99330f8368 Remove unnecessary #include <assert.h>; it was used to bring in the
_DIAGASSERT macro on NetBSD, but we don't need it.
2002-09-21 00:29:23 +00:00
Tim J. Robbins
8e4365cf75 Replace a stray reference to strtok() with one to wcstok(). 2002-09-08 11:09:24 +00:00
Tim J. Robbins
9ad391340e Add an implementation of wcstok(), based on strtok_r(). 2002-09-07 08:16:57 +00:00
Tim J. Robbins
85adcfc150 Sync prototypes with <wchar.h> with respect to the restrict qualifier. 2002-09-07 04:07:00 +00:00
Tim J. Robbins
9c261371ec Add restrict qualifiers where C99 permits them. All of these already had
restrict qualifiers on their prototypes in <wchar.h>.
2002-09-07 04:03:28 +00:00
Tim J. Robbins
91bd11ad84 Call strtok_r() via a libc private name from within strtok(). 2002-09-07 02:53:19 +00:00
Tim J. Robbins
58d38e2520 Style: One space between "restrict" qualifier and "*". 2002-09-06 11:24:06 +00:00
Robert Drehmel
bc0ad8e7a1 - Let their manual pages show the reader that the bzero(3) and
bcopy(3) functions are prototyped in <strings.h> and not in
   <string.h> anymore.
 - Add a sentence about that to the respective HISTORY sections.
In the C source files:
 - Include <string.h> or <strings.h> depending on what function
   is to be compiled.
 - Use ANSI-C function definitions.
2002-09-01 21:53:46 +00:00
Robert Drehmel
2f4772b37f Add the 'restrict' type qualifier to the function prototype
of the swab(3) function in its manual page to match the
standardization by POSIX.1-2001.
2002-08-30 21:18:39 +00:00
Robert Drehmel
9abf5797a0 - Update the manual page of bcmp(3) by replacing
.In string.h
   with
     .In strings.h
   and adding a sentence to the HISTORY section.
 - Use an ANSI-C function definition.
 - Include <strings.h> instead of <string.h>.
 - Apply style(9): Put a space after return keywords.
2002-08-30 21:07:40 +00:00
Robert Drehmel
c9ab23eea5 - Convert the function definition to declare its arguments
in the ANSI-C format.
 - Change the code a bit to hopefully save some cycles.
   I.e. (simplified) change

     a = b + 1;
     while (--b & 0x7)
	/* ... */
   to
     a = b;
     for (; b & 0x7; b--)
	/* ... */
   and
     while (--a >= 0)
	/* ... */
   to
     for (; a > 0; a--)
	/* ... */
 - Equip two function arguments of swab() with the 'restrict'
   type qualifier in form of the '__restrict' macro.  This is
   specified by POSIX.1-2001.
2002-08-30 20:33:05 +00:00
Robert Drehmel
425289a9db - Update the manual pages of index() and rindex() to show
<strings.h> as the associated header file.
   The prototypes have been moved there from <string.h> because
   POSIX.1-2001 said so.
 - Conditionally include either <strings.h> or <string.h> based
   on whether the [r]index() or str[r]chr() functions are
   compiled, respectively.
 - Style(9) tells us to
    - put a space after the return keyword
    - to check for a NUL character without using the ! operator.
    - use NULL instead of (type *)NULL where the compiler knows
      the type.
   Apply these rules.
 - Rather use ANSI-C function definitions than K&R ones.
 - For index(3), correct second function argument's type; it was
   declared to be a `const char' before and is now an `int'.
2002-08-30 19:42:07 +00:00
Robert Drehmel
554331bbb9 - Update the manual page to show that the associated header file
is <strings.h> and not <string.h> anymore.
 - Tell the reader about this change in the HISTORY section.
 - Switch to use an ANSI-C function definition.
 - Include <strings.h> instead of <string.h> in the source file.
2002-08-30 19:08:53 +00:00
Robert Drehmel
c271a3613c - Update strcasecmp(3)/strncasecmp(3) to reflect the fact that
the prototypes for both functions are now in the <strings.h>
   header, as required by IEEE Std 1003.1-2001.
 - Add one sentence about that in the HISTORY section.
 - Include <strings.h> in the source file to have the prototypes
   in scope when the _ANSI_SOURCE macro is defined.
2002-08-30 15:40:01 +00:00
Tim J. Robbins
c8e804757d Add a manual page for wcswidth(). 2002-08-20 03:40:45 +00:00
Andrey A. Chernov
353450fbbe Move just committed version of wcswidth.c here (from "locale"),
a bit optimized now.
2002-08-20 02:06:28 +00:00
Robert Drehmel
ad90696815 - Add the 'restrict' qualifier to the definitions of the string
concatenation and copy functions using the '__restrict' macro.
   This is to satisfy IEEE Std 1003-1.2001.
 - Use ANSI-C function definitions.
 - Add the 'restrict' keyword to the manual pages, too.
2002-08-14 22:59:22 +00:00
Robert Drehmel
33f9b60eee - Add the 'restrict' qualifier required by IEEE Std 1003.1-2001
to the function definition of strxfrm(3) in form of our
   '__restrict' macro.
 - Use an ANSI-C function definition for strxfrm(3).
 - Change the manual page accordingly.
2002-08-14 21:01:04 +00:00
Archie Cobbs
a8ee7a0256 Correct an inaccuracy in this man page regarding detecting empty fields.
MFC after:	2 days
2002-08-07 20:08:50 +00:00
Jonathan Mini
16f33a4885 Fix off-by-one error.
PR:		misc/40104
Submitted by:	Neal Fachan <neal@isilon.com>
MFC after:	3 days
2002-07-03 06:28:04 +00:00
David E. O'Brien
333fc21e3c Fix the style of the SCM ID's.
I believe have made all of libc .c's as consistent as possible.
2002-03-22 21:53:29 +00:00
David E. O'Brien
8fb3f3f682 Remove 'register' keyword. 2002-03-21 18:49:23 +00:00
Chris D. Faulhaber
ea018aa260 Revert last commit. stdio.h include is for perror(), not strerror() 2002-01-31 13:32:14 +00:00
Chris D. Faulhaber
066f7169c1 strerror(3) is in string.h, not stdio.h
MFC after:	1 week
2002-01-31 13:20:48 +00:00
Mike Barcroft
4681597d9a Add a few cleanups from rev 1.1:
o Restore vendor ID.
o Order variable types by size.
o Remove a gratuitous temporary variable.

Submitted by:	bde
2002-01-15 17:52:21 +00:00
Mike Barcroft
1936b2c83b o Add prototype for printf(3).
style(9):
o Order variables in declarations.
o Move initialization out of declaration.
o Fix over-indents in previous delta.
2002-01-15 08:50:28 +00:00
Mike Barcroft
f601b5ba4b style(9)
Submitted by:	Joseph Mallett <jmallett@xmach.org>
Reviewed by:	md5(1)
2002-01-15 08:26:58 +00:00
Ruslan Ermilov
ce9df6eefc mdoc(7) police:
Stop abusing the .%J macro for where the .Pa macro should have been used.
2002-01-09 14:01:22 +00:00
Dima Dorfman
b06e8b97a9 Suggest using memmove(3) if src and dst may overlap.
PR:		33298
Submitted by:	Tim J. Robbins <tim@robbins.dropbear.id.au>
2002-01-07 06:03:37 +00:00
Chris Costello
41f91cb492 Add a new `SECURITY CONSIDERATIONS' section. Sample code similar to
the first revision of strcpy(3)'s section is included, but should be
removed as the Security Architecture document is committed and
completed.

Obtained from:	TrustedBSD Project
Sponsored by:	DARPA, NAI Labs
2002-01-05 20:44:34 +00:00
Chris Costello
80080d642e Include a section cross-reference to EXAMPLES' in SECURITY
CONSIDERATIONS' as a source for relevant sample code.

Obtained from:	TrustedBSD Project
Sponsored by:	DARPA, NAI Labs
2002-01-05 20:36:47 +00:00
Chris Costello
8680aaea87 Remove the example from SECURITY CONSIDERATIONS. This is mostly
duplicated code from EXAMPLES.

Obtained from:	TrustedBSD Project
Sponsored by:	DARPA, NAI Labs
2002-01-05 20:24:38 +00:00
Chris Costello
17dc85f4d0 Copy the sample `SECURITY CONSIDERATIONS' section from sec-doc.7.
This will be trimmed as the FreeBSD Security Architecture document
is fleshed out and committed.

Obtained from:	TrustedBSD Project
Sponsored by:	DARPA, NAI Labs
2002-01-02 19:56:57 +00:00
Ruslan Ermilov
6184d98a2a mdoc(7) police: minor markup nits. 2001-12-12 15:02:32 +00:00
Wes Peters
556f162ac0 Make strerror and strerror_r use sys_errlist[0] for errnum = 0. Be
more careful about reporting truncation with ERANGE in strerror_r.
Set errno to EINVAL for "unknown" errnum in strerror as required
by P1003.1-200x Draft June 14, 2001.

More carefully document the handling of strerrbuf when errors
(ERANGE, EINVAL) are encountered in strerror_r.

Reviewed by:	bde (ongoing discussion)
2001-12-07 06:28:58 +00:00
Wes Peters
f61a2ede84 New, improved, more Posix-compliant strerror_r implementation,
complete with documentation.

Reviewed by:	mike@ gad@
MFC after:	1 week
2001-12-06 04:53:31 +00:00
Wes Peters
4f7d6d65dc Must link strerror manpage to strerror_r.
Thanks for the review, Mike.

Submitted by:	Mike Barcroft <mike@FreeBSD.org>
2001-11-27 07:57:31 +00:00