public inbox for cygwin@cygwin.com
 help / color / mirror / Atom feed
* Text file created from the keyboard is DOS termninated
@ 2002-12-07 13:37 fergus
  0 siblings, 0 replies; 4+ messages in thread
From: fergus @ 2002-12-07 13:37 UTC (permalink / raw)
  To: cygwin; +Cc: fergus

I am set up for "Unix" rather than "DOS" and created a text file directly
from the keyboard by typing

$ cat > textfile
this is line1 <press Enter>
this is line2 <press Enter>
<press Ctrl-D>
$

It turns out that the two-line file textfile created by this method, is
DOS-terminated. I was kind of thinking it would (should?) be
Unix-terminated. I know there are 100 threads on line termination, but in
contexts more sophisticated than this. Please can somebody tell me whether
this is a bug; or meant to happen (if so, why); or comment with assurance
that my "Unix" set-up must be faulty in some way (correctable?)

Thank you. By the way, if I try

$ cat > textfile << X
> this is line1 <press Enter>
> this is line2 <press Enter>
> X <press Enter>
$

(where > is the provided prompt) then the two-line file textfile is
Unix-terminated.

Fergus


--
Unsubscribe info:      http://cygwin.com/ml/#unsubscribe-simple
Bug reporting:         http://cygwin.com/bugs.html
Documentation:         http://cygwin.com/docs.html
FAQ:                   http://cygwin.com/faq/

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: Text file created from the keyboard is DOS termninated
@ 2002-12-08  2:40 Gareth Pearce
  0 siblings, 0 replies; 4+ messages in thread
From: Gareth Pearce @ 2002-12-08  2:40 UTC (permalink / raw)
  To: fergus, cygwin






> > Your are using textmode mounts.  Worx fine with binmode:
>
>Thanks for trying this out. I'm not using textmode mounts; and it doesn't
>seem to be working fine with binmode. Contrast the two methods of textfile
>creation in the following snippet:
>
>============
>  ~> mount
>c:\Cygwin\bin on /usr/bin type system (binmode)
>c:\Cygwin\lib on /usr/lib type system (binmode)
>c:\Cygwin on / type system (binmode)
>c: on /cygdrive/c type user (binmode,noumount)
>
>~> cat > file1 << X
> > line1
> > line2
> > X
>~> od -tx1 file1
>0000000 6c 69 6e 65 31 0a 6c 69 6e 65 32 0a
>0000014
>
>~> cat > file2
>line1
>line2
>~> od -tx1 file2
>0000000 6c 69 6e 65 31 0d 0a 6c 69 6e 65 32 0d 0a
>0000016
>~>
>============
>
>So I can get what I require (Unix terminators) by appending <<X to the cat
>line; but I'd still like to know the reason for the intrusive 0d under the
>other method, and whether it is a "bug" in the sense that it really
>shouldn't be happening at all (which is what I feel about it).
>

Do you have CYGWIN variable set to contain binmode? - in one method your 
doing input using pipes without file reference and in the other (i think ;P) 
you are referencing a file (effectively at least).  Without a file reference 
- cygwin doesnt know binmode or textmode (i think) - so what it does depends 
on the CYGWIN variable (and whatever the default is) ...

did i say "i think" enough times :)

Gareth

_________________________________________________________________
Protect your PC - get McAfee.com VirusScan Online 
http://clinic.mcafee.com/clinic/ibuy/campaign.asp?cid=3963


--
Unsubscribe info:      http://cygwin.com/ml/#unsubscribe-simple
Bug reporting:         http://cygwin.com/bugs.html
Documentation:         http://cygwin.com/docs.html
FAQ:                   http://cygwin.com/faq/

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: Text file created from the keyboard is DOS termninated
  2002-12-07 20:07 Rolf Campbell
