/*
- * findvar - see if this variable is known to us
+ * findvar - see if this variable is known to us.
+ * If "code" is 1, return ctl_var->code.
+ * Otherwise return the ordinal position of the found variable.
*/
int
findvar(
char *varname,
- struct ctl_var *varlist
+ struct ctl_var *varlist,
+ int code
)
{
register char *np;
np = varname;
while (vl->fmt != EOV) {
if (vl->fmt != PADDING && STREQ(np, vl->text))
- return vl->code;
+ return (code)
+ ? vl->code
+ : (vl - varlist)
+ ;
vl++;
}
return 0;
startoutput();
while (nextvar(&length, &data, &name, &value)) {
- varid = findvar(name, varlist);
+ varid = findvar(name, varlist, 0);
if (varid == 0) {
output_raw = '*';
} else {
extern int decodetime P((char *, l_fp *));
extern void printvars P((int, char *, int, int, FILE *));
extern int decodeint P((char *, long *));
-extern int findvar P((char *, struct ctl_var *));
+extern int findvar P((char *, struct ctl_var *, int code));
while (nextvar(&datalen, &data, &name, &value)) {
struct sockaddr_storage dum_store;
- i = findvar(name, peer_var);
+ i = findvar(name, peer_var, 1);
if (i == 0)
continue; /* don't know this one */
switch (i) {