RE: sed and dos format

2004-08-25 Thread Hannu E K Nevalainen
Brian wrote:
> Regarding efficiency, I am strictly talking about the code path.
> Having Cygwin add a \r when the file is written the first time should
> be more efficient than reprocessing the whole thing after it's been
> processed the first time, or at the least reparsing the lines in an
> output filter pipeline to insert \r's.

Of course it would be more efficient, but as I wrote previously - one has to
have the consequences in mind.

>  Again my reply was under the
> context of "lots of files that *must* remain DOS-mode" where
> accidently forgetting a u2d somewhere breaks things just as bad as
> some obscure text-mode bug in some app.
>
> This is beginning to get trollish so I will cease further comment in
> this thread.

 ;-) why is it a troll when you're discussion alternative ways of doing
things? I'm not sure whether this is amusing or something else.

/Hannu E K Nevalainen, B.Sc. EE Microcomputer systems--72-->

** mailing list preference; please keep replies on list **

-- printf("LocalTime: UTC+%02d\n",(DST)? 2:1); --
--END OF MESSAGE--


--
Unsubscribe info:  http://cygwin.com/ml/#unsubscribe-simple
Problem reports:   http://cygwin.com/problems.html
Documentation: http://cygwin.com/docs.html
FAQ:   http://cygwin.com/faq/



Re: sed and dos format

2004-08-24 Thread Brian Dessent
Hannu E K Nevalainen wrote:

> james pentland also wrote:
> > this makes sed unusable or undesirable for a large
> > number of files i might want to edit.
> 
> I don't take this as an implication of 'bulk' edits. So your "many files"
> falls on this. Also; using sed implies automatic changes.

My response was addressing the point of view that he had lots of files
for a certain application that must remain with DOS line endings and
that they would all possibly be handled in various ways by various sed
scripts.  Obviously for a few random text files u2d is easier.

The poster asked about how to make sed work as he wanted, and to me
making a text mount addresses that question most directly.  Obviously if
he knows how to use sed he is aware of how to use u2d or add an explicit
\r in his scripts, so telling him to use u2d does not paint the whole
picture.  "How do I make X work? Use Y." is an incomplete response when
X can easily be made to work as requested.

I agree that text mode mounts have lots of issues but in the context of
his post I invisioned a specific application in a specific drectory or
tree that could all be mounted text, seperate from the rest of the
system.  Obviously mounting all kinds of things text without
consideration is a bad idea.

Regarding efficiency, I am strictly talking about the code path.  Having
Cygwin add a \r when the file is written the first time should be more
efficient than reprocessing the whole thing after it's been processed
the first time, or at the least reparsing the lines in an output filter
pipeline to insert \r's.  Again my reply was under the context of "lots
of files that *must* remain DOS-mode" where accidently forgetting a u2d
somewhere breaks things just as bad as some obscure text-mode bug in
some app.

This is beginning to get trollish so I will cease further comment in
this thread.

Brian

--
Unsubscribe info:  http://cygwin.com/ml/#unsubscribe-simple
Problem reports:   http://cygwin.com/problems.html
Documentation: http://cygwin.com/docs.html
FAQ:   http://cygwin.com/faq/



RE: sed and dos format

2004-08-24 Thread Hannu E K Nevalainen
Brian Dessent wrote:
> Hannu E K Nevalainen wrote:
>
>> You wrote:
>>> james pentland wrote:
>>>
 sed has the unfortunate property that it reduces dos
 format line endings to unix format line endings.
>>>
>>> Use a text mode mount.
>>
>> Using a sledgahammer for a nail?
>>  Better to use unix2dos A.K.A. u2d.
>
> I disagree.  He said he was doing this with many files.  It's far
> easier to just mount the directory once as textmode and not have to
> change anything than it is to edit all his scripts to run u2d
> afterward, and have to remember to do that to all future scripts.

> One "mount" command versus potentially dozens of current and future
> script updates is hardly a "sledgehammer for a nail".  Plus textmode
> mounts will keep his files with DOS line endings no matter what
> processing he does, whereas "u2d" requires that he remember to run
> that command any time he changes a file with a cygwin program.  I
> don't see how you can advocate manually having to do that every time
> when there's a feature built in to Cygwin to handle this very thing
> and handle it more efficiently.
>
> Brian

james pentland also wrote:
> this makes sed unusable or undesirable for a large
> number of files i might want to edit.

I don't take this as an implication of 'bulk' edits. So your "many files"
falls on this. Also; using sed implies automatic changes.

What your refer to as beeing easy; to use a text mount has its pitfalls, and
that is why I'm writing this.