@ 2002-12-08  0:15 ` fergus
  0 siblings, 0 replies; 4+ messages in thread
From: fergus @ 2002-12-08  0:15 UTC (permalink / raw)
  To: cygwin; +Cc: Rolf Campbell, fergus

> Your are using textmode mounts.  Worx fine with binmode:

Thanks for trying this out. I'm not using textmode mounts; and it doesn't
seem to be working fine with binmode. Contrast the two methods of textfile
creation in the following snippet:

============
 ~> mount
c:\Cygwin\bin on /usr/bin type system (binmode)
c:\Cygwin\lib on /usr/lib type system (binmode)
c:\Cygwin on / type system (binmode)
c: on /cygdrive/c type user (binmode,noumount)

~> cat > file1 << X
> line1
> line2
> X
~> od -tx1 file1
0000000 6c 69 6e 65 31 0a 6c 69 6e 65 32 0a
0000014

~> cat > file2
line1
line2
~> od -tx1 file2
0000000 6c 69 6e 65 31 0d 0a 6c 69 6e 65 32 0d 0a
0000016
~>
============

So I can get what I require (Unix terminators) by appending <<X to the cat
line; but I'd still like to know the reason for the intrusive 0d under the
other method, and whether it is a "bug" in the sense that it really
shouldn't be happening at all (which is what I feel about it).

Fergus


--
Unsubscribe info:      http://cygwin.com/ml/#unsubscribe-simple
Bug reporting:         http://cygwin.com/bugs.html
Documentation:         http://cygwin.com/docs.html
FAQ:                   http://cygwin.com/faq/

^ permalink raw reply	[flat|nested] 4+ messages in thread

* RE: Text file created from the keyboard is DOS termninated
@ 2002-12-07 20:07 Rolf Campbell
  2002-12-08  0:15 ` fergus
  0 siblings, 1 reply; 4+ messages in thread
From: Rolf Campbell @ 2002-12-07 20:07 UTC (permalink / raw)
  To: fergus, cygwin

Your are using textmode mounts.  Worx fine with binmode:
/home/rcampbell> cat > a << A
> a
> a
> A
/home/rcampbell> od -tx1 < a
0000000 61 0a 61 0a
0000004


> -----Original Message-----
> From: fergus@bonhard.uklinux.net [mailto:fergus@bonhard.uklinux.net] 
> Sent: Saturday, December 07, 2002 3:10 PM
> To: cygwin@cygwin.com
> Cc: fergus@bonhard.uklinux.net
> Subject: Text file created from the keyboard is DOS termninated
> 
> 
> I am set up for "Unix" rather than "DOS" and created a text 
> file directly from the keyboard by typing
> 
> $ cat > textfile
> this is line1 <press Enter>
> this is line2 <press Enter>
> <press Ctrl-D>
> $
> 
> It turns out that the two-line file textfile created by this 
> method, is DOS-terminated. I was kind of thinking it would 
> (should?) be Unix-terminated. I know there are 100 threads on 
> line termination, but in contexts more sophisticated than 
> this. Please can somebody tell me whether this is a bug; or 
> meant to happen (if so, why); or comment with assurance that 
> my "Unix" set-up must be faulty in some way (correctable?)
> 
> Thank you. By the way, if I try
> 
> $ cat > textfile << X
> > this is line1 <press Enter>
> > this is line2 <press Enter>
> > X <press Enter>
> $
> 
> (where > is the provided prompt) then the two-line file 
> textfile is Unix-terminated.
> 
> Fergus
> 
> 
> --
> Unsubscribe info:      http://cygwin.com/ml/#unsubscribe-simple
> Bug reporting:         http://cygwin.com/bugs.html
> Documentation:         http://cygwin.com/docs.html
> FAQ:                   http://cygwin.com/faq/
> 
> 

--
Unsubscribe info:      http://cygwin.com/ml/#unsubscribe-simple
Bug reporting:         http://cygwin.com/bugs.html
Documentation:         http://cygwin.com/docs.html
FAQ:                   http://cygwin.com/faq/

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2002-12-08  9:33 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2002-12-07 13:37 Text file created from the keyboard is DOS termninated fergus
2002-12-07 20:07 Rolf Campbell
2002-12-08  0:15 ` fergus
2002-12-08  2:40 Gareth Pearce

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).