OpenCoverage

uniq.c

Absolute File Name:/home/opencoverage/opencoverage/guest-scripts/coreutils/src/src/uniq.c
Source codeSwitch to Preprocessed file
LineSourceCount
1/* uniq -- remove duplicate lines from a sorted file-
2 Copyright (C) 1986-2018 Free Software Foundation, Inc.-
3-
4 This program is free software: you can redistribute it and/or modify-
5 it under the terms of the GNU General Public License as published by-
6 the Free Software Foundation, either version 3 of the License, or-
7 (at your option) any later version.-
8-
9 This program is distributed in the hope that it will be useful,-
10 but WITHOUT ANY WARRANTY; without even the implied warranty of-
11 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the-
12 GNU General Public License for more details.-
13-
14 You should have received a copy of the GNU General Public License-
15 along with this program. If not, see <https://www.gnu.org/licenses/>. */-
16-
17/* Written by Richard M. Stallman and David MacKenzie. */-
18-
19#include <config.h>-
20-
21#include <getopt.h>-
22#include <sys/types.h>-
23-
24#include "system.h"-
25#include "argmatch.h"-
26#include "linebuffer.h"-
27#include "die.h"-
28#include "error.h"-
29#include "fadvise.h"-
30#include "hard-locale.h"-
31#include "posixver.h"-
32#include "stdio--.h"-
33#include "xmemcoll.h"-
34#include "xstrtol.h"-
35#include "memcasecmp.h"-
36#include "quote.h"-
37-
38/* The official name of this program (e.g., no 'g' prefix). */-
39#define PROGRAM_NAME "uniq"-
40-
41#define AUTHORS \-
42 proper_name ("Richard M. Stallman"), \-
43 proper_name ("David MacKenzie")-
44-
45#define SWAP_LINES(A, B) \-
46 do \-
47 { \-
48 struct linebuffer *_tmp; \-
49 _tmp = (A); \-
50 (A) = (B); \-
51 (B) = _tmp; \-
52 } \-
53 while (0)-
54-
55/* True if the LC_COLLATE locale is hard. */-
56static bool hard_LC_COLLATE;-
57-
58/* Number of fields to skip on each line when doing comparisons. */-
59static size_t skip_fields;-
60-
61/* Number of chars to skip after skipping any fields. */-
62static size_t skip_chars;-
63-
64/* Number of chars to compare. */-
65static size_t check_chars;-
66-
67enum countmode-
68{-
69 count_occurrences, /* -c Print count before output lines. */-
70 count_none /* Default. Do not print counts. */-
71};-
72-
73/* Whether and how to precede the output lines with a count of the number of-
74 times they occurred in the input. */-
75static enum countmode countmode;-
76-
77/* Which lines to output: unique lines, the first of a group of-
78 repeated lines, and the second and subsequented of a group of-
79 repeated lines. */-
80static bool output_unique;-
81static bool output_first_repeated;-
82static bool output_later_repeated;-
83-
84/* If true, ignore case when comparing. */-
85static bool ignore_case;-
86-
87enum delimit_method-
88{-
89 /* No delimiters output. --all-repeated[=none] */-
90 DM_NONE,-
91-
92 /* Delimiter precedes all groups. --all-repeated=prepend */-
93 DM_PREPEND,-
94-
95 /* Delimit all groups. --all-repeated=separate */-
96 DM_SEPARATE-
97};-
98-
99static char const *const delimit_method_string[] =-
100{-
101 "none", "prepend", "separate", NULL-
102};-
103-
104static enum delimit_method const delimit_method_map[] =-
105{-
106 DM_NONE, DM_PREPEND, DM_SEPARATE-
107};-
108-
109/* Select whether/how to delimit groups of duplicate lines. */-
110static enum delimit_method delimit_groups;-
111-
112enum grouping_method-
113{-
114 /* No grouping, when "--group" isn't used */-
115 GM_NONE,-
116-
117 /* Delimiter preceges all groups. --group=prepend */-
118 GM_PREPEND,-
119-
120 /* Delimiter follows all groups. --group=append */-
121 GM_APPEND,-
122-
123 /* Delimiter between groups. --group[=separate] */-
124 GM_SEPARATE,-
125-
126 /* Delimiter before and after each group. --group=both */-
127 GM_BOTH-
128};-
129-
130static char const *const grouping_method_string[] =-
131{-
132 "prepend", "append", "separate", "both", NULL-
133};-
134-
135static enum grouping_method const grouping_method_map[] =-
136{-
137 GM_PREPEND, GM_APPEND, GM_SEPARATE, GM_BOTH-
138};-
139-
140static enum grouping_method grouping = GM_NONE;-
141-
142enum-
143{-
144 GROUP_OPTION = CHAR_MAX + 1-
145};-
146-
147static struct option const longopts[] =-
148{-
149 {"count", no_argument, NULL, 'c'},-
150 {"repeated", no_argument, NULL, 'd'},-
151 {"all-repeated", optional_argument, NULL, 'D'},-
152 {"group", optional_argument, NULL, GROUP_OPTION},-
153 {"ignore-case", no_argument, NULL, 'i'},-
154 {"unique", no_argument, NULL, 'u'},-
155 {"skip-fields", required_argument, NULL, 'f'},-
156 {"skip-chars", required_argument, NULL, 's'},-
157 {"check-chars", required_argument, NULL, 'w'},-
158 {"zero-terminated", no_argument, NULL, 'z'},-
159 {GETOPT_HELP_OPTION_DECL},-
160 {GETOPT_VERSION_OPTION_DECL},-
161 {NULL, 0, NULL, 0}-
162};-
163-
164void-
165usage (int status)-
166{-
167 if (status != EXIT_SUCCESS)
status != 0Description
TRUEevaluated 45 times by 1 test
Evaluated by:
  • uniq
FALSEevaluated 16 times by 1 test
Evaluated by:
  • uniq
16-45
168 emit_try_help ();
executed 45 times by 1 test: end of block
Executed by:
  • uniq
45
169 else-
170 {-
171 printf (_("\-
172Usage: %s [OPTION]... [INPUT [OUTPUT]]\n\-
173"),-
174 program_name);-
175 fputs (_("\-
176Filter adjacent matching lines from INPUT (or standard input),\n\-
177writing to OUTPUT (or standard output).\n\-
178\n\-
179With no options, matching lines are merged to the first occurrence.\n\-
180"), stdout);-
181-
182 emit_mandatory_arg_note ();-
183-
184 fputs (_("\-
185 -c, --count prefix lines by the number of occurrences\n\-
186 -d, --repeated only print duplicate lines, one for each group\n\-
187"), stdout);-
188 fputs (_("\-
189 -D print all duplicate lines\n\-
190 --all-repeated[=METHOD] like -D, but allow separating groups\n\-
191 with an empty line;\n\-
192 METHOD={none(default),prepend,separate}\n\-
193"), stdout);-
194 fputs (_("\-
195 -f, --skip-fields=N avoid comparing the first N fields\n\-
196"), stdout);-
197 fputs (_("\-
198 --group[=METHOD] show all items, separating groups with an empty line;\n\-
199 METHOD={separate(default),prepend,append,both}\n\-
200"), stdout);-
201 fputs (_("\-
202 -i, --ignore-case ignore differences in case when comparing\n\-
203 -s, --skip-chars=N avoid comparing the first N characters\n\-
204 -u, --unique only print unique lines\n\-
205"), stdout);-
206 fputs (_("\-
207 -z, --zero-terminated line delimiter is NUL, not newline\n\-
208"), stdout);-
209 fputs (_("\-
210 -w, --check-chars=N compare no more than N characters in lines\n\-
211"), stdout);-
212 fputs (HELP_OPTION_DESCRIPTION, stdout);-
213 fputs (VERSION_OPTION_DESCRIPTION, stdout);-
214 fputs (_("\-
215\n\-
216A field is a run of blanks (usually spaces and/or TABs), then non-blank\n\-
217characters. Fields are skipped before chars.\n\-
218"), stdout);-
219 fputs (_("\-
220\n\-
221Note: 'uniq' does not detect repeated lines unless they are adjacent.\n\-
222You may want to sort the input first, or use 'sort -u' without 'uniq'.\n\-
223Also, comparisons honor the rules specified by 'LC_COLLATE'.\n\-
224"), stdout);-
225 emit_ancillary_info (PROGRAM_NAME);-
226 }
executed 16 times by 1 test: end of block
Executed by:
  • uniq
16
227 exit (status);
executed 61 times by 1 test: exit (status);
Executed by:
  • uniq
61
228}-
229-
230static bool-
231strict_posix2 (void)-
232{-
233 int posix_ver = posix2_version ();-
234 return 200112 <= posix_ver && posix_ver < 200809;
executed 12 times by 1 test: return 200112 <= posix_ver && posix_ver < 200809;
Executed by:
  • uniq
12
235}-
236-
237/* Convert OPT to size_t, reporting an error using MSGID if OPT is-
238 invalid. Silently convert too-large values to SIZE_MAX. */-
239-
240static size_t-
241size_opt (char const *opt, char const *msgid)-
242{-
243 unsigned long int size;-
244 verify (SIZE_MAX <= ULONG_MAX);-
245-
246 switch (xstrtoul (opt, NULL, 10, &size, ""))-
247 {-
248 case LONGINT_OK:
executed 207 times by 1 test: case LONGINT_OK:
Executed by:
  • uniq
207
249 case LONGINT_OVERFLOW:
executed 12 times by 1 test: case LONGINT_OVERFLOW:
Executed by:
  • uniq
12
250 break;
executed 219 times by 1 test: break;
Executed by:
  • uniq
219
251-
252 default:
executed 6 times by 1 test: default:
Executed by:
  • uniq
6
253 die (EXIT_FAILURE, 0, "%s: %s", opt, _(msgid));-
254 }
never executed: end of block
0
255-
256 return MIN (size, SIZE_MAX);
executed 219 times by 1 test: return ((( size )<((18446744073709551615UL)))?( size ):((18446744073709551615UL))) ;
Executed by:
  • uniq
219
257}-
258-
259/* Given a linebuffer LINE,-
260 return a pointer to the beginning of the line's field to be compared. */-
261-
262static char * _GL_ATTRIBUTE_PURE-
263find_field (struct linebuffer const *line)-
264{-
265 size_t count;-
266 char const *lp = line->buffer;-
267 size_t size = line->length - 1;-
268 size_t i = 0;-
269-
270 for (count = 0; count < skip_fields && i < size; count++)
count < skip_fieldsDescription
TRUEevaluated 434 times by 1 test
Evaluated by:
  • uniq
FALSEevaluated 1807 times by 1 test
Evaluated by:
  • uniq
i < sizeDescription
TRUEevaluated 334 times by 1 test
Evaluated by:
  • uniq
FALSEevaluated 100 times by 1 test
Evaluated by:
  • uniq
100-1807
271 {-
272 while (i < size && field_sep (lp[i]))
i < sizeDescription
TRUEevaluated 358 times by 1 test
Evaluated by:
  • uniq
FALSEnever evaluated
field_sep (lp[i])Description
TRUEevaluated 24 times by 1 test
Evaluated by:
  • uniq
FALSEevaluated 334 times by 1 test
Evaluated by:
  • uniq
0-358
273 i++;
executed 24 times by 1 test: i++;
Executed by:
  • uniq
24
274 while (i < size && !field_sep (lp[i]))
i < sizeDescription
TRUEevaluated 660 times by 1 test
Evaluated by:
  • uniq
FALSEevaluated 100 times by 1 test
Evaluated by:
  • uniq
!field_sep (lp[i])Description
TRUEevaluated 426 times by 1 test
Evaluated by:
  • uniq
FALSEevaluated 234 times by 1 test
Evaluated by:
  • uniq
100-660
275 i++;
executed 426 times by 1 test: i++;
Executed by:
  • uniq
426
276 }
executed 334 times by 1 test: end of block
Executed by:
  • uniq
334
277-
278 i += MIN (skip_chars, size - i);
(( skip_chars )<( size - i ))Description
TRUEevaluated 1795 times by 1 test
Evaluated by:
  • uniq
FALSEevaluated 112 times by 1 test
Evaluated by:
  • uniq
112-1795
279-
280 return line->buffer + i;
executed 1907 times by 1 test: return line->buffer + i;
Executed by:
  • uniq
1907
281}-
282-
283/* Return false if two strings OLD and NEW match, true if not.-
284 OLD and NEW point not to the beginnings of the lines-
285 but rather to the beginnings of the fields to compare.-
286 OLDLEN and NEWLEN are their lengths. */-
287-
288static bool-
289different (char *old, char *new, size_t oldlen, size_t newlen)-
290{-
291 if (check_chars < oldlen)
check_chars < oldlenDescription
TRUEevaluated 61 times by 1 test
Evaluated by:
  • uniq
FALSEevaluated 1321 times by 1 test
Evaluated by:
  • uniq
61-1321
292 oldlen = check_chars;
executed 61 times by 1 test: oldlen = check_chars;
Executed by:
  • uniq
61
293 if (check_chars < newlen)
check_chars < newlenDescription
TRUEevaluated 61 times by 1 test
Evaluated by:
  • uniq
FALSEevaluated 1321 times by 1 test
Evaluated by:
  • uniq
61-1321
294 newlen = check_chars;
executed 61 times by 1 test: newlen = check_chars;
Executed by:
  • uniq
61
295-
296 if (ignore_case)
ignore_caseDescription
TRUEevaluated 12 times by 1 test
Evaluated by:
  • uniq
FALSEevaluated 1370 times by 1 test
Evaluated by:
  • uniq
12-1370
297 {-
298 /* FIXME: This should invoke strcoll somehow. */-
299 return oldlen != newlen || memcasecmp (old, new, oldlen);
executed 12 times by 1 test: return oldlen != newlen || memcasecmp (old, new, oldlen);
Executed by:
  • uniq
12
300 }-
301 else if (hard_LC_COLLATE)
hard_LC_COLLATEDescription
TRUEnever evaluated
FALSEevaluated 1370 times by 1 test
Evaluated by:
  • uniq
0-1370
302 return xmemcoll (old, oldlen, new, newlen) != 0;
never executed: return xmemcoll (old, oldlen, new, newlen) != 0;
0
303 else-
304 return oldlen != newlen || memcmp (old, new, oldlen);
executed 1370 times by 1 test: return oldlen != newlen || memcmp (old, new, oldlen);
Executed by:
  • uniq
1370
305}-
306-
307/* Output the line in linebuffer LINE to standard output-
308 provided that the switches say it should be output.-
309 MATCH is true if the line matches the previous line.-
310 If requested, print the number of times it occurred, as well;-
311 LINECOUNT + 1 is the number of times that the line occurred. */-
312-
313static void-
314writeline (struct linebuffer const *line,-
315 bool match, uintmax_t linecount)-
316{-
317 if (! (linecount == 0 ? output_unique
! (linecount =...ater_repeated)Description
TRUEevaluated 486 times by 1 test
Evaluated by:
  • uniq
FALSEevaluated 189 times by 1 test
Evaluated by:
  • uniq
linecount == 0Description
TRUEevaluated 485 times by 1 test
Evaluated by:
  • uniq
FALSEevaluated 190 times by 1 test
Evaluated by:
  • uniq
189-486
318 : !match ? output_first_repeated
! (linecount =...ater_repeated)Description
TRUEevaluated 486 times by 1 test
Evaluated by:
  • uniq
FALSEevaluated 189 times by 1 test
Evaluated by:
  • uniq
!matchDescription
TRUEevaluated 130 times by 1 test
Evaluated by:
  • uniq
FALSEevaluated 60 times by 1 test
Evaluated by:
  • uniq
60-486
319 : output_later_repeated))
! (linecount =...ater_repeated)Description
TRUEevaluated 486 times by 1 test
Evaluated by:
  • uniq
FALSEevaluated 189 times by 1 test
Evaluated by:
  • uniq
189-486
320 return;
executed 486 times by 1 test: return;
Executed by:
  • uniq
486
321-
322 if (countmode == count_occurrences)
countmode == count_occurrencesDescription
TRUEevaluated 22 times by 1 test
Evaluated by:
  • uniq
FALSEevaluated 167 times by 1 test
Evaluated by:
  • uniq
22-167
323 printf ("%7" PRIuMAX " ", linecount + 1);
executed 22 times by 1 test: printf ("%7" "l" "u" " ", linecount + 1);
Executed by:
  • uniq
22
324-
325 fwrite (line->buffer, sizeof (char), line->length, stdout);
never executed: break;
(__builtin_exp...r++))) == (-1)Description
TRUEnever evaluated
FALSEnever evaluated
__cnt > 0Description
TRUEnever evaluated
FALSEnever evaluated
__builtin_expe...write_end), 0)Description
TRUEnever evaluated
FALSEnever evaluated
0
326}
executed 189 times by 1 test: end of block
Executed by:
  • uniq
189
327-
328/* Process input file INFILE with output to OUTFILE.-
329 If either is "-", use the standard I/O stream for it instead. */-
330-
331static void-
332check_file (const char *infile, const char *outfile, char delimiter)-
333{-
334 struct linebuffer lb1, lb2;-
335 struct linebuffer *thisline, *prevline;-
336-
337 if (! (STREQ (infile, "-") || freopen (infile, "r", stdin)))
never executed: __result = (((const unsigned char *) (const char *) ( infile ))[3] - __s2[3]);
never executed: end of block
never executed: end of block
never executed: __result = (((const unsigned char *) (const char *) ( "-" ))[3] - __s2[3]);
never executed: end of block
executed 397 times by 1 test: end of block
Executed by:
  • uniq
( __extension_...)))); }) == 0)Description
TRUEevaluated 397 times by 1 test
Evaluated by:
  • uniq
FALSEevaluated 158 times by 1 test
Evaluated by:
  • uniq
__s1_len > 0Description
TRUEnever evaluated
FALSEnever evaluated
__result == 0Description
TRUEnever evaluated
FALSEnever evaluated
__s1_len > 1Description
TRUEnever evaluated
FALSEnever evaluated
__result == 0Description
TRUEnever evaluated
FALSEnever evaluated
__s1_len > 2Description
TRUEnever evaluated
FALSEnever evaluated
__result == 0Description
TRUEnever evaluated
FALSEnever evaluated
__s2_len > 0Description
TRUEevaluated 555 times by 1 test
Evaluated by:
  • uniq
FALSEnever evaluated
__result == 0Description
TRUEevaluated 397 times by 1 test
Evaluated by:
  • uniq
FALSEevaluated 158 times by 1 test
Evaluated by:
  • uniq
__s2_len > 1Description
TRUEnever evaluated
FALSEevaluated 397 times by 1 test
Evaluated by:
  • uniq
__result == 0Description
TRUEnever evaluated
FALSEnever evaluated
__s2_len > 2Description
TRUEnever evaluated
FALSEnever evaluated
__result == 0Description
TRUEnever evaluated
FALSEnever evaluated
freopen_safer ..., "r", stdin )Description
TRUEevaluated 158 times by 1 test
Evaluated by:
  • uniq
FALSEnever evaluated
0-555
338 die (EXIT_FAILURE, errno, "%s", quotef (infile));
never executed: ((!!sizeof (struct { _Static_assert ( 1 , "verify_expr (" "1" ", " "(error (1, (*__errno_location ()), \"%s\", quotearg_n_style_colon (0, shell_escape_quoting_style, infile)), assume (false))" ")"); int _gl_dummy; })) ? ((error ( 1 , (*__errno_location ()...lon (0, shell_escape_quoting_style, infile)), (( 0 ) ? (void) 0 : __builtin_unreachable ()))) : ((error ( 1 , (*__errno_location ()) , "%s", quotearg_n_style_colon (0, shell_escape_quoting_style, infile)), (( 0 ) ? (void) 0 : __builtin_unreachable ()))));
0
339 if (! (STREQ (outfile, "-") || freopen (outfile, "w", stdout)))
never executed: __result = (((const unsigned char *) (const char *) ( outfile ))[3] - __s2[3]);
never executed: end of block
never executed: end of block
never executed: __result = (((const unsigned char *) (const char *) ( "-" ))[3] - __s2[3]);
never executed: end of block
executed 555 times by 1 test: end of block
Executed by:
  • uniq
( __extension_...)))); }) == 0)Description
TRUEevaluated 555 times by 1 test
Evaluated by:
  • uniq
FALSEnever evaluated
__s1_len > 0Description
TRUEnever evaluated
FALSEnever evaluated
__result == 0Description
TRUEnever evaluated
FALSEnever evaluated
__s1_len > 1Description
TRUEnever evaluated
FALSEnever evaluated
__result == 0Description
TRUEnever evaluated
FALSEnever evaluated
__s1_len > 2Description
TRUEnever evaluated
FALSEnever evaluated
__result == 0Description
TRUEnever evaluated
FALSEnever evaluated
__s2_len > 0Description
TRUEevaluated 555 times by 1 test
Evaluated by:
  • uniq
FALSEnever evaluated
__result == 0Description
TRUEevaluated 555 times by 1 test
Evaluated by:
  • uniq
FALSEnever evaluated
__s2_len > 1Description
TRUEnever evaluated
FALSEevaluated 555 times by 1 test
Evaluated by:
  • uniq
__result == 0Description
TRUEnever evaluated
FALSEnever evaluated
__s2_len > 2Description
TRUEnever evaluated
FALSEnever evaluated
__result == 0Description
TRUEnever evaluated
FALSEnever evaluated
freopen_safer ... "w", stdout )Description
TRUEnever evaluated
FALSEnever evaluated
0-555
340 die (EXIT_FAILURE, errno, "%s", quotef (outfile));
never executed: ((!!sizeof (struct { _Static_assert ( 1 , "verify_expr (" "1" ", " "(error (1, (*__errno_location ()), \"%s\", quotearg_n_style_colon (0, shell_escape_quoting_style, outfile)), assume (false))" ")"); int _gl_dummy; })) ? ((error ( 1 , (*__errno_location (...n (0, shell_escape_quoting_style, outfile)), (( 0 ) ? (void) 0 : __builtin_unreachable ()))) : ((error ( 1 , (*__errno_location ()) , "%s", quotearg_n_style_colon (0, shell_escape_quoting_style, outfile)), (( 0 ) ? (void) 0 : __builtin_unreachable ()))));
0
341-
342 fadvise (stdin, FADVISE_SEQUENTIAL);-
343-
344 thisline = &lb1;-
345 prevline = &lb2;-
346-
347 initbuffer (thisline);-
348 initbuffer (prevline);-
349-
350 /* The duplication in the following 'if' and 'else' blocks is an-
351 optimization to distinguish between when we can print input-
352 lines immediately (1. & 2.) or not.-
353-
354 1. --group => all input lines are printed.-
355 checking for unique/duplicated lines is used only for printing-
356 group separators.-
357-
358 2. The default case in which none of these options has been specified:-
359 --count, --repeated, --all-repeated, --unique-
360 In the default case, this optimization lets uniq output each different-
361 line right away, without waiting to see if the next one is different.-
362-
363 3. All other cases.-
364 */-
365 if (output_unique && output_first_repeated && countmode == count_none)
output_uniqueDescription
TRUEevaluated 429 times by 1 test
Evaluated by:
  • uniq
FALSEevaluated 126 times by 1 test
Evaluated by:
  • uniq
output_first_repeatedDescription
TRUEevaluated 398 times by 1 test
Evaluated by:
  • uniq
FALSEevaluated 31 times by 1 test
Evaluated by:
  • uniq
countmode == count_noneDescription
TRUEevaluated 382 times by 1 test
Evaluated by:
  • uniq
FALSEevaluated 16 times by 1 test
Evaluated by:
  • uniq
16-429
366 {-
367 char *prevfield IF_LINT ( = NULL);-
368 size_t prevlen IF_LINT ( = 0);-
369 bool first_group_printed = false;-
370-
371 while (!feof (stdin))
!feof_unlocked ( stdin )Description
TRUEevaluated 1456 times by 1 test
Evaluated by:
  • uniq
FALSEevaluated 36 times by 1 test
Evaluated by:
  • uniq
36-1456
372 {-
373 char *thisfield;-
374 size_t thislen;-
375 bool new_group;-
376-
377 if (readlinebuffer_delim (thisline, stdin, delimiter) == 0)
readlinebuffer...elimiter) == 0Description
TRUEevaluated 346 times by 1 test
Evaluated by:
  • uniq
FALSEevaluated 1110 times by 1 test
Evaluated by:
  • uniq
346-1110
378 break;
executed 346 times by 1 test: break;
Executed by:
  • uniq
346
379-
380 thisfield = find_field (thisline);-
381 thislen = thisline->length - 1 - (thisfield - thisline->buffer);-
382-
383 new_group = (prevline->length == 0
prevline->length == 0Description
TRUEevaluated 352 times by 1 test
Evaluated by:
  • uniq
FALSEevaluated 758 times by 1 test
Evaluated by:
  • uniq
352-758
384 || different (thisfield, prevfield, thislen, prevlen));
different (thi...slen, prevlen)Description
TRUEevaluated 138 times by 1 test
Evaluated by:
  • uniq
FALSEevaluated 620 times by 1 test
Evaluated by:
  • uniq
138-620
385-
386 if (new_group && grouping != GM_NONE
new_groupDescription
TRUEevaluated 490 times by 1 test
Evaluated by:
  • uniq
FALSEevaluated 620 times by 1 test
Evaluated by:
  • uniq
grouping != GM_NONEDescription
TRUEevaluated 84 times by 1 test
Evaluated by:
  • uniq
FALSEevaluated 406 times by 1 test
Evaluated by:
  • uniq
84-620
387 && (grouping == GM_PREPEND || grouping == GM_BOTH
grouping == GM_PREPENDDescription
TRUEevaluated 18 times by 1 test
Evaluated by:
  • uniq
FALSEevaluated 66 times by 1 test
Evaluated by:
  • uniq
grouping == GM_BOTHDescription
TRUEevaluated 12 times by 1 test
Evaluated by:
  • uniq
FALSEevaluated 54 times by 1 test
Evaluated by:
  • uniq
12-66
388 || (first_group_printed && (grouping == GM_APPEND
first_group_printedDescription
TRUEevaluated 18 times by 1 test
Evaluated by:
  • uniq
FALSEevaluated 36 times by 1 test
Evaluated by:
  • uniq
grouping == GM_APPENDDescription
TRUEevaluated 6 times by 1 test
Evaluated by:
  • uniq
FALSEevaluated 12 times by 1 test
Evaluated by:
  • uniq
6-36
389 || grouping == GM_SEPARATE))))
grouping == GM_SEPARATEDescription
TRUEevaluated 12 times by 1 test
Evaluated by:
  • uniq
FALSEnever evaluated
0-12
390 putchar (delimiter);
executed 48 times by 1 test: putchar_unlocked (delimiter);
Executed by:
  • uniq
48
391-
392 if (new_group || grouping != GM_NONE)
new_groupDescription
TRUEevaluated 490 times by 1 test
Evaluated by:
  • uniq
FALSEevaluated 620 times by 1 test
Evaluated by:
  • uniq
grouping != GM_NONEDescription
TRUEevaluated 54 times by 1 test
Evaluated by:
  • uniq
FALSEevaluated 566 times by 1 test
Evaluated by:
  • uniq
54-620
393 {-
394 fwrite (thisline->buffer, sizeof (char),
never executed: break;
(__builtin_exp...r++))) == (-1)Description
TRUEnever evaluated
FALSEnever evaluated
__cnt > 0Description
TRUEnever evaluated
FALSEnever evaluated
__builtin_expe...write_end), 0)Description
TRUEnever evaluated
FALSEnever evaluated
0
395 thisline->length, stdout);-
396-
397 SWAP_LINES (prevline, thisline);-
398 prevfield = thisfield;-
399 prevlen = thislen;-
400 first_group_printed = true;-
401 }
executed 544 times by 1 test: end of block
Executed by:
  • uniq
544
402 }
executed 1110 times by 1 test: end of block
Executed by:
  • uniq
1110
403 if ((grouping == GM_BOTH || grouping == GM_APPEND) && first_group_printed)
grouping == GM_BOTHDescription
TRUEevaluated 12 times by 1 test
Evaluated by:
  • uniq
FALSEevaluated 370 times by 1 test
Evaluated by:
  • uniq
grouping == GM_APPENDDescription
TRUEevaluated 18 times by 1 test
Evaluated by:
  • uniq
FALSEevaluated 352 times by 1 test
Evaluated by:
  • uniq
first_group_printedDescription
TRUEevaluated 18 times by 1 test
Evaluated by:
  • uniq
FALSEevaluated 12 times by 1 test
Evaluated by:
  • uniq
12-370
404 putchar (delimiter);
executed 18 times by 1 test: putchar_unlocked (delimiter);
Executed by:
  • uniq
18
405 }
executed 382 times by 1 test: end of block
Executed by:
  • uniq
382
406 else-
407 {-
408 char *prevfield;-
409 size_t prevlen;-
410 uintmax_t match_count = 0;-
411 bool first_delimiter = true;-
412-
413 if (readlinebuffer_delim (prevline, stdin, delimiter) == 0)
readlinebuffer...elimiter) == 0Description
TRUEnever evaluated
FALSEevaluated 173 times by 1 test
Evaluated by:
  • uniq
0-173
414 goto closefiles;
never executed: goto closefiles;
0
415 prevfield = find_field (prevline);-
416 prevlen = prevline->length - 1 - (prevfield - prevline->buffer);-
417-
418 while (!feof (stdin))
!feof_unlocked ( stdin )Description
TRUEevaluated 776 times by 1 test
Evaluated by:
  • uniq
FALSEevaluated 21 times by 1 test
Evaluated by:
  • uniq
21-776
419 {-
420 bool match;-
421 char *thisfield;-
422 size_t thislen;-
423 if (readlinebuffer_delim (thisline, stdin, delimiter) == 0)
readlinebuffer...elimiter) == 0Description
TRUEevaluated 152 times by 1 test
Evaluated by:
  • uniq
FALSEevaluated 624 times by 1 test
Evaluated by:
  • uniq
152-624
424 {-
425 if (ferror (stdin))
ferror_unlocked ( stdin )Description
TRUEnever evaluated
FALSEevaluated 152 times by 1 test
Evaluated by:
  • uniq
0-152
426 goto closefiles;
never executed: goto closefiles;
0
427 break;
executed 152 times by 1 test: break;
Executed by:
  • uniq
152
428 }-
429 thisfield = find_field (thisline);-
430 thislen = thisline->length - 1 - (thisfield - thisline->buffer);-
431 match = !different (thisfield, prevfield, thislen, prevlen);-
432 match_count += match;-
433-
434 if (match_count == UINTMAX_MAX)
match_count ==...73709551615UL)Description
TRUEnever evaluated
FALSEevaluated 624 times by 1 test
Evaluated by:
  • uniq
0-624
435 {-
436 if (count_occurrences)
count_occurrencesDescription
TRUEnever evaluated
FALSEnever evaluated
0
437 die (EXIT_FAILURE, 0, _("too many repeated lines"));
never executed: ((!!sizeof (struct { _Static_assert ( 1 , "verify_expr (" "1" ", " "(error (1, 0, dcgettext (((void *)0), \"too many repeated lines\", 5)), assume (false))" ")"); int _gl_dummy; })) ? ((error ( 1 , 0, dcgettext (((void *)0), "too many repeated lines" , 5) ), (( 0 ) ? (void) 0 : __builtin_unreachable ()))) : ((error ( 1 , 0, dcgettext (((void *)0), "too many repeated lines" , 5) ), (( 0 ) ? (void) 0 : __builtin_unreachable ()))));
0
438 match_count--;-
439 }
never executed: end of block
0
440-
441 if (delimit_groups != DM_NONE)
delimit_groups != DM_NONEDescription
TRUEevaluated 90 times by 1 test
Evaluated by:
  • uniq
FALSEevaluated 534 times by 1 test
Evaluated by:
  • uniq
90-534
442 {-
443 if (!match)
!matchDescription
TRUEevaluated 42 times by 1 test
Evaluated by:
  • uniq
FALSEevaluated 48 times by 1 test
Evaluated by:
  • uniq
42-48
444 {-
445 if (match_count) /* a previous match */
match_countDescription
TRUEevaluated 24 times by 1 test
Evaluated by:
  • uniq
FALSEevaluated 18 times by 1 test
Evaluated by:
  • uniq
18-24
446 first_delimiter = false; /* Only used when DM_SEPARATE */
executed 24 times by 1 test: first_delimiter = 0 ;
Executed by:
  • uniq
24
447 }
executed 42 times by 1 test: end of block
Executed by:
  • uniq
42
448 else if (match_count == 1)
match_count == 1Description
TRUEevaluated 48 times by 1 test
Evaluated by:
  • uniq
FALSEnever evaluated
0-48
449 {-
450 if ((delimit_groups == DM_PREPEND)
(delimit_groups == DM_PREPEND)Description
TRUEevaluated 18 times by 1 test
Evaluated by:
  • uniq
FALSEevaluated 30 times by 1 test
Evaluated by:
  • uniq
18-30
451 || (delimit_groups == DM_SEPARATE
delimit_groups == DM_SEPARATEDescription
TRUEevaluated 30 times by 1 test
Evaluated by:
  • uniq
FALSEnever evaluated
0-30
452 && !first_delimiter))
!first_delimiterDescription
TRUEevaluated 12 times by 1 test
Evaluated by:
  • uniq
FALSEevaluated 18 times by 1 test
Evaluated by:
  • uniq
12-18
453 putchar (delimiter);
executed 30 times by 1 test: putchar_unlocked (delimiter);
Executed by:
  • uniq
30
454 }
executed 48 times by 1 test: end of block
Executed by:
  • uniq
48
455 }
executed 90 times by 1 test: end of block
Executed by:
  • uniq
90
456-
457 if (!match || output_later_repeated)
!matchDescription
TRUEevaluated 442 times by 1 test
Evaluated by:
  • uniq
FALSEevaluated 182 times by 1 test
Evaluated by:
  • uniq
output_later_repeatedDescription
TRUEevaluated 60 times by 1 test
Evaluated by:
  • uniq
FALSEevaluated 122 times by 1 test
Evaluated by:
  • uniq
60-442
458 {-
459 writeline (prevline, match, match_count);-
460 SWAP_LINES (prevline, thisline);-
461 prevfield = thisfield;-
462 prevlen = thislen;-
463 if (!match)
!matchDescription
TRUEevaluated 442 times by 1 test
Evaluated by:
  • uniq
FALSEevaluated 60 times by 1 test
Evaluated by:
  • uniq
60-442
464 match_count = 0;
executed 442 times by 1 test: match_count = 0;
Executed by:
  • uniq
442
465 }
executed 502 times by 1 test: end of block
Executed by:
  • uniq
502
466 }
executed 624 times by 1 test: end of block
Executed by:
  • uniq
