revised extended autnum patch, was: Re: Bit of tweaking to IRRToolSet web site

S.P.Zeidler spz at serpens.de
Sun Feb 15 10:52:37 UTC 2009


Hi,

I just noticed that RtConfig and rpslcheck parse their input differently
than peval, and thus their input wasn't covered by the previous patch.

The attached patch fixes command line (resp other command input) parsing
for both.

regards,
	spz
-------------- next part --------------
--- src/RtConfig/command.l.orig	2006-06-08 17:16:26.000000000 +0200
+++ src/RtConfig/command.l
@@ -205,8 +205,12 @@ int yywrap () {
 }
 
 
-<USEFUL_LINE>[Aa][Ss][0-9]+ {
-   yylval.as = atoi(yytext+2);
+<USEFUL_LINE>[Aa][Ss]([0-9]+|[0-9]+\.[0-9]+) {
+   const char *dot = strchr(yytext,'.');
+   if (dot)
+      yylval.as = atoi(yytext+2)<<16 | atoi(dot+1);
+   else
+      yylval.as = atoi(yytext+2);
    LEXER_RETURN(TKN_ASNUM);
 }
 
--- src/rpslcheck/rpslcheck.cc.orig	2007-02-09 20:46:31.000000000 +0100
+++ src/rpslcheck/rpslcheck.cc
@@ -163,7 +167,11 @@ main(int argc, char **argv, char **envp)
    
    while (opt_my_as || cin ) {
        if (opt_my_as) {
-	  myAS = atoi(opt_my_as + 2);
+          const char *dot = strchr(opt_my_as,'.');
+          if (dot)
+             myAS = atoi(opt_my_as + 2)<<16 | atoi(dot+1);
+          else
+	     myAS = atoi(opt_my_as + 2);
 	  const AutNum *autnum = irr->getAutNum(myAS);
           if (!autnum)	{
           	std::cerr << "Error: no object for AS " << myAS << std::endl;


More information about the irrtoolset mailing list