Hello, list!

I am happy to introduce alpha version of chat applet.
This is a powerful tool for scripting TTY devices.
Scripts are expect-send pairs given on cmdline.

News:
-----------

1. ENABLE_FEATURE_CHAT_NOFAIL [=1] (+126 bytes)

"No fail" mode is introduced 
(or subsend-subexpect in terms of the original chat)

E.g.:

chat -exp1: '' exp2: info ...

reads as:
* wait for a string ending with exp1
* if we get it send info, else send empty string and wait for exp2, if we get 
it send info, else fail
* proceed

2. ENABLE_FEATURE_CHAT_TTY_HIFI [=1] (+70 bytes)

TTY raw mode

It is come out that we really must set raw tty mode for STDIN
or else some replies from devices sometimes (approx. 3/10) come in wrong order.
While not enough feedback is available to locate the cause of such a behaviour
I prefer to just issue tcsetattr(STDIN, ...).

3. ENABLE_FEATURE_CHAT_SWALLOW_OPTS [=1] (+24 bytes)

Original chat is often being used with -vsSE or whatever options.
BB applet requires no options: its behaviour is totally controlled via script
directives. So I added dummy call to getopt32("vVsSE") so that BB chat not fail
if used in place of original one.

4. ENABLE_FEATURE_CHAT_CLR_ABORT [=0] (+113 bytes)

Chat has so-called abort strings, i.e. collection of replies that cause
unconditional script termination. They can be added via ABORT str directive.
Sometimes it is good to have possibility to revoke such ABORT later in script.
This FEATURE adds this functionality. Switched off by default since it is 
bloaty.

5. ENABLE_FEATURE_CHAT_VAR_ABORT_LEN [=0] (+70 bytes)

Due to technique of matching abort conditions the length of the longest
abort string must be known. This requires quite expensive (see size increase!)
calculations, especially when previous FEATURE is on. Off by default, meaning
abort string can not be longer than 50 bytes (original chat default).

6. ENABLE_FEATURE_CHAT_SEND_ESCAPES [=0] (+60 bytes, slowdown)

Original chat uses some special escape sequences meaning not sending data but 
performing
an action on device:
\K sends break sequence;
\d delays execution for a second;
\p delays execution for a 1/100 of second.

To use this feature means to send data byte-by-byte (slowdown) and bloat IMHO.
Off by default.

-----------

With features described above having default values chat compiles to 1187 bytes 
(by BB objsize).

Denys, please commit so people can report bugs.

As usual, comments are very welcome.

--
Vladimir

P.S.
BTW, of course I am now online via BB chat :)

Attachment: chat.c
Description: Binary data

_______________________________________________
busybox mailing list
[email protected]
http://busybox.net/cgi-bin/mailman/listinfo/busybox

Reply via email to