aboutsummaryrefslogtreecommitdiffstats
path: root/src/bin/pad.c
diff options
context:
space:
mode:
authorEpoch Qwert <epoch@53flpnlls43fcguy.onion>2014-10-21 12:49:50 -0500
committerEpoch Qwert <epoch@53flpnlls43fcguy.onion>2014-10-21 12:53:12 -0500
commit12201178a5950eecd9537e642b1246011490b499 (patch)
treeb606b8f77af7d8b77a92ef5a3f7c905d66b97ad9 /src/bin/pad.c
parent1852f2d7d63c39d0fd97a2774d1bd16bf53ec67d (diff)
downloadmisc-12201178a5950eecd9537e642b1246011490b499.tar.gz
misc-12201178a5950eecd9537e642b1246011490b499.zip
updated rebuild.sh to work better with libexec and bin instead of just bin.
added epochttpd 2
Diffstat (limited to 'src/bin/pad.c')
-rw-r--r--src/bin/pad.c32
1 files changed, 32 insertions, 0 deletions
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 <stdio.h>
+#include <string.h>
+
+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;
+}