Ignore:
Timestamp:
May 23, 2001, 6:59:40 PM (24 years ago)
Author:
umoeller
Message:

Misc changes.

File:
1 edited

Legend:

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

    r69 r73  
    11521152 *
    11531153 *      <B>Example:</B>
    1154  +          strhFindAttribValue("<PAGE BLAH="data">, "BLAH")
     1154 +          strhFindAttribValue("<PAGE BLAH=\"data\">", "BLAH")
    11551155 +
    11561156 +          returns ....................... ^ this address.
     
    11581158 *@@added V0.9.0 [umoeller]
    11591159 *@@changed V0.9.3 (2000-05-19) [umoeller]: some speed optimizations
     1160 *@@changed V0.9.12 (2001-05-22) [umoeller]: fixed space bug, thanks Yuri Dario
    11601161 */
    11611162
    11621163PSZ strhFindAttribValue(const char *pszSearchIn, const char *pszAttrib)
     1164{
     1165   PSZ    prc = 0;
     1166   PSZ    pszSearchIn2, p;
     1167   ULONG  cbAttrib = strlen(pszAttrib),
     1168          ulLength = strlen(pszSearchIn);
     1169
     1170   // use alloca(), so memory is freed on function exit
     1171   pszSearchIn2 = (PSZ)alloca(ulLength + 1);
     1172   memcpy(pszSearchIn2, pszSearchIn, ulLength + 1);
     1173
     1174   // 1) find token, (space char, \n, \r, \t)
     1175   p = strtok(pszSearchIn2, " \n\r\t");
     1176   while (p)
     1177   {
     1178        CHAR c2;
     1179        PSZ pOrig;
     1180
     1181        // check tag name
     1182        if (!strnicmp(p, pszAttrib, cbAttrib))
     1183        {
     1184            // position in original string
     1185            pOrig = (PSZ)pszSearchIn + (p - pszSearchIn2);
     1186
     1187            // yes:
     1188            prc = pOrig + cbAttrib;
     1189            c2 = *prc;
     1190            while (   (   (c2 == ' ')
     1191                       || (c2 == '=')
     1192                       || (c2 == '\n')
     1193                       || (c2 == '\r')
     1194                      )
     1195                    && (c2 != 0)
     1196                  )
     1197                c2 = *++prc;
     1198
     1199            break;
     1200        }
     1201
     1202        p = strtok(NULL, " \n\r\t");
     1203   }
     1204
     1205   return (prc);
     1206}
     1207
     1208/* PSZ strhFindAttribValue(const char *pszSearchIn, const char *pszAttrib)
    11631209{
    11641210    PSZ     prc = 0;
     
    12111257    }
    12121258    return (prc);
    1213 }
     1259} */
    12141260
    12151261/*
Note: See TracChangeset for help on using the changeset viewer.