The branch main has been updated by des:

URL: 
https://cgit.FreeBSD.org/src/commit/?id=d350e8d795d53dbc58ea428f76355cf5e28f6116

commit d350e8d795d53dbc58ea428f76355cf5e28f6116
Author:     Dag-Erling Smørgrav <d...@freebsd.org>
AuthorDate: 2024-10-09 12:08:42 +0000
Commit:     Dag-Erling Smørgrav <d...@freebsd.org>
CommitDate: 2024-10-09 12:11:42 +0000

    cmp: Style and type issues.
    
    MFC after:      3 days
    Sponsored by:   Klara, Inc.
    Reviewed by:    0mp, markj
    Differential Revision:  https://reviews.freebsd.org/D47019
---
 usr.bin/cmp/cmp.c              |  4 ++--
 usr.bin/cmp/link.c             |  4 +++-
 usr.bin/cmp/regular.c          |  1 +
 usr.bin/cmp/special.c          |  1 +
 usr.bin/cmp/tests/cmp_test2.sh | 16 ++++++++--------
 5 files changed, 15 insertions(+), 11 deletions(-)

diff --git a/usr.bin/cmp/cmp.c b/usr.bin/cmp/cmp.c
index c22e4d4121ac..01750aa66da7 100644
--- a/usr.bin/cmp/cmp.c
+++ b/usr.bin/cmp/cmp.c
@@ -38,6 +38,7 @@
 #include <fcntl.h>
 #include <getopt.h>
 #include <nl_types.h>
+#include <stdbool.h>
 #include <stdio.h>
 #include <stdlib.h>
 #include <string.h>
@@ -66,7 +67,6 @@ volatile sig_atomic_t info;
 static void
 siginfo(int signo)
 {
-
        info = signo;
 }
 #endif
@@ -244,7 +244,7 @@ main(int argc, char *argv[])
        else {
                if (zflag && sb1.st_size != sb2.st_size) {
                        if (!sflag)
-                               (void) printf("%s %s differ: size\n",
+                               (void)printf("%s %s differ: size\n",
                                    file1, file2);
                        exit(DIFF_EXIT);
                }
diff --git a/usr.bin/cmp/link.c b/usr.bin/cmp/link.c
index 33b0fa46458c..a08f4dcf9973 100644
--- a/usr.bin/cmp/link.c
+++ b/usr.bin/cmp/link.c
@@ -27,6 +27,7 @@
  */
 
 #include <sys/types.h>
+
 #include <err.h>
 #include <limits.h>
 #include <stdbool.h>
@@ -42,7 +43,8 @@ c_link(const char *file1, off_t skip1, const char *file2, 
off_t skip2,
 {
        char buf1[PATH_MAX], *p1;
        char buf2[PATH_MAX], *p2;
-       int dfound, len1, len2;
+       ssize_t len1, len2;
+       int dfound;
        off_t byte;
        u_char ch;
 
diff --git a/usr.bin/cmp/regular.c b/usr.bin/cmp/regular.c
index 0b78b83968c7..9e1db2bd8772 100644
--- a/usr.bin/cmp/regular.c
+++ b/usr.bin/cmp/regular.c
@@ -37,6 +37,7 @@
 #include <err.h>
 #include <limits.h>
 #include <signal.h>
+#include <stdbool.h>
 #include <stdlib.h>
 #include <stdio.h>
 #include <unistd.h>
diff --git a/usr.bin/cmp/special.c b/usr.bin/cmp/special.c
index f29d3b454f64..47082eb276ab 100644
--- a/usr.bin/cmp/special.c
+++ b/usr.bin/cmp/special.c
@@ -33,6 +33,7 @@
 
 #include <capsicum_helpers.h>
 #include <err.h>
+#include <stdbool.h>
 #include <stdlib.h>
 #include <stdio.h>
 
diff --git a/usr.bin/cmp/tests/cmp_test2.sh b/usr.bin/cmp/tests/cmp_test2.sh
index ca4f6d7cf848..80d2e663875f 100755
--- a/usr.bin/cmp/tests/cmp_test2.sh
+++ b/usr.bin/cmp/tests/cmp_test2.sh
@@ -31,12 +31,12 @@ special_head() {
 special_body() {
        echo 0123456789abcdef > a
        echo 0123456789abcdeg > b
-       atf_check -s exit:0 -o empty -e empty -x "cat a | cmp a -"
-       atf_check -s exit:0 -o empty -e empty -x "cat a | cmp - a"
-       atf_check -s exit:1 -o not-empty -e empty -x "cat b | cmp a -"
-       atf_check -s exit:1 -o not-empty -e empty -x "cat b | cmp - a"
+       atf_check -s exit:0 -o empty -e empty cmp a - <a
+       atf_check -s exit:0 -o empty -e empty cmp - a <a
+       atf_check -s exit:1 -o not-empty -e empty cmp a - <b
+       atf_check -s exit:1 -o not-empty -e empty cmp - a <b
 
-       atf_check -s exit:0 -o empty -e empty -x "cmp a a <&-"
+       atf_check -s exit:0 -o empty -e empty cmp a a <&-
 }
 
 atf_test_case symlink
@@ -112,9 +112,9 @@ limit_body()
 
        # Test special, too.  The implementation for link is effectively
        # identical.
-       atf_check -s exit:0 -e empty -x "cat a | cmp -sn 4 b -"
-       atf_check -s exit:0 -e empty -x "cat a | cmp -sn 3 b -"
-       atf_check -s exit:1 -o ignore -x "cat a | cmp -sn 5 b -"
+       atf_check -s exit:0 -e empty cmp -sn 4 b - <a
+       atf_check -s exit:0 -e empty cmp -sn 3 b - <a
+       atf_check -s exit:1 -o ignore cmp -sn 5 b - <a
 }
 
 atf_test_case bflag

Reply via email to