diff --git a/test/b64decode.c b/test/b64decode.c index 960b25b..04afe28 100644 --- a/test/b64decode.c +++ b/test/b64decode.c @@ -1,11 +1,12 @@ #include +#include #include "buffer.h" #include "textcode.h" #include "havealloca.h" void b64encode(const char* c) { char* buf=alloca(strlen(c)*2+4); - unsigned int dlen; + unsigned long dlen; scan_base64(c,buf,&dlen); buffer_put(buffer_1,buf,dlen); } @@ -23,7 +24,10 @@ main(int argc,char* argv[]) { src[len]=0; b64encode(src); } - buffer_putnlflush(buffer_1); + if (isatty(1)) + buffer_putnlflush(buffer_1); + else + buffer_flush(buffer_1); if (len==-1) return(1); } return 0; diff --git a/test/b64encode.c b/test/b64encode.c index 595e726..3a707e1 100644 --- a/test/b64encode.c +++ b/test/b64encode.c @@ -1,3 +1,4 @@ +#include #include #include "buffer.h" #include "textcode.h" @@ -6,7 +7,10 @@ void b64encode(const char* c) { char* buf=alloca(strlen(c)*2+4); buffer_put(buffer_1,buf,fmt_base64(buf,c,strlen(c))); - buffer_putnlflush(buffer_1); + if (isatty(1)) + buffer_putnlflush(buffer_1); + else + buffer_flush(buffer_1); } main(int argc,char* argv[]) {