X-Git-Url: http://erislabs.net/gitweb/?a=blobdiff_plain;f=lib%2Fposixtm.c;h=1400e5a51d7e35de5b35ba92666978426217b65b;hb=02eb9acbac6b05f1d5f3acb89bcc4bbc45215e2a;hp=41c00ad677906d66445670a2c0e56b4f51419aec;hpb=b20a6a6e55940a5219dfe54a84f8a5abed5fa1b6;p=gnulib.git diff --git a/lib/posixtm.c b/lib/posixtm.c index 41c00ad67..1400e5a51 100644 --- a/lib/posixtm.c +++ b/lib/posixtm.c @@ -1,5 +1,7 @@ /* Parse dates for touch and date. - Copyright (C) 1989, 1990, 1991, 1998, 2000-2002 Free Software Foundation Inc. + + Copyright (C) 1989, 1990, 1991, 1998, 2000, 2001, 2002, 2003, 2004 + Free Software Foundation Inc. This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -22,22 +24,12 @@ # include #endif -#if HAVE_STDBOOL_H -# include -#else -typedef enum {false = 0, true = 1} bool; -#endif +#include #include -#if HAVE_STDLIB_H -# include -#endif +#include #include -#if HAVE_STRING_H -# include -#else -# include -#endif +#include #ifdef TM_IN_SYS_TIME # include @@ -46,7 +38,10 @@ typedef enum {false = 0, true = 1} bool; #endif #include "posixtm.h" -#include "unlocked-io.h" + +#if USE_UNLOCKED_IO +# include "unlocked-io.h" +#endif /* ISDIGIT differs from isdigit, as follows: - Its arg may be any int or unsigned int; it need not be an unsigned char. @@ -55,7 +50,7 @@ typedef enum {false = 0, true = 1} bool; POSIX says that only '0' through '9' are digits. Prefer ISDIGIT to ISDIGIT_LOCALE unless it's important to use the locale's definition of `digit' even when the host does not conform to POSIX. */ -#define ISDIGIT(c) ((unsigned) (c) - '0' <= 9) +#define ISDIGIT(c) ((unsigned int) (c) - '0' <= 9) time_t mktime (); @@ -123,7 +118,7 @@ posix_time_parse (struct tm *tm, const char *s, unsigned int syntax_bits) const char *dot = NULL; int pair[6]; int *p; - unsigned int i; + size_t i; size_t s_len = strlen (s); size_t len = (((syntax_bits & PDS_SECONDS) && (dot = strchr (s, '.'))) @@ -298,7 +293,7 @@ END-DATA # define MAX_BUFF_LEN 1024 int -main () +main (void) { char buff[MAX_BUFF_LEN + 1]; @@ -314,7 +309,7 @@ main () { printf ("%-15s %2u ", time_str, syntax_bits); if (posixtime (&t, time_str, syntax_bits)) - printf ("%12ld %s", (long) t, ctime (&t)); + printf ("%12ld %s", (long int) t, ctime (&t)); else printf ("%12s %s", "*", "*\n"); }