1752749 Members
4907 Online
108789 Solutions
New Discussion юеВ

ux2Dos

 
SOLVED
Go to solution
MarkWilson
Occasional Visitor

ux2Dos

Is there any way to stop ux2Dos from putting an end-of-file character (0x1a) at the end of each converted file?

3 REPLIES 3
Steven Schweda
Honored Contributor
Solution

Re: ux2Dos

> Is there any way to stop ux2Dos from putting an end-of-file character
> (0x1a) at the end of each converted file?

   I doubt it.

   Write a short C program to replace "ux2dos"?  Delete the thing after
"ux2dos" adds it?  For example:

dyi# uname -a
HP-UX dyi B.11.31 U ia64 4235313755 unlimited-user license

dyi# cat two.txt
A
B

dyi# cat two.txt | od -b
0000000 101 012 102 012
0000004

dyi# cat two.txt | ux2dos | od -b
0000000 101 015 012 102 015 012 032
0000007

dyi# cat two.txt | ux2dos | tr -d '\032' | od -b
0000000 101 015 012 102 015 012
0000006

   What's the flow that requires this sort of line-ending conversion?

MarkWilson
Occasional Visitor

Re: ux2Dos

We are writting an extract to send to a customer.  Our convention is to write unix style line endings.  Our customer wants DOS style line endings.  My boss has made the decision that we will not modify our code to generate DOS style line endings for this extract.

I was hoping to not have to write something to remove the end of file character.

 

Thank you for your assistance.

Steven Schweda
Honored Contributor

Re: ux2Dos

> We are writting an extract to send to a customer. [...]

   "send" how, exactly?

> I was hoping to not have to write something to remove the end of file
> character.

   The reason I asked about the flow is that one possibility would be
to send a zip archive to the victim instead of a raw text file.  For
example, Info-ZIP Zip has an option, "-l   convert LF to CR LF", and
Info-ZIP UnZip has an option, "-a  auto-convert any text files".
Info-ZIP UnZip or some other unzip programs (or related OS features)
might do the desired line-ending conversion with little or no extra
effort, even if Zip didn't.  (And you'd get the compression and
file-integrity checking which come with a zip archive.)

   As usual, many things are possible.  You probably know more about
your victim's environment and requirements/desires than I do, but
"ux2dos", with or without extra help, might not be the best tool for the
job (depending on exactly what the job actually is).