K&R C Programming Language: pg. 105
Extend
entab
anddetab
to accept the shorthand
entab -m +n
to mean tab stops every
n
columns, starting at columnm
.
entab
replaces a number of spaces with a tab character and detab
does the opposite. The question I have concerns the tab stops and entab
. I figure that for detab
it's pretty easy to determine the number of spaces needed to reach the next tab stop, so no worries there. With entab
, replacing spaces with tabs is slightly more difficult since I cannot for sure know how large the tab character goes to its own tab stop (unless there is a way to know for sure).
Am I even thinking about this thing properly?