Re: script(1) Why does it output in CR/LF?

2006-03-03 Thread Kristian Vaaf

At 16:05 28.02.2006, James Bailie wrote:

Glenn Dawson wrote:

 At 02:30 AM 2/28/2006, Kristian Vaaf wrote:

 Hello.

 I am just curious why the files I generate with script(1) output in CR/LF
 forcing me to run dos2unix on them everytime?


 Script just captures the output of your shell, and your shell has to
 send crlf in order to get the cursor back to the beginning of a line.

No it doesn't.  The script(1) utility interposes a
pseudo-terminal between the program whose output is to be
captured and itself, so the program thinks its running on a
terminal device and behaves accordingly.  Then script(1) acts
like a transparent filter, shuttling data back-and-forth from the
actual terminal to the pseudo-terminal, while sending a copy of
the program's output to the log file as well.  It is the terminal
driver in canonical mode, inside the pseudo-terminal, that is
expanding NLs in the proggy's output stream into CRNL pairs.

--
James Bailie [EMAIL PROTECTED]
http://www.jamesbailie.com


Thank you man, that was a wonderful description :)

The last question though,
don't you find it the least bit stupid?

Thanks!

___
freebsd-questions@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-questions
To unsubscribe, send any mail to [EMAIL PROTECTED]


Re: script(1) Why does it output in CR/LF?

2006-03-03 Thread Donald J. O'Neill
On Friday 03 March 2006 04:52, Kristian Vaaf wrote:
 At 16:05 28.02.2006, James Bailie wrote:
 Glenn Dawson wrote:
   At 02:30 AM 2/28/2006, Kristian Vaaf wrote:
   Hello.
  
   I am just curious why the files I generate with script(1) output
   in CR/LF forcing me to run dos2unix on them everytime?
  
   Script just captures the output of your shell, and your shell has
   to send crlf in order to get the cursor back to the beginning of
   a line.
 
 No it doesn't.  The script(1) utility interposes a
 pseudo-terminal between the program whose output is to be
 captured and itself, so the program thinks its running on a
 terminal device and behaves accordingly.  Then script(1) acts
 like a transparent filter, shuttling data back-and-forth from the
 actual terminal to the pseudo-terminal, while sending a copy of
 the program's output to the log file as well.  It is the terminal
 driver in canonical mode, inside the pseudo-terminal, that is
 expanding NLs in the proggy's output stream into CRNL pairs.
 
 --
 James Bailie [EMAIL PROTECTED]
 http://www.jamesbailie.com

 Thank you man, that was a wonderful description :)

 The last question though,
 don't you find it the least bit stupid?

 Thanks!

Christian,

Just a quick question: what are you using to look at them?

If things just work, there is no problem. I don't understand why you 
have to do this. Are you looking at them on a windows box? I know 
you're emailing the list from a windows box.

Don


___
freebsd-questions@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-questions
To unsubscribe, send any mail to [EMAIL PROTECTED]


Re: script(1) Why does it output in CR/LF?

2006-03-03 Thread James Bailie

Kristian Vaaf wrote:

 The last question though,
 don't you find it the least bit stupid?

Sure is.  One is probably not going to use script(1) very often
with programs which take the terminal out of canonical mode, so
it makes sense to normalize line terminators when writing to the
log file.  With those programs which do fiddle with the terminal
settings, the CRs might have significance, though.

It would not be difficult to add an option to screen(1) to tell
it to normalize line terminators in the log file, or perhaps
change it to normalize by default, and have the option shut it
off.  It's a very simple program (/usr/src/usr.bin/script/script.c).

--
James Bailie [EMAIL PROTECTED]
http://www.jamesbailie.com
___
freebsd-questions@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-questions
To unsubscribe, send any mail to [EMAIL PROTECTED]


Re: script(1) Why does it output in CR/LF?

2006-03-03 Thread James Bailie

James Bailie wrote:

 It would not be difficult to add an option to screen(1) to tell
 it to normalize line terminators in the log file...

I had some time on my hands, so I made a patch to add a c
option to script(1) to collapse CRNL into NL in the log file.  If
you're interested, it's sitting in the pr-queue at:

http://www.freebsd.org/cgi/query-pr.cgi?pr=94052

--
James Bailie [EMAIL PROTECTED]
http://www.jamesbailie.com
___
freebsd-questions@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-questions
To unsubscribe, send any mail to [EMAIL PROTECTED]


script(1) Why does it output in CR/LF?

2006-02-28 Thread Kristian Vaaf


Hello.

I am just curious why the files I generate with script(1) output in CR/LF
forcing me to run dos2unix on them everytime?

Isn't this a bit stupid?

Thanks,
Vaaf

___
freebsd-questions@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-questions
To unsubscribe, send any mail to [EMAIL PROTECTED]


Re: script(1) Why does it output in CR/LF?

2006-02-28 Thread Glenn Dawson

At 02:30 AM 2/28/2006, Kristian Vaaf wrote:


Hello.

I am just curious why the files I generate with script(1) output in CR/LF
forcing me to run dos2unix on them everytime?


Script just captures the output of your shell, and your shell has to 
send crlf in order to get the cursor back to the beginning of a line.


-Glenn



Isn't this a bit stupid?

Thanks,
Vaaf

___
freebsd-questions@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-questions
To unsubscribe, send any mail to [EMAIL PROTECTED]


___
freebsd-questions@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-questions
To unsubscribe, send any mail to [EMAIL PROTECTED]


Re: script(1) Why does it output in CR/LF?

2006-02-28 Thread James Bailie

Glenn Dawson wrote:

 At 02:30 AM 2/28/2006, Kristian Vaaf wrote:

 Hello.

 I am just curious why the files I generate with script(1) output in 
CR/LF

 forcing me to run dos2unix on them everytime?


 Script just captures the output of your shell, and your shell has to
 send crlf in order to get the cursor back to the beginning of a line.

No it doesn't.  The script(1) utility interposes a
pseudo-terminal between the program whose output is to be
captured and itself, so the program thinks its running on a
terminal device and behaves accordingly.  Then script(1) acts
like a transparent filter, shuttling data back-and-forth from the
actual terminal to the pseudo-terminal, while sending a copy of
the program's output to the log file as well.  It is the terminal
driver in canonical mode, inside the pseudo-terminal, that is
expanding NLs in the proggy's output stream into CRNL pairs.

--
James Bailie [EMAIL PROTECTED]
http://www.jamesbailie.com
___
freebsd-questions@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-questions
To unsubscribe, send any mail to [EMAIL PROTECTED]