Make ``show escape'' require context.
De-globalize EscMap[].
This commit is contained in:
parent
56c9cf9d98
commit
9991562d36
@ -17,7 +17,7 @@
|
||||
* IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED
|
||||
* WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR A PARTICULAR PURPOSE.
|
||||
*
|
||||
* $Id: async.c,v 1.15.2.5 1998/02/08 11:04:40 brian Exp $
|
||||
* $Id: async.c,v 1.15.2.6 1998/02/09 19:20:31 brian Exp $
|
||||
*
|
||||
*/
|
||||
#include <sys/param.h>
|
||||
@ -77,7 +77,7 @@ HdlcPutByte(struct async *async, u_char **cp, u_char c, int proto)
|
||||
*wp++ = HDLC_ESC;
|
||||
c ^= HDLC_XOR;
|
||||
}
|
||||
if (EscMap[32] && EscMap[c >> 3] & (1 << (c & 7))) {
|
||||
if (async->cfg.EscMap[32] && async->cfg.EscMap[c >> 3] & (1 << (c & 7))) {
|
||||
*wp++ = HDLC_ESC;
|
||||
c ^= HDLC_XOR;
|
||||
}
|
||||
|
@ -23,7 +23,7 @@
|
||||
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
|
||||
* SUCH DAMAGE.
|
||||
*
|
||||
* $Id: async.h,v 1.2.4.4 1998/02/02 19:33:33 brian Exp $
|
||||
* $Id: async.h,v 1.2.4.5 1998/02/08 11:04:42 brian Exp $
|
||||
*/
|
||||
|
||||
#define HDLCSIZE (MAX_MRU*2+6)
|
||||
@ -35,6 +35,10 @@ struct async {
|
||||
u_char xbuff[HDLCSIZE]; /* xmit buffer */
|
||||
u_long my_accmap;
|
||||
u_long his_accmap;
|
||||
|
||||
struct {
|
||||
u_char EscMap[33];
|
||||
} cfg;
|
||||
};
|
||||
|
||||
extern void async_Init(struct async *);
|
||||
|
@ -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.24 1998/02/17 19:28:25 brian Exp $
|
||||
* $Id: command.c,v 1.131.2.25 1998/02/17 19:28:42 brian Exp $
|
||||
*
|
||||
*/
|
||||
#include <sys/param.h>
|
||||
@ -421,14 +421,17 @@ ShowLogLevel(struct cmdargs const *arg)
|
||||
static int
|
||||
ShowEscape(struct cmdargs const *arg)
|
||||
{
|
||||
int code, bit;
|
||||
if (arg->cx->physical->async.cfg.EscMap[32]) {
|
||||
int code, bit;
|
||||
char *sep = "";
|
||||
|
||||
if (EscMap[32]) {
|
||||
for (code = 0; code < 32; code++)
|
||||
if (EscMap[code])
|
||||
if (arg->cx->physical->async.cfg.EscMap[code])
|
||||
for (bit = 0; bit < 8; bit++)
|
||||
if (EscMap[code] & (1 << bit))
|
||||
prompt_Printf(&prompt, " 0x%02x", (code << 3) + bit);
|
||||
if (arg->cx->physical->async.cfg.EscMap[code] & (1 << bit)) {
|
||||
prompt_Printf(&prompt, "%s0x%02x", sep, (code << 3) + bit);
|
||||
sep = ", ";
|
||||
}
|
||||
prompt_Printf(&prompt, "\n");
|
||||
}
|
||||
return 0;
|
||||
@ -577,7 +580,7 @@ static struct cmdtab const ShowCommands[] = {
|
||||
"Show compression stats", "show compress"},
|
||||
{"dfilter", NULL, ShowDfilter, LOCAL_AUTH,
|
||||
"Show Demand filters", "show dfilteroption .."},
|
||||
{"escape", NULL, ShowEscape, LOCAL_AUTH,
|
||||
{"escape", NULL, ShowEscape, LOCAL_AUTH | LOCAL_CX,
|
||||
"Show escape characters", "show escape"},
|
||||
{"hdlc", NULL, ReportHdlcStatus, LOCAL_AUTH,
|
||||
"Show HDLC errors", "show hdlc"},
|
||||
@ -1098,13 +1101,13 @@ SetEscape(struct cmdargs const *arg)
|
||||
char const *const *argv = arg->argv;
|
||||
|
||||
for (code = 0; code < 33; code++)
|
||||
EscMap[code] = 0;
|
||||
arg->cx->physical->async.cfg.EscMap[code] = 0;
|
||||
|
||||
while (argc-- > 0) {
|
||||
sscanf(*argv++, "%x", &code);
|
||||
code &= 0xff;
|
||||
EscMap[code >> 3] |= (1 << (code & 7));
|
||||
EscMap[32] = 1;
|
||||
arg->cx->physical->async.cfg.EscMap[code >> 3] |= (1 << (code & 7));
|
||||
arg->cx->physical->async.cfg.EscMap[32] = 1;
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
@ -17,7 +17,7 @@
|
||||
* IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED
|
||||
* WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR A PARTICULAR PURPOSE.
|
||||
*
|
||||
* $Id: hdlc.c,v 1.28.2.8 1998/02/09 19:20:47 brian Exp $
|
||||
* $Id: hdlc.c,v 1.28.2.9 1998/02/10 03:23:19 brian Exp $
|
||||
*
|
||||
* TODO:
|
||||
*/
|
||||
@ -101,8 +101,6 @@ static u_short const fcstab[256] = {
|
||||
/* f8 */ 0x7bc7, 0x6a4e, 0x58d5, 0x495c, 0x3de3, 0x2c6a, 0x1ef1, 0x0f78
|
||||
};
|
||||
|
||||
u_char EscMap[33];
|
||||
|
||||
void
|
||||
HdlcInit()
|
||||
{
|
||||
|
@ -15,7 +15,7 @@
|
||||
* IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED
|
||||
* WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR A PARTICULAR PURPOSE.
|
||||
*
|
||||
* $Id: hdlc.h,v 1.14.2.3 1998/02/02 19:32:07 brian Exp $
|
||||
* $Id: hdlc.h,v 1.14.2.4 1998/02/09 19:20:49 brian Exp $
|
||||
*
|
||||
* TODO:
|
||||
*/
|
||||
@ -56,8 +56,6 @@
|
||||
#define PRI_LINK 1 /* Urgent (LQR packets) */
|
||||
#define PRI_MAX 1
|
||||
|
||||
extern u_char EscMap[33];
|
||||
|
||||
struct physical;
|
||||
struct link;
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user