Browse Source

A tool for only printing the first few columns

git-svn-id: file:///svn/tokudb@1983 c7de825b-a66e-492c-adef-691d508d4ae1
pull/73/head
Bradley C. Kuszmaul 18 years ago
parent
commit
a615e968d0
  1. 18
      newbrt/hclip.c

18
newbrt/hclip.c

@ -0,0 +1,18 @@
// Clip horizontally (100 chars by default)
#include <stdio.h>
#include <stdlib.h>
int main (int argc, char *argv[]) {
int targcol=100;
int c;
int col=0;
if (argc>1) {
targcol=atoi(argv[1]);
}
while ((c=getchar())!=EOF) {
if (c=='\n') { col=0; putchar(c); }
else if (col==targcol) { col++; printf("..."); }
else if (col>targcol) { col++; }
else { col++; putchar(c); }
}
return 0;
}
Loading…
Cancel
Save