ETHER: Accept upper or lower attach transport types (UDP, TAP, VDE, NAT)

This commit is contained in:
Mark Pizzolato 2018-10-09 23:23:39 -07:00
parent d4de42b353
commit 6e65b635e3
3 changed files with 18 additions and 14 deletions

20
scp.c
View file

@ -4394,7 +4394,7 @@ if (Exist || (*gbuf == '"') || (*gbuf == '\'')) { /* quoted string compari
if (!optr->op) if (!optr->op)
return sim_messagef (SCPE_ARG, "Invalid operator: %s\n", op); return sim_messagef (SCPE_ARG, "Invalid operator: %s\n", op);
cptr += strlen (optr->op); cptr += strlen (optr->op);
if ((!isspace (*cptr)) && isalpha (optr->op[strlen (optr->op) - 1]) && isalnum (*cptr)) if ((!sim_isspace (*cptr)) && sim_isalpha (optr->op[strlen (optr->op) - 1]) && sim_isalnum (*cptr))
return sim_messagef (SCPE_ARG, "Invalid operator: %s\n", op); return sim_messagef (SCPE_ARG, "Invalid operator: %s\n", op);
while (sim_isspace (*cptr)) /* skip spaces */ while (sim_isspace (*cptr)) /* skip spaces */
++cptr; ++cptr;
@ -9017,7 +9017,7 @@ return ((c < 0) || (c >= 128)) ? 0 : isprint (c);
int sim_isdigit (int c) int sim_isdigit (int c)
{ {
return ((c < 0) || (c >= 128)) ? 0 : isdigit (c); return ((c >= '0') && (c <= '9'));
} }
int sim_isgraph (int c) int sim_isgraph (int c)
@ -14108,10 +14108,10 @@ static const char BinaryDigits[] = "01";
*stat = SCPE_OK; /* Assume Success */ *stat = SCPE_OK; /* Assume Success */
*buf = '\0'; *buf = '\0';
*oper = NULL; *oper = NULL;
while (isspace (*cptr)) while (sim_isspace (*cptr))
++cptr; ++cptr;
if (isalpha (*cptr) || (*cptr == '_')) { if (sim_isalpha (*cptr) || (*cptr == '_')) {
while (isalnum (*cptr) || (*cptr == '.') || (*cptr == '_')) while (sim_isalnum (*cptr) || (*cptr == '.') || (*cptr == '_'))
*buf++ = *cptr++; *buf++ = *cptr++;
*buf = '\0'; *buf = '\0';
} }
@ -14149,7 +14149,7 @@ else {
} }
} }
} }
if (isalpha (*cptr)) { /* Numbers can't be followed by alpha character */ if (sim_isalpha (*cptr)) { /* Numbers can't be followed by alpha character */
*stat = SCPE_INVEXPR; *stat = SCPE_INVEXPR;
return cptr; return cptr;
} }
@ -14161,7 +14161,7 @@ else {
while (isdigit (*cptr)) while (isdigit (*cptr))
*buf++ = *cptr++; *buf++ = *cptr++;
*buf = '\0'; *buf = '\0';
if (isalpha (*cptr)) { /* Numbers can't be followed by alpha character */ if (sim_isalpha (*cptr)) { /* Numbers can't be followed by alpha character */
*stat = SCPE_INVEXPR; *stat = SCPE_INVEXPR;
return cptr; return cptr;
} }
@ -14189,7 +14189,7 @@ else {
} }
} }
} }
while (isspace (*cptr)) while (sim_isspace (*cptr))
++cptr; ++cptr;
return cptr; return cptr;
} }
@ -14207,7 +14207,7 @@ Operator *op = NULL, *last_op;
Stack *stack2 = new_Stack(); /* operator stack */ Stack *stack2 = new_Stack(); /* operator stack */
char gbuf[CBUFSIZE]; char gbuf[CBUFSIZE];
while (isspace(*cptr)) /* skip leading whitespace */ while (sim_isspace(*cptr)) /* skip leading whitespace */
++cptr; ++cptr;
if (parens_required && (*cptr != '(')) { if (parens_required && (*cptr != '(')) {
delete_Stack (stack2); delete_Stack (stack2);
@ -14288,7 +14288,7 @@ static t_bool _value_of (const char *data, t_svalue *svalue, char *string, size_
CONST char *gptr; CONST char *gptr;
size_t data_size = strlen (data); size_t data_size = strlen (data);
if (isalpha (*data) || (*data == '_')) { if (sim_isalpha (*data) || (*data == '_')) {
REG *rptr = NULL; REG *rptr = NULL;
DEVICE *dptr = sim_dfdev; DEVICE *dptr = sim_dfdev;
const char *dot; const char *dot;

7
scp.h
View file

@ -166,9 +166,12 @@ int sim_islower (int c);
#ifdef islower #ifdef islower
#undef islower #undef islower
#endif #endif
#ifndef IN_SCP_C
#define islower(chr) sim_islower (chr) #define islower(chr) sim_islower (chr)
int sim_isupper (int c);
#ifdef isupper
#undef isupper
#endif #endif
#define isupper(chr) sim_isupper (chr)
int sim_isalpha (int c); int sim_isalpha (int c);
#ifdef isalpha #ifdef isalpha
#undef isalpha #undef isalpha
@ -187,9 +190,7 @@ int sim_isdigit (int c);
#ifdef isdigit #ifdef isdigit
#undef isdigit #undef isdigit
#endif #endif
#ifndef IN_SCP_C
#define isdigit(chr) sim_isdigit (chr) #define isdigit(chr) sim_isdigit (chr)
#endif
int sim_isgraph (int c); int sim_isgraph (int c);
#ifdef isgraph #ifdef isgraph
#undef isgraph #undef isgraph

View file

@ -2273,7 +2273,10 @@ else {
} }
namebuf[sizeof(namebuf)-1] = '\0'; namebuf[sizeof(namebuf)-1] = '\0';
strncpy (namebuf, savname, sizeof(namebuf)-1); strlcpy (namebuf, savname, sizeof(namebuf));
for (num = 0; (namebuf[num] != ':') && (namebuf[num] != '\0'); num++)
if (isupper (namebuf[num]))
namebuf[num] = tolower (namebuf[num]);
savname = namebuf; savname = namebuf;
r = _eth_open_port(namebuf, &dev->eth_api, &dev->handle, &dev->fd_handle, errbuf, NULL, (void *)dev, dptr, dbit); r = _eth_open_port(namebuf, &dev->eth_api, &dev->handle, &dev->fd_handle, errbuf, NULL, (void *)dev, dptr, dbit);