9b542a3e6221b2d056a650180e3249c10bc58f66 braney Tue Oct 18 11:31:27 2016 -0700 some tweaks to hubToMetaRa diff --git src/lib/common.c src/lib/common.c index e0a2159..a7ebe33 100644 --- src/lib/common.c +++ src/lib/common.c @@ -1990,82 +1990,66 @@ ++in; } if (*in == 0) break; /* Tag end of word with zero. */ if (outArray != NULL) *in = 0; /* And skip over the zero. */ in += 1; } return recordCount; } int chopByWhiteRespectDoubleQuotes(char *in, char *outArray[], int outSize) +// NOTE: this routine does not do what this comment says. It did not ever remove quotes due to +// a coding error so I took out the code that pretended to be doing this. /* Like chopString, but specialized for white space separators. * Further, any doubleQuotes (") are respected. * If doubleQuote is encloses whole string, then they are removed: * "Fred and Ethyl" results in word [Fred and Ethyl] * If doubleQuotes exist inside string they are retained: * Fred" and Ethyl" results in word [Fred" and Ethyl"] * Special note "" is a valid, though empty word. */ { int recordCount = 0; char c; -char *quoteBegins = NULL; boolean quoting = FALSE; for (;;) { if (outArray != NULL && recordCount >= outSize) break; /* Skip initial separators. */ while (isspace(*in)) ++in; if (*in == 0) break; /* Store start of word and look for end of word. */ if (outArray != NULL) - { outArray[recordCount] = in; - if (*in == '"') - quoteBegins = (in+1); - else - quoteBegins = NULL; - } recordCount += 1; quoting = FALSE; for (;;) { if ((c = *in) == 0) break; if (quoting) { if (c == '"') - { quoting = FALSE; - if (quoteBegins != NULL) // implies out array - { - if ((c = *(in+1) == 0 )|| isspace(c)) // whole word is quoted. - { - outArray[recordCount-1] = quoteBegins; // Fix beginning of word - quoteBegins = NULL; - break; - } - } - } } else { quoting = (c == '"'); if (isspace(c)) break; } ++in; } if (*in == 0) break; /* Tag end of word with zero. */ if (outArray != NULL) *in = 0;