master
Add wcsnlen(3), wcslen(3) with a max len argument
Document that these functions are now in strings.h.
Add framework for resolving (pun intended) libc namespace issues, using wrapper .h files and asm labels to let internal calls resolve directly and not be overridable or use the PLT. Then, apply that framework to most of the functions in stdio.h, string.h, err.h, and wchar.h. Delete the should-have-been-hidden-all-along _v?(err|warn)[cx]? symbols while here.
Add STANDARDS: denis@ spotted that it was missing. OK deraadt@ jca@ jmc@
adapt to bitstring(3) renaming, and look at that bit_ffs(3) is the actual name we want to Xr... ok jmc
Instead of trying to handle ffs() with the normal rename-mark-hidden-and-alias dance, mark it protected. This works better for both gcc and clang: gcc blocks overriding of internal calls, while clang permits inlining again.
appeared in 4.3BSD before 4.3BSD-Tahoe ok millert@ schwarze@
clang doesn't propagate attributes like "asm labels" and "visibility(hidden)" to builtins like mem{set,cpy,move} and __stack_smash_handler. So, when building with clang, instead mark those as protected visibility to get rid of the PLT relocations. We can't take the address of them then, but that's ok: it's a build-time error not a run-time error.
The mdoc(7) .Ft macro does not need quoting of its arguments, but about 10% of our manual pages using this macro employed useless quoting anyway. Remove these quotes such that they do not incite fear, uncertainty, and doubt in developers who happen to look at these pages. jmc@ and tb@ agree with the direction.
Replace the simple memmem() implementation with a version that is O(n) based on code from musl and now similar to our strstr(). OK tb@ millert@
Use the fancy .In macro for includes. From Jan Klemkow. ok jmc schwarze
I am retiring my old email address; replace it with my OpenBSD one.
in HISTORY, say where this actually came from; ok deraadt@ bentley@
GNU ld has prefixed the contents of .gnu.warning.SYMBOL sections with "warning: " since 2003, so the messages themselves need not contain the prefix anymore.
New POSIX xlocale implementation written from scratch. Complete in the sense that all POSIX *locale(3) and *_l(3) functions are included, but in OpenBSD, we of course only really care about LC_CTYPE and we only support ASCII and UTF-8.
libc string functions were not ported from pwb to v7
As per POSIX, when str{,r}chr is comparing it should convert c to a char.
Improve the description of locale dependency: * mention LC_COLLATE; * clarify that all these functions are infested, including the *_l() versions; * avoid ENVIRONMENT, these functions don't inspect it; * and point to the C library functions that change the locale. OK millert@
Phrase allocation failure more clearly. ok deraadt@
More consistently put remarks about the less useful LC_* categoties, i.e. those other than LC_CTYPE, into the CAVEATS section, and standardize wording somewhat. OK jmc@
Remove the save_errno dance inside strerror_r(3). It is from the time when we had national language support. OK millert@
The improbable occurred: strlcpy(3) and strlcat(3) are in POSIX-2024. memmem(3) was also added. Update #include visibility and manpages and add restrict qualifiers.
strlen was in v6 libc (s5/perror.c) but not documented till v7 ok schwarze@
void functions don't return 0
strmode takes a mode_t, not an int; prompted by Collin Funk. ok kettenis@ deraadt@ tb@
tweak previous;
Use somewhat harsher language and better examples; demonstrate that non-dangerous use functions is difficult. ok guenther
__strsignal() is now declared in hidden/signal.h
Add RETURN VALUES section and .Xr to memmem(3). From Michal Mazurek <akfaew at jasminek dot net>. OK tedu@
Resync our strstr.c with the musl version. Removes some debug code and optimizes one statement in two-way string compare. OK tb@ millert@
use Fn rather than Nm for swab(); from josiah frentsos
update swab() to match the current posix definition. "rationale: none." rewrite the function to be simpler as well. the compiler can unroll the loop for us if necessary. ok schwarze
loosen the spec for timingsafe functions slightly, so as to not artificially constrain alternative implementations. ok deraadt
Wrap <inttypes.h> and finish wrapping of <wchar.h> so that calls go direct and the symbols not in the C standard are weak
Eliminate the last of the LINTEDn and PRINTFLIKEn comments. In one case, by deleting some useless '& of an array' we also eliminate the need for the casts which prompted the original lint warnings
the referred to EXAMPLES section is now in strncpy(3); issue reported by scott cheloha
update HISTORY and SEE ALSO for all of string(3), together with various smaller improvements; jmc@ and nicm@ both ask me to get this in because further tweaking will be easier in-tree
wcslcpy() and wcslcat() are in POSIX-2024. Update #include visibility and manpages and add restrict qualifiers.
zap remaining rcsid.
Import w* functions so that I can send smaller diffs around.