From 7454819aa30c0a52b8b99f857eeba410ff7d3c51 Mon Sep 17 00:00:00 2001 From: Rich Felker Date: Wed, 7 Feb 2018 21:26:17 +0000 Subject: [PATCH] add octal corner cases --- src/functional/snprintf.c | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/src/functional/snprintf.c b/src/functional/snprintf.c index c96f151..70c1118 100644 --- a/src/functional/snprintf.c +++ b/src/functional/snprintf.c @@ -60,6 +60,20 @@ static const struct { { "%o", 15, "17" }, { "%#o", 15, "017" }, + /* octal: corner cases */ + { "%#o", 0, "0" }, + { "%#.0o", 0, "0" }, + { "%#.1o", 0, "0" }, + { "%#o", 1, "01" }, + { "%#.0o", 1, "01" }, + { "%#.1o", 1, "01" }, + { "%#04o", 1, "0001" }, + { "%#04.0o", 1, " 01" }, + { "%#04.1o", 1, " 01" }, + { "%04o", 1, "0001" }, + { "%04.0o", 1, " 1" }, + { "%04.1o", 1, " 1" }, + { NULL, 0.0, NULL } }; -- 2.11.4.GIT