2
0
mirror of https://codeberg.org/kiss-community/repo synced 2024-12-22 23:30:05 -07:00
repo/core/busybox/patches/awk-fix-%%.patch
2021-09-10 18:24:41 +03:00

22 lines
514 B
Diff

diff --git a/editors/awk.c b/editors/awk.c
index 3adbca7..f7b8ef0 100644
--- a/editors/awk.c
+++ b/editors/awk.c
@@ -2346,8 +2346,15 @@ static char *awk_printf(node *n, size_t *len)
size_t slen;
s = f;
- while (*f && (*f != '%' || *++f == '%'))
+ while (*f && *f != '%')
f++;
+ c = *++f;
+ if (c == '%') { /* double % */
+ slen = f - s;
+ s = xstrndup(s, slen);
+ f++;
+ goto tail;
+ }
while (*f && !isalpha(*f)) {
if (*f == '*')
syntax_error("%*x formats are not supported");