diff options
author | ache <ache@FreeBSD.org> | 1999-10-24 03:42:35 +0000 |
---|---|---|
committer | ache <ache@FreeBSD.org> | 1999-10-24 03:42:35 +0000 |
commit | c594629213790c0e8db9fa5de9cf030e3dea312d (patch) | |
tree | 66066db5eeff4232131bd5e16af11cf52ec49a20 /usr.bin/comm | |
parent | 16d1a2d1fdb76b9b3453b09697adbe3e18254169 (diff) | |
download | FreeBSD-src-c594629213790c0e8db9fa5de9cf030e3dea312d.zip FreeBSD-src-c594629213790c0e8db9fa5de9cf030e3dea312d.tar.gz |
Localize it
PR: 11221
Submitted by: Grigoriy Strokin <grg@philol.msu.ru>
Diffstat (limited to 'usr.bin/comm')
-rw-r--r-- | usr.bin/comm/comm.c | 21 |
1 files changed, 19 insertions, 2 deletions
diff --git a/usr.bin/comm/comm.c b/usr.bin/comm/comm.c index 25e0f2f..28e6bd7 100644 --- a/usr.bin/comm/comm.c +++ b/usr.bin/comm/comm.c @@ -48,9 +48,11 @@ static const char rcsid[] = "$FreeBSD$"; #endif /* not lint */ +#include <ctype.h> #include <err.h> #include <errno.h> #include <limits.h> +#include <locale.h> #include <stdio.h> #include <stdlib.h> #include <string.h> @@ -64,6 +66,19 @@ FILE *file __P((char *)); void show __P((FILE *, char *, char *)); static void usage __P((void)); +int stricoll(char *s1, char *s2) +{ + char *p, line1[MAXLINELEN], line2[MAXLINELEN]; + + for (p = line1; *s1; s1++) + *p++ = toupper((unsigned char)*s1); + *p = '\0'; + for (p = line2; *s2; s2++) + *p++ = toupper((unsigned char)*s2); + *p = '\0'; + return strcoll(s1, s2); +} + int main(argc, argv) int argc; @@ -78,6 +93,8 @@ main(argc, argv) flag1 = flag2 = flag3 = 1; iflag = 0; + (void) setlocale(LC_CTYPE, ""); + while ((ch = getopt(argc, argv, "-123i")) != -1) switch(ch) { case '-': @@ -139,9 +156,9 @@ done: argc -= optind; /* lines are the same */ if(iflag) - comp = strcasecmp(line1, line2); + comp = stricoll(line1, line2); else - comp = strcmp(line1, line2); + comp = strcoll(line1, line2); if (!comp) { read1 = read2 = 1; |