+
+void time_clean(
+ char *result,
+ char *format)
+{
+ int j, jj;
+
+ jj = 0;
+ for(j = 0; j < FMT_LEG_LEN - 1; j++) { /* we don't need to parse the last char */
+ if (format[j] == '%') {
+ if ((format[j+1] == 'A') || (format[j+1] == 'a') ||
+ (format[j+1] == 'B') || (format[j+1] == 'b') ||
+ (format[j+1] == 'C') || (format[j+1] == 'c') ||
+ (format[j+1] == 'D') || (format[j+1] == 'd') ||
+ (format[j+1] == 'E') || (format[j+1] == 'e') ||
+ (format[j+1] == 'F') ||
+ (format[j+1] == 'G') || (format[j+1] == 'g') ||
+ (format[j+1] == 'H') || (format[j+1] == 'h') ||
+ (format[j+1] == 'I') ||
+ (format[j+1] == 'j') ||
+ (format[j+1] == 'k') ||
+ (format[j+1] == 'l') ||
+ (format[j+1] == 'M') || (format[j+1] == 'm') ||
+ (format[j+1] == 'O') ||
+ (format[j+1] == 'P') || (format[j+1] == 'p') ||
+ (format[j+1] == 'R') || (format[j+1] == 'r') ||
+ (format[j+1] == 'S') || (format[j+1] == 's') ||
+ (format[j+1] == 'T') ||
+ (format[j+1] == 'U') || (format[j+1] == 'u') ||
+ (format[j+1] == 'V') || (format[j+1] == 'v') ||
+ (format[j+1] == 'W') || (format[j+1] == 'w') ||
+ (format[j+1] == 'X') || (format[j+1] == 'x') ||
+ (format[j+1] == 'Y') || (format[j+1] == 'y') ||
+ (format[j+1] == 'Z') || (format[j+1] == 'z') ||
+ (format[j+1] == '+')) {
+ result[jj++] = '-';
+ j++; /* We skip the following char */
+ } else if (format[j+1] == '%') {
+ result[jj++] = '%';
+ j++; /* We skip the following char */
+ } else if (format[j+1] == 'n') {
+ result[jj++] = '\r';
+ result[jj++] = '\n';
+ j++; /* We skip the following char */
+ } else if (format[j+1] == 't') {
+ result[jj++] = '\t';
+ j++; /* We skip the following char */
+ } else {
+ result[jj++] = format[j];
+ }
+ } else {
+ result[jj++] = format[j];
+ }
+ }
+ result[jj] = '\0'; /* We must force the end of the string */
+}