fix number handling

git-svn-id: svn://katsu.triplehelix.org/dgamelaunch/trunk@85 db0b04b0-f4d1-0310-9a6d-de3e77497b0e
This commit is contained in:
Joshua Kwan 2004-01-05 02:58:48 +00:00
parent 8da9e3acdc
commit 2966031319
2 changed files with 4 additions and 2 deletions

View File

@ -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 */

View File

@ -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);