diff options
Diffstat (limited to 'src/lib/libc')
| -rw-r--r-- | src/lib/libc/string/strftime.c | 22 |
1 files changed, 14 insertions, 8 deletions
diff --git a/src/lib/libc/string/strftime.c b/src/lib/libc/string/strftime.c index 0b69e10ac0..b6326f274e 100644 --- a/src/lib/libc/string/strftime.c +++ b/src/lib/libc/string/strftime.c | |||
| @@ -1,4 +1,4 @@ | |||
| 1 | /* $OpenBSD: strftime.c,v 1.3 1996/03/09 02:42:58 niklas Exp $ */ | 1 | /* $OpenBSD: strftime.c,v 1.4 1996/03/25 21:17:36 tholo Exp $ */ |
| 2 | 2 | ||
| 3 | /* | 3 | /* |
| 4 | * Copyright (c) 1989 The Regents of the University of California. | 4 | * Copyright (c) 1989 The Regents of the University of California. |
| @@ -35,7 +35,7 @@ | |||
| 35 | 35 | ||
| 36 | #if defined(LIBC_SCCS) && !defined(lint) | 36 | #if defined(LIBC_SCCS) && !defined(lint) |
| 37 | /*static char *sccsid = "from: @(#)strftime.c 5.11 (Berkeley) 2/24/91";*/ | 37 | /*static char *sccsid = "from: @(#)strftime.c 5.11 (Berkeley) 2/24/91";*/ |
| 38 | static char *rcsid = "$Id: strftime.c,v 1.3 1996/03/09 02:42:58 niklas Exp $"; | 38 | static char *rcsid = "$Id: strftime.c,v 1.4 1996/03/25 21:17:36 tholo Exp $"; |
| 39 | #endif /* LIBC_SCCS and not lint */ | 39 | #endif /* LIBC_SCCS and not lint */ |
| 40 | 40 | ||
| 41 | #include <sys/localedef.h> | 41 | #include <sys/localedef.h> |
| @@ -46,8 +46,10 @@ static char *rcsid = "$Id: strftime.c,v 1.3 1996/03/09 02:42:58 niklas Exp $"; | |||
| 46 | 46 | ||
| 47 | static size_t gsize; | 47 | static size_t gsize; |
| 48 | static char *pt; | 48 | static char *pt; |
| 49 | static int _add(), _conv(), _secs(); | 49 | static int _add __P((const char *)); |
| 50 | static size_t _fmt(); | 50 | static int _secs __P((const struct tm *)); |
| 51 | static int _conv __P((int, int, char)); | ||
| 52 | static size_t _fmt __P((const char *, const struct tm *)); | ||
| 51 | 53 | ||
| 52 | size_t | 54 | size_t |
| 53 | strftime(s, maxsize, format, t) | 55 | strftime(s, maxsize, format, t) |
| @@ -74,8 +76,8 @@ strftime(s, maxsize, format, t) | |||
| 74 | ((t)->tm_wday ? (t)->tm_wday - 1 : 6)) / 7) | 76 | ((t)->tm_wday ? (t)->tm_wday - 1 : 6)) / 7) |
| 75 | static size_t | 77 | static size_t |
| 76 | _fmt(format, t) | 78 | _fmt(format, t) |
| 77 | register char *format; | 79 | register const char *format; |
| 78 | struct tm *t; | 80 | const struct tm *t; |
| 79 | { | 81 | { |
| 80 | for (; *format; ++format) { | 82 | for (; *format; ++format) { |
| 81 | if (*format == '%') { | 83 | if (*format == '%') { |
| @@ -276,7 +278,7 @@ _fmt(format, t) | |||
| 276 | 278 | ||
| 277 | static int | 279 | static int |
| 278 | _secs(t) | 280 | _secs(t) |
| 279 | struct tm *t; | 281 | const struct tm *t; |
| 280 | { | 282 | { |
| 281 | static char buf[15]; | 283 | static char buf[15]; |
| 282 | register time_t s; | 284 | register time_t s; |
| @@ -292,9 +294,13 @@ _secs(t) | |||
| 292 | } | 294 | } |
| 293 | 295 | ||
| 294 | static int | 296 | static int |
| 297 | #if __STDC__ | ||
| 298 | _conv(int n, int digits, char pad) | ||
| 299 | #else | ||
| 295 | _conv(n, digits, pad) | 300 | _conv(n, digits, pad) |
| 296 | int n, digits; | 301 | int n, digits; |
| 297 | char pad; | 302 | char pad; |
| 303 | #endif | ||
| 298 | { | 304 | { |
| 299 | static char buf[10]; | 305 | static char buf[10]; |
| 300 | register char *p; | 306 | register char *p; |
| @@ -308,7 +314,7 @@ _conv(n, digits, pad) | |||
| 308 | 314 | ||
| 309 | static int | 315 | static int |
| 310 | _add(str) | 316 | _add(str) |
| 311 | register char *str; | 317 | register const char *str; |
| 312 | { | 318 | { |
| 313 | for (;; ++pt, --gsize) { | 319 | for (;; ++pt, --gsize) { |
| 314 | if (!gsize) | 320 | if (!gsize) |
