num [0123456789abcdefABCDEF]+
name [a-zA-Z.\-_][a-zA-Z0-9.\-_]*
other [^ \t\na-zA-Z.\-_0-9;]
struct sym *curgate = NULL;
struct sym *sym_head = NULL;
static char sccsid[] = "@(#)hyr_lex.l 2.1 Hyperchannel Routing Daemon 82/11/29";
extern struct sym *lookup();
{ws}direct{s}{name}{s}{num}{s}{num}{s}{num}{ws}; {
unsigned dst, ctl, access;
sscanf(yytext, " direct %s %x %x %x ", name, &dst, &ctl, &access);
fprintf(stderr, "DIRECT %s %04x %04x %04x\n", name, dst, ctl, access);
s->s_access = htons(access);
sscanf(yytext, " gateway %s ", name);
fprintf(stderr, "GATEWAY %s ->", name);
sscanf(yytext, " %s ", name);
fprintf(stderr, " %s", name);
if (curgate->s_ngate < 32)
curgate->s_gate[curgate->s_ngate++] = s;
; ; /* ignore extra ';'s */
long fulladdr = rhost(&cp);
for (s = sym_head; s != NULL; s = s->s_next) {
if (strncmp(cp, s->s_name, sizeof(s->s_name)) == 0)
s = (struct sym *) malloc(sizeof *s);
s->s_dst = s->s_ctl = s->s_access = 0;
s->s_fulladdr = fulladdr;
strncpy(s->s_name, cp, sizeof(s->s_name));
printf("Host %s:\t%08x\n", s->s_name, s->s_fulladdr);
if (s->s_flags & HS_DIR) {
printf("\tdst %04x ctl %04x access %04x %s\n",
s->s_dst, s->s_ctl, s->s_access,
(s->s_flags & HS_GATE) ? "gateway" : "");
} else if (s->s_flags & HS_INDIR) {
printf("\t%d gateways:", s->s_ngate);
for (i = 0; i < s->s_ngate; i++)
printf(" %s", s->s_gate[i]->s_name);
for (s = sym_head; s != NULL; s = s->s_next)
printf("End of Symbol table\n");
* record characters in the output buffer for later error message
if ((isprint(c) || c == ' ') && isascii(c) && outbufp < &outbuf[sizeof(outbuf)])
* if there are any characters in the output buffer, print an error message
fprintf(stderr, "hyroute: syntax error on \"%s\"\n", outbuf);
* flush last error message out then return saying no more input available