summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--src/printf.c2
-rw-r--r--tests/bfs/printf_invalid_flag.sh1
-rw-r--r--tests/gnu/printf_flags.sh2
3 files changed, 3 insertions, 2 deletions
diff --git a/src/printf.c b/src/printf.c
index f8428f7..be09ebd 100644
--- a/src/printf.c
+++ b/src/printf.c
@@ -709,9 +709,9 @@ int bfs_printf_parse(const struct bfs_ctx *ctx, struct bfs_expr *expr, const cha
case '#':
case '0':
case '+':
+ case ' ':
must_be_numeric = true;
fallthru;
- case ' ':
case '-':
if (strchr(fmt.str, c)) {
bfs_expr_error(ctx, expr);
diff --git a/tests/bfs/printf_invalid_flag.sh b/tests/bfs/printf_invalid_flag.sh
new file mode 100644
index 0000000..70dfe97
--- /dev/null
+++ b/tests/bfs/printf_invalid_flag.sh
@@ -0,0 +1 @@
+! invoke_bfs basic -printf '% p'
diff --git a/tests/gnu/printf_flags.sh b/tests/gnu/printf_flags.sh
index 2ef37ad..98e8faa 100644
--- a/tests/gnu/printf_flags.sh
+++ b/tests/gnu/printf_flags.sh
@@ -1 +1 @@
-bfs_diff basic -printf '|%- 10.10p| %+03d %#4m\n'
+bfs_diff basic -printf '|%-10.10p| %+03d % #4m\n'