diff options
author | ache <ache@FreeBSD.org> | 1996-08-13 17:03:18 +0000 |
---|---|---|
committer | ache <ache@FreeBSD.org> | 1996-08-13 17:03:18 +0000 |
commit | 3ba537ecfe2ab1290c1a9710fd0766979614ce7a (patch) | |
tree | ac378725cfdd0263fb218296c9c0d68e408c1e7a /lib/libc/string | |
parent | 5353c9c28576d84c8560a7c6a4bdedead2448d47 (diff) | |
download | FreeBSD-src-3ba537ecfe2ab1290c1a9710fd0766979614ce7a.zip FreeBSD-src-3ba537ecfe2ab1290c1a9710fd0766979614ce7a.tar.gz |
Back out fallback approximation changes, they are not so right to live
Diffstat (limited to 'lib/libc/string')
-rw-r--r-- | lib/libc/string/strcoll.3 | 11 | ||||
-rw-r--r-- | lib/libc/string/strcoll.c | 22 | ||||
-rw-r--r-- | lib/libc/string/strxfrm.c | 22 |
3 files changed, 15 insertions, 40 deletions
diff --git a/lib/libc/string/strcoll.3 b/lib/libc/string/strcoll.3 index c81762e..08f48ad 100644 --- a/lib/libc/string/strcoll.3 +++ b/lib/libc/string/strcoll.3 @@ -53,10 +53,13 @@ lexicographically compares the null-terminated strings .Fa s1 and .Fa s2 -according to the current locale collation if any, otherwise some -approximation procedure is used based on available -.Xr ctype 3 -information. +according to the current locale collation if any, otherwise call +.Fa strcmp , +and returns an integer greater than, equal to, or less than 0, +according as +.Fa s1 +is greater than, equal to, or less than +.Fa s2 . .Sh SEE ALSO .Xr setlocale 3 , .Xr strcmp 3 , diff --git a/lib/libc/string/strcoll.c b/lib/libc/string/strcoll.c index 405a78b..b916913 100644 --- a/lib/libc/string/strcoll.c +++ b/lib/libc/string/strcoll.c @@ -24,12 +24,11 @@ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * SUCH DAMAGE. * - * $Id: strcoll.c,v 1.5 1996/06/09 14:56:06 ache Exp $ + * $Id: strcoll.c,v 1.6 1996/07/12 18:55:38 jkh Exp $ */ #include <stdlib.h> #include <string.h> -#include <ctype.h> #include "collate.h" int @@ -39,23 +38,8 @@ strcoll(s, s2) int len, len2, prim, prim2, sec, sec2, ret, ret2; char *tt, *t, *tt2, *t2; - if (__collate_load_error) { - register const u_char - *us1 = (const u_char *)s, - *us2 = (const u_char *)s2; - - while (tolower(*us1) == tolower(*us2)) { - if (*us1 == '\0') - return (0); - if (isupper(*us1) && islower(*us2)) - return (-1); - else if (islower(*us1) && isupper(*us2)) - return (1); - us1++; - us2++; - } - return (tolower(*us1) - tolower(*us2)); - } + if (__collate_load_error) + return strcmp(s, s2); len = len2 = 1; ret = ret2 = 0; diff --git a/lib/libc/string/strxfrm.c b/lib/libc/string/strxfrm.c index 236c3ac..6031674 100644 --- a/lib/libc/string/strxfrm.c +++ b/lib/libc/string/strxfrm.c @@ -29,7 +29,6 @@ #include <stdlib.h> #include <string.h> -#include <ctype.h> #include "collate.h" size_t @@ -51,25 +50,14 @@ strxfrm(dest, src, len) if (__collate_load_error) { size_t slen = strlen(src); - u_char *us; - if (slen < len) + if (slen < len) { strcpy(d, src); - else { - slen = len - 1; - strncpy(d, src, slen); - d[slen] = '\0'; + return slen; } - for (us = d; *us; us++) { - if (isupper(*us)) { - if (tolower(*us) < *us) - *us = tolower(*us) - 1; - /* assume it not started from 0 */ - else - *us = tolower(*us); - } - } - return slen; + strncpy(d, src, len - 1); + d[len - 1] = '\0'; + return len - 1; } ss = s = __collate_substitute(src); |