]> skyeroc.xyz Git - dgamelaunch/commitdiff
works!
authorJoshua Kwan <joshk@triplehelix.org>
Mon, 5 Jan 2004 09:18:39 +0000 (09:18 +0000)
committerJoshua Kwan <joshk@triplehelix.org>
Mon, 5 Jan 2004 09:18:39 +0000 (09:18 +0000)
git-svn-id: svn://katsu.triplehelix.org/dgamelaunch/trunk@86 db0b04b0-f4d1-0310-9a6d-de3e77497b0e

config.l
config.y

index c4b1de6a6cfa94000269b7f112538424ca036282..97afd861314db44afce92559a23f98f01a5bb27c 100644 (file)
--- a/config.l
+++ b/config.l
@@ -29,7 +29,7 @@ LONGCOMMENT   "/*"
 
 %%             /* BEGIN RULES SECTION */
 
-{NUMBER} { yylval.i = atoi(yytext); }
+{NUMBER} { yylval.i = atoi(yytext); return TYPE_NUMBER; }
 {VALUE}        {
   yytext[yyleng - 1] = '\0'; /* Kill the trailing quote */
   yytext++; /* Kill the leading quote */
index 3d60ed746076ced8c5e2f235705803b16d054e7f..81a8e5aeb0569d8fb038232061af768d2c7bdcca 100644 (file)
--- a/config.y
+++ b/config.y
@@ -105,21 +105,31 @@ KeyPair: KeyType '=' TYPE_VALUE {
   free($3);
 }
        | KeyType '=' TYPE_NUMBER {
+  if (!myconfig)
+    myconfig = calloc(1, sizeof(struct dg_config));
+              
   switch ($1)
   {
     case TYPE_SUID:
-      if (!myconfig->shed_user && getpwuid($3) != NULL)
-        myconfig->shed_uid = $3;
-      else
-        fprintf(stderr, "%s: no such uid %lu\n", config, $3);
+      if (!myconfig->shed_user)
+      {
+        if (getpwuid($3) != NULL)
+          myconfig->shed_uid = $3;
+        else
+          fprintf(stderr, "%s: no such uid %lu\n", config, $3);
+      }
        
       break;
 
     case TYPE_SGID:
-      if (!myconfig->shed_group && getgrgid($3) != NULL)
-        myconfig->shed_gid = $3;
-      else
-        fprintf(stderr, "%s: no such gid %lu\n", config, $3);
+      if (!myconfig->shed_group)
+      {
+       if (getgrgid($3) != NULL)
+          myconfig->shed_gid = $3;
+        else
+          fprintf(stderr, "%s: no such gid %lu\n", config, $3);
+      }
+
       break;
 
     case TYPE_MAX: