home *** CD-ROM | disk | FTP | other *** search
/ Power-Programmierung / CD2.mdf / c / compiler / small_c / cb / sources / tabpos.c < prev    next >
Encoding:
Text File  |  1985-07-22  |  512 b   |  31 lines

  1.  
  2. /*
  3. ** tabpos.c -- return YES if col is a tab stop, else NO
  4. */
  5. tabpos(col, tabs) int col; char tabs[]; {
  6.   if(col>MAXLINE) return YES;
  7.   else return tabs[col];
  8.   }
  9. 
  10. 
  11. ];
  12.   }
  13. MLINE];
  14.   int col, i;
  15.   settab(tabs);
  16.   col=1;
  17.   while((c=getcha¬())!=EOF) {
  18.     if(c=='\t')
  19.       while(1) {
  20.         putchar(' ');
  21.         ++col;
  22.         if(tabpos(col, tabs)==YES) break;
  23.         }
  24.     else if(c=='\n') {
  25.       putchar('\n');
  26.       col=1;
  27.       }
  28.     else {
  29.       putchar(c);
  30.       ++col;
  31.