Ignore:
Timestamp:
Apr 25, 2001, 8:55:35 PM (24 years ago)
Author:
umoeller
Message:

Misc. fixes.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/helpers/configsys.c

    r47 r63  
    163163 *@@changed V0.9.7 (2001-01-15) [umoeller]: moved this here from stringh.c; renamed from strhFindKey
    164164 *@@changed V0.9.7 (2001-01-15) [umoeller]: now checking for tabs too
     165 *@@changed V0.9.11 (2001-04-25) [umoeller]: this never found lines which had leading spaces, fixed
    165166 */
    166167
     
    180181        p = strhistr(p, pcszKey);
    181182
    182         if ((p) && (p >= pcszSearchIn))
     183        if (    (p)
     184             && (p >= pcszSearchIn)
     185           )
    183186        {
    184187            // make sure the key is at the beginning of a line
    185188            // by going backwards until we find a char != " "
    186189            const char *pStartOfLine = p;
    187             while (     (   (*pStartOfLine == ' ')
    188                          || (*pStartOfLine == '\t')       // allow tabs too
    189                         )
    190                      && (pStartOfLine > pcszSearchIn)
     190
     191            // fixed this V0.9.11 (2001-04-25) [umoeller]
     192            while (    (pStartOfLine > pcszSearchIn)
     193                    && (    (*(pStartOfLine - 1) == ' ')
     194                         || (*(pStartOfLine - 1) == '\t')       // allow tabs too
     195                       )
    191196                  )
    192                 pStartOfLine--;
     197                --pStartOfLine;
    193198
    194199            // if we're at the beginning of a line or
     
    368373                        ulOldParamOfs,
    369374                        ulToReplace,
    370                         &strReplaceWith);
     375                        strReplaceWith.psz,
     376                        strReplaceWith.ulLength);      // adjusted V0.9.11 (2001-04-22) [umoeller]
    371377
    372378                xstrClear(&strReplaceWith);
     
    10061012}
    10071013
    1008 
     1014// testcase
     1015
     1016/* int main()
     1017{
     1018    PSZ pszContents = NULL;
     1019    if (0 == csysLoadConfigSys(NULL, &pszContents))
     1020    {
     1021        CHAR    szValue[1000];
     1022        PSZ pszValue = csysGetParameter(pszContents,
     1023                                        "IFS=",
     1024                                        szValue,
     1025                                        sizeof(szValue));
     1026        if (pszValue)
     1027            printf("Value: %s", szValue);
     1028    }
     1029
     1030    return (0);
     1031} */
Note: See TracChangeset for help on using the changeset viewer.