diff options
Diffstat (limited to 'usr.sbin/ppp/ppp/chat.c')
-rw-r--r-- | usr.sbin/ppp/ppp/chat.c | 11 |
1 files changed, 6 insertions, 5 deletions
diff --git a/usr.sbin/ppp/ppp/chat.c b/usr.sbin/ppp/ppp/chat.c index be243407bca..20f6246505f 100644 --- a/usr.sbin/ppp/ppp/chat.c +++ b/usr.sbin/ppp/ppp/chat.c @@ -23,7 +23,7 @@ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * SUCH DAMAGE. * - * $OpenBSD: chat.c,v 1.13 2000/02/27 01:38:25 brian Exp $ + * $OpenBSD: chat.c,v 1.14 2000/08/09 19:31:25 brian Exp $ */ #include <sys/param.h> @@ -213,7 +213,8 @@ chat_UpdateSet(struct fdescriptor *d, fd_set *r, fd_set *w, fd_set *e, int *n) * portion of that sequence. */ - needcr = c->state == CHAT_SEND && *c->argptr != '!'; + needcr = c->state == CHAT_SEND && + (*c->argptr != '!' || c->argptr[1] == '!'); /* We leave room for a potential HDLC header in the target string */ ExpandString(c, c->argptr, c->exp + 2, sizeof c->exp - 2, needcr); @@ -254,8 +255,8 @@ chat_UpdateSet(struct fdescriptor *d, fd_set *r, fd_set *w, fd_set *e, int *n) else if (c->nargptr == NULL && !strcmp(c->exp+2, "TIMEOUT")) gottimeout = 1; else { - if (c->exp[2] == '!') - ExecStr(c->physical, c->exp + 3, c->exp + 2, sizeof c->exp - 2); + if (c->exp[2] == '!' && c->exp[3] != '!') + ExecStr(c->physical, c->exp + 3, c->exp + 3, sizeof c->exp - 3); if (c->exp[2] == '\0') { /* Empty string, reparse (this may be better as a `goto start') */ @@ -279,7 +280,7 @@ chat_UpdateSet(struct fdescriptor *d, fd_set *r, fd_set *w, fd_set *e, int *n) } /* set c->argptr to point in the right place */ - c->argptr = c->exp + 2; + c->argptr = c->exp + (c->exp[2] == '!' ? 3 : 2); c->arglen = strlen(c->argptr); if (c->state == CHAT_EXPECT) { |