summaryrefslogtreecommitdiff
path: root/usr.bin/uniq
diff options
context:
space:
mode:
authorAndrey A. Chernov <ache@FreeBSD.org>1999-10-24 04:08:15 +0000
committerAndrey A. Chernov <ache@FreeBSD.org>1999-10-24 04:08:15 +0000
commitc02e58945605ff5dee2cd0eb4d94197ddf2a3b27 (patch)
treebeff96405c5712499c0ccc633aff03bfd7f4958e /usr.bin/uniq
parent2c2b14e1624e218fdbe60bf75d78e91fe11e99b8 (diff)
downloadsrc-test2-c02e58945605ff5dee2cd0eb4d94197ddf2a3b27.tar.gz
src-test2-c02e58945605ff5dee2cd0eb4d94197ddf2a3b27.zip
Notes
Diffstat (limited to 'usr.bin/uniq')
-rw-r--r--usr.bin/uniq/uniq.c20
1 files changed, 17 insertions, 3 deletions
diff --git a/usr.bin/uniq/uniq.c b/usr.bin/uniq/uniq.c
index 0cc7977bbaf7..11f5ea538acf 100644
--- a/usr.bin/uniq/uniq.c
+++ b/usr.bin/uniq/uniq.c
@@ -50,13 +50,14 @@ static const char rcsid[] =
#include <ctype.h>
#include <err.h>
+#include <limits.h>
#include <locale.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <unistd.h>
-#define MAXLINELEN (8 * 1024)
+#define MAXLINELEN (LINE_MAX + 1)
int cflag, dflag, uflag;
int numchars, numfields, repeats;
@@ -67,6 +68,19 @@ char *skip __P((char *));
void obsolete __P((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;
@@ -160,9 +174,9 @@ done: argc -= optind;
/* If different, print; set previous to new value. */
if (iflag)
- comp = strcasecmp(t1, t2);
+ comp = stricoll(t1, t2);
else
- comp = strcmp(t1, t2);
+ comp = strcoll(t1, t2);
if (comp) {
show(ofp, prevline);