[hackers] [PATCH][sbase] cmp: Make output POSIX compliant

From: Richard Ipsum <richardipsum_AT_fastmail.co.uk>
Date: Sun, 19 May 2019 16:37:01 +0100

From POSIX:

In the POSIX locale, results of the comparison shall be written to
standard output. When no options are used, the format shall be:

    "%s %s differ: char %d, line %d\n", file1, file2,
        <byte number>, <line number>

....
in the POSIX locale the following
diagnostic message shall be written:

"cmp: EOF on %s%s\n", <name of shorter file>, <additional info>
---
 cmp.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/cmp.c b/cmp.c
index ea8902f..6949191 100644
--- a/cmp.c
+++ b/cmp.c
_AT_@ -57,12 +57,12 @@ main(int argc, char *argv[])
 			continue;
 		} else if (b[0] == EOF || b[1] == EOF) {
 			if (!sflag)
-				weprintf("cmp: EOF on %s\n", argv[(b[0] != EOF)]);
+				printf("cmp: EOF on %s\n", argv[(b[0] != EOF)]);
 			same = 0;
 			break;
 		} else if (!lflag) {
 			if (!sflag)
-				printf("%s %s differ: byte %zu, line %zu\n",
+				printf("%s %s differ: char %zu, line %zu\n",
 				       argv[0], argv[1], n, line);
 			same = 0;
 			break;
-- 
2.21.0
Received on Sun May 19 2019 - 17:37:01 CEST

This archive was generated by hypermail 2.3.0 : Sun May 19 2019 - 18:24:25 CEST