aboutsummaryrefslogtreecommitdiff
path: root/coreutils/uniq.c
diff options
context:
space:
mode:
Diffstat (limited to 'coreutils/uniq.c')
-rw-r--r--coreutils/uniq.c10
1 files changed, 8 insertions, 2 deletions
diff --git a/coreutils/uniq.c b/coreutils/uniq.c
index be550b5cd..1c23e1d08 100644
--- a/coreutils/uniq.c
+++ b/coreutils/uniq.c
@@ -54,12 +54,13 @@ int uniq_main(int argc UNUSED_PARAM, char **argv)
54 OPT_f = 0x8, 54 OPT_f = 0x8,
55 OPT_s = 0x10, 55 OPT_s = 0x10,
56 OPT_w = 0x20, 56 OPT_w = 0x20,
57 OPT_i = 0x40,
57 }; 58 };
58 59
59 skip_fields = skip_chars = 0; 60 skip_fields = skip_chars = 0;
60 max_chars = INT_MAX; 61 max_chars = INT_MAX;
61 62
62 opt = getopt32(argv, "cduf:+s:+w:+", &skip_fields, &skip_chars, &max_chars); 63 opt = getopt32(argv, "cduf:+s:+w:+i", &skip_fields, &skip_chars, &max_chars);
63 argv += optind; 64 argv += optind;
64 65
65 input_filename = argv[0]; 66 input_filename = argv[0];
@@ -106,7 +107,12 @@ int uniq_main(int argc UNUSED_PARAM, char **argv)
106 ++cur_compare; 107 ++cur_compare;
107 } 108 }
108 109
109 if (!old_line || strncmp(old_compare, cur_compare, max_chars)) { 110 if (!old_line)
111 break;
112 if ((opt & OPT_i)
113 ? strncasecmp(old_compare, cur_compare, max_chars)
114 : strncmp(old_compare, cur_compare, max_chars)
115 ) {
110 break; 116 break;
111 } 117 }
112 118