*** src/shellutils/src/date.c.orig Tue Sep 19 11:49:45 2000 --- src/shellutils/src/date.c Thu Sep 21 23:37:29 2000 *************** *** 310,317 **** show_date (const char *format, time_t when) { struct tm *tm; char *out = NULL; ! size_t out_length = 0; tm = localtime (&when); --- 310,319 ---- show_date (const char *format, time_t when) { struct tm *tm; + char *safe_format; + size_t in_length; char *out = NULL; ! size_t out_length; tm = localtime (&when); *************** *** 336,350 **** return; } do { out_length += 200; out = (char *) xrealloc (out, out_length); } ! while (strftime (out, out_length, format, tm) == 0); ! printf ("%s\n", out); free (out); } static void --- 338,357 ---- return; } + out_length = in_length = strlen(format); + safe_format = (char *)malloc(in_length+2); + *safe_format = 'X'; + strcpy(safe_format+1, format); do { out_length += 200; out = (char *) xrealloc (out, out_length); } ! while (strftime (out, out_length, safe_format, tm) == 0); ! printf ("%s\n", out+1); free (out); + free (safe_format); } static void