mirror of
https://git.FreeBSD.org/src.git
synced 2024-12-16 10:20:30 +00:00
Compare lines with strcmp(), not strcoll(). We are interested only in
equality, not ordering.
This commit is contained in:
parent
6a8be5c4f2
commit
5935c07540
Notes:
svn2git
2020-12-20 02:59:44 +00:00
svn path=/head/; revision=97906
@ -67,7 +67,6 @@ void show(FILE *, char *);
|
||||
char *skip(char *);
|
||||
void obsolete(char *[]);
|
||||
static void usage(void);
|
||||
int stricoll(char *, char*);
|
||||
|
||||
int
|
||||
main (argc, argv)
|
||||
@ -152,9 +151,9 @@ main (argc, argv)
|
||||
|
||||
/* If different, print; set previous to new value. */
|
||||
if (iflag)
|
||||
comp = stricoll(t1, t2);
|
||||
comp = strcasecmp(t1, t2);
|
||||
else
|
||||
comp = strcoll(t1, t2);
|
||||
comp = strcmp(t1, t2);
|
||||
|
||||
if (comp) {
|
||||
show(ofp, prevline);
|
||||
@ -252,18 +251,3 @@ usage()
|
||||
"usage: uniq [-c | -d | -u] [-i] [-f fields] [-s chars] [input [output]]\n");
|
||||
exit(1);
|
||||
}
|
||||
|
||||
int
|
||||
stricoll(s1, s2)
|
||||
char *s1, *s2;
|
||||
{
|
||||
char *p, line1[MAXLINELEN], line2[MAXLINELEN];
|
||||
|
||||
for (p = line1; *s1; s1++)
|
||||
*p++ = tolower((unsigned char)*s1);
|
||||
*p = '\0';
|
||||
for (p = line2; *s2; s2++)
|
||||
*p++ = tolower((unsigned char)*s2);
|
||||
*p = '\0';
|
||||
return strcoll(line1, line2);
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user