logo

utils-std

Collection of commonly available Unix tools
commit: c1dca7872a6458e4a17e3c02802c3834691b90dc
parent e3dc53404bd34234de0803f671ba0e57aa9d562c
Author: Haelwenn (lanodan) Monnier <contact@hacktivis.me>
Date:   Tue,  4 Jun 2024 19:28:21 +0200

test-lib/mode: Format mode with zero-padded octals

Diffstat:

Mtest-lib/mode.c10+++++-----
1 file changed, 5 insertions(+), 5 deletions(-)

diff --git a/test-lib/mode.c b/test-lib/mode.c @@ -21,13 +21,13 @@ t_mode(char *str, mode_t old, mode_t expect) mode_t got = new_mode(str, old, &errstr); if(got == expect && errstr == NULL) { - printf("ok %d - new_mode(\"%s\", %d) == %d\n", id, str, old, expect); + printf("ok %d - new_mode(\"%s\", 0%06o) == 0%06o\n", id, str, old, expect); return; } err = 1; - printf("not ok %d - new_mode(\"%s\", %d) == %d\n", id, str, old, expect); - if(got != expect) printf("# Got: %d\n", got); + printf("not ok %d - new_mode(\"%s\", 0%06o) == 0%06o\n", id, str, old, expect); + if(got != expect) printf("# Got: 0%06o\n", got); if(errstr != NULL) printf("# Errstr: \"%s\"\n", errstr); } @@ -42,11 +42,11 @@ t_mode_errstr(char *str, mode_t old, char *expect_errstr) if(errstr != NULL && strcmp(errstr, expect_errstr) == 0) { - printf("ok %d - new_mode(\"%s\", %d) -> %s\n", id, str, old, expect_errstr); + printf("ok %d - new_mode(\"%s\", 0%06o) -> %s\n", id, str, old, expect_errstr); } else { - printf("not ok %d - new_mode(\"%s\", %d) -> %s\n", id, str, old, expect_errstr); + printf("not ok %d - new_mode(\"%s\", 0%06o) -> %s\n", id, str, old, expect_errstr); printf("# Got errstr: \"%s\"\n", errstr); err = 1; }