⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 etb.c

📁 数字转换的六个功能模块
💻 C
字号:
/*
** etb.c -- replace blanks with tabs and blanks
**
** Copyright 1982 J. E. Hendrix.  All rights reserved.
*/
#include <stdio.h>
#include "tools.h"
#define NOCCARGC
#define MAXLIN1 (MAXLINE+1)
main(argc, argv) int argc, *argv; {
  char c, tabs[MAXLIN1];
  int col, newcol;
  auxbuf(stdin, 4096);
  if(settab(tabs, argc, argv)==ERR) {
    fputs("usage: ETB [#]... [+#]\n", stderr);
    abort(7);
    }
  col=1;
  while(YES) {
    poll(YES);
    newcol=col;
    while((c=getchar())==' ') {
      ++newcol;
      if(tabpos(newcol, tabs)==YES) {
        cout('\t', stdout);
        col=newcol;
        }
      }
    if(c=='\t') {
      while(tabpos(newcol, tabs)==NO) ++newcol;
      cout('\t', stdout);
      col=newcol;
      continue;
      }
    while(col<newcol) {
      cout(' ', stdout);
      ++col;
      }
    if(c==EOF) break;
    cout(c, stdout);
    if(c=='\n') col=1;
    else if(c=='\b') --col; /* ok if it goes neg */
    else ++col;
    }
  fclose(stdout);
  }
#include "settab.c"
#include "tabpos.c"
#include "out.c"

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -