diff --git a/lib/util.C b/lib/util.C index 39f94e9247..530d13f176 100755 --- a/lib/util.C +++ b/lib/util.C @@ -65,9 +65,9 @@ int double_to_ydhms (double x, int smallest_timescale, char *buf) { } if (smallest_timescale==3) { - sprintf( day_buf, "%.2f day ", days ); + sprintf( day_buf, "%.2f day%s ", days, (days>1?"s":"") ); } else if (days > 1 && smallest_timescale < 3) { - sprintf( day_buf, "%d day ", (int)days ); + sprintf( day_buf, "%d day%s ", (int)days, (days>1?"s":"") ); } else { strcpy( day_buf, "" ); } @@ -280,9 +280,12 @@ void escape_url(char *in, char*out) { out[y] = 0; } -void safe_strncpy(char* dst, char* src, int len) { - strncpy(dst, src, len); +char * safe_strncpy(char* dst, char* src, int len) { + char *retval; + + retval = strncpy(dst, src, len); dst[len-1]=0; + return retval; } char* timestamp() { diff --git a/lib/util.h b/lib/util.h index 5cfbde439d..de53d6f5ed 100755 --- a/lib/util.h +++ b/lib/util.h @@ -28,7 +28,7 @@ extern double drand(); extern void c2x(char *what); extern void unescape_url(char *url); extern void escape_url(char *in, char*out); -extern void safe_strncpy(char*, char*, int); +extern char* safe_strncpy(char*, char*, int); extern char* timestamp(); #ifndef max