From 12201178a5950eecd9537e642b1246011490b499 Mon Sep 17 00:00:00 2001 From: Epoch Qwert Date: Tue, 21 Oct 2014 12:49:50 -0500 Subject: updated rebuild.sh to work better with libexec and bin instead of just bin. added epochttpd 2 --- src/bin/pad.c | 32 ++++++++++++++++++++++++++++++++ 1 file changed, 32 insertions(+) create mode 100644 src/bin/pad.c (limited to 'src/bin/pad.c') diff --git a/src/bin/pad.c b/src/bin/pad.c new file mode 100644 index 0000000..2f2ea13 --- /dev/null +++ b/src/bin/pad.c @@ -0,0 +1,32 @@ +#include +#include + +int main(int argc,char *argv[]) { + short in; + int i=0; + int width=argc>1?atoi(argv[1]):80; + char with=argc>2?argv[2][0]:' '; + char *line=argc>3?argv[3]:0; + if(width <= 0) width=80; + if(!line) { + while((in=fgetc(stdin)) != -1) { + if(in == '\n') { + for(;i%width || i == 0;i++) { + putchar(with); + } + i=-1; + } + i++; + putchar(in); + } + } else { + i=strlen(line); + } + if(i != 0 || line) { + if(line) fputs(line,stdout); + for(;i%width || i == 0;i++) { + putchar(with); + } + } + return 0; +} -- cgit v1.2.3