Index: ossp-pkg/rc/rc_const.h RCS File: /v/ossp/cvs/ossp-pkg/rc/rc_const.h,v rcsdiff -q -kk '-r1.13' '-r1.14' -u '/v/ossp/cvs/ossp-pkg/rc/rc_const.h,v' 2>/dev/null --- rc_const.h 2002/08/02 20:09:59 1.13 +++ rc_const.h 2003/05/16 12:37:10 1.14 @@ -125,6 +125,8 @@ #define RC_DEF_OFF "0" /* Digital switch */ #define RC_DEF_DEF "^%(\\w+)[ \t]*(.*?)\\n(.*?)^$" /* Section definition */ #define RC_DEF_NCF "config" /* Config section name */ +#define RC_DEF_UIG "-u" /* Section user string */ +#define RC_DEF_UID -1 /* Section user value */ #define RC_DEF_PRG "-p" /* Section priority string */ #define RC_DEF_PRI 200 /* Section priority value */ Index: ossp-pkg/rc/rc_script.c RCS File: /v/ossp/cvs/ossp-pkg/rc/rc_script.c,v rcsdiff -q -kk '-r1.15' '-r1.16' -u '/v/ossp/cvs/ossp-pkg/rc/rc_script.c,v' 2>/dev/null --- rc_script.c 2003/05/15 22:22:30 1.15 +++ rc_script.c 2003/05/16 12:37:10 1.16 @@ -29,6 +29,7 @@ #include #include +#include /* For isspace(3) */ #include "rc.h" /* Public Rc interface */ #include "rc_pcre.h" /* For section parsing */ @@ -111,6 +112,7 @@ char *piEnd = NULL; long nPri = 0; long nUid = 0; + int nTmp = 0; int nOffset = 0; int nFound = 0; int nVecsize = 0; @@ -172,8 +174,6 @@ piLabstart = piBlocend + *(pnVec + 2); nLabsize = *(pnVec + 3) - *(pnVec + 2); -/*fprintf(stderr, "Substring we want ist %s!\n", kszSecname); -fprintf(stderr, "Compared with ist %s!\n", piLabstart);*/ /* Test the substring. If it matches our label, make a new section */ if (!strncmp(piLabstart, kszSecname, nLabsize)) { /* Handle the section body */ @@ -182,21 +182,32 @@ pSec = sectionNew(); sectionSetndata(pSec, piStart, piEnd - piStart); + /* FIXME: Implement --ParseSectionParam for extra gravy */ /* Handle the section priority */ piStart = piBlocend + *(pnVec + 4); piEnd = piBlocend + *(pnVec + 5); - /* FIXME: Implement --ParseSectionParam for extra gravy */ piSubtemp = strnstr(piStart, RC_DEF_PRG, piEnd - piStart); if (piSubtemp) { /* Priority pattern found */ -/* FIXME: Remove the 1 in the following line! */ - nPri = strtol(piSubtemp + strlen(RC_DEF_PRG), (char **)NULL, 10); + for (nTmp = (int)piSubtemp + strlen(RC_DEF_PRG);\ + isspace(*(char *)nTmp); nTmp += sizeof (char)); /* Strip */ + nPri = strtol((char *)nTmp, (char **)NULL, 10); sectionSetpri(pSec, nPri); } else /* Fallback to default value */ sectionSetpri(pSec, RC_DEF_PRI); /* Handle the section userid */ - return(pSec); /* Section found, so return the text */ + piSubtemp = strnstr(piStart, RC_DEF_UIG, piEnd - piStart); + if (piSubtemp) { /* Priority pattern found */ + for (nTmp = (int)piSubtemp + strlen(RC_DEF_UIG);\ + isspace(*(char *)nTmp); nTmp += sizeof (char)); /* Strip */ + nUid = strtol((char *)nTmp, (char **)NULL, 10); + sectionSetuid(pSec, nUid); + } + else /* Fallback to default value */ + sectionSetuid(pSec, RC_DEF_UID); + + return(pSec); /* Section found, so return the text */ } /* Looks like we didn't find the section yet, so keep trying */