]> skyeroc.xyz Git - dgamelaunch/commitdiff
fix number handling
authorJoshua Kwan <joshk@triplehelix.org>
Mon, 5 Jan 2004 02:58:48 +0000 (02:58 +0000)
committerJoshua Kwan <joshk@triplehelix.org>
Mon, 5 Jan 2004 02:58:48 +0000 (02:58 +0000)
git-svn-id: svn://katsu.triplehelix.org/dgamelaunch/trunk@85 db0b04b0-f4d1-0310-9a6d-de3e77497b0e

config.l
config.y

index 1ffcbb6362cbd3cdf5398427949d732145fbef9f..c4b1de6a6cfa94000269b7f112538424ca036282 100644 (file)
--- a/config.l
+++ b/config.l
@@ -20,6 +20,7 @@ static void ccomment(void);
 
 %}
 
+NUMBER         [0-9]+
 VALUE          \".*\"
 MALSTRING      \"[^\"\n]*\n
 WHITE          [\t ]*
@@ -28,6 +29,7 @@ LONGCOMMENT   "/*"
 
 %%             /* BEGIN RULES SECTION */
 
+{NUMBER} { yylval.i = atoi(yytext); }
 {VALUE}        {
   yytext[yyleng - 1] = '\0'; /* Kill the trailing quote */
   yytext++; /* Kill the leading quote */
index 028fb0048f5bdd58bb420b6ff7319c19b0cb5fb2..3d60ed746076ced8c5e2f235705803b16d054e7f 100644 (file)
--- a/config.y
+++ b/config.y
@@ -108,7 +108,7 @@ KeyPair: KeyType '=' TYPE_VALUE {
   switch ($1)
   {
     case TYPE_SUID:
-      if (getpwuid($3) != NULL)
+      if (!myconfig->shed_user && getpwuid($3) != NULL)
         myconfig->shed_uid = $3;
       else
         fprintf(stderr, "%s: no such uid %lu\n", config, $3);
@@ -116,7 +116,7 @@ KeyPair: KeyType '=' TYPE_VALUE {
       break;
 
     case TYPE_SGID:
-      if (getgrgid($3) != NULL)
+      if (!myconfig->shed_group && getgrgid($3) != NULL)
         myconfig->shed_gid = $3;
       else
         fprintf(stderr, "%s: no such gid %lu\n", config, $3);