624
467-
468 writeline (prevline, false, match_count);-
469 }
executed 173 times by 1 test: end of block
Executed by:
  • uniq
173
470-
471 closefiles:
code before this statement executed 555 times by 1 test: closefiles:
Executed by:
  • uniq
555
472 if (ferror (stdin) || fclose (stdin) != 0)
ferror_unlocked ( stdin )Description
TRUEnever evaluated
FALSEevaluated 555 times by 1 test
Evaluated by:
  • uniq
rpl_fclose ( stdin ) != 0Description
TRUEnever evaluated
FALSEevaluated 555 times by 1 test
Evaluated by:
  • uniq
0-555
473 die (EXIT_FAILURE, 0, _("error reading %s"), quoteaf (infile));
never executed: ((!!sizeof (struct { _Static_assert ( 1 , "verify_expr (" "1" ", " "(error (1, 0, dcgettext (((void *)0), \"error reading %s\", 5), quotearg_style (shell_escape_always_quoting_style, infile)), assume (false))" ")"); int _gl_dummy; })) ? ((error ( 1 , 0, d...ys_quoting_style, infile)), (( 0 ) ? (void) 0 : __builtin_unreachable ()))) : ((error ( 1 , 0, dcgettext (((void *)0), "error reading %s" , 5) , quotearg_style (shell_escape_always_quoting_style, infile)), (( 0 ) ? (void) 0 : __builtin_unreachable ()))));
0
474-
475 /* stdout is handled via the atexit-invoked close_stdout function. */-
476-
477 free (lb1.buffer);-
478 free (lb2.buffer);-
479}
executed 555 times by 1 test: end of block
Executed by:
  • uniq
