diff options
author | Thorsten Lockert <tholo@cvs.openbsd.org> | 1999-02-28 21:58:35 +0000 |
---|---|---|
committer | Thorsten Lockert <tholo@cvs.openbsd.org> | 1999-02-28 21:58:35 +0000 |
commit | be6c0c795aa2d454d92156537e202b4b9981f92c (patch) | |
tree | 73e006884f58bfffc785db0c39b5ed772e988af5 /gnu/usr.bin/cvs/lib | |
parent | 4029a51f9c2b0ad309f4f23f3cba7ede7fac899f (diff) |
Integrate local changes
Diffstat (limited to 'gnu/usr.bin/cvs/lib')
-rw-r--r-- | gnu/usr.bin/cvs/lib/getdate.c | 10 | ||||
-rw-r--r-- | gnu/usr.bin/cvs/lib/getdate.y | 6 | ||||
-rw-r--r-- | gnu/usr.bin/cvs/lib/memmove.c | 5 | ||||
-rw-r--r-- | gnu/usr.bin/cvs/lib/vasprintf.c | 171 |
4 files changed, 13 insertions, 179 deletions
diff --git a/gnu/usr.bin/cvs/lib/getdate.c b/gnu/usr.bin/cvs/lib/getdate.c index c97fd30af03..c02af2a5fc9 100644 --- a/gnu/usr.bin/cvs/lib/getdate.c +++ b/gnu/usr.bin/cvs/lib/getdate.c @@ -633,6 +633,10 @@ ToSeconds(Hours, Minutes, Seconds, Meridian) } +/* Year is either + * A negative number, which means to use its absolute value (why?) + * A number from 0 to 99, which means a year from 1900 to 1999, or + * The actual year (>=100). */ static time_t Convert(Month, Day, Year, Hours, Minutes, Seconds, Meridian, DSTmode) time_t Month; @@ -724,7 +728,7 @@ RelativeMonth(Start, RelMonth) if (RelMonth == 0) return 0; tm = localtime(&Start); - Month = 12 * tm->tm_year + tm->tm_mon + RelMonth; + Month = 12 * (tm->tm_year + 1900) + tm->tm_mon + RelMonth; Year = Month / 12; Month = Month % 12 + 1; return DSTcorrect(Start, @@ -1040,7 +1044,7 @@ main(ac, av) /* NOTREACHED */ } #endif /* defined(TEST) */ -#line 1044 "y.tab.c" +#line 1048 "y.tab.c" #define YYABORT goto yyabort #define YYREJECT goto yyabort #define YYACCEPT goto yyaccept @@ -1465,7 +1469,7 @@ case 41: yyval.Meridian = yyvsp[0].Meridian; } break; -#line 1469 "y.tab.c" +#line 1473 "y.tab.c" } yyssp -= yym; yystate = *yyssp; diff --git a/gnu/usr.bin/cvs/lib/getdate.y b/gnu/usr.bin/cvs/lib/getdate.y index fdb177d04c1..9a4a8fae658 100644 --- a/gnu/usr.bin/cvs/lib/getdate.y +++ b/gnu/usr.bin/cvs/lib/getdate.y @@ -619,6 +619,10 @@ ToSeconds(Hours, Minutes, Seconds, Meridian) } +/* Year is either + * A negative number, which means to use its absolute value (why?) + * A number from 0 to 99, which means a year from 1900 to 1999, or + * The actual year (>=100). */ static time_t Convert(Month, Day, Year, Hours, Minutes, Seconds, Meridian, DSTmode) time_t Month; @@ -710,7 +714,7 @@ RelativeMonth(Start, RelMonth) if (RelMonth == 0) return 0; tm = localtime(&Start); - Month = 12 * tm->tm_year + tm->tm_mon + RelMonth; + Month = 12 * (tm->tm_year + 1900) + tm->tm_mon + RelMonth; Year = Month / 12; Month = Month % 12 + 1; return DSTcorrect(Start, diff --git a/gnu/usr.bin/cvs/lib/memmove.c b/gnu/usr.bin/cvs/lib/memmove.c index 8818d46544c..047a5a0941a 100644 --- a/gnu/usr.bin/cvs/lib/memmove.c +++ b/gnu/usr.bin/cvs/lib/memmove.c @@ -12,10 +12,7 @@ but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Library General Public License for more details. -You should have received a copy of the GNU Library General Public -License along with libiberty; see the file COPYING.LIB. If -not, write to the Free Software Foundation, Inc., 675 Mass Ave, -Cambridge, MA 02139, USA. */ +*/ /* diff --git a/gnu/usr.bin/cvs/lib/vasprintf.c b/gnu/usr.bin/cvs/lib/vasprintf.c deleted file mode 100644 index 45253b15325..00000000000 --- a/gnu/usr.bin/cvs/lib/vasprintf.c +++ /dev/null @@ -1,171 +0,0 @@ -/* Like vsprintf but provides a pointer to malloc'd storage, which must - be freed by the caller. - Copyright (C) 1994 Free Software Foundation, Inc. - -This file is part of the libiberty library. -Libiberty is free software; you can redistribute it and/or -modify it under the terms of the GNU Library General Public -License as published by the Free Software Foundation; either -version 2 of the License, or (at your option) any later version. - -Libiberty is distributed in the hope that it will be useful, -but WITHOUT ANY WARRANTY; without even the implied warranty of -MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -Library General Public License for more details. - -You should have received a copy of the GNU Library General Public -License along with libiberty; see the file COPYING.LIB. If -not, write to the Free Software Foundation, Inc., 675 Mass Ave, -Cambridge, MA 02139, USA. */ - -#include <stdio.h> -#include <string.h> - -#ifdef HAVE_CONFIG_H -#include "config.h" -#endif - -#ifdef __STDC__ -#include <stdarg.h> -#else -#include <varargs.h> -#endif - -extern int abs (); - -#ifdef TEST -int global_total_width; -#endif - -unsigned long strtoul (); -char *malloc (); - -static int -int_vasprintf (result, format, args) - char **result; - const char *format; - va_list *args; -{ - const char *p = format; - /* Add one to make sure that it is never zero, which might cause malloc - to return NULL. */ - int total_width = strlen (format) + 1; - va_list ap; - - memcpy (&ap, args, sizeof (va_list)); - - while (*p != '\0') - { - if (*p++ == '%') - { - while (strchr ("-+ #0", *p)) - ++p; - if (*p == '*') - { - ++p; - total_width += abs (va_arg (ap, int)); - } - else - total_width += strtoul (p, &p, 10); - if (*p == '.') - { - ++p; - if (*p == '*') - { - ++p; - total_width += abs (va_arg (ap, int)); - } - else - total_width += strtoul (p, &p, 10); - } - while (strchr ("hlL", *p)) - ++p; - /* Should be big enough for any format specifier except %s. */ - total_width += 30; - switch (*p) - { - case 'd': - case 'i': - case 'o': - case 'u': - case 'x': - case 'X': - case 'c': - (void) va_arg (ap, int); - break; - case 'f': - case 'e': - case 'E': - case 'g': - case 'G': - (void) va_arg (ap, double); - break; - case 's': - total_width += strlen (va_arg (ap, char *)); - break; - case 'p': - case 'n': - (void) va_arg (ap, char *); - break; - } - } - } -#ifdef TEST - global_total_width = total_width; -#endif - *result = malloc (total_width); - if (*result != NULL) - return vsprintf (*result, format, *args); - else - return 0; -} - -int -vasprintf (result, format, args) - char **result; - const char *format; - va_list args; -{ - return int_vasprintf (result, format, &args); -} - -#ifdef TEST -void -checkit -#ifdef __STDC__ - (const char* format, ...) -#else - (va_alist) - va_dcl -#endif -{ - va_list args; - char *result; - -#ifdef __STDC__ - va_start (args, format); -#else - char *format; - va_start (args); - format = va_arg (args, char *); -#endif - vasprintf (&result, format, args); - if (strlen (result) < global_total_width) - printf ("PASS: "); - else - printf ("FAIL: "); - printf ("%d %s\n", global_total_width, result); -} - -int -main () -{ - checkit ("%d", 0x12345678); - checkit ("%200d", 5); - checkit ("%.300d", 6); - checkit ("%100.150d", 7); - checkit ("%s", "jjjjjjjjjiiiiiiiiiiiiiiioooooooooooooooooppppppppppppaa\n\ -777777777777777777333333333333366666666666622222222222777777777777733333"); - checkit ("%f%s%d%s", 1.0, "foo", 77, "asdjffffffffffffffiiiiiiiiiiixxxxx"); -} -#endif /* TEST */ |