o Fix chats expect-send-expect - it shouldn't be

expect-send-send !
o Say `disabled' rather than 0s in `show timeout'.
o Set all arguments in ``set device'' rather than just
  the first (read: quotes aren't necessary).
o Set the device speed correctly (broken in last commit).
This commit is contained in:
Brian Somers 1998-04-10 23:51:33 +00:00
parent c8dc575810
commit 99294c8bfa
Notes: svn2git 2020-12-20 02:59:44 +00:00
svn path=/cvs2svn/branches/MP/; revision=35122
5 changed files with 38 additions and 26 deletions

View File

@ -23,7 +23,7 @@
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*
* $Id: chat.c,v 1.44.2.20 1998/04/06 09:12:24 brian Exp $
* $Id: chat.c,v 1.44.2.21 1998/04/07 00:53:27 brian Exp $
*/
#include <sys/types.h>
@ -133,18 +133,20 @@ chat_UpdateSet(struct descriptor *d, fd_set *r, fd_set *w, fd_set *e, int *n)
{
struct chat *c = descriptor2chat(d);
int special, gotabort, gottimeout, needcr;
int TimedOut = c->TimedOut;
if (c->pause.state == TIMER_RUNNING)
return 0;
if (c->TimedOut) {
if (TimedOut) {
LogPrintf(LogCHAT, "Expect timeout\n");
if ( c->nargptr == NULL)
if (c->nargptr == NULL)
c->state = CHAT_FAILED;
else {
c->state = CHAT_EXPECT;
/* c->state = CHAT_EXPECT; */
c->argptr = "";
}
c->TimedOut = 0;
}
if (c->state != CHAT_EXPECT && c->state != CHAT_SEND)
@ -161,7 +163,7 @@ chat_UpdateSet(struct descriptor *d, fd_set *r, fd_set *w, fd_set *e, int *n)
special = 1;
while (special && (c->nargptr || c->arg < c->argc - 1)) {
if (c->arg < 0 || !c->TimedOut)
if (c->arg < 0 || (!TimedOut && c->state == CHAT_SEND))
c->nargptr = NULL;
if (c->nargptr != NULL) {
@ -283,7 +285,6 @@ chat_UpdateSet(struct descriptor *d, fd_set *r, fd_set *w, fd_set *e, int *n)
return chat_UpdateSet(d, r, w, e, n);
}
c->TimedOut = 0;
LogPrintf(LogCHAT, "Expect(%d): %s\n", c->TimeoutSec, c->argptr);
chat_SetTimeout(c);
}

View File

@ -17,7 +17,7 @@
* IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED
* WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR A PARTICULAR PURPOSE.
*
* $Id: command.c,v 1.131.2.56 1998/04/07 23:45:45 brian Exp $
* $Id: command.c,v 1.131.2.57 1998/04/10 13:19:03 brian Exp $
*
*/
#include <sys/types.h>
@ -436,11 +436,14 @@ ShowTimeout(struct cmdargs const *arg)
{
int remaining;
prompt_Printf(arg->prompt, "Idle Timer: %ds\n",
arg->bundle->cfg.idle_timeout);
remaining = bundle_RemainingIdleTime(arg->bundle);
if (remaining != -1)
prompt_Printf(arg->prompt, "Remaining: %ds\n", remaining);
prompt_Printf(arg->prompt, "Idle Timer: ");
if (arg->bundle->cfg.idle_timeout) {
prompt_Printf(arg->prompt, "%ds\n", arg->bundle->cfg.idle_timeout);
remaining = bundle_RemainingIdleTime(arg->bundle);
if (remaining != -1)
prompt_Printf(arg->prompt, "Remaining: %ds\n", remaining);
} else
prompt_Printf(arg->prompt, "disabled\n");
return 0;
}
@ -486,7 +489,7 @@ static int
ShowVersion(struct cmdargs const *arg)
{
static char VarVersion[] = "PPP Version 2.0-beta";
static char VarLocalVersion[] = "$Date: 1998/04/07 23:45:45 $";
static char VarLocalVersion[] = "$Date: 1998/04/10 13:19:03 $";
prompt_Printf(arg->prompt, "%s - %s \n", VarVersion, VarLocalVersion);
return 0;
@ -1120,7 +1123,7 @@ SetVariable(struct cmdargs const *arg)
}
break;
case VAR_DEVICE:
Physical_SetDeviceList(cx->physical, argp);
Physical_SetDeviceList(cx->physical, arg->argc, arg->argv);
break;
case VAR_ACCMAP:
if (arg->argc > 0) {

View File

@ -17,7 +17,7 @@
* IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED
* WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR A PARTICULAR PURPOSE.
*
* $Id: modem.c,v 1.77.2.47 1998/04/10 13:22:38 brian Exp $
* $Id: modem.c,v 1.77.2.48 1998/04/10 14:55:11 brian Exp $
*
* TODO:
*/
@ -588,9 +588,9 @@ modem_Open(struct physical *modem, struct bundle *bundle)
if (modem->dev_is_modem && !Physical_IsSync(modem)) {
tcgetattr(modem->fd, &rstio);
modem->ios = rstio;
LogPrintf(LogDEBUG, "modem_Open: modem = %d\n", modem->fd);
LogPrintf(LogDEBUG, "modem_Open: modem (get): iflag = %x, oflag = %x,"
" cflag = %x\n", rstio.c_iflag, rstio.c_oflag, rstio.c_cflag);
LogPrintf(LogDEBUG, "modem_Open: modem (get): fd = %d, iflag = %x, "
"oflag = %x, cflag = %x\n", modem->fd, rstio.c_iflag,
rstio.c_oflag, rstio.c_cflag);
cfmakeraw(&rstio);
if (modem->cfg.rts_cts)
rstio.c_cflag |= CLOCAL | CCTS_OFLOW | CRTS_IFLOW;
@ -601,7 +601,8 @@ modem_Open(struct physical *modem, struct bundle *bundle)
rstio.c_iflag |= IXON;
if (modem->type != PHYS_DEDICATED)
rstio.c_cflag |= HUPCL;
else if (modem->type != PHYS_STDIN) {
if (modem->type != PHYS_STDIN) {
/* Change tty speed when we're not in -direct mode */
rstio.c_cflag &= ~(CSIZE | PARODD | PARENB);
rstio.c_cflag |= modem->cfg.parity;

View File

@ -16,7 +16,7 @@
* IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED
* WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR A PARTICULAR PURPOSE.
*
* $Id: physical.c,v 1.1.2.22 1998/04/07 00:54:13 brian Exp $
* $Id: physical.c,v 1.1.2.23 1998/04/10 13:19:15 brian Exp $
*
*/
@ -81,11 +81,18 @@ const char *Physical_GetDevice(struct physical *phys)
return phys->name.full;
}
/* XXX-ML - must be moved into the physical struct */
void
Physical_SetDeviceList(struct physical *phys, const char *new_device_list) {
strncpy(phys->cfg.devlist, new_device_list, sizeof phys->cfg.devlist - 1);
phys->cfg.devlist[sizeof phys->cfg.devlist - 1] = '\0';
Physical_SetDeviceList(struct physical *p, int argc, const char *const *argv)
{
int f, pos;
p->cfg.devlist[sizeof p->cfg.devlist - 1] = '\0';
for (f = 0, pos = 0; f < argc && pos < sizeof p->cfg.devlist - 1; f++) {
if (pos)
p->cfg.devlist[pos++] = ' ';
strncpy(p->cfg.devlist + pos, argv[f], sizeof p->cfg.devlist - pos - 1);
pos += strlen(p->cfg.devlist + pos);
}
}

View File

@ -16,7 +16,7 @@
* IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED
* WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR A PARTICULAR PURPOSE.
*
* $Id: physical.h,v 1.1.2.19 1998/04/07 00:54:14 brian Exp $
* $Id: physical.h,v 1.1.2.20 1998/04/10 13:19:16 brian Exp $
*
*/
@ -76,7 +76,7 @@ int Physical_IsSync(struct physical *);
const char *Physical_GetDevice(struct physical *);
void Physical_SetDeviceList(struct physical *, const char *);
void Physical_SetDeviceList(struct physical *, int, const char *const *);
int /* Was this speed OK? */
Physical_SetSpeed(struct physical *, int);