555
480-
481enum Skip_field_option_type-
482 {-
483 SFO_NONE,-
484 SFO_OBSOLETE,-
485 SFO_NEW-
486 };-
487-
488int-
489main (int argc, char **argv)-
490{-
491 int optc = 0;-
492 bool posixly_correct = (getenv ("POSIXLY_CORRECT") != NULL);-
493 enum Skip_field_option_type skip_field_option_type = SFO_NONE;-
494 unsigned int nfiles = 0;-
495 char const *file[2];-
496 char delimiter = '\n'; /* change with --zero-terminated, -z */-
497 bool output_option_used = false; /* if true, one of -u/-d/-D/-c was used */-
498-
499 file[0] = file[1] = "-";-
500 initialize_main (&argc, &argv);-
501 set_program_name (argv[0]);-
502 setlocale (LC_ALL, "");-
503 bindtextdomain (PACKAGE, LOCALEDIR);-
504 textdomain (PACKAGE);-
505 hard_LC_COLLATE = hard_locale (LC_COLLATE);-
506-
507 atexit (close_stdout);-
508-
509 skip_chars = 0;-
510 skip_fields = 0;-
511 check_chars = SIZE_MAX;-
512 output_unique = output_first_repeated = true;-
513 output_later_repeated = false;-
514 countmode = count_none;-
515 delimit_groups = DM_NONE;-
516-
517 while (true)-
518 {-
519 /* Parse an operand with leading "+" as a file after "--" was-
520 seen; or if pedantic and a file was seen; or if not-
521 obsolete. */-
522-
523 if (optc == -1
optc == -1Description
TRUEevaluated 2 times by 1 test
Evaluated by:
  • uniq
FALSEevaluated 1645 times by 1 test
Evaluated by:
  • uniq
2-1645
524 || (posixly_correct && nfiles != 0)
posixly_correctDescription
TRUEnever evaluated
FALSEevaluated 1645 times by 1 test
Evaluated by:
  • uniq
nfiles != 0Description
TRUEnever evaluated
FALSEnever evaluated
0-1645
525 || ((optc = getopt_long (argc, argv,
((optc = getop...*)0) )) == -1)Description
TRUEevaluated 585 times by 1 test
Evaluated by:
  • uniq
FALSEevaluated 1060 times by 1 test
Evaluated by:
  • uniq
585-1060
526 "-0123456789Dcdf:is:uw:z", longopts, NULL))
((optc = getop...*)0) )) == -1)Description
TRUEevaluated 585 times by 1 test
Evaluated by:
  • uniq
