Newer revised HTABLE for 4.2BSD


Dan Hoey (hoey@nrl-aic.ARPA)
16 Apr 1986 12:25:49 EST (Wed)


Here are context diffs for /usr/src/etc/{scan.l,htable.h} that will
allow machines like 3B2 and hosts like UCBVAX.Berkeley.EDU. It
shouldn't have any problem with one-character host names, either.

This diff is between the 4.2 scan.l and the new one. If you have
applied the change Mike Muuss sent out yesterday, the form of your
{ALPHA} rule will be different but the effect is the same: the rule is
deleted, because it is handled by the revised rule.

This change will NOT handle machine types like "360/50". Tokens must
contain an alphabetic character before the first slash, dot, or hyphen.
This prevents ambiguity in parsing octet notation.

And yes, this will accept some invalid syntax, too. The Hostmaster
will have to get a new canary.

Dan Hoey

*** 4.2/scan.l Thu Jun 30 20:19:45 1983
--- scan.l Wed Apr 16 12:10:14 1986
***************
*** 9,17

  BLANK [ \t]
  DIGIT [0-9]
! ALPHA [A-Z]
! ANUM [0-9A-Z]
! NAMECHR [0-9A-Z./-]

  %%
  "NET" {

--- 9,17 -----

  BLANK [ \t]
  DIGIT [0-9]
! ALPHA [A-Za-z]
! ANUM [0-9A-Za-z]
! NAMECHR [0-9A-Za-z./-]

  %%
  "NET" {
***************
*** 29,36
                        return (KEYWORD);
                }

! {ALPHA}{NAMECHR}*{ANUM} {
! yylval.namelist = newname(yytext);
                        return (NAME);
                }

--- 29,36 -----
                        return (KEYWORD);
                }

! {DIGIT}*{ALPHA}{NAMECHR}* {
! yylval.namelist = newname(lower(yytext));
                        return (NAME);
                }

***************
*** 33,40
                        yylval.namelist = newname(yytext);
                        return (NAME);
                }
-
- {ALPHA} return (NAME);

  {DIGIT}+ {
                        yylval.number = atoi(yytext);

--- 33,38 -----
                        yylval.namelist = newname(lower(yytext));
                        return (NAME);
                }

  {DIGIT}+ {
                        yylval.number = atoi(yytext);
*** 4.2/htable.h Thu Nov 3 15:35:32 1983
--- htable.h Wed Apr 16 10:47:32 1986
***************
*** 34,39
  #define KW_HOST 3

  struct name *newname();
  char *malloc();

  char *infile; /* Input file name */

--- 34,40 -----
  #define KW_HOST 3

  struct name *newname();
+ char *lower();
  char *malloc();

  char *infile; /* Input file name */
================
End of diffs.



This archive was generated by hypermail 2.0b3 on Thu Mar 09 2000 - 14:36:06 GMT