Message-Id: <199907291640.LAA07707@darwin.sfbr.org> Date: Thu, 29 Jul 1999 11:40:55 -0500 (CDT) From: Jeff Williams Subject: about dtou and utod To: djgpp AT delorie DOT com MIME-Version: 1.0 Content-Type: TEXT/plain; charset=us-ascii Content-MD5: 96Ivy60Q01Foa+w4zqi5/w== X-Mailer: dtmail 1.3.0 @(#)CDE Version 1.3.4 SunOS 5.7 sun4u sparc Reply-To: djgpp AT delorie DOT com 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