FALSEevaluated 1060 times by 1 test
Evaluated by:
  • uniq
585-1060
527 == -1))
((optc = getop...*)0) )) == -1)Description
TRUEevaluated 585 times by 1 test
Evaluated by:
  • uniq
FALSEevaluated 1060 times by 1 test
Evaluated by:
  • uniq
585-1060
528 {-
529 if (argc <= optind)
argc <= optindDescription
TRUEevaluated 585 times by 1 test
Evaluated by:
  • uniq
FALSEevaluated 2 times by 1 test
Evaluated by:
  • uniq
2-585
530 break;
executed 585 times by 1 test: break;
Executed by:
  • uniq
585
531 if (nfiles == 2)
nfiles == 2Description
TRUEnever evaluated
FALSEevaluated 2 times by 1 test
Evaluated by:
  • uniq
0-2
532 {-
533 error (0, 0, _("extra operand %s"), quote (argv[optind]));-
534 usage (EXIT_FAILURE);-
535 }
never executed: end of block
0
536 file[nfiles++] = argv[optind++];-
537 }
executed 2 times by 1 test: end of block
Executed by:
  • uniq
2
538 else switch (optc)-
539 {-
540 case 1:
executed 178 times by 1 test: case 1:
Executed by:
  • uniq
178
541 {-
542 unsigned long int size;-
543 if (optarg[0] == '+'
optarg[0] == '+'Description
TRUEevaluated 12 times by 1 test
Evaluated by:
  • uniq
FALSEevaluated 166 times by 1 test
Evaluated by:
  • uniq
12-166
544 && ! strict_posix2 ()
! strict_posix2 ()Description
TRUEevaluated 12 times by 1 test
Evaluated by:
  • uniq
FALSEnever evaluated
0-12
545 && xstrtoul (optarg, NULL, 10, &size, "") == LONGINT_OK
xstrtoul (opta... == LONGINT_OKDescription
TRUEevaluated 12 times by 1 test
Evaluated by:
  • uniq
FALSEnever evaluated
0-12
546 && size <= SIZE_MAX)
size <= (18446...73709551615UL)Description
TRUEevaluated 12 times by 1 test
Evaluated by:
  • uniq
FALSEnever evaluated
0-12
547 skip_chars = size;
executed 12 times by 1 test: skip_chars = size;
Executed by:
  • uniq
12
548 else if (nfiles == 2)
nfiles == 2Description
TRUEnever evaluated
FALSEevaluated 166 times by 1 test
Evaluated by:
  • uniq
0-166
549 {-
550 error (0, 0, _("extra operand %s"), quote (optarg));-
551 usage (EXIT_FAILURE);-
552 }
never executed: end of block
0
553 else-
554 file[nfiles++] = optarg;
executed 166 times by 1 test: file[nfiles++] = optarg;
Executed by:
  • uniq
166
555 }-
556 break;
executed 178 times by 1 test: break;
Executed by:
  • uniq
178
557-
558 case '0':
never executed: case '0':
0
559 case '1':
executed 6 times by 1 test: case '1':
Executed by:
  • uniq
6
560 case '2':
never executed: case '2':
0
561 case '3':
never executed: case '3':
0
562 case '4':
never executed: case '4':
0
563 case '5':
never executed: case '5':
0
564 case '6':
never executed: case '6':
0
565 case '7':
never executed: case '7':
0
566 case '8':
never executed: case '8':
0
567 case '9':
never executed: case '9':
0
568 {-
569 if (skip_field_option_type == SFO_NEW)
skip_field_opt...ype == SFO_NEWDescription
TRUEnever evaluated
FALSEevaluated 6 times by 1 test
Evaluated by:
  • uniq
0-6
570 skip_fields = 0;
never executed: skip_fields = 0;
0
571-
572 if (!DECIMAL_DIGIT_ACCUMULATE (skip_fields, optc - '0', size_t))
!( (void) (&(s... '0')), 1 )) )Description
TRUEnever evaluated
FALSEevaluated 6 times by 1 test
Evaluated by:
  • uniq
(size_t) -1 / ... (skip_fields)Description
TRUEnever evaluated
FALSEevaluated 6 times by 1 test
Evaluated by:
  • uniq
(size_t) ((ski... (skip_fields)Description
TRUEnever evaluated
FALSEevaluated 6 times by 1 test
Evaluated by:
  • uniq
0-6
573 skip_fields = SIZE_MAX;
never executed: skip_fields = (18446744073709551615UL) ;
0
574-
575 skip_field_option_type = SFO_OBSOLETE;-
576 }-
577 break;
executed 6 times by 1 test: break;
Executed by:
  • uniq
6
578-
579 case 'c':
executed 30 times by 1 test: case 'c':
Executed by:
  • uniq
30
580 countmode = count_occurrences;-
581 output_option_used = true;-
582 break;
executed 30 times by 1 test: break;
Executed by:
  • uniq
30
583-
584 case 'd':
executed 86 times by 1 test: case 'd':
Executed by:
  • uniq
86
585 output_unique = false;-
586 output_option_used = true;-
587 break;
executed 86 times by 1 test: break;
Executed by:
  • uniq
86
588-
589 case 'D':
executed 68 times by 1 test: case 'D':
Executed by:
  • uniq
68
590 output_unique = false;-
591 output_later_repeated = true;-
592 if (optarg == NULL)
optarg == ((void *)0)Description
TRUEevaluated 26 times by 1 test
Evaluated by:
  • uniq
FALSEevaluated 42 times by 1 test
Evaluated by:
  • uniq
26-42
593 delimit_groups = DM_NONE;
executed 26 times by 1 test: delimit_groups = DM_NONE;
Executed by:
  • uniq
26
594 else-
595 delimit_groups = XARGMATCH ("--all-repeated", optarg,
executed 42 times by 1 test: delimit_groups = ((delimit_method_map) [__xargmatch_internal ("--all-repeated", optarg, delimit_method_string, (char const *) (delimit_method_map), sizeof *(delimit_method_map), argmatch_die)]) ;
Executed by:
  • uniq
42
596 delimit_method_string,
executed 42 times by 1 test: delimit_groups = ((delimit_method_map) [__xargmatch_internal ("--all-repeated", optarg, delimit_method_string, (char const *) (delimit_method_map), sizeof *(delimit_method_map), argmatch_die)]) ;
Executed by:
  • uniq
42
597 delimit_method_map);
executed 42 times by 1 test: delimit_groups = ((delimit_method_map) [__xargmatch_internal ("--all-repeated", optarg, delimit_method_string, (char const *) (delimit_method_map), sizeof *(delimit_method_map), argmatch_die)]) ;
Executed by:
  • uniq
42
598 output_option_used = true;-
599 break;
executed 62 times by 1 test: break;
Executed by:
  • uniq
62
600-
601 case GROUP_OPTION:
executed 109 times by 1 test: case GROUP_OPTION:
Executed by:
  • uniq
109
602 if (optarg == NULL)
optarg == ((void *)0)Description
TRUEevaluated 37 times by 1 test
Evaluated by:
  • uniq
FALSEevaluated 72 times by 1 test
Evaluated by:
  • uniq
37-72
603 grouping = GM_SEPARATE;
executed 37 times by 1 test: grouping = GM_SEPARATE;
Executed by:
  • uniq
37
604 else-
605 grouping = XARGMATCH ("--group", optarg,
executed 72 times by 1 test: grouping = ((grouping_method_map) [__xargmatch_internal ("--group", optarg, grouping_method_string, (char const *) (grouping_method_map), sizeof *(grouping_method_map), argmatch_die)]) ;
Executed by:
  • uniq
72
606 grouping_method_string,
executed 72 times by 1 test: grouping = ((grouping_method_map) [__xargmatch_internal ("--group", optarg, grouping_method_string, (char const *) (grouping_method_map), sizeof *(grouping_method_map), argmatch_die)]) ;
Executed by:
  • uniq
72
607 grouping_method_map);
executed 72 times by 1 test: grouping = ((grouping_method_map) [__xargmatch_internal ("--group", optarg, grouping_method_string, (char const *) (grouping_method_map), sizeof *(grouping_method_map), argmatch_die)]) ;
Executed by:
  • uniq
72
608 break;
executed 103 times by 1 test: break;
Executed by:
  • uniq
103
609-
610 case 'f':
executed 102 times by 1 test: case 'f':
Executed by:
  • uniq
102
611 skip_field_option_type = SFO_NEW;-
612 skip_fields = size_opt (optarg,-
613 N_("invalid number of fields to skip"));-
614 break;
executed 100 times by 1 test: break;
Executed by:
  • uniq
100
615-
616 case 'i':
executed 14 times by 1 test: case 'i':
Executed by:
  • uniq
14
617 ignore_case = true;-
618 break;
executed 14 times by 1 test: break;
Executed by:
  • uniq
14
619-
620 case 's':
executed 56 times by 1 test: case 's':
Executed by:
  • uniq
56
621 skip_chars = size_opt (optarg,-
622 N_("invalid number of bytes to skip"));-
623 break;
executed 54 times by 1 test: break;
Executed by:
  • uniq
54
624-
625 case 'u':
executed 57 times by 1 test: case 'u':
Executed by:
  • uniq
57
626 output_first_repeated = false;-
627 output_option_used = true;-
628 break;
executed 57 times by 1 test: break;
Executed by:
  • uniq
57
629-
630 case 'w':
executed 67 times by 1 test: case 'w':
Executed by:
  • uniq
67
631 check_chars = size_opt (optarg,-
632 N_("invalid number of bytes to compare"));-
633 break;
executed 65 times by 1 test: break;
Executed by:
  • uniq
65
634-
635 case 'z':
executed 263 times by 1 test: case 'z':
Executed by:
  • uniq
263
636 delimiter = '\0';-
637 break;
executed 263 times by 1 test: break;
Executed by:
  • uniq
263
638-
639 case_GETOPT_HELP_CHAR;
never executed: break;
executed 16 times by 1 test: case GETOPT_HELP_CHAR:
Executed by:
  • uniq
0-16
640-
641 case_GETOPT_VERSION_CHAR (PROGRAM_NAME, AUTHORS);
executed 5 times by 1 test: exit ( 0 );
Executed by:
  • uniq
never executed: break;
executed 5 times by 1 test: case GETOPT_VERSION_CHAR:
Executed by:
  • uniq
0-5
642-
643 default:
executed 3 times by 1 test: default:
Executed by:
  • uniq
3
644 usage (EXIT_FAILURE);-
645 }
never executed: end of block
0
646 }-
647-
648 /* Note we could allow --group with -D at least, and that would-
649 avoid the need to specify a grouping method to --all-repeated.-
650 It was thought best to avoid deprecating those parameters though-
651 and keep --group separate to other options. */-
652 if (grouping != GM_NONE && output_option_used)
grouping != GM_NONEDescription
TRUEevaluated 102 times by 1 test
Evaluated by:
  • uniq
