return 0;
}
/**
- * @ingroup StrBuf
+ * @ingroup StrBuf_Filler
* @brief modifies a Single char of the Buf
* You can point to it via char* or a zero-based integer
* @param Buf The buffer to manipulate
}
/**
- * @ingroup StrBuf
+ * @ingroup StrBuf_Filler
* @brief Append a StringBuffer to the buffer
* @param Buf Buffer to modify
* @param AppendBuf Buffer to copy at the end of our buffer
/**
- * @ingroup StrBuf
+ * @ingroup StrBuf_Filler
* @brief Append a C-String to the buffer
* @param Buf Buffer to modify
* @param AppendBuf Buffer to copy at the end of our buffer
}
/**
- * @ingroup StrBuf
+ * @ingroup StrBuf_Filler
* @brief sprintf like function appending the formated string to the buffer
* vsnprintf version to wrap into own calls
* @param Buf Buffer to extend by format and Params
}
/**
- * @ingroup StrBuf
+ * @ingroup StrBuf_Filler
* @brief sprintf like function appending the formated string to the buffer
* @param Buf Buffer to extend by format and Params
* @param format printf alike format to add
}
/**
- * @ingroup StrBuf
+ * @ingroup StrBuf_Filler
* @brief sprintf like function putting the formated string into the buffer
* @param Buf Buffer to extend by format and Parameters
* @param format printf alike format to add
}
/**
- * @ingroup StrBuf
+ * @ingroup StrBuf_Filler
* @brief Callback for cURL to append the webserver reply to a buffer
* @param ptr pre-defined by the cURL API; see man 3 curl for mre info
* @param size pre-defined by the cURL API; see man 3 curl for mre info
}
/**
- * @ingroup StrBuf
+ * @ingroup StrBuf_Filler
* @brief uppercase the contents of a buffer
* @param Buf the buffer to translate
*/
/**
- * @ingroup StrBuf
+ * @ingroup StrBuf_Filler
* @brief lowercase the contents of a buffer
* @param Buf the buffer to translate
*/
}
+/**
+ * @ingroup StrBuf
+ * @brief removes all \r s from the string, or replaces them with \n if its not a combination of both.
+ * @param buf Buffer to modify
+ */
+void StrBufToUnixLF(StrBuf *buf)
+{
+ char *pche, *pchS, *pchT;
+ if (buf == NULL)
+ return;
+
+ pche = buf->buf + buf->BufUsed;
+ pchS = pchT = buf->buf;
+ while (pchS < pche)
+ {
+ if (*pchS == '\r')
+ {
+ pchS ++;
+ if (*pchS != '\n') {
+ *pchT = '\n';
+ pchT++;
+ }
+ }
+ *pchT = *pchS;
+ pchT++; pchS++;
+ }
+ *pchT = '\0';
+ buf->BufUsed = pchT - buf->buf;
+}
+
/*******************************************************************************
* Iconv Wrapper; RFC822 de/encoding *
CU_ASSERT(strlen(ch) == i);
free(ch);
FreeStrBuf(&Buf2);
+ FreeStrBuf(&Buf3);
}
static void TestStrBufPeek(void)
CU_ASSERT(StrBufPeek(Buf, NULL, 5, 'A') == 5);
CU_ASSERT_STRING_EQUAL(ChrPtr(Buf), "0123AA6");
+ FreeStrBuf(&Buf);
}
static void TestBufStringManipulation(void)
int main(int argc, char* argv[])
{
+ int i;
setvbuf(stdout, NULL, _IONBF, 0);
StartLibCitadel(8);
if (argc > 0)
Quiet = 1; // todo: -q ;-)
-
+ for (i=0; i< 100000; i++) {
CU_set_output_filename("TestAutomated");
if (CU_initialize_registry()) {
printf("\nInitialize of test Registry failed.");
}
CU_cleanup_registry();
-
+ }
return 0;
}