Using u2d is by far easier than using sed ;-). And as it is sed we're
talking about, the "automatic" nature of the thing indicates that he is
using a script - adding "u2d" at an apropriate point isn't hard.

Text mounts means that you have the potential danger of CRLF vs LF
confusion - at a point where you've forgotten that you have mounted in text
mode.

 To summarize somewhat on my text mode mount concerns;
1) Not always easy to remember which mount is text mode which is not.
   Do you check this out every time? - I don't.
2) The main danger is inadvertent(sp?) text conversion;
   This causes MUCH confusion/malfuction - problems which often lead
   to extensive "bug hunting". My experience is that the *last* you
   think of is CRLF vs LF problems in this situation.
3) In addition some(many?) cygwin/gnu tools has problems as soon as
   there is a text mount involved... (in addition to taking stdin as
   implication of "text mode requirement" as it seems)
This situation is slowly getting better though.
3a) How many percent of cygwin users know exactly which tools to not
use on text mounts?
3b) Yet another question is whether they (3a) do(can) keep an updated
list of these - as patches are applied?

 IMO; to be safe: stay away from text mode mounts and you *won't* have to
remember nor worry as much.
 I'd say that it is easier to remember that you're working on a DOS file
(say a .bat) than to remember which of all mounts are in text mode.

Now you come and say things like "handle it more efficiently"; If I'm on a
futile bug hunt for hours before I can finish the job, then the efficiency
comes to a grand halt.

Also with "my way" (above) in mind you'll quite easily see that the
unreliability (wrt line endings) of a utility like sed as discussed here,
and 'cat 

** mailing list preference; please keep replies on list **

-- printf("LocalTime: UTC+%02d\n",(DST)? 2:1); --
--END OF MESSAGE--


--
Unsubscribe info:  http://cygwin.com/ml/#unsubscribe-simple
Problem reports:   http://cygwin.com/problems.html
Documentation: http://cygwin.com/docs.html
FAQ:   http://cygwin.com/faq/



Re: sed and dos format

2004-08-23 Thread Brian Dessent
Hannu E K Nevalainen wrote:

> You wrote:
> > james pentland wrote:
> >
> >> sed has the unfortunate property that it reduces dos
> >> format line endings to unix format line endings.
> >
> > Use a text mode mount.
> 
> Using a sledgahammer for a nail?
>  Better to use unix2dos A.K.A. u2d.

I disagree.  He said he was doing this with many files.  It's far easier
to just mount the directory once as textmode and not have to change
anything than it is to edit all his scripts to run u2d afterward, and
have to remember to do that to all future scripts.  One "mount" command
versus potentially dozens of current and future script updates is hardly
a "sledgehammer for a nail".  Plus textmode mounts will keep his files
with DOS line endings no matter what processing he does, whereas "u2d"
requires that he remember to run that command any time he changes a file
with a cygwin program.  I don't see how you can advocate manually having
to do that every time when there's a feature built in to Cygwin to
handle this very thing and handle it more efficiently.

Brian

--
Unsubscribe info:  http://cygwin.com/ml/#unsubscribe-simple
Problem reports:   http://cygwin.com/problems.html
Documentation: http://cygwin.com/docs.html
FAQ:   http://cygwin.com/faq/



RE: sed and dos format

2004-08-23 Thread Hannu E K Nevalainen
You wrote:
> james pentland wrote:
> 
>> sed has the unfortunate property that it reduces dos
>> format line endings to unix format line endings.
> 
> Use a text mode mount.
> 
> Brian

Using a sledgahammer for a nail?
 Better to use unix2dos A.K.A. u2d.

/Hannu E K Nevalainen, B.Sc. EE Microcomputer systems--72-->

** mailing list preference; please keep replies on list **

-- printf("LocalTime: UTC+%02d\n",(DST)? 2:1); --
--END OF MESSAGE--

--
Unsubscribe info:  http://cygwin.com/ml/#unsubscribe-simple
Problem reports:   http://cygwin.com/problems.html
Documentation: http://cygwin.com/docs.html
FAQ:   http://cygwin.com/faq/



Re: sed and dos format

2004-08-22 Thread Brian Dessent
james pentland wrote:

> sed has the unfortunate property that it reduces dos
> format line endings to unix format line endings.

Use a text mode mount.

Brian

--
Unsubscribe info:  http://cygwin.com/ml/#unsubscribe-simple
Problem reports:   http://cygwin.com/problems.html
Documentation: http://cygwin.com/docs.html
FAQ:   http://cygwin.com/faq/