/*
- *
+ * A basic toolset containing miscellaneous functions for string manipluation,
+ * encoding/decoding, and a bunch of other stuff.
*/
static byte dtable[256] = "\0"; /* base64 decode table */
static byte etable[256] = "\0"; /* base64 encode table */
-/* Month strings for date conversions */
-char *ascmonths[12] = {
- "Jan", "Feb", "Mar", "Apr", "May", "Jun",
- "Jul", "Aug", "Sep", "Oct", "Nov", "Dec"
-};
-
char *safestrncpy(char *dest, const char *src, size_t n)
{
int i = 0;
struct tm tm;
int hour;
+ /* Month strings for date conversions ... this needs to be localized eventually */
+ char *fmt_date_months[12] = {
+ "Jan", "Feb", "Mar", "Apr", "May", "Jun", "Jul", "Aug", "Sep", "Oct", "Nov", "Dec"
+ };
+
strcpy(buf, "");
localtime_r(&thetime, &tm);
if (seconds) {
snprintf(buf, n, "%s %d %4d %d:%02d:%02d%s",
- ascmonths[tm.tm_mon],
+ fmt_date_months[tm.tm_mon],
tm.tm_mday,
tm.tm_year + 1900,
hour,
);
} else {
snprintf(buf, n, "%s %d %4d %d:%02d%s",
- ascmonths[tm.tm_mon],
+ fmt_date_months[tm.tm_mon],
tm.tm_mday,
tm.tm_year + 1900,
hour,
}
-/**
+/*
* \brief searches for a paternn within asearch string
* \param search the string to search
* \param patn the pattern to find in string