Page Menu
Home
FreeBSD
Search
Configure Global Search
Log In
Files
F160395577
D48000.diff
No One
Temporary
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Flag For Later
Award Token
Size
1 KB
Referenced Files
None
Subscribers
None
D48000.diff
View Options
diff --git a/usr.bin/uniq/tests/uniq_test.sh b/usr.bin/uniq/tests/uniq_test.sh
--- a/usr.bin/uniq/tests/uniq_test.sh
+++ b/usr.bin/uniq/tests/uniq_test.sh
@@ -80,6 +80,25 @@
atf_check_uniq --all-repeated=separate
}
+atf_test_case count_all_repeated
+count_all_repeated_head() {
+ atf_set descr "count and print every instance of repeated lines"
+}
+count_all_repeated_body() {
+ printf "a\na\nb\na\na\n" >input
+ printf " 1 a\n 2 a\n 1 a\n 2 a\n" >expected
+ atf_check_uniq -D -c
+ atf_check_uniq -Dnone -c
+ atf_check_uniq -cD
+ atf_check_uniq -cDnone
+ atf_check_uniq -c -D
+ atf_check_uniq -c -Dnone
+ atf_check_uniq --all-repeated --count
+ atf_check_uniq --all-repeated=none --count
+ atf_check_uniq --count --all-repeated
+ atf_check_uniq --count --all-repeated=none
+}
+
atf_test_case skip_fields
skip_fields_head() {
atf_set descr "skip fields"
@@ -196,6 +215,7 @@
atf_add_test_case repeated
atf_add_test_case count_repeated
atf_add_test_case all_repeated
+ atf_add_test_case count_all_repeated
atf_add_test_case skip_fields
atf_add_test_case skip_fields_tab
atf_add_test_case ignore_case
diff --git a/usr.bin/uniq/uniq.c b/usr.bin/uniq/uniq.c
--- a/usr.bin/uniq/uniq.c
+++ b/usr.bin/uniq/uniq.c
@@ -225,12 +225,13 @@
fputc('\n', ofp);
show(ofp, prevline);
}
- show(ofp, thisline);
} else if (dflag && !cflag) {
if (repeats == 0)
show(ofp, prevline);
}
++repeats;
+ if (Dflag)
+ show(ofp, thisline);
}
}
if (ferror(ifp))
File Metadata
Details
Attached
Mime Type
text/plain
Expires
Thu, Jun 25, 2:16 AM (12 h, 56 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
34300621
Default Alt Text
D48000.diff (1 KB)
Attached To
Mode
D48000: uniq: Fix off-by-one bug in -cD case.
Attached
Detach File
Event Timeline
Log In to Comment