diff options
author | Rob Landley <rob@landley.net> | 2016-03-15 15:02:21 -0500 |
---|---|---|
committer | Rob Landley <rob@landley.net> | 2016-03-15 15:02:21 -0500 |
commit | 2665cd0cf0d1116fae397d5b598a5ae1bd055afa (patch) | |
tree | 56d6513c6116fbb4ce846cfa2fd08473bb99267b /toys | |
parent | 2b999e614c48f084f6a14d589d434904aec6d491 (diff) | |
download | toybox-2665cd0cf0d1116fae397d5b598a5ae1bd055afa.tar.gz |
Add base64.test, and Izabera pointed out that -w0 should disable wrapping.
Diffstat (limited to 'toys')
-rw-r--r-- | toys/other/base64.c | 8 |
1 files changed, 3 insertions, 5 deletions
diff --git a/toys/other/base64.c b/toys/other/base64.c index 234ca1c3..33155bc5 100644 --- a/toys/other/base64.c +++ b/toys/other/base64.c @@ -4,7 +4,7 @@ * * No standard -USE_BASE64(NEWTOY(base64, "diw#<1[!dw]", TOYFLAG_USR|TOYFLAG_BIN)) +USE_BASE64(NEWTOY(base64, "diw#<0=76[!dw]", TOYFLAG_USR|TOYFLAG_BIN)) config BASE64 bool "base64" @@ -16,7 +16,7 @@ config BASE64 -d decode -i ignore non-alphabetic characters - -w wrap output at COLUMNS (default 76) + -w wrap output at COLUMNS (default 76 or 0 for no wrap) */ #define FOR_base64 @@ -32,7 +32,7 @@ static void wraputchar(int c, int *x) { putchar(c); TT.total++; - if (++*x == TT.columns) { + if (TT.columns && ++*x == TT.columns) { *x = 0; xputc('\n'); }; @@ -89,8 +89,6 @@ static void do_base64(int fd, char *name) void base64_main(void) { - if (!TT.columns) TT.columns = 76; - base64_init(toybuf); loopfiles(toys.optargs, do_base64); } |