Dec 132017
 
Two C programs that will turn tabs into spaces, and vice-versa. Includes full C source code.
File TABEDIT.ZIP from The Programmer’s Corner in
Category Word Processors
Two C programs that will turn tabs into spaces, and vice-versa. Includes full C source code.
File Name File Size Zip Size Zip Type
DETAB.C 2612 1148 deflated
DETAB.EXE 12756 6068 deflated
ENTAB.C 3346 1365 deflated
ENTAB.EXE 12870 6122 deflated
TABEDIT.DOC 1408 672 deflated

Download File TABEDIT.ZIP Here

Contents of the TABEDIT.DOC file




Here's a quick summary of the function of entab and detab:

Detab takes files and turns their tabs into spaces. When a
tab is encountered, an appropriate number of spaces are
inserted to advance to the next tab stop. By default, tabs
are set every 8th column. The -tN option changes the tabs
to every Nth column.

Entab takes files and turns spaces into tabs where it would
reduce the number of characters. Remember that entab doesn't
know about things like quoted strings, so it may change spaces
to tabs inside a string; watch out for this. Like detab, the
default tabstops are every 8th column, and can be changed with
the -tN option.

Both entab and detab can have their default tabstops changed
from every 8th column by using an environment variable. For
example, the command

SET TABS=4

changes the default tabstops to every 4th column.

For more details on the operation of entab and detab, see the
header in the C source files. In particular, note the use of
the getenv() call to obtain a value set by DOS's SET command.
It's a mighty handy way to set up values needed by utilities.
Lattice C has the getenv() call, which is a standard Unix C
library call. Hopefully your compiler will have it too.
If not, you might try writing your own interface in assembler.



 December 13, 2017  Add comments

Leave a Reply