Mail Archives: djgpp/1999/07/29/12:47:20
Hi,
I have some questions/comments about `dtou' and `utod' (djgpp v2.02).
[1] Take a DOS CR/LF/^Z text file; apply `dtou' and get a unix NL
version (sans ^Z); apply `utod' to this and recover the original DOS
version *except* for the ^Z EOF marker. This has *not* been a problem;
but I noticed it while working on a text filter. Could someone explain
why this happens (i.e., why the ^Z doesn't reappear)?
[2] Just a comment: I appreciate the way that repeated application of
`dtou' (or of `utod') does not turn one CR/LF into two CR/LF's, etc.,
as happens with text files and `dos2unix' on my Solaris box at work
(where the first application of `dos2unix' adds one ^M, a second
application leaves you with ^M^M on each line, etc). So if there is
any doubt about the current format of a text file, one can apply the
desired filter without worrying about messing up a file that is already
in the desired format.
[3] Related to [2]: is there a way to detect whether a text file is
in unix NL format or DOS CR/LF/[^Z] format, preferably within from
a bash script?
[4] The main reason any of this matters to me is because I move lots of
files back and forth from work (Solaris 2.7) to home (djgpp). I was
working on the idea of hacking the source for `dtou' to use as a filter
with the `--use-compress-program=PROG' option of GNU tar. Then I could
make a tarball using djgpp that would untar on my Solaris box without
having then to apply `dos2unix' to the unpack files. (I got the idea
from the interesting conversation in the tar info file).
TIA for comments, suggestions,
jtw
- Raw text -