When entering ``term'' mode, don't output any messages until
the device is successfully opened. If we fail to open it, mention the fact. Also go back into command mode as soon as the device is closed rather than waiting for the user to type something before noticing.
This commit is contained in:
parent
7885089c3c
commit
bf1d3ff614
Notes:
svn2git
2020-12-20 02:59:44 +00:00
svn path=/head/; revision=38200
@ -23,7 +23,7 @@
|
||||
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
|
||||
* SUCH DAMAGE.
|
||||
*
|
||||
* $Id: bundle.c,v 1.30 1998/08/02 06:56:40 brian Exp $
|
||||
* $Id: bundle.c,v 1.31 1998/08/07 18:42:47 brian Exp $
|
||||
*/
|
||||
|
||||
#include <sys/param.h>
|
||||
@ -1080,6 +1080,8 @@ bundle_LinkClosed(struct bundle *bundle, struct datalink *dl)
|
||||
struct datalink *odl;
|
||||
int other_links;
|
||||
|
||||
log_SetTtyCommandMode(dl);
|
||||
|
||||
other_links = 0;
|
||||
for (odl = bundle->links; odl; odl = odl->next)
|
||||
if (odl != dl && odl->state != DATALINK_CLOSED)
|
||||
|
@ -23,7 +23,7 @@
|
||||
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
|
||||
* SUCH DAMAGE.
|
||||
*
|
||||
* $Id: datalink.c,v 1.16 1998/07/03 17:24:37 brian Exp $
|
||||
* $Id: datalink.c,v 1.17 1998/08/07 18:42:48 brian Exp $
|
||||
*/
|
||||
|
||||
#include <sys/types.h>
|
||||
@ -244,6 +244,9 @@ datalink_UpdateSet(struct descriptor *d, fd_set *r, fd_set *w, fd_set *e,
|
||||
if (--dl->dial_tries < 0)
|
||||
dl->dial_tries = 0;
|
||||
if (modem_Open(dl->physical, dl->bundle) >= 0) {
|
||||
log_WritePrompts(dl, "%s: Entering terminal mode on %s\r\n"
|
||||
"Type `~?' for help\r\n", dl->name,
|
||||
dl->physical->name.full);
|
||||
if (dl->script.run) {
|
||||
datalink_NewState(dl, DATALINK_DIAL);
|
||||
chat_Init(&dl->chat, dl->physical, dl->cfg.script.dial, 1,
|
||||
@ -260,7 +263,7 @@ datalink_UpdateSet(struct descriptor *d, fd_set *r, fd_set *w, fd_set *e,
|
||||
if (!(dl->physical->type & (PHYS_DDIAL|PHYS_DEDICATED)) &&
|
||||
dl->cfg.dial.max)
|
||||
log_Printf(LogCHAT, "Failed to open modem (attempt %u of %d)\n",
|
||||
dl->cfg.dial.max - dl->dial_tries, dl->cfg.dial.max);
|
||||
dl->cfg.dial.max - dl->dial_tries, dl->cfg.dial.max);
|
||||
else
|
||||
log_Printf(LogCHAT, "Failed to open modem\n");
|
||||
|
||||
@ -270,10 +273,15 @@ datalink_UpdateSet(struct descriptor *d, fd_set *r, fd_set *w, fd_set *e,
|
||||
datalink_NewState(dl, DATALINK_CLOSED);
|
||||
dl->reconnect_tries = 0;
|
||||
dl->dial_tries = -1;
|
||||
log_WritePrompts(dl, "Failed to open %s\n",
|
||||
dl->physical->name.full);
|
||||
bundle_LinkClosed(dl->bundle, dl);
|
||||
}
|
||||
if (!dl->bundle->CleaningUp)
|
||||
if (!dl->bundle->CleaningUp) {
|
||||
log_WritePrompts(dl, "Failed to open %s, pause %d seconds\n",
|
||||
dl->physical->name.full, dl->cfg.dial.timeout);
|
||||
datalink_StartDialTimer(dl, dl->cfg.dial.timeout);
|
||||
}
|
||||
}
|
||||
}
|
||||
break;
|
||||
|
@ -23,7 +23,7 @@
|
||||
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
|
||||
* SUCH DAMAGE.
|
||||
*
|
||||
* $Id: log.c,v 1.32 1998/08/02 13:01:15 brian Exp $
|
||||
* $Id: log.c,v 1.33 1998/08/07 18:42:49 brian Exp $
|
||||
*/
|
||||
|
||||
#include <sys/types.h>
|
||||
@ -155,13 +155,16 @@ log_DisplayPrompts()
|
||||
}
|
||||
|
||||
void
|
||||
log_WritePrompts(struct datalink *dl, const char *data, int len)
|
||||
log_WritePrompts(struct datalink *dl, const char *fmt,...)
|
||||
{
|
||||
va_list ap;
|
||||
struct prompt *p;
|
||||
|
||||
va_start(ap, fmt);
|
||||
for (p = promptlist; p; p = p->next)
|
||||
if (prompt_IsTermMode(p, dl))
|
||||
prompt_Printf(p, "%.*s", len, data);
|
||||
prompt_vPrintf(p, fmt, ap);
|
||||
va_end(ap);
|
||||
}
|
||||
|
||||
void
|
||||
|
@ -23,7 +23,7 @@
|
||||
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
|
||||
* SUCH DAMAGE.
|
||||
*
|
||||
* $Id: log.h,v 1.21 1998/08/02 13:01:16 brian Exp $
|
||||
* $Id: log.h,v 1.22 1998/08/07 18:42:49 brian Exp $
|
||||
*/
|
||||
|
||||
#define LogMIN (1)
|
||||
@ -73,8 +73,11 @@ extern void log_Close(void);
|
||||
#ifdef __GNUC__
|
||||
extern void log_Printf(int, const char *,...)
|
||||
__attribute__ ((format (printf, 2, 3)));
|
||||
extern void log_WritePrompts(struct datalink *, const char *, ...)
|
||||
__attribute__ ((format (printf, 2, 3)));
|
||||
#else
|
||||
extern void log_Printf(int, const char *,...);
|
||||
extern void log_WritePrompts(struct datalink *, const char *, ...);
|
||||
#endif
|
||||
extern void log_DumpBp(int, const char *, const struct mbuf *);
|
||||
extern void log_DumpBuff(int, const char *, const u_char *, int);
|
||||
@ -87,7 +90,6 @@ extern void log_RegisterPrompt(struct prompt *);
|
||||
extern void log_UnRegisterPrompt(struct prompt *);
|
||||
extern void log_DestroyPrompts(struct server *);
|
||||
extern void log_DisplayPrompts(void);
|
||||
extern void log_WritePrompts(struct datalink *, const char *, int);
|
||||
extern void log_ActivatePrompt(struct prompt *);
|
||||
extern void log_DeactivatePrompt(struct prompt *);
|
||||
extern void log_SetTtyCommandMode(struct datalink *);
|
||||
|
@ -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.96 1998/07/29 18:20:53 brian Exp $
|
||||
* $Id: modem.c,v 1.97 1998/08/07 18:42:50 brian Exp $
|
||||
*
|
||||
* TODO:
|
||||
*/
|
||||
@ -966,16 +966,14 @@ modem_DescriptorRead(struct descriptor *d, struct bundle *bundle,
|
||||
cp = hdlc_Detect(p, rbuff, n);
|
||||
if (cp) {
|
||||
/* LCP packet is detected. Turn ourselves into packet mode */
|
||||
if (cp != rbuff) {
|
||||
if (cp != rbuff)
|
||||
/* Get rid of the bit before the HDLC header */
|
||||
log_WritePrompts(p->dl, rbuff, cp - rbuff);
|
||||
log_WritePrompts(p->dl, "\r\n", 2);
|
||||
}
|
||||
log_WritePrompts(p->dl, "%.*s\r\n", cp - rbuff, rbuff);
|
||||
log_Printf(LogPHASE, "%s: PPP packet detected, coming up\n",
|
||||
p->link.name);
|
||||
datalink_Up(p->dl, 0, 1);
|
||||
} else
|
||||
log_WritePrompts(p->dl, rbuff, n);
|
||||
log_WritePrompts(p->dl, "%.*s", n, rbuff);
|
||||
}
|
||||
} else if (n > 0)
|
||||
async_Input(bundle, rbuff, n, p);
|
||||
|
@ -23,7 +23,7 @@
|
||||
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
|
||||
* SUCH DAMAGE.
|
||||
*
|
||||
* $Id: prompt.c,v 1.9 1998/07/04 22:04:12 brian Exp $
|
||||
* $Id: prompt.c,v 1.10 1998/08/07 18:42:50 brian Exp $
|
||||
*/
|
||||
|
||||
#include <sys/param.h>
|
||||
@ -453,9 +453,6 @@ prompt_TtyTermMode(struct prompt *p, struct datalink *dl)
|
||||
{
|
||||
int stat;
|
||||
|
||||
prompt_Printf(p, "Entering terminal mode on %s.\n", dl->name);
|
||||
prompt_Printf(p, "Type `~?' for help.\n");
|
||||
|
||||
if (p->Term == stdout)
|
||||
tcsetattr(p->fd_in, TCSADRAIN, &p->comtio);
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user