FALSEevaluated 483 times by 1 test
Evaluated by:
  • uniq
output_option_usedDescription
TRUEevaluated 24 times by 1 test
Evaluated by:
  • uniq
FALSEevaluated 78 times by 1 test
Evaluated by:
  • uniq
24-483
653 {-
654 error (0, 0, _("--group is mutually exclusive with -c/-d/-D/-u"));-
655 usage (EXIT_FAILURE);-
656 }
never executed: end of block
0
657-
658 if (grouping != GM_NONE && countmode != count_none)
grouping != GM_NONEDescription
TRUEevaluated 78 times by 1 test
Evaluated by:
  • uniq
FALSEevaluated 483 times by 1 test
Evaluated by:
  • uniq
countmode != count_noneDescription
TRUEnever evaluated
FALSEevaluated 78 times by 1 test
Evaluated by:
  • uniq
0-483
659 {-
660 error (0, 0,-
661 _("grouping and printing repeat counts is meaningless"));-
662 usage (EXIT_FAILURE);-
663 }
never executed: end of block
0
664-
665 if (countmode == count_occurrences && output_later_repeated)
countmode == count_occurrencesDescription
TRUEevaluated 22 times by 1 test
Evaluated by:
  • uniq
FALSEevaluated 539 times by 1 test
Evaluated by:
  • uniq
output_later_repeatedDescription
TRUEevaluated 6 times by 1 test
Evaluated by:
  • uniq
FALSEevaluated 16 times by 1 test
Evaluated by:
  • uniq
6-539
666 {-
667 error (0, 0,-
668 _("printing all duplicated lines and repeat counts is meaningless"));-
669 usage (EXIT_FAILURE);-
670 }
never executed: end of block
0
671-
672 check_file (file[0], file[1], delimiter);-
673-
674 return EXIT_SUCCESS;
executed 555 times by 1 test: return 0 ;
Executed by:
  • uniq
555
675}-
Source codeSwitch to Preprocessed file

Generated by Squish Coco 4.1.2