/* * get the value pointed to by string. string should be pointing just beyond * the equal sign. */ char * NSSUTIL_ArgFetchValue(const char *string, int *pcount) { const char *end = NSSUTIL_ArgFindEnd(string); char *retString, *copyString; PRBool lastEscape = PR_FALSE; int len; len = end - string; if (len == 0) { *pcount = 0; return NULL; } copyString = retString = (char *)PORT_Alloc(len + 1); if (*end) len++; *pcount = len; if (retString == NULL) return NULL; if (NSSUTIL_ArgIsQuote(*string)) string++; for (; string < end; string++) { if (NSSUTIL_ArgIsEscape(*string) && !lastEscape) { lastEscape = PR_TRUE; continue; } lastEscape = PR_FALSE; *copyString++ = *string; } *copyString = 0; return retString; }
/* * point to the next parameter in string */ char * NSSUTIL_ArgSkipParameter(char *string) { char *end; /* look for the end of the <name>= */ for (;*string; string++) { if (*string == '=') { string++; break; } if (NSSUTIL_ArgIsBlank(*string)) return(string); } end = NSSUTIL_ArgFindEnd(string); if (*end) end++; return end; }