- if (!strcmp(buf, "text")) {
- while (serv_getln(buf, sizeof buf), strcmp(buf, "000")) {
- extract_token(key, buf, 0, '|', sizeof key);
- extract_token(value, buf, 1, '|', sizeof value);
- if (!IsEmptyStr(key))
- Put(WC->hash_prefs, key, strlen(key), strdup(value), free);
+ if (!strcmp(ChrPtr(ReadBuf), "text")) {
+ StrBuf *Key;
+ StrBuf *Data = NULL;
+ StrBuf *LastData = NULL;
+
+ Key = NewStrBuf();
+ while (StrBuf_ServGetln(ReadBuf),
+ strcmp(ChrPtr(ReadBuf), "000"))
+ {
+ if ((ChrPtr(ReadBuf)[0] == ' ') &&
+ (Data != NULL)) {
+ StrBufAppendBuf(Data, ReadBuf, 1);
+ }
+ else {
+ LastData = Data = NewStrBuf();
+ StrBufExtract_token(Key, ReadBuf, 0, '|');
+ StrBufExtract_token(Data, ReadBuf, 1, '|');
+ if (!IsEmptyStr(ChrPtr(Key)))
+ {
+ Put(WC->hash_prefs,
+ ChrPtr(Key), StrLength(Key),
+ Data,
+ HFreeStrBuf);
+ }
+ else
+ {
+ FreeStrBuf(&Data);
+ LastData = NULL;
+ }
+ }