cvs commit: src/sys/compat/ndis subr_ndis.c src/sys/dev/if_ndis
if_ndis.c
Bruce Evans
bde at zeta.org.au
Sun May 30 23:31:33 PDT 2004
On Sun, 30 May 2004, Nate Lawson wrote:
> While we're at it, two from acpi:
> /* FreeBSD doesn't have strupr, should be fixed. (move to libkern) */
> static __inline char *
> strupr(char *str)
> {
> char *c = str;
> while(*c) {
> *c = toupper(*c);
> c++;
> }
> return(str);
> }
libc doesn't seem to have this, but if it did then it would have a version
without so many style bugs. FreeBSD userland seems to only have it in
libroken. Why would the kernel need it more than libc?
> #ifdef _KERNEL
> /* Or strstr (used in debugging mode, also move to libkern) */
> static __inline char *
> strstr(char *s, char *find)
> {
> char c, sc;
> size_t len;
>
> if ((c = *find++) != 0) {
> len = strlen(find);
> do {
> do {
> if ((sc = *s++) == 0)
> return (NULL);
> } while (sc != c);
> } while (strncmp(s, find, len) != 0);
> s--;
> }
> return ((char *)s);
> }
> #endif /* _KERNEL */
libc already has a version of this without so many bugs and style bugs.
The above is was apparently obtained from rev.1.1 of libc/string/strstr.c
(its only differences are "static __inline", de-register'ing and format
mangling). The libc version has since caught up with the 1980's and
uses "const".
Bruce
More information about the cvs-src
mailing list