/**********************/
-void
+static void
cmdline_valid_buffer(struct rdline *rdl, const char *buf,
__attribute__((unused)) unsigned int size)
{
cmdline_printf(cl, "Bad arguments\n");
}
-int
+static int
cmdline_complete_buffer(struct rdline *rdl, const char *buf,
char *dstbuf, unsigned int dstsize,
int *state)
if ( isendofline(*buf) || iscomment(*buf) )
break;
- n = token_hdr.ops->parse(token_p, buf, (result_buf ? result_buf+token_hdr.offset : NULL));
- if ( n < 0 )
+ if (result_buf)
+ n = token_hdr.ops->parse(token_p, buf,
+ (char *)result_buf +
+ token_hdr.offset);
+ else
+ n = token_hdr.ops->parse(token_p, buf, NULL);
+
+ if (n < 0)
break;
+
debug_printf("TK parsed (len=%d)\n", n);
i++;
buf += n;
if (i != ETHER_ADDR_LEN)
return NULL;
- ether_addr.ea_oct[0] = o0;
- ether_addr.ea_oct[1] = o1;
- ether_addr.ea_oct[2] = o2;
- ether_addr.ea_oct[3] = o3;
- ether_addr.ea_oct[4] = o4;
- ether_addr.ea_oct[5] = o5;
+ ether_addr.ea_oct[0] = (uint8_t)o0;
+ ether_addr.ea_oct[1] = (uint8_t)o1;
+ ether_addr.ea_oct[2] = (uint8_t)o2;
+ ether_addr.ea_oct[3] = (uint8_t)o3;
+ ether_addr.ea_oct[4] = (uint8_t)o4;
+ ether_addr.ea_oct[5] = (uint8_t)o5;
return (struct ether_addr *)ðer_addr;
}
* sizeof(int) < 4. sizeof(int) > 4 is fine; all the world's not a VAX.
*/
-static int inet_pton4(const char *src, u_char *dst);
-static int inet_pton6(const char *src, u_char *dst);
+static int inet_pton4(const char *src, unsigned char *dst);
+static int inet_pton6(const char *src, unsigned char *dst);
/* int
* inet_pton(af, src, dst)
* Paul Vixie, 1996.
*/
static int
-inet_pton4(const char *src, u_char *dst)
+inet_pton4(const char *src, unsigned char *dst)
{
static const char digits[] = "0123456789";
int saw_digit, octets, ch;
- u_char tmp[INADDRSZ], *tp;
+ unsigned char tmp[INADDRSZ], *tp;
saw_digit = 0;
octets = 0;
const char *pch;
if ((pch = strchr(digits, ch)) != NULL) {
- u_int new = *tp * 10 + (pch - digits);
+ unsigned int new = *tp * 10 + (pch - digits);
if (new > 255)
return (0);
return (0);
saw_digit = 1;
}
- *tp = new;
+ *tp = (unsigned char)new;
} else if (ch == '.' && saw_digit) {
if (octets == 4)
return (0);
* Paul Vixie, 1996.
*/
static int
-inet_pton6(const char *src, u_char *dst)
+inet_pton6(const char *src, unsigned char *dst)
{
static const char xdigits_l[] = "0123456789abcdef",
xdigits_u[] = "0123456789ABCDEF";
- u_char tmp[IN6ADDRSZ], *tp, *endp, *colonp;
+ unsigned char tmp[IN6ADDRSZ], *tp, *endp, *colonp;
const char *xdigits, *curtok;
int ch, saw_xdigit, count_xdigit;
- u_int val;
+ unsigned int val;
memset((tp = tmp), '\0', IN6ADDRSZ);
endp = tp + IN6ADDRSZ;
}
if (tp + sizeof(int16_t) > endp)
return (0);
- *tp++ = (u_char) (val >> 8) & 0xff;
- *tp++ = (u_char) val & 0xff;
+ *tp++ = (unsigned char) ((val >> 8) & 0xff);
+ *tp++ = (unsigned char) (val & 0xff);
saw_xdigit = 0;
count_xdigit = 0;
val = 0;
if (saw_xdigit) {
if (tp + sizeof(int16_t) > endp)
return (0);
- *tp++ = (u_char) (val >> 8) & 0xff;
- *tp++ = (u_char) val & 0xff;
+ *tp++ = (unsigned char) ((val >> 8) & 0xff);
+ *tp++ = (unsigned char) (val & 0xff);
}
if (colonp != NULL) {
/*
DEC_NEG_OK,
DEC_POS_OK,
FLOAT_POS_OK,
- FLOAT_NEG_OK,
+ FLOAT_NEG_OK
};
/* Keep it sync with enum in .h */
};
static inline int
-add_to_res(unsigned int c, unsigned int *res, unsigned int base)
+add_to_res(unsigned int c, uint32_t *res, unsigned int base)
{
/* overflow */
if ( (UINT32_MAX - c) / base < *res ) {
case DEC_NEG_OK:
if ( nd.type == INT8 && res1 <= INT8_MAX + 1 ) {
if (res)
- *(int8_t *)res = - (int8_t) res1;
+ *(int8_t *)res = (int8_t) (-res1);
return (buf-srcbuf);
}
else if ( nd.type == INT16 && res1 <= (uint16_t)INT16_MAX + 1 ) {
if (res)
- *(int16_t *)res = - (int16_t) res1;
+ *(int16_t *)res = (int16_t) (-res1);
return (buf-srcbuf);
}
else if ( nd.type == INT32 && res1 <= (uint32_t)INT32_MAX + 1 ) {
if (res)
- *(int32_t *)res = - (int32_t) res1;
+ *(int32_t *)res = (int32_t) (-res1);
return (buf-srcbuf);
}
#ifndef CMDLINE_NO_FLOAT
debug_printf("error\n");
return -1;
}
- return -1;
}
UINT32,
INT8,
INT16,
- INT32,
+ INT32
#ifndef NO_PARSE_FLOAT
- FLOAT,
+ ,FLOAT
#endif
};
}
/* val is never more than 255 */
while (div) {
- c = val / div;
+ c = (char)(val / div);
if (c || started) {
- rdl->write_char(rdl, c+'0');
+ rdl->write_char(rdl, (char)(c+'0'));
started = 1;
}
val %= div;
enum rdline_status {
RDLINE_INIT,
- RDLINE_RUNNING,
+ RDLINE_RUNNING
};
struct rdline;
#include "cmdline_parse.h"
#include "cmdline_rdline.h"
+#include "cmdline_socket.h"
#include "cmdline.h"
/**********************/
enum cmdline_vt100_parser_state {
CMDLINE_VT100_INIT,
CMDLINE_VT100_ESCAPE,
- CMDLINE_VT100_ESCAPE_CSI,
+ CMDLINE_VT100_ESCAPE_CSI
};
#define CMDLINE_VT100_BUF_SIZE 8