diff options
Diffstat (limited to 'gnu/usr.bin/cvs/lib')
-rw-r--r-- | gnu/usr.bin/cvs/lib/getdate.c | 88 | ||||
-rw-r--r-- | gnu/usr.bin/cvs/lib/getdate.y | 4 | ||||
-rw-r--r-- | gnu/usr.bin/cvs/lib/strippath.c | 80 |
3 files changed, 48 insertions, 124 deletions
diff --git a/gnu/usr.bin/cvs/lib/getdate.c b/gnu/usr.bin/cvs/lib/getdate.c index 77da8b87a42..d4d93506e90 100644 --- a/gnu/usr.bin/cvs/lib/getdate.c +++ b/gnu/usr.bin/cvs/lib/getdate.c @@ -8,7 +8,7 @@ static char yysccsid[] = "@(#)yaccpar 1.9 (Berkeley) 02/21/93"; #define yyerrok (yyerrflag=0) #define YYRECOVERING (yyerrflag!=0) #define YYPREFIX "yy" -#line 2 "../../lib/getdate.y" +#line 2 "../../work/ccvs/lib/getdate.y" /* ** Originally written by Steven M. Bellovin <smb@research.att.com> while ** at the University of North Carolina at Chapel Hill. Later tweaked by @@ -185,7 +185,7 @@ static MERIDIAN yyMeridian; static time_t yyRelMonth; static time_t yyRelSeconds; -#line 180 "../../lib/getdate.y" +#line 180 "../../work/ccvs/lib/getdate.y" typedef union { time_t Number; enum _MERIDIAN Meridian; @@ -403,7 +403,7 @@ YYSTYPE yylval; short yyss[YYSTACKSIZE]; YYSTYPE yyvs[YYSTACKSIZE]; #define yystacksize YYSTACKSIZE -#line 393 "../../lib/getdate.y" +#line 393 "../../work/ccvs/lib/getdate.y" /* Month and day table. */ static TABLE const MonthDayTable[] = { @@ -654,7 +654,9 @@ Convert(Month, Day, Year, Hours, Minutes, Seconds, Meridian, DSTmode) Year += 1900; DaysInMonth[1] = Year % 4 == 0 && (Year % 100 != 0 || Year % 400 == 0) ? 29 : 28; - if (Year < EPOCH || Year > 1999 + /* Checking for 2038 bogusly assumes that time_t is 32 bits. But + I'm too lazy to try to check for time_t overflow in another way. */ + if (Year < EPOCH || Year > 2038 || Month < 1 || Month > 12 /* Lint fluff: "conversion from long may lose accuracy" */ || Day < 1 || Day > DaysInMonth[(int)--Month]) @@ -1018,7 +1020,7 @@ main(ac, av) /* NOTREACHED */ } #endif /* defined(TEST) */ -#line 1022 "y.tab.c" +#line 1024 "y.tab.c" #define YYABORT goto yyabort #define YYREJECT goto yyabort #define YYACCEPT goto yyaccept @@ -1160,37 +1162,37 @@ yyreduce: switch (yyn) { case 3: -#line 198 "../../lib/getdate.y" +#line 198 "../../work/ccvs/lib/getdate.y" { yyHaveTime++; } break; case 4: -#line 201 "../../lib/getdate.y" +#line 201 "../../work/ccvs/lib/getdate.y" { yyHaveZone++; } break; case 5: -#line 204 "../../lib/getdate.y" +#line 204 "../../work/ccvs/lib/getdate.y" { yyHaveDate++; } break; case 6: -#line 207 "../../lib/getdate.y" +#line 207 "../../work/ccvs/lib/getdate.y" { yyHaveDay++; } break; case 7: -#line 210 "../../lib/getdate.y" +#line 210 "../../work/ccvs/lib/getdate.y" { yyHaveRel++; } break; case 9: -#line 216 "../../lib/getdate.y" +#line 216 "../../work/ccvs/lib/getdate.y" { yyHour = yyvsp[-1].Number; yyMinutes = 0; @@ -1199,7 +1201,7 @@ case 9: } break; case 10: -#line 222 "../../lib/getdate.y" +#line 222 "../../work/ccvs/lib/getdate.y" { yyHour = yyvsp[-3].Number; yyMinutes = yyvsp[-1].Number; @@ -1208,7 +1210,7 @@ case 10: } break; case 11: -#line 228 "../../lib/getdate.y" +#line 228 "../../work/ccvs/lib/getdate.y" { yyHour = yyvsp[-3].Number; yyMinutes = yyvsp[-1].Number; @@ -1218,7 +1220,7 @@ case 11: } break; case 12: -#line 235 "../../lib/getdate.y" +#line 235 "../../work/ccvs/lib/getdate.y" { yyHour = yyvsp[-5].Number; yyMinutes = yyvsp[-3].Number; @@ -1227,7 +1229,7 @@ case 12: } break; case 13: -#line 241 "../../lib/getdate.y" +#line 241 "../../work/ccvs/lib/getdate.y" { yyHour = yyvsp[-5].Number; yyMinutes = yyvsp[-3].Number; @@ -1238,56 +1240,56 @@ case 13: } break; case 14: -#line 251 "../../lib/getdate.y" +#line 251 "../../work/ccvs/lib/getdate.y" { yyTimezone = yyvsp[0].Number; yyDSTmode = DSToff; } break; case 15: -#line 255 "../../lib/getdate.y" +#line 255 "../../work/ccvs/lib/getdate.y" { yyTimezone = yyvsp[0].Number; yyDSTmode = DSTon; } break; case 16: -#line 260 "../../lib/getdate.y" +#line 260 "../../work/ccvs/lib/getdate.y" { yyTimezone = yyvsp[-1].Number; yyDSTmode = DSTon; } break; case 17: -#line 266 "../../lib/getdate.y" +#line 266 "../../work/ccvs/lib/getdate.y" { yyDayOrdinal = 1; yyDayNumber = yyvsp[0].Number; } break; case 18: -#line 270 "../../lib/getdate.y" +#line 270 "../../work/ccvs/lib/getdate.y" { yyDayOrdinal = 1; yyDayNumber = yyvsp[-1].Number; } break; case 19: -#line 274 "../../lib/getdate.y" +#line 274 "../../work/ccvs/lib/getdate.y" { yyDayOrdinal = yyvsp[-1].Number; yyDayNumber = yyvsp[0].Number; } break; case 20: -#line 280 "../../lib/getdate.y" +#line 280 "../../work/ccvs/lib/getdate.y" { yyMonth = yyvsp[-2].Number; yyDay = yyvsp[0].Number; } break; case 21: -#line 284 "../../lib/getdate.y" +#line 284 "../../work/ccvs/lib/getdate.y" { yyMonth = yyvsp[-4].Number; yyDay = yyvsp[-2].Number; @@ -1295,7 +1297,7 @@ case 21: } break; case 22: -#line 289 "../../lib/getdate.y" +#line 289 "../../work/ccvs/lib/getdate.y" { /* ISO 8601 format. yyyy-mm-dd. */ yyYear = yyvsp[-2].Number; @@ -1304,7 +1306,7 @@ case 22: } break; case 23: -#line 295 "../../lib/getdate.y" +#line 295 "../../work/ccvs/lib/getdate.y" { /* e.g. 17-JUN-1992. */ yyDay = yyvsp[-2].Number; @@ -1313,14 +1315,14 @@ case 23: } break; case 24: -#line 301 "../../lib/getdate.y" +#line 301 "../../work/ccvs/lib/getdate.y" { yyMonth = yyvsp[-1].Number; yyDay = yyvsp[0].Number; } break; case 25: -#line 305 "../../lib/getdate.y" +#line 305 "../../work/ccvs/lib/getdate.y" { yyMonth = yyvsp[-3].Number; yyDay = yyvsp[-2].Number; @@ -1328,14 +1330,14 @@ case 25: } break; case 26: -#line 310 "../../lib/getdate.y" +#line 310 "../../work/ccvs/lib/getdate.y" { yyMonth = yyvsp[0].Number; yyDay = yyvsp[-1].Number; } break; case 27: -#line 314 "../../lib/getdate.y" +#line 314 "../../work/ccvs/lib/getdate.y" { yyMonth = yyvsp[-1].Number; yyDay = yyvsp[-2].Number; @@ -1343,68 +1345,68 @@ case 27: } break; case 28: -#line 321 "../../lib/getdate.y" +#line 321 "../../work/ccvs/lib/getdate.y" { yyRelSeconds = -yyRelSeconds; yyRelMonth = -yyRelMonth; } break; case 30: -#line 328 "../../lib/getdate.y" +#line 328 "../../work/ccvs/lib/getdate.y" { yyRelSeconds += yyvsp[-1].Number * yyvsp[0].Number * 60L; } break; case 31: -#line 331 "../../lib/getdate.y" +#line 331 "../../work/ccvs/lib/getdate.y" { yyRelSeconds += yyvsp[-1].Number * yyvsp[0].Number * 60L; } break; case 32: -#line 334 "../../lib/getdate.y" +#line 334 "../../work/ccvs/lib/getdate.y" { yyRelSeconds += yyvsp[0].Number * 60L; } break; case 33: -#line 337 "../../lib/getdate.y" +#line 337 "../../work/ccvs/lib/getdate.y" { yyRelSeconds += yyvsp[-1].Number; } break; case 34: -#line 340 "../../lib/getdate.y" +#line 340 "../../work/ccvs/lib/getdate.y" { yyRelSeconds += yyvsp[-1].Number; } break; case 35: -#line 343 "../../lib/getdate.y" +#line 343 "../../work/ccvs/lib/getdate.y" { yyRelSeconds++; } break; case 36: -#line 346 "../../lib/getdate.y" +#line 346 "../../work/ccvs/lib/getdate.y" { yyRelMonth += yyvsp[-1].Number * yyvsp[0].Number; } break; case 37: -#line 349 "../../lib/getdate.y" +#line 349 "../../work/ccvs/lib/getdate.y" { yyRelMonth += yyvsp[-1].Number * yyvsp[0].Number; } break; case 38: -#line 352 "../../lib/getdate.y" +#line 352 "../../work/ccvs/lib/getdate.y" { yyRelMonth += yyvsp[0].Number; } break; case 39: -#line 357 "../../lib/getdate.y" +#line 357 "../../work/ccvs/lib/getdate.y" { if (yyHaveTime && yyHaveDate && !yyHaveRel) yyYear = yyvsp[0].Number; @@ -1432,18 +1434,18 @@ case 39: } break; case 40: -#line 384 "../../lib/getdate.y" +#line 384 "../../work/ccvs/lib/getdate.y" { yyval.Meridian = MER24; } break; case 41: -#line 387 "../../lib/getdate.y" +#line 387 "../../work/ccvs/lib/getdate.y" { yyval.Meridian = yyvsp[0].Meridian; } break; -#line 1447 "y.tab.c" +#line 1449 "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 046fa3fb1ee..8ed565caacc 100644 --- a/gnu/usr.bin/cvs/lib/getdate.y +++ b/gnu/usr.bin/cvs/lib/getdate.y @@ -640,7 +640,9 @@ Convert(Month, Day, Year, Hours, Minutes, Seconds, Meridian, DSTmode) Year += 1900; DaysInMonth[1] = Year % 4 == 0 && (Year % 100 != 0 || Year % 400 == 0) ? 29 : 28; - if (Year < EPOCH || Year > 1999 + /* Checking for 2038 bogusly assumes that time_t is 32 bits. But + I'm too lazy to try to check for time_t overflow in another way. */ + if (Year < EPOCH || Year > 2038 || Month < 1 || Month > 12 /* Lint fluff: "conversion from long may lose accuracy" */ || Day < 1 || Day > DaysInMonth[(int)--Month]) diff --git a/gnu/usr.bin/cvs/lib/strippath.c b/gnu/usr.bin/cvs/lib/strippath.c deleted file mode 100644 index 39687f92b80..00000000000 --- a/gnu/usr.bin/cvs/lib/strippath.c +++ /dev/null @@ -1,80 +0,0 @@ -/* strippath.c -- remove unnecessary components from a path specifier - Copyright (C) 1992 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 - the Free Software Foundation; either version 2, or (at your option) - any later version. - - This program 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 General Public License for more details. - - You should have received a copy of the GNU General Public License - along with this program; if not, write to the Free Software - Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */ - -#ifdef HAVE_CONFIG_H -#include "config.h" -#endif - -#if STDC_HEADERS || HAVE_STRING_H -#include <string.h> -/* An ANSI string.h and pre-ANSI memory.h might conflict. */ -#if !STDC_HEADERS && HAVE_MEMORY_H -#include <memory.h> -#endif /* not STDC_HEADERS and HAVE_MEMORY_H */ -#else /* not STDC_HJEADERS and not HAVE_STRING_H */ -#include <strings.h> -/* memory.h and strings.h conflict on some systems. */ -#endif /* not STDC_HEADERS and not HAVE_STRING_H */ - -#include <stdio.h> - -#if __STDC__ -static void remove_component(char *beginc, char *endc); -void strip_trailing_slashes(char *path); -#else -static void remove_component(); -void strip_trailing_slashes(); -#endif /* __STDC__ */ - -/* Remove unnecessary components from PATH. */ - -void -strip_path (path) - char *path; -{ - int stripped = 0; - char *cp, *slash; - - for (cp = path; (slash = strchr(cp, '/')) != NULL; cp = slash) - { - *slash = '\0'; - if ((!*cp && (cp != path || stripped)) || - strcmp(cp, ".") == 0 || strcmp(cp, "/") == 0) - { - stripped = 1; - remove_component(cp, slash); - slash = cp; - } - else - { - *slash++ = '/'; - } - } - strip_trailing_slashes(path); -} - -/* Remove the component delimited by BEGINC and ENDC from the path */ - -static void -remove_component (beginc, endc) - char *beginc; - char *endc; -{ - for (endc++; *endc; endc++) - *beginc++ = *endc; - *beginc = '\0'; -} |