#define CC_FUDGEVAL2 10
#define CC_FLAGS 11
#define CC_DEVICE 12
-#define CC_VARLIST 13
+#define CC_VARLIST 13
#define CC_MAXCODE CC_VARLIST
/*
{
l_fp tmp;
char str[256];
- char buf[CTL_MAX_DATA_LEN];
u_int u;
double kb;
double dtemp;
- char *s, *t, *be;
const char *ss;
- int i;
+ size_t len;
+ int firstvarname;
const struct ctl_var *k;
#ifdef AUTOKEY
struct cert_info *cp;
- char cbuf[256];
#endif /* AUTOKEY */
#ifdef KERNEL_PLL
static struct timex ntx;
break;
case CS_VARLIST:
- s = buf;
- be = buf + sizeof(buf);
- if (strlen(sys_var[CS_VARLIST].text) + 4 > sizeof(buf))
- break; /* really long var name */
-
- snprintf(s, sizeof(buf), "%s=\"",
+ snprintf(str, sizeof(str), "%s=\"",
sys_var[CS_VARLIST].text);
- s += strlen(s);
- t = s;
+ ctl_putdata(str, strlen(str), TRUE);
+
+ firstvarname = TRUE;
for (k = sys_var; !(EOV & k->flags); k++) {
if (PADDING & k->flags)
continue;
- i = strlen(k->text);
- if (s + i + 1 >= be)
- break;
-
- if (s != t)
- *s++ = ',';
- memcpy(s, k->text, i);
- s += i;
+ len = strlen(k->text);
+ if (0 == len)
+ continue;
+ if (!firstvarname)
+ ctl_putdata(",", 1, TRUE);
+ else
+ firstvarname = FALSE;
+ ctl_putdata(k->text, len, TRUE);
}
for (k = ext_sys_var; k && !(EOV & k->flags); k++) {
if (PADDING & k->flags)
continue;
-
- ss = k->text;
- if (NULL == ss)
+ if (NULL == k->text)
continue;
-
- while (*ss != '\0' && *ss != '=')
- ss++;
- i = ss - k->text;
- if (s + i + 1 >= be)
- break;
-
- if (s != t)
- *s++ = ',';
- memcpy(s, k->text, (unsigned)i);
- s += i;
+ ss = strchr(k->text, '=');
+ if (NULL == ss)
+ len = strlen(k->text);
+ else
+ len = ss - k->text;
+ ctl_putdata(",", 1, TRUE);
+ ctl_putdata(k->text, len, TRUE);
}
- if (s + 2 >= be)
- break;
- *s++ = '"';
- *s = '\0';
-
- ctl_putdata(buf, (unsigned)(s - buf), 0);
+ ctl_putdata("\"", 1, TRUE);
break;
case CS_TAI:
case CS_CERTIF:
for (cp = cinfo; cp != NULL; cp = cp->link) {
- snprintf(cbuf, sizeof(cbuf), "%s %s 0x%x",
+ snprintf(str, sizeof(str), "%s %s 0x%x",
cp->subject, cp->issuer, cp->flags);
- ctl_putstr(sys_var[CS_CERTIF].text, cbuf,
- strlen(cbuf));
+ ctl_putstr(sys_var[CS_CERTIF].text, str,
+ strlen(str));
ctl_putfs(sys_var[CS_REVTIME].text, cp->last);
}
break;
#define MAXLINE 512 /* maximum line length */
#define MAXTOKENS (1+MAXARGS+2) /* maximum number of usable tokens */
#define MAXVARLEN 256 /* maximum length of a variable name */
-#define MAXVALLEN 400 /* maximum length of a variable value */
+#define MAXVALLEN 2048 /* maximum length of a variable value */
#define MAXOUTLINE 72 /* maximum length of an output line */
#define SCREENWIDTH 76 /* nominal screen width in columns */
size_t out_octets
)
{
- register const u_char * pchIn;
- const u_char * pchInLimit;
- register u_char * pchOut;
- register u_char c;
+ const u_char * pchIn;
+ const u_char * pchInLimit;
+ u_char * pchOut;
+ u_char c;
pchIn = (const u_char *)in;
pchInLimit = pchIn + in_octets;
if ('"' == *np) {
do {
np++;
- } while (np < cpend && '"' != *np && '\r' != *np);
+ } while (np < cpend && '"' != *np);
if (np < cpend && '"' == *np)
np++;
} else {
np++;
}
len = np - cp;
- if (np >= cpend || len >= sizeof(value) ||
- (',' != *np && '\r' != *np))
+ if (np > cpend || len >= sizeof(value) ||
+ (np < cpend && ',' != *np && '\r' != *np))
return 0;
memcpy(value, cp, len);
/*
l_fp lfparr[8];
char b[12];
char bn[2 * MAXVARLEN];
- char bv[2 * MAXVARLEN];
+ char bv[2 * MAXVALLEN];
UNUSED_ARG(datatype);
if (output_raw != 0) {
atoascii(name, MAXVARLEN, bn, sizeof(bn));
- atoascii(value, MAXVARLEN, bv, sizeof(bv));
+ atoascii(value, MAXVALLEN, bv, sizeof(bv));
if (output_raw != '*') {
len = strlen(bv);
bv[len] = output_raw;