Exemplo n.º 1
0
/*
 * get the value from that tag value pair.
 */
char *
NSSUTIL_ArgGetParamValue(const char *paramName, const char *parameters)
{
    char searchValue[256];
    int paramLen = strlen(paramName);
    char *returnValue = NULL;
    int next;

    if ((parameters == NULL) || (*parameters == 0))
        return NULL;

    PORT_Assert(paramLen + 2 < sizeof(searchValue));

    PORT_Strcpy(searchValue, paramName);
    PORT_Strcat(searchValue, "=");
    while (*parameters) {
        if (PORT_Strncasecmp(parameters, searchValue, paramLen + 1) == 0) {
            parameters += paramLen + 1;
            returnValue = NSSUTIL_ArgFetchValue(parameters, &next);
            break;
        } else {
            parameters = NSSUTIL_ArgSkipParameter(parameters);
        }
        parameters = NSSUTIL_ArgStrip(parameters);
    }
    return returnValue;
}
/* parse all the slot specific parameters. */
struct NSSUTILPreSlotInfoStr *
NSSUTIL_ArgParseSlotInfo(PRArenaPool *arena, char *slotParams, int *retCount)
{
    char *slotIndex;
    struct NSSUTILPreSlotInfoStr *slotInfo = NULL;
    int i=0,count = 0,next;

    *retCount = 0;
    if ((slotParams == NULL) || (*slotParams == 0))  return NULL;

    /* first count the number of slots */
    for (slotIndex = NSSUTIL_ArgStrip(slotParams); *slotIndex; 
	 slotIndex = NSSUTIL_ArgStrip(NSSUTIL_ArgSkipParameter(slotIndex))) {
	count++;
    }

    /* get the data structures */
    if (arena) {
	slotInfo = PORT_ArenaZNewArray(arena,
				struct NSSUTILPreSlotInfoStr, count); 
    } else {