[prev in list] [next in list] [prev in thread] [next in thread] 

List:       expect
Subject:    Re: [Expect] End-of-line conventions on Expect for Windows
From:       "Kenneth Jones" <aviatraining () gmail ! com>
Date:       2007-09-10 17:32:43
Message-ID: d7b9c5180709101032p3922bffdl2cacbfa7d836f03f () mail ! gmail ! com
[Download RAW message or body]

On 9/9/07, David Gravereaux <davygrvy@pobox.com> wrote:
> Kenneth Jones wrote:
>
> ...
> > I'm quite familiar with the various end-of-line conventions in Expect
> > on UNIX, brought about by the interactions with the pttys. But
> > especially considering that I know that Windows typically uses \r\n as
> > EOL, I was surprised that all of my scripts were receiving only \n as
> > EOL.
>
> It's my understanding that \r\n is just a convention for text files held over
> from the days of DOS.  Expect is grabbing text sent on the way to a console,
> which isn't a 'text file' as stored on disk.
>
> ...
>
> \n seems like the most logical translation for that action.

Fair enough. Though considering the challenge I have already teaching
students the EOL conventions to use for Expect for UNIX, adding in the
different EOL conventions to use for Expect for Windows is going to
just add to the fun. Not that I'm arguing that the original decision
was wrong and the it should be changed. It's just going to be...
interesting. :-)

So, the current EOL conventions for UNIX that I'm teaching students look like:

When your script is interacting with the user (stdout/stderr) in
typical cooked mode:

send: \n
expect: \n

When your script is interacting with the spawned application in
typical cooked mode:

send: \r
expect: \r\n

For Expect for Windows, it looks as though the following are the EOL
conventions:

When your script is interacting with the user (stdin/stdout) in
typical cooked mode:

send: \n
expect: \n

When your script is interacting with the spawned application in
typical cooked mode:

send: \r
expect: \n

Does that all look correct?

Oh, and would raw mode interaction with the user (stdin/stdout) on
Expect for Windows still typically require:

send: \r\n (to actually get the cursor to the beginning of the next line)
expect: \r

Thanks so much. Will you be at the Tcl Conference this year?

--
Ken Jones, President
Avia Training and Consulting
www.avia-training.com
866-TCL-HELP (866-825-4357) US Toll Free
415-643-8692 Voice
415-643-8697 Fax
_______________________________________________
Expect mailing list
Expect@listserv.ActiveState.com
http://listserv.ActiveState.com/mailman/listinfo/expect
[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic