logo

utils-std

Collection of commonly available Unix tools git clone https://anongit.hacktivis.me/git/utils-std.git/
commit: 2e3b088aec6fd56b69191cead91810b194e99418
parent 0ecc432817e51db91b51ed76e309ecabc4034755
Author: Haelwenn (lanodan) Monnier <contact@hacktivis.me>
Date:   Wed, 26 Mar 2025 15:26:45 +0100

cmd/echo: fix variable declaration inside switch-case

Diffstat:

Mcmd/echo.c4+++-
1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/cmd/echo.c b/cmd/echo.c @@ -124,7 +124,8 @@ main(int argc, char *argv[]) case '\\': newd[di++] = '\\'; break; - case '0': /* \0 \0n \0nn \0nnn */ + case '0': /* \0 \0n \0nn \0nnn */ + { int nl = 1; // skip leading 0 int num = 0; for(; nl < 4; nl++) @@ -139,6 +140,7 @@ main(int argc, char *argv[]) newd[di++] = num; argi += (nl - 1); break; + } default: newd[di++] = d[argi]; break;