I grant permission to distribute this patch under the terms of the GNU Public License. Hi, i have ported CVS to IBM OSS/390 USS UNIX. The beast uses EBCDIC for character encoding so most of the port was related to that. Changes for that was reversing your changes of '\012' back to '\n' again in several files. It does not work with having it as \012 since other routines seems to demand the row separator is a newline och CR in the systems native code page. Also a lot of getopt_long parameters was encode with characters 129-134. I added a thousand to those since it is an integer and not a char, thus resulting in 1129-1134. Another problem is that the USS methods getenv and putenv does not seem to be correct. The getenv method seems to return a pointer to the same static area for all environment and thus invalidating all earlier gotten environment variables. The patch below does it all: <<cvs-uss-patch.txt>>
Index: diff/diff.c =================================================================== RCS file: /u/qdtlarb/Repository/cvs/diff/diff.c,v retrieving revision 1.1.1.1 retrieving revision 1.1.1.2 diff -r1.1.1.1 -r1.1.1.2 214,227c214,227 < {"left-column", 0, 0, 129}, < {"suppress-common-lines", 0, 0, 130}, < {"sdiff-merge-assist", 0, 0, 131}, < {"old-line-format", 1, 0, 132}, < {"new-line-format", 1, 0, 133}, < {"unchanged-line-format", 1, 0, 134}, < {"line-format", 1, 0, 135}, < {"old-group-format", 1, 0, 136}, < {"new-group-format", 1, 0, 137}, < {"unchanged-group-format", 1, 0, 138}, < {"changed-group-format", 1, 0, 139}, < {"horizon-lines", 1, 0, 140}, < {"help", 0, 0, 141}, < {"binary", 0, 0, 142}, --- > {"left-column", 0, 0, 1129}, > {"suppress-common-lines", 0, 0, 1130}, > {"sdiff-merge-assist", 0, 0, 1131}, > {"old-line-format", 1, 0, 1132}, > {"new-line-format", 1, 0, 1133}, > {"unchanged-line-format", 1, 0, 1134}, > {"line-format", 1, 0, 1135}, > {"old-group-format", 1, 0, 1136}, > {"new-group-format", 1, 0, 1137}, > {"unchanged-group-format", 1, 0, 1138}, > {"changed-group-format", 1, 0, 1139}, > {"horizon-lines", 1, 0, 1140}, > {"help", 0, 0, 1141}, > {"binary", 0, 0, 1142}, 528c528 < case 129: --- > case 1129: 532c532 < case 130: --- > case 1130: 536c536 < case 131: --- > case 1131: 542,544c542,544 < case 132: < case 133: < case 134: --- > case 1132: > case 1133: > case 1134: 550c550 < case 135: --- > case 1135: 561,564c561,564 < case 136: < case 137: < case 138: < case 139: --- > case 1136: > case 1137: > case 1138: > case 1139: 570c570 < case 140: --- > case 1140: 575c575 < case 141: --- > case 1141: 581c581 < case 142: --- > case 1142: Index: diff/diff3.c =================================================================== RCS file: /u/qdtlarb/Repository/cvs/diff/diff3.c,v retrieving revision 1.1.1.1 retrieving revision 1.1.1.2 diff -r1.1.1.1 -r1.1.1.2 242c242 < {"help", 0, 0, 129}, --- > {"help", 0, 0, 1129}, 328c328 < case 129: --- > case 1129: Index: lib/getdate.c =================================================================== RCS file: /u/qdtlarb/Repository/cvs/lib/getdate.c,v retrieving revision 1.1.1.1 retrieving revision 1.1.1.2 diff -r1.1.1.1 -r1.1.1.2 1,2c1,29 < #ifndef lint < static char yysccsid[] = "@(#)yaccpar 1.9 (Berkeley) 02/21/93 (BSDI)"; --- > /* yacc ./getdate.y */ > /***PROPRIETARY_STATEMENT**********************************************/ > /* */ > /* */ > /* LICENSED MATERIALS - PROPERTY OF IBM */ > /* THIS MODULE IS "RESTRICTED MATERIALS OF IBM" */ > /* 5655-068 (C) COPYRIGHT IBM CORP. 1993, 1998 */ > /* SEE COPYRIGHT INSTRUCTIONS */ > /* */ > /* STATUS = HOT1170 */ > /* */ > /***END_OF_PROPRIETARY_STATEMENT***************************************/ > /* > * Portable way of defining ANSI C prototypes > */ > #ifndef YY_ARGS > #ifdef __STDC__ > #define YY_ARGS(x) x > #else > #define YY_ARGS(x) () > #endif > #endif > > #ifdef YYTRACE > #define YYDEBUG 1 > #else > #ifndef YYDEBUG > #define YYDEBUG 0 > #endif 4,14c31,49 < #include <stdlib.h> < #define YYBYACC 1 < #define YYMAJOR 1 < #define YYMINOR 9 < #define YYEMPTY (-1) < #define YYLEX yylex() < #define yyclearin (yychar=YYEMPTY) < #define yyerrok (yyerrflag=0) < #define YYRECOVERING (yyerrflag!=0) < #define YYPREFIX "yy" < #line 2 "/u/scjones/cvs-nightly/lib/getdate.y" --- > > #if YYDEBUG > typedef struct yyNamedType_tag /* Tokens */ > { > char * name; /* printable name */ > short token; /* token # */ > short type; /* token type */ > } yyNamedType; > > typedef struct yyTypedRules_tag /* Typed rule table */ > { > char * name; /* compressed rule string */ > short type; /* rule result type */ > } yyTypedRules; > > #endif > > #line 1 "./getdate.y" > 190d224 < #line 179 "/u/scjones/cvs-nightly/lib/getdate.y" 195,215c229,288 < #line 196 "y.tab.c" < #define tAGO 257 < #define tDAY 258 < #define tDAYZONE 259 < #define tID 260 < #define tMERIDIAN 261 < #define tMINUTE_UNIT 262 < #define tMONTH 263 < #define tMONTH_UNIT 264 < #define tSEC_UNIT 265 < #define tSNUMBER 266 < #define tUNUMBER 267 < #define tZONE 268 < #define tDST 269 < #define YYERRCODE 256 < short yylhs[] = { -1, < 0, 0, 2, 2, 2, 2, 2, 2, 3, 3, < 3, 3, 3, 4, 4, 4, 6, 6, 6, 5, < 5, 5, 5, 5, 5, 5, 5, 7, 7, 9, < 9, 9, 9, 9, 9, 9, 9, 9, 8, 1, < 1, --- > #define tAGO 257 > #define tDAY 258 > #define tDAYZONE 259 > #define tID 260 > #define tMERIDIAN 261 > #define tMINUTE_UNIT 262 > #define tMONTH 263 > #define tMONTH_UNIT 264 > #define tSEC_UNIT 265 > #define tSNUMBER 266 > #define tUNUMBER 267 > #define tZONE 268 > #define tDST 269 > extern int yychar, yyerrflag; > extern YYSTYPE yylval; > #if YYDEBUG > yyTypedRules yyRules[] = { > { "&00: %02 &00", 0}, > { "%02:", 0}, > { "%02: %02 %03", 0}, > { "%03: %04", 0}, > { "%03: %05", 0}, > { "%03: %06", 0}, > { "%03: %07", 0}, > { "%03: %08", 0}, > { "%03: %09", 0}, > { "%04: &12 &06", 0}, > { "%04: &12 &15 &12 %01", 0}, > { "%04: &12 &15 &12 &11", 0}, > { "%04: &12 &15 &12 &15 &12 %01", 0}, > { "%04: &12 &15 &12 &15 &12 &11", 0}, > { "%05: &13", 0}, > { "%05: &04", 0}, > { "%05: &13 &14", 0}, > { "%07: &03", 0}, > { "%07: &03 &16", 0}, > { "%07: &12 &03", 0}, > { "%06: &12 &17 &12", 0}, > { "%06: &12 &17 &12 &17 &12", 0}, > { "%06: &12 &11 &11", 0}, > { "%06: &12 &08 &11", 0}, > { "%06: &08 &12", 0}, > { "%06: &08 &12 &16 &12", 0}, > { "%06: &12 &08", 0}, > { "%06: &12 &08 &12", 0}, > { "%08: %10 &02", 0}, > { "%08: %10", 0}, > { "%10: &12 &07", 0}, > { "%10: &11 &07", 0}, > { "%10: &07", 0}, > { "%10: &11 &10", 0}, > { "%10: &12 &10", 0}, > { "%10: &10", 0}, > { "%10: &11 &09", 0}, > { "%10: &12 &09", 0}, > { "%10: &09", 0}, > { "%09: &12", 0}, > { "%01:", 2}, > { "%01: &06", 2}, > { "$accept", 0},{ "error", 0} 217,222c290,318 < short yylen[] = { 2, < 0, 2, 1, 1, 1, 1, 1, 1, 2, 4, < 4, 6, 6, 1, 1, 2, 1, 2, 2, 3, < 5, 3, 3, 2, 4, 2, 3, 2, 1, 2, < 2, 1, 2, 2, 1, 2, 2, 1, 1, 0, < 1, --- > yyNamedType yyTokenTypes[] = { > { "$end", 0, 0}, > { "error", 256, 0}, > { "tAGO", 257, 0}, > { "tDAY", 258, 1}, > { "tDAYZONE", 259, 1}, > { "tID", 260, 0}, > { "tMERIDIAN", 261, 2}, > { "tMINUTE_UNIT", 262, 1}, > { "tMONTH", 263, 1}, > { "tMONTH_UNIT", 264, 1}, > { "tSEC_UNIT", 265, 1}, > { "tSNUMBER", 266, 1}, > { "tUNUMBER", 267, 1}, > { "tZONE", 268, 1}, > { "tDST", 269, 0}, > { "':'", 122, 0}, > { "','", 107, 0}, > { "'/'", 97, 0} > > }; > #endif > static short yydef[] = { > > -1, 43, 4, 3, 8, 6, 7, 5, 9, 9 > }; > static short yyex[] = { > > 0, 0, -1, 1 224,229c320,329 < short yydefred[] = { 1, < 0, 0, 15, 32, 0, 38, 35, 0, 0, 0, < 2, 3, 4, 5, 6, 7, 8, 0, 18, 0, < 31, 36, 33, 19, 9, 30, 0, 37, 34, 0, < 0, 0, 16, 28, 0, 23, 27, 22, 0, 0, < 25, 41, 11, 0, 10, 0, 0, 21, 13, 12, --- > static short yyact[] = { > > -3, -38, -26, -17, -20, -23, -18, -5, -4, 268, > 267, 266, 265, 264, 263, 262, 259, 258, -27, -22, > -25, 265, 264, 262, -29, 257, -6, 267, -36, 107, > -37, 269, -15, -14, -35, -43, -28, -7, -21, -24, > -16, 266, 265, 264, 263, 262, 261, 258, 122, 97, > -13, 107, -32, -30, 267, 266, -33, 266, -8, 267, > -9, 267, -31, 267, -12, 97, -11, -19, -41, 266, > 261, 122, -34, 267, -10, 267, -19, -39, 266, 261, -1 231,232c331,334 < short yydgoto[] = { 1, < 45, 11, 12, 13, 14, 15, 16, 17, 18, --- > static short yypact[] = { > > 9, 25, 29, 31, 41, 51, 54, 65, 69, 78, > 75, 73, 63, 61, 59, 57, 27, 21 234,239c336,339 < short yysindex[] = { 0, < -249, -38, 0, 0, -260, 0, 0, -240, -47, -248, < 0, 0, 0, 0, 0, 0, 0, -237, 0, -18, < 0, 0, 0, 0, 0, 0, -262, 0, 0, -239, < -238, -236, 0, 0, -235, 0, 0, 0, -56, -19, < 0, 0, 0, -234, 0, -232, -258, 0, 0, 0, --- > static short yygo[] = { > > -40, -42, 9, -1, -50, -48, -47, -46, -45, -44, > -51, -2, -1 241,246c341,347 < short yyrindex[] = { 0, < 0, 1, 0, 0, 0, 0, 0, 0, 69, 12, < 0, 0, 0, 0, 0, 0, 0, 23, 0, 34, < 0, 0, 0, 0, 0, 0, 67, 0, 0, 0, < 0, 0, 0, 0, 0, 0, 0, 0, 56, 45, < 0, 0, 0, 0, 0, 0, 56, 0, 0, 0, --- > static short yypgo[] = { > > 0, 0, 0, 6, 8, 7, 7, 7, 10, 1, > 1, 11, 11, 11, 11, 11, 11, 11, 11, 11, > 9, 7, 7, 7, 7, 7, 8, 8, 6, 6, > 5, 5, 5, 5, 5, 4, 4, 4, 4, 4, > 3, 3, 4, 9, 0 248,249c349,355 < short yygindex[] = { 0, < -17, 0, 0, 0, 0, 0, 0, 0, 0, --- > static short yyrlen[] = { > > 0, 0, 0, 1, 1, 3, 2, 2, 1, 0, > 1, 1, 2, 2, 1, 2, 2, 1, 2, 2, > 2, 3, 4, 3, 3, 5, 2, 2, 2, 1, > 6, 6, 4, 4, 2, 1, 1, 1, 1, 1, > 0, 2, 1, 1, 2 251,286c357,422 < #define YYTABLESIZE 337 < short yytable[] = { 32, < 17, 44, 42, 36, 37, 19, 20, 49, 2, 3, < 31, 14, 4, 5, 6, 7, 8, 9, 10, 34, < 33, 21, 29, 22, 23, 35, 38, 46, 39, 50, < 40, 41, 47, 24, 48, 0, 0, 0, 0, 0, < 0, 0, 0, 0, 20, 0, 0, 0, 0, 0, < 0, 0, 0, 0, 0, 40, 0, 0, 0, 0, < 0, 0, 0, 0, 0, 0, 26, 0, 39, 0, < 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, < 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, < 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, < 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, < 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, < 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, < 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, < 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, < 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, < 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, < 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, < 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, < 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, < 0, 0, 0, 0, 42, 0, 0, 0, 0, 43, < 24, 0, 0, 25, 26, 27, 28, 29, 30, 0, < 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, < 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, < 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, < 0, 0, 0, 0, 0, 0, 0, 0, 17, 17, < 0, 0, 17, 17, 17, 17, 17, 17, 17, 14, < 14, 0, 0, 14, 14, 14, 14, 14, 14, 14, < 29, 29, 0, 0, 29, 29, 29, 29, 29, 29, < 29, 24, 24, 0, 0, 24, 24, 24, 24, 24, < 24, 24, 20, 20, 0, 0, 20, 20, 20, 20, < 20, 20, 20, 40, 40, 0, 0, 40, 40, 40, < 40, 0, 40, 40, 26, 26, 0, 39, 26, 26, < 26, 26, 0, 0, 26, 39, 39, --- > #define YYS0 48 > #define YYDELTA 8 > #define YYNPACT 18 > #define YYNDEF 10 > > #define YYr42 0 > #define YYr43 1 > #define YYr44 2 > #define YYr14 3 > #define YYr17 4 > #define YYr20 5 > #define YYr24 6 > #define YYr26 7 > #define YYr39 8 > #define YYr40 9 > #define YYr41 10 > #define YYr38 11 > #define YYr37 12 > #define YYr36 13 > #define YYr35 14 > #define YYr34 15 > #define YYr33 16 > #define YYr32 17 > #define YYr31 18 > #define YYr30 19 > #define YYr28 20 > #define YYr27 21 > #define YYr25 22 > #define YYr23 23 > #define YYr22 24 > #define YYr21 25 > #define YYr19 26 > #define YYr18 27 > #define YYr16 28 > #define YYr15 29 > #define YYr13 30 > #define YYr12 31 > #define YYr11 32 > #define YYr10 33 > #define YYr9 34 > #define YYr7 35 > #define YYr6 36 > #define YYr5 37 > #define YYr4 38 > #define YYr3 39 > #define YYrACCEPT YYr42 > #define YYrERROR YYr43 > #define YYrLR2 YYr44 > #if YYDEBUG > char * yystoken[] = { > > "error", > "tAGO", > "tDAY", > "tDAYZONE", > "tID", > "tMERIDIAN", > "tMINUTE_UNIT", > "tMONTH", > "tMONTH_UNIT", > "tSEC_UNIT", > "tSNUMBER", > "tUNUMBER", > "tZONE", > "tDST", > 0 288,322c424,436 < short yycheck[] = { 47, < 0, 58, 261, 266, 267, 44, 267, 266, 258, 259, < 58, 0, 262, 263, 264, 265, 266, 267, 268, 257, < 269, 262, 0, 264, 265, 44, 266, 47, 267, 47, < 267, 267, 267, 0, 267, -1, -1, -1, -1, -1, < -1, -1, -1, -1, 0, -1, -1, -1, -1, -1, < -1, -1, -1, -1, -1, 0, -1, -1, -1, -1, < -1, -1, -1, -1, -1, -1, 0, -1, 0, -1, < -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, < -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, < -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, < -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, < -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, < -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, < -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, < -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, < -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, < -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, < -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, < -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, < -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, < -1, -1, -1, -1, 261, -1, -1, -1, -1, 266, < 258, -1, -1, 261, 262, 263, 264, 265, 266, -1, < -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, < -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, < -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, < -1, -1, -1, -1, -1, -1, -1, -1, 258, 259, < -1, -1, 262, 263, 264, 265, 266, 267, 268, 258, < 259, -1, -1, 262, 263, 264, 265, 266, 267, 268, < 258, 259, -1, -1, 262, 263, 264, 265, 266, 267, < 268, 258, 259, -1, -1, 262, 263, 264, 265, 266, < 267, 268, 258, 259, -1, -1, 262, 263, 264, 265, < 266, 267, 268, 258, 259, -1, -1, 262, 263, 264, < 265, -1, 267, 268, 258, 259, -1, 259, 262, 263, < 264, 265, -1, -1, 268, 267, 268, --- > char * yysvar[] = { > "$accept", > "o_merid", > "spec", > "item", > "time", > "zone", > "date", > "day", > "rel", > "number", > "relunit", > 0 324,339c438,444 < #define YYFINAL 1 < #ifndef YYDEBUG < #define YYDEBUG 0 < #endif < #define YYMAXTOKEN 269 < #if YYDEBUG < char *yyname[] = { < "end-of-file",0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, < 0,0,0,0,0,0,0,0,0,0,"','",0,0,"'/'",0,0,0,0,0,0,0,0,0,0,"':'",0,0,0,0,0,0,0,0,0, < 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, < 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, < 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, < 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, < 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,"tAGO","tDAY", < "tDAYZONE","tID","tMERIDIAN","tMINUTE_UNIT","tMONTH","tMONTH_UNIT","tSEC_UNIT", < "tSNUMBER","tUNUMBER","tZONE","tDST", --- > short yyrmap[] = { > > 42, 43, 44, 14, 17, 20, 24, 26, 39, 40, > 41, 38, 37, 36, 35, 34, 33, 32, 31, 30, > 28, 27, 25, 23, 22, 21, 19, 18, 16, 15, > 13, 12, 11, 10, 9, 7, 6, 5, 4, 3, > 1, 2, 8, 29, 0 341,383c446,452 < char *yyrule[] = { < "$accept : spec", < "spec :", < "spec : spec item", < "item : time", < "item : zone", < "item : date", < "item : day", < "item : rel", < "item : number", < "time : tUNUMBER tMERIDIAN", < "time : tUNUMBER ':' tUNUMBER o_merid", < "time : tUNUMBER ':' tUNUMBER tSNUMBER", < "time : tUNUMBER ':' tUNUMBER ':' tUNUMBER o_merid", < "time : tUNUMBER ':' tUNUMBER ':' tUNUMBER tSNUMBER", < "zone : tZONE", < "zone : tDAYZONE", < "zone : tZONE tDST", < "day : tDAY", < "day : tDAY ','", < "day : tUNUMBER tDAY", < "date : tUNUMBER '/' tUNUMBER", < "date : tUNUMBER '/' tUNUMBER '/' tUNUMBER", < "date : tUNUMBER tSNUMBER tSNUMBER", < "date : tUNUMBER tMONTH tSNUMBER", < "date : tMONTH tUNUMBER", < "date : tMONTH tUNUMBER ',' tUNUMBER", < "date : tUNUMBER tMONTH", < "date : tUNUMBER tMONTH tUNUMBER", < "rel : relunit tAGO", < "rel : relunit", < "relunit : tUNUMBER tMINUTE_UNIT", < "relunit : tSNUMBER tMINUTE_UNIT", < "relunit : tMINUTE_UNIT", < "relunit : tSNUMBER tSEC_UNIT", < "relunit : tUNUMBER tSEC_UNIT", < "relunit : tSEC_UNIT", < "relunit : tSNUMBER tMONTH_UNIT", < "relunit : tUNUMBER tMONTH_UNIT", < "relunit : tMONTH_UNIT", < "number : tUNUMBER", < "o_merid :", < "o_merid : tMERIDIAN", --- > short yysmap[] = { > > 1, 6, 8, 10, 11, 23, 29, 39, 40, 48, > 44, 42, 35, 33, 31, 30, 7, 5, 43, 2, > 26, 19, 3, 27, 20, 4, 21, 28, 22, 36, > 41, 37, 38, 47, 32, 24, 25, 9, 49, 50, > 45, 46, 34, 13, 14, 15, 16, 17, 0, 18, 12 384a454,457 > int yyntoken = 18; > int yynvar = 11; > int yynstate = 51; > int yynrule = 45; 386,391c459,579 < #ifdef YYSTACKSIZE < #undef YYMAXDEPTH < #define YYMAXDEPTH YYSTACKSIZE < #else < #ifdef YYMAXDEPTH < #define YYSTACKSIZE YYMAXDEPTH --- > > #if YYDEBUG > /* > * Package up YACC context for tracing > */ > typedef struct yyTraceItems_tag > { > int state, lookahead, errflag, done; > int rule, npop; > short * states; > int nstates; > YYSTYPE * values; > int nvalues; > short * types; > } yyTraceItems; > #endif > > #line 64 "/etc/yyparse.c" > > /*---------------------------------------------------------------------*/ > /* Copyright 1985, 1990 by Mortice Kern Systems Inc. */ > /* All rights reserved. */ > /* */ > /* Automaton to interpret LALR(1) tables. */ > /* */ > /* Macros: */ > /* yyclearin - clear the lookahead token. */ > /* yyerrok - forgive a pending error */ > /* YYERROR - simulate an error */ > /* YYACCEPT - halt and return 0 */ > /* YYABORT - halt and return 1 */ > /* YYRETURN(value) - halt and return value. You should use this */ > /* instead of return(value). */ > /* YYREAD - ensure yychar contains a lookahead token by reading */ > /* one if it does not. See also YYSYNC. */ > /* YYRECOVERING - 1 if syntax error detected and not recovered */ > /* yet; otherwise, 0. */ > /* */ > /* Preprocessor flags: */ > /* YYDEBUG - includes debug code if 1. The parser will print */ > /* a travelogue of the parse if this is defined as 1 */ > /* and yydebug is non-zero. */ > /* yacc -t sets YYDEBUG to 1, but not yydebug. */ > /* YYTRACE - No longer used but retained so as not to break existing */ > /* code. Previously it was defined as: */ > /* */ > /* turn on YYDEBUG, and undefine default trace */ > /* functions so that the interactive functions in */ > /* 'ytrack.c' will be used. */ > /* */ > /* YYSSIZE - size of state and value stacks (default 150). */ > /* YYSTATIC - By default, the state stack is an automatic array. */ > /* If this is defined, the stack will be static. */ > /* In either case, the value stack is static. */ > /* YYALLOC - Dynamically allocate both the state and value stacks */ > /* by calling malloc() and free(). */ > /* YYDYNAMIC - Dynamically allocate (and reallocate, if necessary) */ > /* both the state and value stacks by calling malloc(), */ > /* realloc(), and free(). */ > /* YYSYNC - if defined, yacc guarantees to fetch a lookahead token */ > /* before any action, even if it doesnt need it for a decision. */ > /* If YYSYNC is defined, YYREAD will never be necessary unless */ > /* the user explicitly sets yychar = -1 */ > /* */ > /* Copyright (c) 1983, by the University of Waterloo */ > /*---------------------------------------------------------------------*/ > /* > * Prototypes > */ > extern int yylex YY_ARGS((void)); > > #if YYDEBUG > #include <stdlib.h> /* common prototypes */ > #include <string.h> > > extern char * yyValue YY_ARGS((YYSTYPE, int)); /* print yylval */ > extern void yyShowState YY_ARGS((yyTraceItems *)); > extern void yyShowReduce YY_ARGS((yyTraceItems *)); > extern void yyShowGoto YY_ARGS((yyTraceItems *)); > extern void yyShowShift YY_ARGS((yyTraceItems *)); > extern void yyShowErrRecovery YY_ARGS((yyTraceItems *)); > extern void yyShowErrDiscard YY_ARGS((yyTraceItems *)); > extern void yyShowRead YY_ARGS((int)); > #endif > > /*----------------------------------------------------------------------* > * If YYDEBUG defined and yydebug set, * > * tracing functions will be called at appropriate times in yyparse() * > * Pass state of YACC parse, as filled into yyTraceItems yyx * > * If yyx.done is set by the tracing function, yyparse() will terminate * > * with a return value of -1 * > *----------------------------------------------------------------------*/ > #define YY_TRACE(fn) { \ > yyx.state = yystate; yyx.lookahead = yychar; yyx.errflag =yyerrflag; \ > yyx.states = yys+1; yyx.nstates = yyps-yys; \ > yyx.values = yyv+1; yyx.nvalues = yypv-yyv; \ > yyx.types = yytypev+1; yyx.done = 0; \ > yyx.rule = yyi; yyx.npop = yyj; \ > fn(&yyx); \ > if (yyx.done) YYRETURN(-1); } > > #ifndef I18N > #define m_textmsg(id, str, cls) (str) > #else /*I18N*/ > #include <m_nls.h> > #endif/*I18N*/ > > #ifndef YYSSIZE > #define YYSSIZE 150 > #endif > > #ifdef YYDYNAMIC > #define YYALLOC > char *getenv(); > int atoi(); > int yysinc = -1; /* stack size increment, <0 = double, 0 = none, >0 = fixed */ > #endif > > #ifdef YYALLOC > int yyssize = YYSSIZE; > #define YYRETURN(val) { retval = (val); goto yyReturn; } 393,394c581 < #define YYSTACKSIZE 10000 < #define YYMAXDEPTH 10000 --- > #define YYRETURN(val) return(val); 395a583,650 > > #define YYERROR goto yyerrlabel > #define yyerrok yyerrflag = 0 > #define YYACCEPT YYRETURN(0) > #define YYABORT YYRETURN(1) > #define YYRECOVERING() (yyerrflag != 0) > > #if YYDEBUG > #define yyclearin { if (yydebug) yyShowRead(-1); yychar = -1; } > /* The if..else makes this macro behave exactly like a statement */ > #define YYREAD if (yychar < 0) { \ > if ((yychar = yylex()) < 0) { \ > if (yychar == -2) YYABORT; \ > yychar = 0; \ > } /* endif */ \ > if (yydebug) \ > yyShowRead(yychar); \ > } else > #else > #define yyclearin yychar = -1 > #define YYREAD if (yychar < 0) { \ > if ((yychar = yylex()) < 0) { \ > if (yychar == -2) YYABORT; \ > yychar = 0; \ > } /* endif */ \ > } else > #endif > > #define YYERRCODE 256 /* value of `error' */ > #define YYTOKEN_BASE 256 > #define YYQYYP yyq[yyq-yyp] > > /* > * Simulate bitwise negation as if was done on a two's complement machine. > * This makes the generated code portable to machines with different > * representations of integers (ie. signed magnitude). > */ > #define yyneg(s) (-((s)+1)) > > YYSTYPE yyval; /* $ */ > YYSTYPE *yypvt; /* $n */ > YYSTYPE yylval; /* yylex() sets this */ > > int yychar, /* current token */ > yyerrflag, /* error flag */ > yynerrs; /* error count */ > > #if YYDEBUG > int yydebug = 0; /* debug if this flag is set */ > > extern char *yysvar[]; /* table of non-terminals (aka 'variables') */ > extern yyNamedType yyTokenTypes[]; /* table of terminals & their types */ > extern short yyrmap[], yysmap[]; /* map internal rule/states */ > extern int yynstate, yynvar, yyntoken, yynrule; > > extern int yyGetType YY_ARGS((int)); /* token type */ > extern char *yyptok YY_ARGS((int)); /* printable token string */ > extern int yyExpandName YY_ARGS((int, int, char *, int)); > /* expand yyRules[] or yyStates[] */ > static char * yygetState YY_ARGS((int)); > > #define yyassert(condition, msg, arg) \ > if (!(condition)) { \ > printf(m_textmsg(2824, "\nyacc bug: ", "E")); \ > printf(msg, arg); \ > YYABORT; } > #else /* !YYDEBUG */ > #define yyassert(condition, msg, arg) 397,412c652,653 < #define YYINITSTACKSIZE 200 < int yydebug; < int yynerrs; < struct yystack { < short *ssp; < YYSTYPE *vsp; < short *ss; < YYSTYPE *vs; < int stacksize; < short *sslim; < }; < int yychar; /* some people use this, so we copy it in & out */ < int yyerrflag; /* must be global for yyerrok & YYRECOVERING */ < YYSTYPE yylval; < #line 392 "/u/scjones/cvs-nightly/lib/getdate.y" < --- > > #line 393 "./getdate.y" 1055,1105d1295 < #line 1056 "y.tab.c" < /* allocate initial stack */ < #if defined(__STDC__) || defined(__cplusplus) < static int yyinitstack(struct yystack *sp) < #else < static int yyinitstack(sp) < struct yystack *sp; < #endif < { < int newsize; < short *newss; < YYSTYPE *newvs; < < newsize = YYINITSTACKSIZE; < newss = (short *)malloc(newsize * sizeof *newss); < newvs = (YYSTYPE *)malloc(newsize * sizeof *newvs); < sp->ss = sp->ssp = newss; < sp->vs = sp->vsp = newvs; < if (newss == NULL || newvs == NULL) return -1; < sp->stacksize = newsize; < sp->sslim = newss + newsize - 1; < return 0; < } < < /* double stack size, up to YYMAXDEPTH */ < #if defined(__STDC__) || defined(__cplusplus) < static int yygrowstack(struct yystack *sp) < #else < static int yygrowstack(sp) < struct yystack *sp; < #endif < { < int newsize, i; < short *newss; < YYSTYPE *newvs; < < if ((newsize = sp->stacksize) >= YYMAXDEPTH) return -1; < if ((newsize *= 2) > YYMAXDEPTH) newsize = YYMAXDEPTH; < i = sp->ssp - sp->ss; < if ((newss = (short *)realloc(sp->ss, newsize * sizeof *newss)) == NULL) < return -1; < sp->ss = newss; < sp->ssp = newss + i; < if ((newvs = (YYSTYPE *)realloc(sp->vs, newsize * sizeof *newvs)) == NULL) < return -1; < sp->vs = newvs; < sp->vsp = newvs + i; < sp->stacksize = newsize; < sp->sslim = newss + newsize - 1; < return 0; < } 1107,1113c1297 < #define YYFREESTACK(sp) { free((sp)->ss); free((sp)->vs); } < < #define YYABORT goto yyabort < #define YYREJECT goto yyabort < #define YYACCEPT goto yyaccept < #define YYERROR goto yyerrlab < int --- > 1116,1119c1300,1307 < register int yym, yyn, yystate, yych; < register YYSTYPE *yyvsp; < YYSTYPE yyval; < struct yystack yystk; --- > register short *yyp; /* for table lookup */ > register short *yyq; > register short yyi; > register short *yyps; /* top of state stack */ > register short yystate; /* current state */ > register YYSTYPE *yypv; /* top of value stack */ > register int yyj; > 1121,1129c1309,1343 < register char *yys; < extern char *getenv(); < < if (yys = getenv("YYDEBUG")) < { < yyn = *yys; < if (yyn >= '0' && yyn <= '9') < yydebug = yyn - '0'; < } --- > yyTraceItems yyx; /* trace block */ > short *yytp; > int yyruletype = 0; > #endif > > #ifdef YYSTATIC > static short yys[YYSSIZE + 1]; > static YYSTYPE yyv[YYSSIZE + 1]; > > #if YYDEBUG > static short yytypev[YYSSIZE+1]; /* type assignments */ > #endif > #else /* ! YYSTATIC */ > #ifdef YYALLOC > YYSTYPE *yyv; > short *yys; > #if YYDEBUG > short *yytypev; > #endif > YYSTYPE save_yylval; > YYSTYPE save_yyval; > YYSTYPE *save_yypvt; > int save_yychar, save_yyerrflag, save_yynerrs; > int retval; /* return value holder */ > #else > short yys[YYSSIZE + 1]; > static YYSTYPE yyv[YYSSIZE + 1]; /* historically static */ > #if YYDEBUG > short yytypev[YYSSIZE+1]; /* mirror type table */ > #endif > #endif /* ! YYALLOC */ > #endif /* ! YYSTATIC */ > > #ifdef YYDYNAMIC > char *envp; 1130a1345 > 1132,1141c1347,1348 < yynerrs = 0; < yyerrflag = 0; < yychar = yych = YYEMPTY; < < if (yyinitstack(&yystk)) goto yyoverflow; < *yystk.ssp = yystate = 0; < < yyloop: < if (yyn = yydefred[yystate]) goto yyreduce; < if (yych < 0) --- > #ifdef YYDYNAMIC > if ((envp = getenv("YYSTACKSIZE")) != (char *)0) 1143,1144c1350,1390 < if ((yych = YYLEX) < 0) yych = 0; < yychar = yych; --- > yyssize = atoi(envp); > if (yyssize <= 0) > yyssize = YYSSIZE; > } > if ((envp = getenv("YYSTACKINC")) != (char *)0) > yysinc = atoi(envp); > #endif > > #ifdef YYALLOC > yys = (short *) malloc((yyssize + 1) * sizeof(short)); > yyv = (YYSTYPE *) malloc((yyssize + 1) * sizeof(YYSTYPE)); > > #if YYDEBUG > yytypev = (short *) malloc((yyssize + 1) * sizeof(short)); > #endif > > if (yys == (short *)0 || yyv == (YYSTYPE *)0 > #if YYDEBUG > || yytypev == (short *) 0 > #endif > ) { > yyerror(m_textmsg(4967, "Not enough space for parser stacks", > "E")); > return 1; > } > > save_yylval = yylval; > save_yyval = yyval; > save_yypvt = yypvt; > save_yychar = yychar; > save_yyerrflag = yyerrflag; > save_yynerrs = yynerrs; > #endif > > yynerrs = 0; > yyerrflag = 0; > yyclearin; > yyps = yys; > yypv = yyv; > *yyps = yystate = YYS0; /* start state */ > 1146,1153c1392,1393 < if (yydebug) < { < yys = 0; < if (yych <= YYMAXTOKEN) yys = yyname[yych]; < if (!yys) yys = "illegal-symbol"; < printf("%sdebug: state %d, reading %d (%s)\n", < YYPREFIX, yystate, yych, yys); < } --- > yytp = yytypev; > yyi = yyj = 0; /* silence compiler warnings */ 1155,1157c1395,1400 < } < if ((yyn = yysindex[yystate]) && (yyn += yych) >= 0 && < yyn <= YYTABLESIZE && yycheck[yyn] == yych) --- > > yyStack: > yyassert((unsigned)yystate < yynstate, m_textmsg(587, "state %d\n", ""), yystate); > > #ifdef YYDYNAMIC > if (++yyps > &yys[yyssize]) 1158a1402,1429 > int yynewsize; > int yysindex = yyps - yys; > int yyvindex = yypv - yyv; > > #if YYDEBUG > int yytindex = yytp - yytypev; > #endif > > if (yysinc == 0) /* no increment */ > { > yyerror(m_textmsg(4968, "Parser stack overflow", "E")); > YYABORT; > } > else if (yysinc < 0) /* binary-exponential */ > yynewsize = yyssize * 2; > else /* fixed increment */ > yynewsize = yyssize + yysinc; > if (yynewsize < yyssize) > { > yyerror(m_textmsg(4967, "Not enough space for parser stacks", "E")); > YYABORT; > } > yyssize = yynewsize; > yys = (short *) realloc(yys, (yyssize + 1) * sizeof(short)); > yyps = yys + yysindex; > yyv = (YYSTYPE *) realloc(yyv, (yyssize + 1) * sizeof(YYSTYPE)); > yypv = yyv + yyvindex; > 1160,1220c1431,1441 < if (yydebug) < printf("%sdebug: state %d, shifting to state %d\n", < YYPREFIX, yystate, yytable[yyn]); < #endif < if (yystk.ssp >= yystk.sslim && yygrowstack(&yystk)) < goto yyoverflow; < *++yystk.ssp = yystate = yytable[yyn]; < *++yystk.vsp = yylval; < yychar = yych = YYEMPTY; < if (yyerrflag > 0) --yyerrflag; < goto yyloop; < } < if ((yyn = yyrindex[yystate]) && (yyn += yych) >= 0 && < yyn <= YYTABLESIZE && yycheck[yyn] == yych) < { < yyn = yytable[yyn]; < goto yyreduce; < } < if (yyerrflag) goto yyinrecovery; < #ifdef lint < goto yynewerror; < #endif < yynewerror: < yyerror("syntax error"); < #ifdef lint < goto yyerrlab; < #endif < yyerrlab: < ++yynerrs; < yyinrecovery: < if (yyerrflag < 3) < { < yyerrflag = 3; < for (;;) < { < if ((yyn = yysindex[*yystk.ssp]) && < (yyn += YYERRCODE) >= 0 && < yyn <= YYTABLESIZE && yycheck[yyn] == YYERRCODE) < { < #if YYDEBUG < if (yydebug) < printf("%sdebug: state %d, error recovery shifting\ < to state %d\n", YYPREFIX, *yystk.ssp, yytable[yyn]); < #endif < if (yystk.ssp >= yystk.sslim && yygrowstack(&yystk)) < goto yyoverflow; < *++yystk.ssp = yystate = yytable[yyn]; < *++yystk.vsp = yylval; < goto yyloop; < } < else < { < #if YYDEBUG < if (yydebug) < printf("%sdebug: error recovery discarding state %d\n", < YYPREFIX, *yystk.ssp); < #endif < if (yystk.ssp <= yystk.ss) goto yyabort; < --yystk.ssp; < --yystk.vsp; < } --- > yytypev = (short *)realloc(yytypev,(yyssize + 1)*sizeof(short)); > yytp = yytypev + yytindex; > #endif > > if (yys == (short *)0 || yyv == (YYSTYPE *)0 > #if YYDEBUG > || yytypev == (short *) 0 > #endif > ) { > yyerror(m_textmsg(4967, "Not enough space for parser stacks", "E")); > YYABORT; 1223c1444,1446 < else --- > > #else /* ! YYDYNAMIC */ > if (++yyps > &yys[YYSSIZE]) 1225,1237c1448,1449 < if (yych == 0) goto yyabort; < #if YYDEBUG < if (yydebug) < { < yys = 0; < if (yych <= YYMAXTOKEN) yys = yyname[yych]; < if (!yys) yys = "illegal-symbol"; < printf("%sdebug: state %d, error recovery discards token %d (%s)\n", < YYPREFIX, yystate, yych, yys); < } < #endif < yychar = yych = YYEMPTY; < goto yyloop; --- > yyerror(m_textmsg(4968, "Parser stack overflow", "E")); > YYABORT; 1239c1451,1455 < yyreduce: --- > #endif /* !YYDYNAMIC */ > > *yyps = yystate; /* stack current state */ > *++yypv = yyval; /* ... and value */ > 1241,1248c1457,1473 < if (yydebug) < printf("%sdebug: state %d, reducing by rule %d (%s)\n", < YYPREFIX, yystate, yyn, yyrule[yyn]); < #endif < yym = yylen[yyn]; < yyvsp = yystk.vsp; /* for speed in code under switch() */ < yyval = yyvsp[1-yym]; < switch (yyn) --- > *++yytp = yyruletype; /* ... and type */ > if (yydebug) > YY_TRACE(yyShowState) > #endif > > /*--------------------------------------------------------------------*/ > /* Look up next action in action table. */ > /*--------------------------------------------------------------------*/ > yyEncore: > > #ifdef YYSYNC > YYREAD; > #endif > > if (yystate >= sizeof yypact/sizeof yypact[0]) /* simple state */ > yyi = yystate - YYDELTA; /* reduce in any case */ > else 1250,1252c1475,1550 < case 3: < #line 197 "/u/scjones/cvs-nightly/lib/getdate.y" < { --- > if (*(yyp = &yyact[yypact[yystate]]) >= 0) > { > /* Look for a shift on yychar */ > #ifndef YYSYNC > YYREAD; > #endif > yyq = yyp; > yyi = yychar; > while (yyi < *yyp++) > ; > if (yyi == yyp[-1]) > { > yystate = yyneg(YYQYYP); > #if YYDEBUG > if (yydebug) > { > yyruletype = yyGetType(yychar); > YY_TRACE(yyShowShift) > } > #endif > yyval = yylval; /* stack what yylex() set */ > yyclearin; /* clear token */ > if (yyerrflag) > yyerrflag--; /* successful shift */ > goto yyStack; > } > } > > /*-----------------------------------------*/ > /* Fell through - take default action */ > /*-----------------------------------------*/ > if (yystate >= sizeof yydef /sizeof yydef[0]) > goto yyError; > if ((yyi = yydef[yystate]) < 0) /* default == reduce? */ > { > /* Search exception table */ > yyassert((unsigned)yyneg(yyi) < sizeof yyex/sizeof yyex[0], > m_textmsg(2825, "exception %d\n", "I num"), yystate); > yyp = &yyex[yyneg(yyi)]; > > #ifndef YYSYNC > YYREAD; > #endif > > while ((yyi = *yyp) >= 0 && yyi != yychar) > yyp += 2; > yyi = yyp[1]; > yyassert(yyi >= 0, > m_textmsg(2826, "Ex table not reduce %d\n", "I num"), yyi); > } > } > > yyassert((unsigned)yyi < yynrule, m_textmsg(2827, "reduce %d\n", "I num"), yyi); > yyj = yyrlen[yyi]; > > #if YYDEBUG > if (yydebug) > YY_TRACE(yyShowReduce) > yytp -= yyj; > #endif > > yyps -= yyj; /* pop stacks */ > yypvt = yypv; /* save top */ > yypv -= yyj; > yyval = yypv[1]; /* default action $ = $1 */ > > #if YYDEBUG > yyruletype = yyRules[yyrmap[yyi]].type; > #endif > > switch (yyi) /* perform semantic action */ > { > > case YYr3: { /* item : time */ > #line 197 "./getdate.y" > 1254,1258c1552,1557 < } < break; < case 4: < #line 200 "/u/scjones/cvs-nightly/lib/getdate.y" < { --- > > } break; > > case YYr4: { /* item : zone */ > #line 200 "./getdate.y" > 1260,1264c1559,1564 < } < break; < case 5: < #line 203 "/u/scjones/cvs-nightly/lib/getdate.y" < { --- > > } break; > > case YYr5: { /* item : date */ > #line 203 "./getdate.y" > 1266,1270c1566,1571 < } < break; < case 6: < #line 206 "/u/scjones/cvs-nightly/lib/getdate.y" < { --- > > } break; > > case YYr6: { /* item : day */ > #line 206 "./getdate.y" > 1272,1276c1573,1578 < } < break; < case 7: < #line 209 "/u/scjones/cvs-nightly/lib/getdate.y" < { --- > > } break; > > case YYr7: { /* item : rel */ > #line 209 "./getdate.y" > 1278,1283c1580,1586 < } < break; < case 9: < #line 215 "/u/scjones/cvs-nightly/lib/getdate.y" < { < yyHour = yyvsp[-1].Number; --- > > } break; > > case YYr9: { /* time : tUNUMBER tMERIDIAN */ > #line 215 "./getdate.y" > > yyHour = yypvt[-1].Number; 1286,1293c1589,1597 < yyMeridian = yyvsp[0].Meridian; < } < break; < case 10: < #line 221 "/u/scjones/cvs-nightly/lib/getdate.y" < { < yyHour = yyvsp[-3].Number; < yyMinutes = yyvsp[-1].Number; --- > yyMeridian = yypvt[0].Meridian; > > } break; > > case YYr10: { /* time : tUNUMBER ':' tUNUMBER o_merid */ > #line 221 "./getdate.y" > > yyHour = yypvt[-3].Number; > yyMinutes = yypvt[-1].Number; 1295,1302c1599,1607 < yyMeridian = yyvsp[0].Meridian; < } < break; < case 11: < #line 227 "/u/scjones/cvs-nightly/lib/getdate.y" < { < yyHour = yyvsp[-3].Number; < yyMinutes = yyvsp[-1].Number; --- > yyMeridian = yypvt[0].Meridian; > > } break; > > case YYr11: { /* time : tUNUMBER ':' tUNUMBER tSNUMBER */ > #line 227 "./getdate.y" > > yyHour = yypvt[-3].Number; > yyMinutes = yypvt[-1].Number; 1305,1322c1610,1629 < yyTimezone = - (yyvsp[0].Number % 100 + (yyvsp[0].Number / 100) * 60); < } < break; < case 12: < #line 234 "/u/scjones/cvs-nightly/lib/getdate.y" < { < yyHour = yyvsp[-5].Number; < yyMinutes = yyvsp[-3].Number; < yySeconds = yyvsp[-1].Number; < yyMeridian = yyvsp[0].Meridian; < } < break; < case 13: < #line 240 "/u/scjones/cvs-nightly/lib/getdate.y" < { < yyHour = yyvsp[-5].Number; < yyMinutes = yyvsp[-3].Number; < yySeconds = yyvsp[-1].Number; --- > yyTimezone = - (yypvt[0].Number % 100 + (yypvt[0].Number / 100) * 60); > > } break; > > case YYr12: { /* time : tUNUMBER ':' tUNUMBER ':' tUNUMBER o_merid */ > #line 234 "./getdate.y" > > yyHour = yypvt[-5].Number; > yyMinutes = yypvt[-3].Number; > yySeconds = yypvt[-1].Number; > yyMeridian = yypvt[0].Meridian; > > } break; > > case YYr13: { /* time : tUNUMBER ':' tUNUMBER ':' tUNUMBER tSNUMBER */ > #line 240 "./getdate.y" > > yyHour = yypvt[-5].Number; > yyMinutes = yypvt[-3].Number; > yySeconds = yypvt[-1].Number; 1325,1331c1632,1639 < yyTimezone = - (yyvsp[0].Number % 100 + (yyvsp[0].Number / 100) * 60); < } < break; < case 14: < #line 250 "/u/scjones/cvs-nightly/lib/getdate.y" < { < yyTimezone = yyvsp[0].Number; --- > yyTimezone = - (yypvt[0].Number % 100 + (yypvt[0].Number / 100) * 60); > > } break; > > case YYr14: { /* zone : tZONE */ > #line 250 "./getdate.y" > > yyTimezone = yypvt[0].Number; 1333,1338c1641,1647 < } < break; < case 15: < #line 254 "/u/scjones/cvs-nightly/lib/getdate.y" < { < yyTimezone = yyvsp[0].Number; --- > > } break; > > case YYr15: { /* zone : tDAYZONE */ > #line 254 "./getdate.y" > > yyTimezone = yypvt[0].Number; 1340,1345c1649,1655 < } < break; < case 16: < #line 259 "/u/scjones/cvs-nightly/lib/getdate.y" < { < yyTimezone = yyvsp[-1].Number; --- > > } break; > > case YYr16: { /* zone : tZONE tDST */ > #line 259 "./getdate.y" > > yyTimezone = yypvt[-1].Number; 1347,1351c1657,1662 < } < break; < case 17: < #line 265 "/u/scjones/cvs-nightly/lib/getdate.y" < { --- > > } break; > > case YYr17: { /* day : tDAY */ > #line 265 "./getdate.y" > 1353,1358c1664,1670 < yyDayNumber = yyvsp[0].Number; < } < break; < case 18: < #line 269 "/u/scjones/cvs-nightly/lib/getdate.y" < { --- > yyDayNumber = yypvt[0].Number; > > } break; > > case YYr18: { /* day : tDAY ',' */ > #line 269 "./getdate.y" > 1360,1435c1672,1757 < yyDayNumber = yyvsp[-1].Number; < } < break; < case 19: < #line 273 "/u/scjones/cvs-nightly/lib/getdate.y" < { < yyDayOrdinal = yyvsp[-1].Number; < yyDayNumber = yyvsp[0].Number; < } < break; < case 20: < #line 279 "/u/scjones/cvs-nightly/lib/getdate.y" < { < yyMonth = yyvsp[-2].Number; < yyDay = yyvsp[0].Number; < } < break; < case 21: < #line 283 "/u/scjones/cvs-nightly/lib/getdate.y" < { < yyMonth = yyvsp[-4].Number; < yyDay = yyvsp[-2].Number; < yyYear = yyvsp[0].Number; < } < break; < case 22: < #line 288 "/u/scjones/cvs-nightly/lib/getdate.y" < { < /* ISO 8601 format. yyyy-mm-dd. */ < yyYear = yyvsp[-2].Number; < yyMonth = -yyvsp[-1].Number; < yyDay = -yyvsp[0].Number; < } < break; < case 23: < #line 294 "/u/scjones/cvs-nightly/lib/getdate.y" < { < /* e.g. 17-JUN-1992. */ < yyDay = yyvsp[-2].Number; < yyMonth = yyvsp[-1].Number; < yyYear = -yyvsp[0].Number; < } < break; < case 24: < #line 300 "/u/scjones/cvs-nightly/lib/getdate.y" < { < yyMonth = yyvsp[-1].Number; < yyDay = yyvsp[0].Number; < } < break; < case 25: < #line 304 "/u/scjones/cvs-nightly/lib/getdate.y" < { < yyMonth = yyvsp[-3].Number; < yyDay = yyvsp[-2].Number; < yyYear = yyvsp[0].Number; < } < break; < case 26: < #line 309 "/u/scjones/cvs-nightly/lib/getdate.y" < { < yyMonth = yyvsp[0].Number; < yyDay = yyvsp[-1].Number; < } < break; < case 27: < #line 313 "/u/scjones/cvs-nightly/lib/getdate.y" < { < yyMonth = yyvsp[-1].Number; < yyDay = yyvsp[-2].Number; < yyYear = yyvsp[0].Number; < } < break; < case 28: < #line 320 "/u/scjones/cvs-nightly/lib/getdate.y" < { --- > yyDayNumber = yypvt[-1].Number; > > } break; > > case YYr19: { /* day : tUNUMBER tDAY */ > #line 273 "./getdate.y" > > yyDayOrdinal = yypvt[-1].Number; > yyDayNumber = yypvt[0].Number; > > } break; > > case YYr20: { /* date : tUNUMBER '/' tUNUMBER */ > #line 279 "./getdate.y" > > yyMonth = yypvt[-2].Number; > yyDay = yypvt[0].Number; > > } break; > > case YYr21: { /* date : tUNUMBER '/' tUNUMBER '/' tUNUMBER */ > #line 283 "./getdate.y" > > yyMonth = yypvt[-4].Number; > yyDay = yypvt[-2].Number; > yyYear = yypvt[0].Number; > > } break; > > case YYr22: { /* date : tUNUMBER tSNUMBER tSNUMBER */ > #line 288 "./getdate.y" > > > yyYear = yypvt[-2].Number; > yyMonth = -yypvt[-1].Number; > yyDay = -yypvt[0].Number; > > } break; > > case YYr23: { /* date : tUNUMBER tMONTH tSNUMBER */ > #line 294 "./getdate.y" > > > yyDay = yypvt[-2].Number; > yyMonth = yypvt[-1].Number; > yyYear = -yypvt[0].Number; > > } break; > > case YYr24: { /* date : tMONTH tUNUMBER */ > #line 300 "./getdate.y" > > yyMonth = yypvt[-1].Number; > yyDay = yypvt[0].Number; > > } break; > > case YYr25: { /* date : tMONTH tUNUMBER ',' tUNUMBER */ > #line 304 "./getdate.y" > > yyMonth = yypvt[-3].Number; > yyDay = yypvt[-2].Number; > yyYear = yypvt[0].Number; > > } break; > > case YYr26: { /* date : tUNUMBER tMONTH */ > #line 309 "./getdate.y" > > yyMonth = yypvt[0].Number; > yyDay = yypvt[-1].Number; > > } break; > > case YYr27: { /* date : tUNUMBER tMONTH tUNUMBER */ > #line 313 "./getdate.y" > > yyMonth = yypvt[-1].Number; > yyDay = yypvt[-2].Number; > yyYear = yypvt[0].Number; > > } break; > > case YYr28: { /* rel : relunit tAGO */ > #line 320 "./getdate.y" > 1438,1472c1760,1800 < } < break; < case 30: < #line 327 "/u/scjones/cvs-nightly/lib/getdate.y" < { < yyRelSeconds += yyvsp[-1].Number * yyvsp[0].Number * 60L; < } < break; < case 31: < #line 330 "/u/scjones/cvs-nightly/lib/getdate.y" < { < yyRelSeconds += yyvsp[-1].Number * yyvsp[0].Number * 60L; < } < break; < case 32: < #line 333 "/u/scjones/cvs-nightly/lib/getdate.y" < { < yyRelSeconds += yyvsp[0].Number * 60L; < } < break; < case 33: < #line 336 "/u/scjones/cvs-nightly/lib/getdate.y" < { < yyRelSeconds += yyvsp[-1].Number; < } < break; < case 34: < #line 339 "/u/scjones/cvs-nightly/lib/getdate.y" < { < yyRelSeconds += yyvsp[-1].Number; < } < break; < case 35: < #line 342 "/u/scjones/cvs-nightly/lib/getdate.y" < { --- > > } break; > > case YYr30: { /* relunit : tUNUMBER tMINUTE_UNIT */ > #line 327 "./getdate.y" > > yyRelSeconds += yypvt[-1].Number * yypvt[0].Number * 60L; > > } break; > > case YYr31: { /* relunit : tSNUMBER tMINUTE_UNIT */ > #line 330 "./getdate.y" > > yyRelSeconds += yypvt[-1].Number * yypvt[0].Number * 60L; > > } break; > > case YYr32: { /* relunit : tMINUTE_UNIT */ > #line 333 "./getdate.y" > > yyRelSeconds += yypvt[0].Number * 60L; > > } break; > > case YYr33: { /* relunit : tSNUMBER tSEC_UNIT */ > #line 336 "./getdate.y" > > yyRelSeconds += yypvt[-1].Number; > > } break; > > case YYr34: { /* relunit : tUNUMBER tSEC_UNIT */ > #line 339 "./getdate.y" > > yyRelSeconds += yypvt[-1].Number; > > } break; > > case YYr35: { /* relunit : tSEC_UNIT */ > #line 342 "./getdate.y" > 1474,1496c1802,1828 < } < break; < case 36: < #line 345 "/u/scjones/cvs-nightly/lib/getdate.y" < { < yyRelMonth += yyvsp[-1].Number * yyvsp[0].Number; < } < break; < case 37: < #line 348 "/u/scjones/cvs-nightly/lib/getdate.y" < { < yyRelMonth += yyvsp[-1].Number * yyvsp[0].Number; < } < break; < case 38: < #line 351 "/u/scjones/cvs-nightly/lib/getdate.y" < { < yyRelMonth += yyvsp[0].Number; < } < break; < case 39: < #line 356 "/u/scjones/cvs-nightly/lib/getdate.y" < { --- > > } break; > > case YYr36: { /* relunit : tSNUMBER tMONTH_UNIT */ > #line 345 "./getdate.y" > > yyRelMonth += yypvt[-1].Number * yypvt[0].Number; > > } break; > > case YYr37: { /* relunit : tUNUMBER tMONTH_UNIT */ > #line 348 "./getdate.y" > > yyRelMonth += yypvt[-1].Number * yypvt[0].Number; > > } break; > > case YYr38: { /* relunit : tMONTH_UNIT */ > #line 351 "./getdate.y" > > yyRelMonth += yypvt[0].Number; > > } break; > > case YYr39: { /* number : tUNUMBER */ > #line 356 "./getdate.y" > 1498c1830 < yyYear = yyvsp[0].Number; --- > yyYear = yypvt[0].Number; 1500c1832 < if(yyvsp[0].Number>10000) { --- > if(yypvt[0].Number>10000) { 1502,1504c1834,1836 < yyDay= (yyvsp[0].Number)%100; < yyMonth= (yyvsp[0].Number/100)%100; < yyYear = yyvsp[0].Number/10000; --- > yyDay= (yypvt[0].Number)%100; > yyMonth= (yypvt[0].Number/100)%100; > yyYear = yypvt[0].Number/10000; 1508,1509c1840,1841 < if (yyvsp[0].Number < 100) { < yyHour = yyvsp[0].Number; --- > if (yypvt[0].Number < 100) { > yyHour = yypvt[0].Number; 1513,1514c1845,1846 < yyHour = yyvsp[0].Number / 100; < yyMinutes = yyvsp[0].Number % 100; --- > yyHour = yypvt[0].Number / 100; > yyMinutes = yypvt[0].Number % 100; 1520,1524c1852,1857 < } < break; < case 40: < #line 383 "/u/scjones/cvs-nightly/lib/getdate.y" < { --- > > } break; > > case YYr40: { /* o_merid : */ > #line 383 "./getdate.y" > 1526,1542c1859,1882 < } < break; < case 41: < #line 386 "/u/scjones/cvs-nightly/lib/getdate.y" < { < yyval.Meridian = yyvsp[0].Meridian; < } < break; < #line 1535 "y.tab.c" < } < yystk.ssp -= yym; < yystate = *yystk.ssp; < yystk.vsp -= yym; < yym = yylhs[yyn]; < yych = yychar; < if (yystate == 0 && yym == 0) < { --- > > } break; > > case YYr41: { /* o_merid : tMERIDIAN */ > #line 386 "./getdate.y" > > yyval.Meridian = yypvt[0].Meridian; > > } break; > #line 493 "/etc/yyparse.c" > case YYrACCEPT: YYACCEPT; > case YYrERROR: goto yyError; > } > > /*-------------------------------------------*/ > /* Look up next state in goto table. */ > /*-------------------------------------------*/ > yyp = &yygo[yypgo[yyi]]; > yyq = yyp++; > yyi = *yyps; > while (yyi < *yyp++) > ; > yystate = yyneg(yyi == *--yyp? YYQYYP: *yyq); > 1544,1563c1884,1885 < if (yydebug) < printf("%sdebug: after reduction, shifting from state 0 to\ < state %d\n", YYPREFIX, YYFINAL); < #endif < yystate = YYFINAL; < *++yystk.ssp = YYFINAL; < *++yystk.vsp = yyval; < if (yych < 0) < { < if ((yych = YYLEX) < 0) yych = 0; < yychar = yych; < #if YYDEBUG < if (yydebug) < { < yys = 0; < if (yych <= YYMAXTOKEN) yys = yyname[yych]; < if (!yys) yys = "illegal-symbol"; < printf("%sdebug: state %d, reading %d (%s)\n", < YYPREFIX, YYFINAL, yych, yys); < } --- > if (yydebug) > YY_TRACE(yyShowGoto) 1565,1573c1887,1967 < } < if (yych == 0) goto yyaccept; < goto yyloop; < } < if ((yyn = yygindex[yym]) && (yyn += yystate) >= 0 && < yyn <= YYTABLESIZE && yycheck[yyn] == yystate) < yystate = yytable[yyn]; < else < yystate = yydgoto[yym]; --- > > goto yyStack; > > yyerrlabel: ; /* come here from YYERROR */ > /* > #pragma used yyerrlabel > */ > yyerrflag = 1; > if (yyi == YYrERROR) > { > yyps--; > yypv--; > #if YYDEBUG > yytp--; > #endif > } > > yyError: > switch (yyerrflag) > { > /*----------------------------------------------*/ > /* new error */ > /*----------------------------------------------*/ > case 0: > yynerrs++; > yyi = yychar; > yyerror(m_textmsg(4969, "Syntax error", "E")); > if (yyi != yychar) > { > /* user has changed the current token */ > /* try again */ > yyerrflag++; /* avoid loops */ > goto yyEncore; > } > > /*----------------------------------------------*/ > /* partially recovered */ > /*----------------------------------------------*/ > case 1: > case 2: > yyerrflag = 3; /* need 3 valid shifts to recover */ > > /* > * Pop states, looking for a > * shift on `error'. > */ > > for ( ; yyps > yys; yyps--, yypv-- > #if YYDEBUG > , yytp-- > #endif > ) { > if (*yyps >= sizeof yypact/sizeof yypact[0]) > continue; > yyp = &yyact[yypact[*yyps]]; > yyq = yyp; > do { > if (YYERRCODE == *yyp) > { > yyp++; > yystate = yyneg(YYQYYP); > goto yyStack; > } > } while (*yyp++ > YYTOKEN_BASE); > > /* no shift in this state */ > #if YYDEBUG > if (yydebug && yyps > yys+1) > YY_TRACE(yyShowErrRecovery) > #endif > /* pop stacks; try again */ > } > /* no shift on error - abort */ > break; > > /*----------------------------------------------*/ > /* Erroneous token after an error - discard it. */ > /*----------------------------------------------*/ > case 3: > if (yychar == 0) /* but not EOF */ > break; 1575,1591c1969,1993 < if (yydebug) < printf("%sdebug: after reduction, shifting from state %d \ < to state %d\n", YYPREFIX, *yystk.ssp, yystate); < #endif < if (yystk.ssp >= yystk.sslim && yygrowstack(&yystk)) < goto yyoverflow; < *++yystk.ssp = yystate; < *++yystk.vsp = yyval; < goto yyloop; < yyoverflow: < yyerror("yacc stack overflow"); < yyabort: < YYFREESTACK(&yystk); < return (1); < yyaccept: < YYFREESTACK(&yystk); < return (0); --- > if (yydebug) > YY_TRACE(yyShowErrDiscard) > #endif > yyclearin; > goto yyEncore; /* try again in same state */ > } > YYABORT; > > #ifdef YYALLOC > yyReturn: > yylval = save_yylval; > yyval = save_yyval; > yypvt = save_yypvt; > yychar = save_yychar; > yyerrflag = save_yyerrflag; > yynerrs = save_yynerrs; > free((char *)yys); > free((char *)yyv); > > #if YYDEBUG > free((char *)yytypev); > #endif > return(retval); > #endif > 1592a1995,2097 > > /*=====================================================================*/ > /* DEFINE DEBUG/TRACE FUNCTIONS. */ > /*=====================================================================*/ > > #if YYDEBUG > /*----------------------------------------------------*/ > /* Return type of token */ > /*----------------------------------------------------*/ > int yyGetType(int tok) > { > yyNamedType * tp; > for (tp = &yyTokenTypes[yyntoken-1]; tp > yyTokenTypes; tp--) > if (tp->token == tok) > return tp->type; > return 0; > } > > /*----------------------------------------------------*/ > /* Print a token legibly. */ > /*----------------------------------------------------*/ > char * yyptok(int tok) > { > yyNamedType * tp; > for (tp = &yyTokenTypes[yyntoken-1]; tp > yyTokenTypes; tp--) > if (tp->token == tok) > return tp->name; > return ""; > } > > /*----------------------------------------------------*/ > /* Show current state of yyparse */ > /*----------------------------------------------------*/ > void yyShowState(yyTraceItems * tp) > { > short * p; > YYSTYPE * q; > > printf(m_textmsg(2828, "state %d (%d), char %s (%d)\n", > "I num1 num2 char num3"), > yysmap[tp->state], tp->state, > yyptok(tp->lookahead), tp->lookahead); > } > > /*----------------------------------------------------*/ > /* show results of reduction */ > /*----------------------------------------------------*/ > void yyShowReduce(yyTraceItems * tp) > { > printf("reduce %d (%d), pops %d (%d)\n", > yyrmap[tp->rule], tp->rule, > tp->states[tp->nstates - tp->npop], > yysmap[tp->states[tp->nstates - tp->npop]]); > } > > /*----------------------------------------------------*/ > /* */ > /*----------------------------------------------------*/ > void yyShowRead(int val) > { > printf(m_textmsg(2829, "read %s (%d)\n", "I token num"), yyptok(val), val); > } > > /*----------------------------------------------------*/ > /* */ > /*----------------------------------------------------*/ > void yyShowGoto(yyTraceItems * tp) > { > printf(m_textmsg(2830, "goto %d (%d)\n", "I num1 num2"), > yysmap[tp->state], tp->state); > } > > /*----------------------------------------------------*/ > /* */ > /*----------------------------------------------------*/ > void yyShowShift(yyTraceItems * tp) > { > printf(m_textmsg(2831, "shift %d (%d)\n", "I num1 num2"), > yysmap[tp->state], tp->state); > } > > /*----------------------------------------------------*/ > /* */ > /*----------------------------------------------------*/ > void yyShowErrRecovery(yyTraceItems * tp) > { > short * top = tp->states + tp->nstates - 1; > > printf(m_textmsg(2832, "Error recovery pops state %d (%d), uncovers %d (%d)\n", > "I num1 num2 num3 num4"), > yysmap[*top], *top, yysmap[*(top-1)], *(top-1)); > } > > /*----------------------------------------------------*/ > /* */ > /*----------------------------------------------------*/ > void yyShowErrDiscard(yyTraceItems * tp) > { > printf(m_textmsg(2833, "Error recovery discards %s (%d), ", "I token num"), > yyptok(tp->lookahead), tp->lookahead); > } > > #endif /* YYDEBUG */ Index: lib/x.c =================================================================== RCS file: x.c diff -N x.c 0a1,1592 > #ifndef lint > static char yysccsid[] = "@(#)yaccpar 1.9 (Berkeley) 02/21/93 (BSDI)"; > #endif > #include <stdlib.h> > #define YYBYACC 1 > #define YYMAJOR 1 > #define YYMINOR 9 > #define YYEMPTY (-1) > #define YYLEX yylex() > #define yyclearin (yychar=YYEMPTY) > #define yyerrok (yyerrflag=0) > #define YYRECOVERING (yyerrflag!=0) > #define YYPREFIX "yy" > #line 2 "/u/scjones/cvs-nightly/lib/getdate.y" > /* > ** Originally written by Steven M. Bellovin <[EMAIL PROTECTED]> while > ** at the University of North Carolina at Chapel Hill. Later tweaked by > ** a couple of people on Usenet. Completely overhauled by Rich $alz > ** <[EMAIL PROTECTED]> and Jim Berets <[EMAIL PROTECTED]> in August, 1990; > ** > ** This grammar has 10 shift/reduce conflicts. > ** > ** This code is in the public domain and has no copyright. > */ > /* SUPPRESS 287 on yaccpar_sccsid *//* Unused static variable */ > /* SUPPRESS 288 on yyerrlab *//* Label unused */ > > #ifdef HAVE_CONFIG_H > #if defined (emacs) || defined (CONFIG_BROKETS) > #include <config.h> > #else > #include "config.h" > #endif > #endif > > /* Since the code of getdate.y is not included in the Emacs executable > itself, there is no need to #define static in this file. Even if > the code were included in the Emacs executable, it probably > wouldn't do any harm to #undef it here; this will only cause > problems if we try to write to a static variable, which I don't > think this code needs to do. */ > #ifdef emacs > #undef static > #endif > > #include <stdio.h> > #include <ctype.h> > > /* The code at the top of get_date which figures out the offset of the > current time zone checks various CPP symbols to see if special > tricks are need, but defaults to using the gettimeofday system call. > Include <sys/time.h> if that will be used. */ > > #if defined(vms) > > #include <types.h> > #include <time.h> > > #else > > #include <sys/types.h> > > #ifdef TIME_WITH_SYS_TIME > #include <sys/time.h> > #include <time.h> > #else > #ifdef HAVE_SYS_TIME_H > #include <sys/time.h> > #else > #include <time.h> > #endif > #endif > > #ifdef timezone > #undef timezone /* needed for sgi */ > #endif > > #if defined(HAVE_SYS_TIMEB_H) > #include <sys/timeb.h> > #else > /* > ** We use the obsolete `struct timeb' as part of our interface! > ** Since the system doesn't have it, we define it here; > ** our callers must do likewise. > */ > struct timeb { > time_t time; /* Seconds since the epoch */ > unsigned short millitm; /* Field not used */ > short timezone; /* Minutes west of GMT */ > short dstflag; /* Field not used */ > }; > #endif /* defined(HAVE_SYS_TIMEB_H) */ > > #endif /* defined(vms) */ > > #if defined (STDC_HEADERS) || defined (USG) > #include <string.h> > #endif > > /* Some old versions of bison generate parsers that use bcopy. > That loses on systems that don't provide the function, so we have > to redefine it here. */ > #if !defined (HAVE_BCOPY) && defined (HAVE_MEMCPY) && !defined (bcopy) > #define bcopy(from, to, len) memcpy ((to), (from), (len)) > #endif > > #if defined (STDC_HEADERS) > #include <stdlib.h> > #endif > > /* NOTES on rebuilding getdate.c (particularly for inclusion in CVS > releases): > > We don't want to mess with all the portability hassles of alloca. > In particular, most (all?) versions of bison will use alloca in > their parser. If bison works on your system (e.g. it should work > with gcc), then go ahead and use it, but the more general solution > is to use byacc instead of bison, which should generate a portable > parser. I played with adding "#define alloca dont_use_alloca", to > give an error if the parser generator uses alloca (and thus detect > unportable getdate.c's), but that seems to cause as many problems > as it solves. */ > > extern struct tm *gmtime(); > extern struct tm *localtime(); > > #define yyparse getdate_yyparse > #define yylex getdate_yylex > #define yyerror getdate_yyerror > > static int yylex (); > static int yyerror (); > > #define EPOCH 1970 > #define HOUR(x) ((time_t)(x) * 60) > #define SECSPERDAY (24L * 60L * 60L) > > > /* > ** An entry in the lexical lookup table. > */ > typedef struct _TABLE { > char *name; > int type; > time_t value; > } TABLE; > > > /* > ** Daylight-savings mode: on, off, or not yet known. > */ > typedef enum _DSTMODE { > DSTon, DSToff, DSTmaybe > } DSTMODE; > > /* > ** Meridian: am, pm, or 24-hour style. > */ > typedef enum _MERIDIAN { > MERam, MERpm, MER24 > } MERIDIAN; > > > /* > ** Global variables. We could get rid of most of these by using a good > ** union as the yacc stack. (This routine was originally written before > ** yacc had the %union construct.) Maybe someday; right now we only use > ** the %union very rarely. > */ > static char *yyInput; > static DSTMODE yyDSTmode; > static time_t yyDayOrdinal; > static time_t yyDayNumber; > static int yyHaveDate; > static int yyHaveDay; > static int yyHaveRel; > static int yyHaveTime; > static int yyHaveZone; > static time_t yyTimezone; > static time_t yyDay; > static time_t yyHour; > static time_t yyMinutes; > static time_t yyMonth; > static time_t yySeconds; > static time_t yyYear; > static MERIDIAN yyMeridian; > static time_t yyRelMonth; > static time_t yyRelSeconds; > > #line 179 "/u/scjones/cvs-nightly/lib/getdate.y" > typedef union { > time_t Number; > enum _MERIDIAN Meridian; > } YYSTYPE; > #line 196 "y.tab.c" > #define tAGO 257 > #define tDAY 258 > #define tDAYZONE 259 > #define tID 260 > #define tMERIDIAN 261 > #define tMINUTE_UNIT 262 > #define tMONTH 263 > #define tMONTH_UNIT 264 > #define tSEC_UNIT 265 > #define tSNUMBER 266 > #define tUNUMBER 267 > #define tZONE 268 > #define tDST 269 > #define YYERRCODE 256 > short yylhs[] = { -1, > 0, 0, 2, 2, 2, 2, 2, 2, 3, 3, > 3, 3, 3, 4, 4, 4, 6, 6, 6, 5, > 5, 5, 5, 5, 5, 5, 5, 7, 7, 9, > 9, 9, 9, 9, 9, 9, 9, 9, 8, 1, > 1, > }; > short yylen[] = { 2, > 0, 2, 1, 1, 1, 1, 1, 1, 2, 4, > 4, 6, 6, 1, 1, 2, 1, 2, 2, 3, > 5, 3, 3, 2, 4, 2, 3, 2, 1, 2, > 2, 1, 2, 2, 1, 2, 2, 1, 1, 0, > 1, > }; > short yydefred[] = { 1, > 0, 0, 15, 32, 0, 38, 35, 0, 0, 0, > 2, 3, 4, 5, 6, 7, 8, 0, 18, 0, > 31, 36, 33, 19, 9, 30, 0, 37, 34, 0, > 0, 0, 16, 28, 0, 23, 27, 22, 0, 0, > 25, 41, 11, 0, 10, 0, 0, 21, 13, 12, > }; > short yydgoto[] = { 1, > 45, 11, 12, 13, 14, 15, 16, 17, 18, > }; > short yysindex[] = { 0, > -249, -38, 0, 0, -260, 0, 0, -240, -47, -248, > 0, 0, 0, 0, 0, 0, 0, -237, 0, -18, > 0, 0, 0, 0, 0, 0, -262, 0, 0, -239, > -238, -236, 0, 0, -235, 0, 0, 0, -56, -19, > 0, 0, 0, -234, 0, -232, -258, 0, 0, 0, > }; > short yyrindex[] = { 0, > 0, 1, 0, 0, 0, 0, 0, 0, 69, 12, > 0, 0, 0, 0, 0, 0, 0, 23, 0, 34, > 0, 0, 0, 0, 0, 0, 67, 0, 0, 0, > 0, 0, 0, 0, 0, 0, 0, 0, 56, 45, > 0, 0, 0, 0, 0, 0, 56, 0, 0, 0, > }; > short yygindex[] = { 0, > -17, 0, 0, 0, 0, 0, 0, 0, 0, > }; > #define YYTABLESIZE 337 > short yytable[] = { 32, > 17, 44, 42, 36, 37, 19, 20, 49, 2, 3, > 31, 14, 4, 5, 6, 7, 8, 9, 10, 34, > 33, 21, 29, 22, 23, 35, 38, 46, 39, 50, > 40, 41, 47, 24, 48, 0, 0, 0, 0, 0, > 0, 0, 0, 0, 20, 0, 0, 0, 0, 0, > 0, 0, 0, 0, 0, 40, 0, 0, 0, 0, > 0, 0, 0, 0, 0, 0, 26, 0, 39, 0, > 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, > 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, > 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, > 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, > 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, > 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, > 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, > 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, > 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, > 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, > 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, > 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, > 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, > 0, 0, 0, 0, 42, 0, 0, 0, 0, 43, > 24, 0, 0, 25, 26, 27, 28, 29, 30, 0, > 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, > 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, > 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, > 0, 0, 0, 0, 0, 0, 0, 0, 17, 17, > 0, 0, 17, 17, 17, 17, 17, 17, 17, 14, > 14, 0, 0, 14, 14, 14, 14, 14, 14, 14, > 29, 29, 0, 0, 29, 29, 29, 29, 29, 29, > 29, 24, 24, 0, 0, 24, 24, 24, 24, 24, > 24, 24, 20, 20, 0, 0, 20, 20, 20, 20, > 20, 20, 20, 40, 40, 0, 0, 40, 40, 40, > 40, 0, 40, 40, 26, 26, 0, 39, 26, 26, > 26, 26, 0, 0, 26, 39, 39, > }; > short yycheck[] = { 47, > 0, 58, 261, 266, 267, 44, 267, 266, 258, 259, > 58, 0, 262, 263, 264, 265, 266, 267, 268, 257, > 269, 262, 0, 264, 265, 44, 266, 47, 267, 47, > 267, 267, 267, 0, 267, -1, -1, -1, -1, -1, > -1, -1, -1, -1, 0, -1, -1, -1, -1, -1, > -1, -1, -1, -1, -1, 0, -1, -1, -1, -1, > -1, -1, -1, -1, -1, -1, 0, -1, 0, -1, > -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, > -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, > -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, > -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, > -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, > -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, > -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, > -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, > -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, > -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, > -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, > -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, > -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, > -1, -1, -1, -1, 261, -1, -1, -1, -1, 266, > 258, -1, -1, 261, 262, 263, 264, 265, 266, -1, > -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, > -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, > -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, > -1, -1, -1, -1, -1, -1, -1, -1, 258, 259, > -1, -1, 262, 263, 264, 265, 266, 267, 268, 258, > 259, -1, -1, 262, 263, 264, 265, 266, 267, 268, > 258, 259, -1, -1, 262, 263, 264, 265, 266, 267, > 268, 258, 259, -1, -1, 262, 263, 264, 265, 266, > 267, 268, 258, 259, -1, -1, 262, 263, 264, 265, > 266, 267, 268, 258, 259, -1, -1, 262, 263, 264, > 265, -1, 267, 268, 258, 259, -1, 259, 262, 263, > 264, 265, -1, -1, 268, 267, 268, > }; > #define YYFINAL 1 > #ifndef YYDEBUG > #define YYDEBUG 0 > #endif > #define YYMAXTOKEN 269 > #if YYDEBUG > char *yyname[] = { > "end-of-file",0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, > 0,0,0,0,0,0,0,0,0,0,"','",0,0,"'/'",0,0,0,0,0,0,0,0,0,0,"':'",0,0,0,0,0,0,0,0,0, > 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, > 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, > 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, > 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, > 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,"tAGO","tDAY", > "tDAYZONE","tID","tMERIDIAN","tMINUTE_UNIT","tMONTH","tMONTH_UNIT","tSEC_UNIT", > "tSNUMBER","tUNUMBER","tZONE","tDST", > }; > char *yyrule[] = { > "$accept : spec", > "spec :", > "spec : spec item", > "item : time", > "item : zone", > "item : date", > "item : day", > "item : rel", > "item : number", > "time : tUNUMBER tMERIDIAN", > "time : tUNUMBER ':' tUNUMBER o_merid", > "time : tUNUMBER ':' tUNUMBER tSNUMBER", > "time : tUNUMBER ':' tUNUMBER ':' tUNUMBER o_merid", > "time : tUNUMBER ':' tUNUMBER ':' tUNUMBER tSNUMBER", > "zone : tZONE", > "zone : tDAYZONE", > "zone : tZONE tDST", > "day : tDAY", > "day : tDAY ','", > "day : tUNUMBER tDAY", > "date : tUNUMBER '/' tUNUMBER", > "date : tUNUMBER '/' tUNUMBER '/' tUNUMBER", > "date : tUNUMBER tSNUMBER tSNUMBER", > "date : tUNUMBER tMONTH tSNUMBER", > "date : tMONTH tUNUMBER", > "date : tMONTH tUNUMBER ',' tUNUMBER", > "date : tUNUMBER tMONTH", > "date : tUNUMBER tMONTH tUNUMBER", > "rel : relunit tAGO", > "rel : relunit", > "relunit : tUNUMBER tMINUTE_UNIT", > "relunit : tSNUMBER tMINUTE_UNIT", > "relunit : tMINUTE_UNIT", > "relunit : tSNUMBER tSEC_UNIT", > "relunit : tUNUMBER tSEC_UNIT", > "relunit : tSEC_UNIT", > "relunit : tSNUMBER tMONTH_UNIT", > "relunit : tUNUMBER tMONTH_UNIT", > "relunit : tMONTH_UNIT", > "number : tUNUMBER", > "o_merid :", > "o_merid : tMERIDIAN", > }; > #endif > #ifdef YYSTACKSIZE > #undef YYMAXDEPTH > #define YYMAXDEPTH YYSTACKSIZE > #else > #ifdef YYMAXDEPTH > #define YYSTACKSIZE YYMAXDEPTH > #else > #define YYSTACKSIZE 10000 > #define YYMAXDEPTH 10000 > #endif > #endif > #define YYINITSTACKSIZE 200 > int yydebug; > int yynerrs; > struct yystack { > short *ssp; > YYSTYPE *vsp; > short *ss; > YYSTYPE *vs; > int stacksize; > short *sslim; > }; > int yychar; /* some people use this, so we copy it in & out */ > int yyerrflag; /* must be global for yyerrok & YYRECOVERING */ > YYSTYPE yylval; > #line 392 "/u/scjones/cvs-nightly/lib/getdate.y" > > /* Month and day table. */ > static TABLE const MonthDayTable[] = { > { "january", tMONTH, 1 }, > { "february", tMONTH, 2 }, > { "march", tMONTH, 3 }, > { "april", tMONTH, 4 }, > { "may", tMONTH, 5 }, > { "june", tMONTH, 6 }, > { "july", tMONTH, 7 }, > { "august", tMONTH, 8 }, > { "september", tMONTH, 9 }, > { "sept", tMONTH, 9 }, > { "october", tMONTH, 10 }, > { "november", tMONTH, 11 }, > { "december", tMONTH, 12 }, > { "sunday", tDAY, 0 }, > { "monday", tDAY, 1 }, > { "tuesday", tDAY, 2 }, > { "tues", tDAY, 2 }, > { "wednesday", tDAY, 3 }, > { "wednes", tDAY, 3 }, > { "thursday", tDAY, 4 }, > { "thur", tDAY, 4 }, > { "thurs", tDAY, 4 }, > { "friday", tDAY, 5 }, > { "saturday", tDAY, 6 }, > { NULL } > }; > > /* Time units table. */ > static TABLE const UnitsTable[] = { > { "year", tMONTH_UNIT, 12 }, > { "month", tMONTH_UNIT, 1 }, > { "fortnight", tMINUTE_UNIT, 14 * 24 * 60 }, > { "week", tMINUTE_UNIT, 7 * 24 * 60 }, > { "day", tMINUTE_UNIT, 1 * 24 * 60 }, > { "hour", tMINUTE_UNIT, 60 }, > { "minute", tMINUTE_UNIT, 1 }, > { "min", tMINUTE_UNIT, 1 }, > { "second", tSEC_UNIT, 1 }, > { "sec", tSEC_UNIT, 1 }, > { NULL } > }; > > /* Assorted relative-time words. */ > static TABLE const OtherTable[] = { > { "tomorrow", tMINUTE_UNIT, 1 * 24 * 60 }, > { "yesterday", tMINUTE_UNIT, -1 * 24 * 60 }, > { "today", tMINUTE_UNIT, 0 }, > { "now", tMINUTE_UNIT, 0 }, > { "last", tUNUMBER, -1 }, > { "this", tMINUTE_UNIT, 0 }, > { "next", tUNUMBER, 2 }, > { "first", tUNUMBER, 1 }, > /* { "second", tUNUMBER, 2 }, */ > { "third", tUNUMBER, 3 }, > { "fourth", tUNUMBER, 4 }, > { "fifth", tUNUMBER, 5 }, > { "sixth", tUNUMBER, 6 }, > { "seventh", tUNUMBER, 7 }, > { "eighth", tUNUMBER, 8 }, > { "ninth", tUNUMBER, 9 }, > { "tenth", tUNUMBER, 10 }, > { "eleventh", tUNUMBER, 11 }, > { "twelfth", tUNUMBER, 12 }, > { "ago", tAGO, 1 }, > { NULL } > }; > > /* The timezone table. */ > /* Some of these are commented out because a time_t can't store a float. */ > static TABLE const TimezoneTable[] = { > { "gmt", tZONE, HOUR( 0) }, /* Greenwich Mean */ > { "ut", tZONE, HOUR( 0) }, /* Universal (Coordinated) */ > { "utc", tZONE, HOUR( 0) }, > { "wet", tZONE, HOUR( 0) }, /* Western European */ > { "bst", tDAYZONE, HOUR( 0) }, /* British Summer */ > { "wat", tZONE, HOUR( 1) }, /* West Africa */ > { "at", tZONE, HOUR( 2) }, /* Azores */ > #if 0 > /* For completeness. BST is also British Summer, and GST is > * also Guam Standard. */ > { "bst", tZONE, HOUR( 3) }, /* Brazil Standard */ > { "gst", tZONE, HOUR( 3) }, /* Greenland Standard */ > #endif > #if 0 > { "nft", tZONE, HOUR(3.5) }, /* Newfoundland */ > { "nst", tZONE, HOUR(3.5) }, /* Newfoundland Standard */ > { "ndt", tDAYZONE, HOUR(3.5) }, /* Newfoundland Daylight */ > #endif > { "ast", tZONE, HOUR( 4) }, /* Atlantic Standard */ > { "adt", tDAYZONE, HOUR( 4) }, /* Atlantic Daylight */ > { "est", tZONE, HOUR( 5) }, /* Eastern Standard */ > { "edt", tDAYZONE, HOUR( 5) }, /* Eastern Daylight */ > { "cst", tZONE, HOUR( 6) }, /* Central Standard */ > { "cdt", tDAYZONE, HOUR( 6) }, /* Central Daylight */ > { "mst", tZONE, HOUR( 7) }, /* Mountain Standard */ > { "mdt", tDAYZONE, HOUR( 7) }, /* Mountain Daylight */ > { "pst", tZONE, HOUR( 8) }, /* Pacific Standard */ > { "pdt", tDAYZONE, HOUR( 8) }, /* Pacific Daylight */ > { "yst", tZONE, HOUR( 9) }, /* Yukon Standard */ > { "ydt", tDAYZONE, HOUR( 9) }, /* Yukon Daylight */ > { "hst", tZONE, HOUR(10) }, /* Hawaii Standard */ > { "hdt", tDAYZONE, HOUR(10) }, /* Hawaii Daylight */ > { "cat", tZONE, HOUR(10) }, /* Central Alaska */ > { "ahst", tZONE, HOUR(10) }, /* Alaska-Hawaii Standard */ > { "nt", tZONE, HOUR(11) }, /* Nome */ > { "idlw", tZONE, HOUR(12) }, /* International Date Line West */ > { "cet", tZONE, -HOUR(1) }, /* Central European */ > { "met", tZONE, -HOUR(1) }, /* Middle European */ > { "mewt", tZONE, -HOUR(1) }, /* Middle European Winter */ > { "mest", tDAYZONE, -HOUR(1) }, /* Middle European Summer */ > { "swt", tZONE, -HOUR(1) }, /* Swedish Winter */ > { "sst", tDAYZONE, -HOUR(1) }, /* Swedish Summer */ > { "fwt", tZONE, -HOUR(1) }, /* French Winter */ > { "fst", tDAYZONE, -HOUR(1) }, /* French Summer */ > { "eet", tZONE, -HOUR(2) }, /* Eastern Europe, USSR Zone 1 */ > { "bt", tZONE, -HOUR(3) }, /* Baghdad, USSR Zone 2 */ > #if 0 > { "it", tZONE, -HOUR(3.5) },/* Iran */ > #endif > { "zp4", tZONE, -HOUR(4) }, /* USSR Zone 3 */ > { "zp5", tZONE, -HOUR(5) }, /* USSR Zone 4 */ > #if 0 > { "ist", tZONE, -HOUR(5.5) },/* Indian Standard */ > #endif > { "zp6", tZONE, -HOUR(6) }, /* USSR Zone 5 */ > #if 0 > /* For completeness. NST is also Newfoundland Stanard, and SST is > * also Swedish Summer. */ > { "nst", tZONE, -HOUR(6.5) },/* North Sumatra */ > { "sst", tZONE, -HOUR(7) }, /* South Sumatra, USSR Zone 6 */ > #endif /* 0 */ > { "wast", tZONE, -HOUR(7) }, /* West Australian Standard */ > { "wadt", tDAYZONE, -HOUR(7) }, /* West Australian Daylight */ > #if 0 > { "jt", tZONE, -HOUR(7.5) },/* Java (3pm in Cronusland!) */ > #endif > { "cct", tZONE, -HOUR(8) }, /* China Coast, USSR Zone 7 */ > { "jst", tZONE, -HOUR(9) }, /* Japan Standard, USSR Zone 8 */ > #if 0 > { "cast", tZONE, -HOUR(9.5) },/* Central Australian Standard */ > { "cadt", tDAYZONE, -HOUR(9.5) },/* Central Australian Daylight */ > #endif > { "east", tZONE, -HOUR(10) }, /* Eastern Australian Standard */ > { "eadt", tDAYZONE, -HOUR(10) }, /* Eastern Australian Daylight */ > { "gst", tZONE, -HOUR(10) }, /* Guam Standard, USSR Zone 9 */ > { "nzt", tZONE, -HOUR(12) }, /* New Zealand */ > { "nzst", tZONE, -HOUR(12) }, /* New Zealand Standard */ > { "nzdt", tDAYZONE, -HOUR(12) }, /* New Zealand Daylight */ > { "idle", tZONE, -HOUR(12) }, /* International Date Line East */ > { NULL } > }; > > /* Military timezone table. */ > static TABLE const MilitaryTable[] = { > { "a", tZONE, HOUR( 1) }, > { "b", tZONE, HOUR( 2) }, > { "c", tZONE, HOUR( 3) }, > { "d", tZONE, HOUR( 4) }, > { "e", tZONE, HOUR( 5) }, > { "f", tZONE, HOUR( 6) }, > { "g", tZONE, HOUR( 7) }, > { "h", tZONE, HOUR( 8) }, > { "i", tZONE, HOUR( 9) }, > { "k", tZONE, HOUR( 10) }, > { "l", tZONE, HOUR( 11) }, > { "m", tZONE, HOUR( 12) }, > { "n", tZONE, HOUR(- 1) }, > { "o", tZONE, HOUR(- 2) }, > { "p", tZONE, HOUR(- 3) }, > { "q", tZONE, HOUR(- 4) }, > { "r", tZONE, HOUR(- 5) }, > { "s", tZONE, HOUR(- 6) }, > { "t", tZONE, HOUR(- 7) }, > { "u", tZONE, HOUR(- 8) }, > { "v", tZONE, HOUR(- 9) }, > { "w", tZONE, HOUR(-10) }, > { "x", tZONE, HOUR(-11) }, > { "y", tZONE, HOUR(-12) }, > { "z", tZONE, HOUR( 0) }, > { NULL } > }; > > > > > /* ARGSUSED */ > static int > yyerror(s) > char *s; > { > return 0; > } > > > static time_t > ToSeconds(Hours, Minutes, Seconds, Meridian) > time_t Hours; > time_t Minutes; > time_t Seconds; > MERIDIAN Meridian; > { > if (Minutes < 0 || Minutes > 59 || Seconds < 0 || Seconds > 59) > return -1; > switch (Meridian) { > case MER24: > if (Hours < 0 || Hours > 23) > return -1; > return (Hours * 60L + Minutes) * 60L + Seconds; > case MERam: > if (Hours < 1 || Hours > 12) > return -1; > if (Hours == 12) > Hours = 0; > return (Hours * 60L + Minutes) * 60L + Seconds; > case MERpm: > if (Hours < 1 || Hours > 12) > return -1; > if (Hours == 12) > Hours = 0; > return ((Hours + 12) * 60L + Minutes) * 60L + Seconds; > default: > abort (); > } > /* NOTREACHED */ > } > > > /* 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; > time_t Day; > time_t Year; > time_t Hours; > time_t Minutes; > time_t Seconds; > MERIDIAN Meridian; > DSTMODE DSTmode; > { > static int DaysInMonth[12] = { > 31, 0, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31 > }; > time_t tod; > time_t Julian; > int i; > > if (Year < 0) > Year = -Year; > if (Year < 69) > Year += 2000; > else if (Year < 100) > Year += 1900; > DaysInMonth[1] = Year % 4 == 0 && (Year % 100 != 0 || Year % 400 == 0) > ? 29 : 28; > /* 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]) > return -1; > > for (Julian = Day - 1, i = 0; i < Month; i++) > Julian += DaysInMonth[i]; > for (i = EPOCH; i < Year; i++) > Julian += 365 + (i % 4 == 0); > Julian *= SECSPERDAY; > Julian += yyTimezone * 60L; > if ((tod = ToSeconds(Hours, Minutes, Seconds, Meridian)) < 0) > return -1; > Julian += tod; > if (DSTmode == DSTon > || (DSTmode == DSTmaybe && localtime(&Julian)->tm_isdst)) > Julian -= 60 * 60; > return Julian; > } > > > static time_t > DSTcorrect(Start, Future) > time_t Start; > time_t Future; > { > time_t StartDay; > time_t FutureDay; > > StartDay = (localtime(&Start)->tm_hour + 1) % 24; > FutureDay = (localtime(&Future)->tm_hour + 1) % 24; > return (Future - Start) + (StartDay - FutureDay) * 60L * 60L; > } > > > static time_t > RelativeDate(Start, DayOrdinal, DayNumber) > time_t Start; > time_t DayOrdinal; > time_t DayNumber; > { > struct tm *tm; > time_t now; > > now = Start; > tm = localtime(&now); > now += SECSPERDAY * ((DayNumber - tm->tm_wday + 7) % 7); > now += 7 * SECSPERDAY * (DayOrdinal <= 0 ? DayOrdinal : DayOrdinal - 1); > return DSTcorrect(Start, now); > } > > > static time_t > RelativeMonth(Start, RelMonth) > time_t Start; > time_t RelMonth; > { > struct tm *tm; > time_t Month; > time_t Year; > > if (RelMonth == 0) > return 0; > tm = localtime(&Start); > Month = 12 * (tm->tm_year + 1900) + tm->tm_mon + RelMonth; > Year = Month / 12; > Month = Month % 12 + 1; > return DSTcorrect(Start, > Convert(Month, (time_t)tm->tm_mday, Year, > (time_t)tm->tm_hour, (time_t)tm->tm_min, (time_t)tm->tm_sec, > MER24, DSTmaybe)); > } > > > static int > LookupWord(buff) > char *buff; > { > register char *p; > register char *q; > register const TABLE *tp; > int i; > int abbrev; > > /* Make it lowercase. */ > for (p = buff; *p; p++) > if (isupper(*p)) > *p = tolower(*p); > > if (strcmp(buff, "am") == 0 || strcmp(buff, "a.m.") == 0) { > yylval.Meridian = MERam; > return tMERIDIAN; > } > if (strcmp(buff, "pm") == 0 || strcmp(buff, "p.m.") == 0) { > yylval.Meridian = MERpm; > return tMERIDIAN; > } > > /* See if we have an abbreviation for a month. */ > if (strlen(buff) == 3) > abbrev = 1; > else if (strlen(buff) == 4 && buff[3] == '.') { > abbrev = 1; > buff[3] = '\0'; > } > else > abbrev = 0; > > for (tp = MonthDayTable; tp->name; tp++) { > if (abbrev) { > if (strncmp(buff, tp->name, 3) == 0) { > yylval.Number = tp->value; > return tp->type; > } > } > else if (strcmp(buff, tp->name) == 0) { > yylval.Number = tp->value; > return tp->type; > } > } > > for (tp = TimezoneTable; tp->name; tp++) > if (strcmp(buff, tp->name) == 0) { > yylval.Number = tp->value; > return tp->type; > } > > if (strcmp(buff, "dst") == 0) > return tDST; > > for (tp = UnitsTable; tp->name; tp++) > if (strcmp(buff, tp->name) == 0) { > yylval.Number = tp->value; > return tp->type; > } > > /* Strip off any plural and try the units table again. */ > i = strlen(buff) - 1; > if (buff[i] == 's') { > buff[i] = '\0'; > for (tp = UnitsTable; tp->name; tp++) > if (strcmp(buff, tp->name) == 0) { > yylval.Number = tp->value; > return tp->type; > } > buff[i] = 's'; /* Put back for "this" in OtherTable. */ > } > > for (tp = OtherTable; tp->name; tp++) > if (strcmp(buff, tp->name) == 0) { > yylval.Number = tp->value; > return tp->type; > } > > /* Military timezones. */ > if (buff[1] == '\0' && isalpha(*buff)) { > for (tp = MilitaryTable; tp->name; tp++) > if (strcmp(buff, tp->name) == 0) { > yylval.Number = tp->value; > return tp->type; > } > } > > /* Drop out any periods and try the timezone table again. */ > for (i = 0, p = q = buff; *q; q++) > if (*q != '.') > *p++ = *q; > else > i++; > *p = '\0'; > if (i) > for (tp = TimezoneTable; tp->name; tp++) > if (strcmp(buff, tp->name) == 0) { > yylval.Number = tp->value; > return tp->type; > } > > return tID; > } > > > static int > yylex() > { > register char c; > register char *p; > char buff[20]; > int Count; > int sign; > > for ( ; ; ) { > while (isspace(*yyInput)) > yyInput++; > > if (isdigit(c = *yyInput) || c == '-' || c == '+') { > if (c == '-' || c == '+') { > sign = c == '-' ? -1 : 1; > if (!isdigit(*++yyInput)) > /* skip the '-' sign */ > continue; > } > else > sign = 0; > for (yylval.Number = 0; isdigit(c = *yyInput++); ) > yylval.Number = 10 * yylval.Number + c - '0'; > yyInput--; > if (sign < 0) > yylval.Number = -yylval.Number; > return sign ? tSNUMBER : tUNUMBER; > } > if (isalpha(c)) { > for (p = buff; isalpha(c = *yyInput++) || c == '.'; ) > if (p < &buff[sizeof buff - 1]) > *p++ = c; > *p = '\0'; > yyInput--; > return LookupWord(buff); > } > if (c != '(') > return *yyInput++; > Count = 0; > do { > c = *yyInput++; > if (c == '\0') > return c; > if (c == '(') > Count++; > else if (c == ')') > Count--; > } while (Count > 0); > } > } > > #define TM_YEAR_ORIGIN 1900 > > /* Yield A - B, measured in seconds. */ > static long > difftm (a, b) > struct tm *a, *b; > { > int ay = a->tm_year + (TM_YEAR_ORIGIN - 1); > int by = b->tm_year + (TM_YEAR_ORIGIN - 1); > int days = ( > /* difference in day of year */ > a->tm_yday - b->tm_yday > /* + intervening leap days */ > + ((ay >> 2) - (by >> 2)) > - (ay/100 - by/100) > + ((ay/100 >> 2) - (by/100 >> 2)) > /* + difference in years * 365 */ > + (long)(ay-by) * 365 > ); > return (60*(60*(24*days + (a->tm_hour - b->tm_hour)) > + (a->tm_min - b->tm_min)) > + (a->tm_sec - b->tm_sec)); > } > > time_t > get_date(p, now) > char *p; > struct timeb *now; > { > struct tm *tm, gmt; > struct timeb ftz; > time_t Start; > time_t tod; > time_t nowtime; > > yyInput = p; > if (now == NULL) { > struct tm *gmt_ptr; > > now = &ftz; > (void)time (&nowtime); > > gmt_ptr = gmtime (&nowtime); > if (gmt_ptr != NULL) > { > /* Make a copy, in case localtime modifies *tm (I think > that comment now applies to *gmt_ptr, but I am too > lazy to dig into how gmtime and locatime allocate the > structures they return pointers to). */ > gmt = *gmt_ptr; > } > > if (! (tm = localtime (&nowtime))) > return -1; > > if (gmt_ptr != NULL) > ftz.timezone = difftm (&gmt, tm) / 60; > else > /* We are on a system like VMS, where the system clock is > in local time and the system has no concept of timezones. > Hopefully we can fake this out (for the case in which the > user specifies no timezone) by just saying the timezone > is zero. */ > ftz.timezone = 0; > > if(tm->tm_isdst) > ftz.timezone += 60; > } > else > { > nowtime = now->time; > } > > tm = localtime(&nowtime); > yyYear = tm->tm_year + 1900; > yyMonth = tm->tm_mon + 1; > yyDay = tm->tm_mday; > yyTimezone = now->timezone; > yyDSTmode = DSTmaybe; > yyHour = 0; > yyMinutes = 0; > yySeconds = 0; > yyMeridian = MER24; > yyRelSeconds = 0; > yyRelMonth = 0; > yyHaveDate = 0; > yyHaveDay = 0; > yyHaveRel = 0; > yyHaveTime = 0; > yyHaveZone = 0; > > if (yyparse() > || yyHaveTime > 1 || yyHaveZone > 1 || yyHaveDate > 1 || yyHaveDay > 1) > return -1; > > if (yyHaveDate || yyHaveTime || yyHaveDay) { > Start = Convert(yyMonth, yyDay, yyYear, yyHour, yyMinutes, yySeconds, > yyMeridian, yyDSTmode); > if (Start < 0) > return -1; > } > else { > Start = nowtime; > if (!yyHaveRel) > Start -= ((tm->tm_hour * 60L + tm->tm_min) * 60L) + tm->tm_sec; > } > > Start += yyRelSeconds; > Start += RelativeMonth(Start, yyRelMonth); > > if (yyHaveDay && !yyHaveDate) { > tod = RelativeDate(Start, yyDayOrdinal, yyDayNumber); > Start += tod; > } > > /* Have to do *something* with a legitimate -1 so it's distinguishable > * from the error return value. (Alternately could set errno on error.) */ > return Start == -1 ? 0 : Start; > } > > > #if defined(TEST) > > /* ARGSUSED */ > int > main(ac, av) > int ac; > char *av[]; > { > char buff[128]; > time_t d; > > (void)printf("Enter date, or blank line to exit.\n\t> "); > (void)fflush(stdout); > while (gets(buff) && buff[0]) { > d = get_date(buff, (struct timeb *)NULL); > if (d == -1) > (void)printf("Bad format - couldn't convert.\n"); > else > (void)printf("%s", ctime(&d)); > (void)printf("\t> "); > (void)fflush(stdout); > } > exit(0); > /* NOTREACHED */ > } > #endif /* defined(TEST) */ > #line 1056 "y.tab.c" > /* allocate initial stack */ > #if defined(__STDC__) || defined(__cplusplus) > static int yyinitstack(struct yystack *sp) > #else > static int yyinitstack(sp) > struct yystack *sp; > #endif > { > int newsize; > short *newss; > YYSTYPE *newvs; > > newsize = YYINITSTACKSIZE; > newss = (short *)malloc(newsize * sizeof *newss); > newvs = (YYSTYPE *)malloc(newsize * sizeof *newvs); > sp->ss = sp->ssp = newss; > sp->vs = sp->vsp = newvs; > if (newss == NULL || newvs == NULL) return -1; > sp->stacksize = newsize; > sp->sslim = newss + newsize - 1; > return 0; > } > > /* double stack size, up to YYMAXDEPTH */ > #if defined(__STDC__) || defined(__cplusplus) > static int yygrowstack(struct yystack *sp) > #else > static int yygrowstack(sp) > struct yystack *sp; > #endif > { > int newsize, i; > short *newss; > YYSTYPE *newvs; > > if ((newsize = sp->stacksize) >= YYMAXDEPTH) return -1; > if ((newsize *= 2) > YYMAXDEPTH) newsize = YYMAXDEPTH; > i = sp->ssp - sp->ss; > if ((newss = (short *)realloc(sp->ss, newsize * sizeof *newss)) == NULL) > return -1; > sp->ss = newss; > sp->ssp = newss + i; > if ((newvs = (YYSTYPE *)realloc(sp->vs, newsize * sizeof *newvs)) == NULL) > return -1; > sp->vs = newvs; > sp->vsp = newvs + i; > sp->stacksize = newsize; > sp->sslim = newss + newsize - 1; > return 0; > } > > #define YYFREESTACK(sp) { free((sp)->ss); free((sp)->vs); } > > #define YYABORT goto yyabort > #define YYREJECT goto yyabort > #define YYACCEPT goto yyaccept > #define YYERROR goto yyerrlab > int > yyparse() > { > register int yym, yyn, yystate, yych; > register YYSTYPE *yyvsp; > YYSTYPE yyval; > struct yystack yystk; > #if YYDEBUG > register char *yys; > extern char *getenv(); > > if (yys = getenv("YYDEBUG")) > { > yyn = *yys; > if (yyn >= '0' && yyn <= '9') > yydebug = yyn - '0'; > } > #endif > > yynerrs = 0; > yyerrflag = 0; > yychar = yych = YYEMPTY; > > if (yyinitstack(&yystk)) goto yyoverflow; > *yystk.ssp = yystate = 0; > > yyloop: > if (yyn = yydefred[yystate]) goto yyreduce; > if (yych < 0) > { > if ((yych = YYLEX) < 0) yych = 0; > yychar = yych; > #if YYDEBUG > if (yydebug) > { > yys = 0; > if (yych <= YYMAXTOKEN) yys = yyname[yych]; > if (!yys) yys = "illegal-symbol"; > printf("%sdebug: state %d, reading %d (%s)\n", > YYPREFIX, yystate, yych, yys); > } > #endif > } > if ((yyn = yysindex[yystate]) && (yyn += yych) >= 0 && > yyn <= YYTABLESIZE && yycheck[yyn] == yych) > { > #if YYDEBUG > if (yydebug) > printf("%sdebug: state %d, shifting to state %d\n", > YYPREFIX, yystate, yytable[yyn]); > #endif > if (yystk.ssp >= yystk.sslim && yygrowstack(&yystk)) > goto yyoverflow; > *++yystk.ssp = yystate = yytable[yyn]; > *++yystk.vsp = yylval; > yychar = yych = YYEMPTY; > if (yyerrflag > 0) --yyerrflag; > goto yyloop; > } > if ((yyn = yyrindex[yystate]) && (yyn += yych) >= 0 && > yyn <= YYTABLESIZE && yycheck[yyn] == yych) > { > yyn = yytable[yyn]; > goto yyreduce; > } > if (yyerrflag) goto yyinrecovery; > #ifdef lint > goto yynewerror; > #endif > yynewerror: > yyerror("syntax error"); > #ifdef lint > goto yyerrlab; > #endif > yyerrlab: > ++yynerrs; > yyinrecovery: > if (yyerrflag < 3) > { > yyerrflag = 3; > for (;;) > { > if ((yyn = yysindex[*yystk.ssp]) && > (yyn += YYERRCODE) >= 0 && > yyn <= YYTABLESIZE && yycheck[yyn] == YYERRCODE) > { > #if YYDEBUG > if (yydebug) > printf("%sdebug: state %d, error recovery shifting\ > to state %d\n", YYPREFIX, *yystk.ssp, yytable[yyn]); > #endif > if (yystk.ssp >= yystk.sslim && yygrowstack(&yystk)) > goto yyoverflow; > *++yystk.ssp = yystate = yytable[yyn]; > *++yystk.vsp = yylval; > goto yyloop; > } > else > { > #if YYDEBUG > if (yydebug) > printf("%sdebug: error recovery discarding state %d\n", > YYPREFIX, *yystk.ssp); > #endif > if (yystk.ssp <= yystk.ss) goto yyabort; > --yystk.ssp; > --yystk.vsp; > } > } > } > else > { > if (yych == 0) goto yyabort; > #if YYDEBUG > if (yydebug) > { > yys = 0; > if (yych <= YYMAXTOKEN) yys = yyname[yych]; > if (!yys) yys = "illegal-symbol"; > printf("%sdebug: state %d, error recovery discards token %d (%s)\n", > YYPREFIX, yystate, yych, yys); > } > #endif > yychar = yych = YYEMPTY; > goto yyloop; > } > yyreduce: > #if YYDEBUG > if (yydebug) > printf("%sdebug: state %d, reducing by rule %d (%s)\n", > YYPREFIX, yystate, yyn, yyrule[yyn]); > #endif > yym = yylen[yyn]; > yyvsp = yystk.vsp; /* for speed in code under switch() */ > yyval = yyvsp[1-yym]; > switch (yyn) > { > case 3: > #line 197 "/u/scjones/cvs-nightly/lib/getdate.y" > { > yyHaveTime++; > } > break; > case 4: > #line 200 "/u/scjones/cvs-nightly/lib/getdate.y" > { > yyHaveZone++; > } > break; > case 5: > #line 203 "/u/scjones/cvs-nightly/lib/getdate.y" > { > yyHaveDate++; > } > break; > case 6: > #line 206 "/u/scjones/cvs-nightly/lib/getdate.y" > { > yyHaveDay++; > } > break; > case 7: > #line 209 "/u/scjones/cvs-nightly/lib/getdate.y" > { > yyHaveRel++; > } > break; > case 9: > #line 215 "/u/scjones/cvs-nightly/lib/getdate.y" > { > yyHour = yyvsp[-1].Number; > yyMinutes = 0; > yySeconds = 0; > yyMeridian = yyvsp[0].Meridian; > } > break; > case 10: > #line 221 "/u/scjones/cvs-nightly/lib/getdate.y" > { > yyHour = yyvsp[-3].Number; > yyMinutes = yyvsp[-1].Number; > yySeconds = 0; > yyMeridian = yyvsp[0].Meridian; > } > break; > case 11: > #line 227 "/u/scjones/cvs-nightly/lib/getdate.y" > { > yyHour = yyvsp[-3].Number; > yyMinutes = yyvsp[-1].Number; > yyMeridian = MER24; > yyDSTmode = DSToff; > yyTimezone = - (yyvsp[0].Number % 100 + (yyvsp[0].Number / 100) * 60); > } > break; > case 12: > #line 234 "/u/scjones/cvs-nightly/lib/getdate.y" > { > yyHour = yyvsp[-5].Number; > yyMinutes = yyvsp[-3].Number; > yySeconds = yyvsp[-1].Number; > yyMeridian = yyvsp[0].Meridian; > } > break; > case 13: > #line 240 "/u/scjones/cvs-nightly/lib/getdate.y" > { > yyHour = yyvsp[-5].Number; > yyMinutes = yyvsp[-3].Number; > yySeconds = yyvsp[-1].Number; > yyMeridian = MER24; > yyDSTmode = DSToff; > yyTimezone = - (yyvsp[0].Number % 100 + (yyvsp[0].Number / 100) * 60); > } > break; > case 14: > #line 250 "/u/scjones/cvs-nightly/lib/getdate.y" > { > yyTimezone = yyvsp[0].Number; > yyDSTmode = DSToff; > } > break; > case 15: > #line 254 "/u/scjones/cvs-nightly/lib/getdate.y" > { > yyTimezone = yyvsp[0].Number; > yyDSTmode = DSTon; > } > break; > case 16: > #line 259 "/u/scjones/cvs-nightly/lib/getdate.y" > { > yyTimezone = yyvsp[-1].Number; > yyDSTmode = DSTon; > } > break; > case 17: > #line 265 "/u/scjones/cvs-nightly/lib/getdate.y" > { > yyDayOrdinal = 1; > yyDayNumber = yyvsp[0].Number; > } > break; > case 18: > #line 269 "/u/scjones/cvs-nightly/lib/getdate.y" > { > yyDayOrdinal = 1; > yyDayNumber = yyvsp[-1].Number; > } > break; > case 19: > #line 273 "/u/scjones/cvs-nightly/lib/getdate.y" > { > yyDayOrdinal = yyvsp[-1].Number; > yyDayNumber = yyvsp[0].Number; > } > break; > case 20: > #line 279 "/u/scjones/cvs-nightly/lib/getdate.y" > { > yyMonth = yyvsp[-2].Number; > yyDay = yyvsp[0].Number; > } > break; > case 21: > #line 283 "/u/scjones/cvs-nightly/lib/getdate.y" > { > yyMonth = yyvsp[-4].Number; > yyDay = yyvsp[-2].Number; > yyYear = yyvsp[0].Number; > } > break; > case 22: > #line 288 "/u/scjones/cvs-nightly/lib/getdate.y" > { > /* ISO 8601 format. yyyy-mm-dd. */ > yyYear = yyvsp[-2].Number; > yyMonth = -yyvsp[-1].Number; > yyDay = -yyvsp[0].Number; > } > break; > case 23: > #line 294 "/u/scjones/cvs-nightly/lib/getdate.y" > { > /* e.g. 17-JUN-1992. */ > yyDay = yyvsp[-2].Number; > yyMonth = yyvsp[-1].Number; > yyYear = -yyvsp[0].Number; > } > break; > case 24: > #line 300 "/u/scjones/cvs-nightly/lib/getdate.y" > { > yyMonth = yyvsp[-1].Number; > yyDay = yyvsp[0].Number; > } > break; > case 25: > #line 304 "/u/scjones/cvs-nightly/lib/getdate.y" > { > yyMonth = yyvsp[-3].Number; > yyDay = yyvsp[-2].Number; > yyYear = yyvsp[0].Number; > } > break; > case 26: > #line 309 "/u/scjones/cvs-nightly/lib/getdate.y" > { > yyMonth = yyvsp[0].Number; > yyDay = yyvsp[-1].Number; > } > break; > case 27: > #line 313 "/u/scjones/cvs-nightly/lib/getdate.y" > { > yyMonth = yyvsp[-1].Number; > yyDay = yyvsp[-2].Number; > yyYear = yyvsp[0].Number; > } > break; > case 28: > #line 320 "/u/scjones/cvs-nightly/lib/getdate.y" > { > yyRelSeconds = -yyRelSeconds; > yyRelMonth = -yyRelMonth; > } > break; > case 30: > #line 327 "/u/scjones/cvs-nightly/lib/getdate.y" > { > yyRelSeconds += yyvsp[-1].Number * yyvsp[0].Number * 60L; > } > break; > case 31: > #line 330 "/u/scjones/cvs-nightly/lib/getdate.y" > { > yyRelSeconds += yyvsp[-1].Number * yyvsp[0].Number * 60L; > } > break; > case 32: > #line 333 "/u/scjones/cvs-nightly/lib/getdate.y" > { > yyRelSeconds += yyvsp[0].Number * 60L; > } > break; > case 33: > #line 336 "/u/scjones/cvs-nightly/lib/getdate.y" > { > yyRelSeconds += yyvsp[-1].Number; > } > break; > case 34: > #line 339 "/u/scjones/cvs-nightly/lib/getdate.y" > { > yyRelSeconds += yyvsp[-1].Number; > } > break; > case 35: > #line 342 "/u/scjones/cvs-nightly/lib/getdate.y" > { > yyRelSeconds++; > } > break; > case 36: > #line 345 "/u/scjones/cvs-nightly/lib/getdate.y" > { > yyRelMonth += yyvsp[-1].Number * yyvsp[0].Number; > } > break; > case 37: > #line 348 "/u/scjones/cvs-nightly/lib/getdate.y" > { > yyRelMonth += yyvsp[-1].Number * yyvsp[0].Number; > } > break; > case 38: > #line 351 "/u/scjones/cvs-nightly/lib/getdate.y" > { > yyRelMonth += yyvsp[0].Number; > } > break; > case 39: > #line 356 "/u/scjones/cvs-nightly/lib/getdate.y" > { > if (yyHaveTime && yyHaveDate && !yyHaveRel) > yyYear = yyvsp[0].Number; > else { > if(yyvsp[0].Number>10000) { > yyHaveDate++; > yyDay= (yyvsp[0].Number)%100; > yyMonth= (yyvsp[0].Number/100)%100; > yyYear = yyvsp[0].Number/10000; > } > else { > yyHaveTime++; > if (yyvsp[0].Number < 100) { > yyHour = yyvsp[0].Number; > yyMinutes = 0; > } > else { > yyHour = yyvsp[0].Number / 100; > yyMinutes = yyvsp[0].Number % 100; > } > yySeconds = 0; > yyMeridian = MER24; > } > } > } > break; > case 40: > #line 383 "/u/scjones/cvs-nightly/lib/getdate.y" > { > yyval.Meridian = MER24; > } > break; > case 41: > #line 386 "/u/scjones/cvs-nightly/lib/getdate.y" > { > yyval.Meridian = yyvsp[0].Meridian; > } > break; > #line 1535 "y.tab.c" > } > yystk.ssp -= yym; > yystate = *yystk.ssp; > yystk.vsp -= yym; > yym = yylhs[yyn]; > yych = yychar; > if (yystate == 0 && yym == 0) > { > #if YYDEBUG > if (yydebug) > printf("%sdebug: after reduction, shifting from state 0 to\ > state %d\n", YYPREFIX, YYFINAL); > #endif > yystate = YYFINAL; > *++yystk.ssp = YYFINAL; > *++yystk.vsp = yyval; > if (yych < 0) > { > if ((yych = YYLEX) < 0) yych = 0; > yychar = yych; > #if YYDEBUG > if (yydebug) > { > yys = 0; > if (yych <= YYMAXTOKEN) yys = yyname[yych]; > if (!yys) yys = "illegal-symbol"; > printf("%sdebug: state %d, reading %d (%s)\n", > YYPREFIX, YYFINAL, yych, yys); > } > #endif > } > if (yych == 0) goto yyaccept; > goto yyloop; > } > if ((yyn = yygindex[yym]) && (yyn += yystate) >= 0 && > yyn <= YYTABLESIZE && yycheck[yyn] == yystate) > yystate = yytable[yyn]; > else > yystate = yydgoto[yym]; > #if YYDEBUG > if (yydebug) > printf("%sdebug: after reduction, shifting from state %d \ > to state %d\n", YYPREFIX, *yystk.ssp, yystate); > #endif > if (yystk.ssp >= yystk.sslim && yygrowstack(&yystk)) > goto yyoverflow; > *++yystk.ssp = yystate; > *++yystk.vsp = yyval; > goto yyloop; > yyoverflow: > yyerror("yacc stack overflow"); > yyabort: > YYFREESTACK(&yystk); > return (1); > yyaccept: > YYFREESTACK(&yystk); > return (0); > } Index: src/add.c =================================================================== RCS file: /u/qdtlarb/Repository/cvs/src/add.c,v retrieving revision 1.1.1.1 retrieving revision 1.1.1.2 diff -r1.1.1.1 -r1.1.1.2 257c257 < send_to_server ("add\012", 0); --- > send_to_server ("add\n", 0); Index: src/admin.c =================================================================== RCS file: /u/qdtlarb/Repository/cvs/src/admin.c,v retrieving revision 1.1.1.1 retrieving revision 1.1.1.2 diff -r1.1.1.1 -r1.1.1.2 426c426 < send_to_server ("admin\012", 0); --- > send_to_server ("admin\n", 0); Index: src/buffer.c =================================================================== RCS file: /u/qdtlarb/Repository/cvs/src/buffer.c,v retrieving revision 1.1.1.1 retrieving revision 1.1.1.2 diff -r1.1.1.1 -r1.1.1.2 743,744c743,744 < * Read a line (characters up to a \012) from an input buffer. (We < * use \012 rather than \n for the benefit of non Unix clients for --- > * Read a line (characters up to a \n) from an input buffer. (We > * use \n rather than \n for the benefit of non Unix clients for 748c748 < * of the line. The trailing \012 is not included in the buffer. If --- > * of the line. The trailing \n is not included in the buffer. If 774c774 < nl = memchr (data->bufp, '\012', data->size); --- > nl = memchr (data->bufp, '\n', data->size); 868c868 < if (*mem == '\012') --- > if (*mem == '\n') 873c873 < if (memchr (mem, '\012', nbytes) != NULL) --- > if (memchr (mem, '\n', nbytes) != NULL) Index: src/checkout.c =================================================================== RCS file: /u/qdtlarb/Repository/cvs/src/checkout.c,v retrieving revision 1.1.1.1 retrieving revision 1.1.1.2 diff -r1.1.1.1 -r1.1.1.2 329c329 < "export\012" : "co\012", --- > "export\n" : "co\n", 418c418 < || current[hardpath_len] == '\0') --- > || current[hardpath_len] == '\0') { 419a420 > } Index: src/client.c =================================================================== RCS file: /u/qdtlarb/Repository/cvs/src/client.c,v retrieving revision 1.1.1.1 retrieving revision 1.1.1.2 diff -r1.1.1.1 -r1.1.1.2 17a18 > #include <arpa/inet.h> 935c936 < send_to_server ("\012", 0); --- > send_to_server ("\n", 0); 2703c2704 < assert (*p != '\012'); --- > assert (*p != '\n'); 2717c2718 < send_to_server ("\012", 1); --- > send_to_server ("\n", 1); 2719c2720 < send_to_server ("\012", 1); --- > send_to_server ("\n", 1); 2732c2733 < send_to_server ("Static-directory\012", 0); --- > send_to_server ("Static-directory\n", 0); 2762c2763 < send_to_server ("\012", 1); --- > send_to_server ("\n", 1); 2797c2798 < send_to_server ("\012", 1); --- > send_to_server ("\n", 1); 2832c2833 < send_to_server ("\012", 1); --- > send_to_server ("\n", 1); 2992c2993 < send_to_server ("expand-modules\012", 0); --- > send_to_server ("expand-modules\n", 0); 3699c3700 < if (ch == '\012') --- > if (ch == '\n') 3732c3733 < command[0] = getenv ("CVS_SERVER"); --- > command[0] = xgetenv ("CVS_SERVER"); 3802,3803c3803,3804 < begin = "BEGIN VERIFICATION REQUEST\012"; < end = "END VERIFICATION REQUEST\012"; --- > begin = "BEGIN VERIFICATION REQUEST\n"; > end = "END VERIFICATION REQUEST\n"; 3807,3808c3808,3809 < begin = "BEGIN AUTH REQUEST\012"; < end = "END AUTH REQUEST\012"; --- > begin = "BEGIN AUTH REQUEST\n"; > end = "END AUTH REQUEST\n"; 3829c3830 < if (send (sock, "\012", 1, 0) < 0) --- > if (send (sock, "\n", 1, 0) < 0) 3833c3834 < if (send (sock, "\012", 1, 0) < 0) --- > if (send (sock, "\n", 1, 0) < 0) 3837c3838 < if (send (sock, "\012", 1, 0) < 0) --- > if (send (sock, "\n", 1, 0) < 0) 3990c3991 < portenv = getenv ("CVS_CLIENT_PORT"); --- > portenv = xgetenv ("CVS_CLIENT_PORT"); 4099c4100 < str = "BEGIN GSSAPI REQUEST\012"; --- > str = "BEGIN GSSAPI REQUEST\n"; 4184c4185 < send_to_server ("\012", 1); --- > send_to_server ("\n", 1); 4193c4194 < char *log = getenv ("CVS_CLIENT_LOG"); --- > char *log = xgetenv ("CVS_CLIENT_LOG"); 4375c4376 < send_to_server ("\012", 1); --- > send_to_server ("\n", 1); 4388c4389 < send_to_server ("\012", 1); --- > send_to_server ("\n", 1); 4390c4391 < send_to_server ("valid-requests\012", 0); --- > send_to_server ("valid-requests\n", 0); 4416c4417 < send_to_server ("Global_option -n\012", 0); --- > send_to_server ("Global_option -n\n", 0); 4426c4427 < send_to_server ("Global_option -q\012", 0); --- > send_to_server ("Global_option -q\n", 0); 4436c4437 < send_to_server ("Global_option -Q\012", 0); --- > send_to_server ("Global_option -Q\n", 0); 4446c4447 < send_to_server ("Global_option -r\012", 0); --- > send_to_server ("Global_option -r\n", 0); 4456c4457 < send_to_server ("Global_option -t\012", 0); --- > send_to_server ("Global_option -t\n", 0); 4466c4467 < send_to_server ("Global_option -l\012", 0); --- > send_to_server ("Global_option -l\n", 0); 4488c4489 < send_to_server ("wrapper-sendme-rcsOptions\012", 0); --- > send_to_server ("wrapper-sendme-rcsOptions\n", 0); 4508c4509 < send_to_server ("Kerberos-encrypt\012", 0); --- > send_to_server ("Kerberos-encrypt\n", 0); 4523c4524 < send_to_server ("Gssapi-encrypt\012", 0); --- > send_to_server ("Gssapi-encrypt\n", 0); 4550c4551 < send_to_server ("\012", 1); --- > send_to_server ("\n", 1); 4569c4570 < send_to_server ("\012", 1); --- > send_to_server ("\n", 1); 4597c4598 < send_to_server ("Gssapi-authenticate\012", 0); --- > send_to_server ("Gssapi-authenticate\n", 0); 4616c4617 < send_to_server ("Case\012", 0); --- > send_to_server ("Case\n", 0); 4655,4656c4656,4657 < char *cvs_rsh = getenv ("CVS_RSH"); < char *cvs_server = getenv ("CVS_SERVER"); --- > char *cvs_rsh = xgetenv ("CVS_RSH"); > char *cvs_server = xgetenv ("CVS_SERVER"); 4735,4736c4736,4737 < char *cvs_rsh = getenv ("CVS_RSH"); < char *cvs_server = getenv ("CVS_SERVER"); --- > char *cvs_rsh = xgetenv ("CVS_RSH"); > char *cvs_server = xgetenv ("CVS_SERVER"); 4814c4815 < send_to_server ("\012Argumentx ", 0); --- > send_to_server ("\nArgumentx ", 0); 4823c4824 < send_to_server ("\012", 1); --- > send_to_server ("\n", 1); 4911c4912 < send_to_server ("\012", 1); --- > send_to_server ("\n", 1); 4913c4914 < send_to_server ("\012z", 2); --- > send_to_server ("\nz", 2); 4949c4950 < send_to_server ("\012", 1); --- > send_to_server ("\n", 1); 4951,4952c4952,4953 < send_to_server ("\012", 1); < sprintf (tmp, "%lu\012", (unsigned long) newsize); --- > send_to_server ("\n", 1); > sprintf (tmp, "%lu\n", (unsigned long) newsize); 5047c5048 < send_to_server ("\012", 1); --- > send_to_server ("\n", 1); 5075c5076 < send_to_server ("\012", 1); --- > send_to_server ("\n", 1); 5103c5104 < send_to_server ("\012", 1); --- > send_to_server ("\n", 1); 5124c5125 < send_to_server ("\012", 1); --- > send_to_server ("\n", 1); 5160c5161 < send_to_server ("\012", 1); --- > send_to_server ("\n", 1); 5337c5338 < send_to_server ("\012", 1); --- > send_to_server ("\n", 1); 5403c5404 < send_to_server ("\012Argumentx ", 0); --- > send_to_server ("\nArgumentx ", 0); 5417c5418 < send_to_server ("\012", 1); --- > send_to_server ("\n", 1); 5546c5547 < send_to_server ("\012", 1); --- > send_to_server ("\n", 1); 5568c5569 < send_to_server ("\012", 1); --- > send_to_server ("\n", 1); 5727c5728 < send_to_server ("\012", 1); --- > send_to_server ("\n", 1); 5749c5750 < send_to_server ("\012", 1); --- > send_to_server ("\n", 1); 5777c5778 < send_to_server ("\012", 0); --- > send_to_server ("\n", 0); Index: src/commit.c =================================================================== RCS file: /u/qdtlarb/Repository/cvs/src/commit.c,v retrieving revision 1.1.1.1 retrieving revision 1.1.1.2 diff -r1.1.1.1 -r1.1.1.2 543c543 < send_to_server ("\012", 1); --- > send_to_server ("\n", 1); 545c545 < send_to_server ("\012", 1); --- > send_to_server ("\n", 1); 549c549 < send_to_server ("\012", 1); --- > send_to_server ("\n", 1); 587c587 < send_to_server ("ci\012", 0); --- > send_to_server ("ci\n", 0); 2022c2022 < desc[desclen++] = '\012'; --- > desc[desclen++] = '\n'; Index: src/cvs.h =================================================================== RCS file: /u/qdtlarb/Repository/cvs/src/cvs.h,v retrieving revision 1.1.1.1 retrieving revision 1.1.1.2 diff -r1.1.1.1 -r1.1.1.2 13a14 > #include "xgetenv.h" Index: src/cvsrc.c =================================================================== RCS file: /u/qdtlarb/Repository/cvs/src/cvsrc.c,v retrieving revision 1.1.1.1 retrieving revision 1.1.1.2 diff -r1.1.1.1 -r1.1.1.2 60a61 > Index: src/diff.c =================================================================== RCS file: /u/qdtlarb/Repository/cvs/src/diff.c,v retrieving revision 1.1.1.1 retrieving revision 1.1.1.2 diff -r1.1.1.1 -r1.1.1.2 113,114c113,114 < {"context", 2, 0, 143}, < {"ifdef", 1, 0, 131}, --- > {"context", 2, 0, 1143}, > {"ifdef", 1, 0, 1131}, 120c120 < {"initial-tab", 0, 0, 148}, --- > {"initial-tab", 0, 0, 1148}, 128c128 < {"paginate", 0, 0, 144}, --- > {"paginate", 0, 0, 1144}, 136c136 < {"brief", 0, 0, 145}, --- > {"brief", 0, 0, 1145}, 141,154c141,154 < {"side-by-side", 0, 0, 147}, < {"unified", 2, 0, 146}, < {"left-column", 0, 0, 129}, < {"suppress-common-lines", 0, 0, 130}, < {"old-line-format", 1, 0, 132}, < {"new-line-format", 1, 0, 133}, < {"unchanged-line-format", 1, 0, 134}, < {"line-format", 1, 0, 135}, < {"old-group-format", 1, 0, 136}, < {"new-group-format", 1, 0, 137}, < {"unchanged-group-format", 1, 0, 138}, < {"changed-group-format", 1, 0, 139}, < {"horizon-lines", 1, 0, 140}, < {"binary", 0, 0, 142}, --- > {"side-by-side", 0, 0, 1147}, > {"unified", 2, 0, 1146}, > {"left-column", 0, 0, 1129}, > {"suppress-common-lines", 0, 0, 1130}, > {"old-line-format", 1, 0, 1132}, > {"new-line-format", 1, 0, 1133}, > {"unchanged-line-format", 1, 0, 1134}, > {"line-format", 1, 0, 1135}, > {"old-group-format", 1, 0, 1136}, > {"new-group-format", 1, 0, 1137}, > {"unchanged-group-format", 1, 0, 1138}, > {"changed-group-format", 1, 0, 1139}, > {"horizon-lines", 1, 0, 1140}, > {"binary", 0, 0, 1142}, 278c278 < case 131: --- > case 1131: 283,286c283,286 < case 129: case 130: case 132: case 133: case 134: < case 135: case 136: case 137: case 138: case 139: case 140: < case 141: case 142: case 143: case 144: case 145: case 146: < case 147: case 148: --- > case 1129: case 1130: case 1132: case 1133: case 1134: > case 1135: case 1136: case 1137: case 1138: case 1139: case 1140: > case 1141: case 1142: case 1143: case 1144: case 1145: case 1146: > case 1147: case 1148: 374c374 < send_to_server ("diff\012", 0); --- > send_to_server ("diff\n", 0); 433a434 > 698,704c699,701 < if (!have_rev1_label) < label1 = < make_file_label (finfo->fullname, use_rev1, vers->srcfile); < < if (!have_rev2_label) < label2 = < make_file_label (finfo->fullname, use_rev2, vers->srcfile); --- > if (!have_rev1_label) { > label1 = make_file_label(finfo->fullname, use_rev1, vers->srcfile); > } 705a703,705 > if (!have_rev2_label) { > label2 = make_file_label(finfo->fullname, use_rev2, vers->srcfile); > } 842c842 < if (diff_rev1 && strcmp (diff_rev1, TAG_HEAD) == 0) --- > if (diff_rev1 && strcmp (diff_rev1, TAG_HEAD) == 0) { 845a846 > } 849c850 < if (xvers->vn_rcs != NULL) --- > if (xvers->vn_rcs != NULL) { 850a852 > } 864c866 < if (xvers->vn_rcs != NULL) --- > if (xvers->vn_rcs != NULL) { 865a868 > } 868a872 > 906a911 > 912a918 > Index: src/edit.c =================================================================== RCS file: /u/qdtlarb/Repository/cvs/src/edit.c,v retrieving revision 1.1.1.1 retrieving revision 1.1.1.2 diff -r1.1.1.1 -r1.1.1.2 94c94 < send_to_server (turning_on ? "watch-on\012" : "watch-off\012", 0); --- > send_to_server (turning_on ? "watch-on\n" : "watch-off\n", 0); 251c251 < send_to_server ("noop\012", 0); --- > send_to_server ("noop\n", 0); 1116c1116 < send_to_server ("editors\012", 0); --- > send_to_server ("editors\n", 0); Index: src/expand_path.c =================================================================== RCS file: /u/qdtlarb/Repository/cvs/src/expand_path.c,v retrieving revision 1.1.1.1 retrieving revision 1.1.1.2 diff -r1.1.1.1 -r1.1.1.2 57c57 < if (strchr (p, '\012') != NULL) --- > if (strchr (p, '\n') != NULL) Index: src/fileattr.c =================================================================== RCS file: /u/qdtlarb/Repository/cvs/src/fileattr.c,v retrieving revision 1.1.1.1 retrieving revision 1.1.1.2 diff -r1.1.1.1 -r1.1.1.2 506c506 < fputs ("\012", fp); --- > fputs ("\n", fp); 615c615 < fputs ("\012", fp); --- > fputs ("\n", fp); 625c625 < fputs ("\012", fp); --- > fputs ("\n", fp); Index: src/filesubr.c =================================================================== RCS file: /u/qdtlarb/Repository/cvs/src/filesubr.c,v retrieving revision 1.1.1.1 retrieving revision 1.1.1.2 diff -r1.1.1.1 -r1.1.1.2 813c813 < char *env = getenv ("HOME"); --- > char *env = xgetenv ("HOME"); Index: src/history.c =================================================================== RCS file: /u/qdtlarb/Repository/cvs/src/history.c,v retrieving revision 1.1.1.1 retrieving revision 1.1.1.2 diff -r1.1.1.1 -r1.1.1.2 588c588 < send_to_server ("history\012", 0); --- > send_to_server ("history\n", 0); Index: src/ignore.c =================================================================== RCS file: /u/qdtlarb/Repository/cvs/src/ignore.c,v retrieving revision 1.1.1.1 retrieving revision 1.1.1.2 diff -r1.1.1.1 -r1.1.1.2 99c99 < ign_add (getenv (IGNORE_ENV), 0); --- > ign_add (xgetenv (IGNORE_ENV), 0); Index: src/import.c =================================================================== RCS file: /u/qdtlarb/Repository/cvs/src/import.c,v retrieving revision 1.1.1.1 retrieving revision 1.1.1.2 diff -r1.1.1.1 -r1.1.1.2 269c269 < send_to_server ("import\012", 0); --- > send_to_server ("import\n", 0); 1094c1094 < if (fprintf (fprcs, "head %s;\012", add_vhead) < 0) --- > if (fprintf (fprcs, "head %s;\n", add_vhead) < 0) 1099c1099 < if (fprintf (fprcs, "head ;\012") < 0) --- > if (fprintf (fprcs, "head ;\n") < 0) 1105c1105 < if (fprintf (fprcs, "branch %s;\012", add_vbranch) < 0) --- > if (fprintf (fprcs, "branch %s;\n", add_vbranch) < 0) 1108c1108 < if (fprintf (fprcs, "access ;\012") < 0 || --- > if (fprintf (fprcs, "access ;\n") < 0 || 1127c1127 < if (fprintf (fprcs, ";\012") < 0) --- > if (fprintf (fprcs, ";\n") < 0) 1130c1130 < if (fprintf (fprcs, "locks ; strict;\012") < 0 || --- > if (fprintf (fprcs, "locks ; strict;\n") < 0 || 1132c1132 < fprintf (fprcs, "comment @%s@;\012", get_comment (user)) < 0) --- > fprintf (fprcs, "comment @%s@;\n", get_comment (user)) < 0) 1139c1139 < if (fprintf (fprcs, "expand @%s@;\012", local_opt) < 0) --- > if (fprintf (fprcs, "expand @%s@;\n", local_opt) < 0) 1145c1145 < if (fprintf (fprcs, "\012") < 0) --- > if (fprintf (fprcs, "\n") < 0) 1163,1164c1163,1164 < if (fprintf (fprcs, "\012%s\012", add_vhead) < 0 || < fprintf (fprcs, "date %s; author %s; state Exp;\012", --- > if (fprintf (fprcs, "\n%s\n", add_vhead) < 0 || > fprintf (fprcs, "date %s; author %s; state Exp;\n", 1175c1175 < if (fprintf (fprcs, ";\012") < 0) --- > if (fprintf (fprcs, ";\n") < 0) 1178c1178 < if (fprintf (fprcs, "next ;\012") < 0) --- > if (fprintf (fprcs, "next ;\n") < 0) 1190c1190 < fprintf (fprcs, "@;\012") < 0) --- > fprintf (fprcs, "@;\n") < 0) 1196c1196 < if (fprintf (fprcs, "owner\t%u;\012", sb.st_uid) < 0) --- > if (fprintf (fprcs, "owner\t%u;\n", sb.st_uid) < 0) 1198c1198 < if (fprintf (fprcs, "group\t%u;\012", sb.st_gid) < 0) --- > if (fprintf (fprcs, "group\t%u;\n", sb.st_gid) < 0) 1200c1200 < if (fprintf (fprcs, "permissions\t%o;\012", --- > if (fprintf (fprcs, "permissions\t%o;\n", 1208c1208 < if (fprintf (fprcs, "special\t%s %lu;\012", --- > if (fprintf (fprcs, "special\t%s %lu;\n", 1226,1227c1226,1227 < if (fprintf (fprcs, "\012%s.1\012", add_vbranch) < 0 || < fprintf (fprcs, "date %s; author %s; state Exp;\012", --- > if (fprintf (fprcs, "\n%s.1\n", add_vbranch) < 0 || > fprintf (fprcs, "date %s; author %s; state Exp;\n", 1229,1230c1229,1230 < fprintf (fprcs, "branches ;\012") < 0 || < fprintf (fprcs, "next ;\012") < 0) --- > fprintf (fprcs, "branches ;\n") < 0 || > fprintf (fprcs, "next ;\n") < 0) 1242c1242 < fprintf (fprcs, "@;\012") < 0) --- > fprintf (fprcs, "@;\n") < 0) 1248,1250c1248,1250 < if (fprintf (fprcs, "owner\t%u;\012", sb.st_uid) < 0 || < fprintf (fprcs, "group\t%u;\012", sb.st_gid) < 0 || < fprintf (fprcs, "permissions\t%o;\012", --- > if (fprintf (fprcs, "owner\t%u;\n", sb.st_uid) < 0 || > fprintf (fprcs, "group\t%u;\n", sb.st_gid) < 0 || > fprintf (fprcs, "permissions\t%o;\n", 1259c1259 < if (fprintf (fprcs, "special\t%s %lu;\012", --- > if (fprintf (fprcs, "special\t%s %lu;\n", 1275c1275 < if (fprintf (fprcs, "\012") < 0) --- > if (fprintf (fprcs, "\n") < 0) 1281c1281 < if (fprintf (fprcs, "\012desc\012") < 0 || --- > if (fprintf (fprcs, "\ndesc\n") < 0 || 1292c1292 < if (fprintf (fprcs, "@\012\012\012") < 0) --- > if (fprintf (fprcs, "@\n\n\n") < 0) 1299,1300c1299,1300 < if (fprintf (fprcs, "\012%s\012", add_vhead) < 0 || < fprintf (fprcs, "log\012@") < 0) --- > if (fprintf (fprcs, "\n%s\n", add_vhead) < 0 || > fprintf (fprcs, "log\n@") < 0) 1307c1307 < if (fprintf (fprcs, "Initial revision\012") < 0) --- > if (fprintf (fprcs, "Initial revision\n") < 0) 1315,1316c1315,1316 < if (fprintf (fprcs, "@\012") < 0 || < fprintf (fprcs, "text\012@") < 0) --- > if (fprintf (fprcs, "@\n") < 0 || > fprintf (fprcs, "text\n@") < 0) 1342c1342 < if (fprintf (fprcs, "@\012\012") < 0) --- > if (fprintf (fprcs, "@\n\n") < 0) 1346,1347c1346,1347 < if (fprintf (fprcs, "\012%s.1\012", add_vbranch) < 0 || < fprintf (fprcs, "log\012@") < 0 || --- > if (fprintf (fprcs, "\n%s.1\n", add_vbranch) < 0 || > fprintf (fprcs, "log\n@") < 0 || 1350,1351c1350,1351 < fprintf (fprcs, "@\012text\012") < 0 || < fprintf (fprcs, "@@\012") < 0) --- > fprintf (fprcs, "@\ntext\n") < 0 || > fprintf (fprcs, "@@\n") < 0) Index: src/log.c =================================================================== RCS file: /u/qdtlarb/Repository/cvs/src/log.c,v retrieving revision 1.1.1.1 retrieving revision 1.1.1.2 diff -r1.1.1.1 -r1.1.1.2 171c171 < send_to_server ("\012", 0); --- > send_to_server ("\n", 0); 274c274 < send_to_server ("Argument -d\012", 0); --- > send_to_server ("Argument -d\n", 0); 284c284 < send_to_server ("\012", 0); --- > send_to_server ("\n", 0); 288c288 < send_to_server ("Argument -d\012", 0); --- > send_to_server ("Argument -d\n", 0); 292c292 < send_to_server ("\012", 0); --- > send_to_server ("\n", 0); 323c323 < send_to_server ("\012", 0); --- > send_to_server ("\n", 0); 331c331 < send_to_server ("log\012", 0); --- > send_to_server ("log\n", 0); Index: src/login.c =================================================================== RCS file: /u/qdtlarb/Repository/cvs/src/login.c,v retrieving revision 1.1.1.1 retrieving revision 1.1.1.2 diff -r1.1.1.1 -r1.1.1.2 43c43 < if ((passfile = getenv ("CVS_PASSFILE")) != NULL) --- > if ((passfile = xgetenv ("CVS_PASSFILE")) != NULL) 312c312 < if (getenv ("CVS_PASSWORD") != NULL) --- > if (xgetenv ("CVS_PASSWORD") != NULL) Index: src/main.c =================================================================== RCS file: /u/qdtlarb/Repository/cvs/src/main.c,v retrieving revision 1.1.1.1 retrieving revision 1.1.1.2 diff -r1.1.1.1 -r1.1.1.2 425,428c425,428 < {"help-commands", 0, NULL, 1}, < {"help-synonyms", 0, NULL, 2}, < {"help-options", 0, NULL, 4}, < {"allow-root", required_argument, NULL, 3}, --- > {"help-commands", 0, NULL, 1001}, > {"help-synonyms", 0, NULL, 1002}, > {"help-options", 0, NULL, 1004}, > {"allow-root", required_argument, NULL, 1003}, 465c465 < if ((cp = getenv (TMPDIR_ENV)) != NULL) --- > if ((cp = xgetenv (TMPDIR_ENV)) != NULL) 470c470 < if ((cp = getenv (EDITOR1_ENV)) != NULL) --- > if ((cp = xgetenv (EDITOR1_ENV)) != NULL) 472c472 < else if ((cp = getenv (EDITOR2_ENV)) != NULL) --- > else if ((cp = xgetenv (EDITOR2_ENV)) != NULL) 474c474 < else if ((cp = getenv (EDITOR3_ENV)) != NULL) --- > else if ((cp = xgetenv (EDITOR3_ENV)) != NULL) 476c476 < if ((cp = getenv (CVSROOT_ENV)) != NULL) --- > if ((cp = xgetenv (CVSROOT_ENV)) != NULL) 481c481 < if (getenv (CVSREAD_ENV) != NULL) --- > if (xgetenv (CVSREAD_ENV) != NULL) 505c505 < if (use_cvsrc) --- > if (use_cvsrc) { 506a507 > } 517c518 < case 1: --- > case 1001: 521c522 < case 2: --- > case 1002: 525c526 < case 4: --- > case 1004: 529c530 < case 3: --- > case 1003: 689c690 < if ((cp = getenv (CVSUMASK_ENV)) != NULL) --- > if ((cp = xgetenv (CVSUMASK_ENV)) != NULL) 761c762 < (void) putenv (env); --- > (void) xputenv (env); 968c969 < (void) putenv (env); --- > (void) xputenv (env); Index: src/myndbm.c =================================================================== RCS file: /u/qdtlarb/Repository/cvs/src/myndbm.c,v retrieving revision 1.1.1.1 retrieving revision 1.1.1.2 diff -r1.1.1.1 -r1.1.1.2 65c65 < fputs ("\012", fp); --- > fputs ("\n", fp); 214c214 < while ((line_length = getstr (&line, &line_size, fp, '\012', 0)) >= 0) --- > while ((line_length = getstr (&line, &line_size, fp, '\n', 0)) >= 0) 216c216 < if (line_length > 0 && line[line_length - 1] == '\012') --- > if (line_length > 0 && line[line_length - 1] == '\n') Index: src/patch.c =================================================================== RCS file: /u/qdtlarb/Repository/cvs/src/patch.c,v retrieving revision 1.1.1.1 retrieving revision 1.1.1.2 diff -r1.1.1.1 -r1.1.1.2 227c227 < send_to_server ("rdiff\012", 0); --- > send_to_server ("rdiff\n", 0); Index: src/rcs.c =================================================================== RCS file: /u/qdtlarb/Repository/cvs/src/rcs.c,v retrieving revision 1.1.1.1 retrieving revision 1.1.1.2 diff -r1.1.1.1 -r1.1.1.2 134a135 > #if 0 154a156,158 > #else > #define whitespace(c) isspace(c) > #endif 798c802 < if (*cp++ != '\012') --- > if (*cp++ != '\n') 809c813 < if (*cp == '\012') --- > if (*cp == '\n') 1036a1041 > #if 0 1037a1043 > #endif 1040a1047 > #if 0 1041a1049,1051 > #else > #define my_whitespace(c) (isspace(c)) > #endif 1110c1120 < error (1, 0, "EOF in key in RCS file %s", --- > error (1, 0, "EOF in key in RCS file %s (1)", 1431a1442 > #if 0 1432a1444 > #endif 1435a1448 > #if 0 1436a1450,1452 > #else > #define my_whitespace(c) (isspace(c)) > #endif 1505c1521 < error (1, 0, "EOF in key in RCS file %s", --- > error (1, 0, "EOF in key in RCS file %s (2)", 1533a1550 > #if 0 1534a1552 > #endif 1539a1558 > #if 0 1540a1560,1562 > #else > #define my_whitespace(c) (isspace(c)) > #endif 1679a1702 > #if 0 1680a1704 > #endif 1683a1708 > #if 0 1684a1710,1712 > #else > #define my_whitespace(c) (isspace(c)) > #endif 3394c3422 < if (rcs->flags & PARTIAL) --- > if (rcs->flags & PARTIAL) { 3395a3424 > } 3399c3428 < if (p == NULL) --- > if (p == NULL) { 3400a3430 > } 3414c3444 < if (ftm->tm_year > 1900) --- > if (ftm->tm_year > 1900) { 3415a3446 > } 3423a3455 > 7198c7230 < if (*p++ != '\012') --- > if (*p++ != '\n') 8861c8893 < send_to_server ("annotate\012", 0); --- > send_to_server ("annotate\n", 0); Index: src/release.c =================================================================== RCS file: /u/qdtlarb/Repository/cvs/src/release.c,v retrieving revision 1.1.1.1 retrieving revision 1.1.1.2 diff -r1.1.1.1 -r1.1.1.2 249,250c249,250 < send_to_server ("\012", 1); < send_to_server ("release\012", 0); --- > send_to_server ("\n", 1); > send_to_server ("release\n", 0); 290c290 < send_to_server ("noop\012", 0); --- > send_to_server ("noop\n", 0); Index: src/remove.c =================================================================== RCS file: /u/qdtlarb/Repository/cvs/src/remove.c,v retrieving revision 1.1.1.1 retrieving revision 1.1.1.2 diff -r1.1.1.1 -r1.1.1.2 106c106 < send_to_server ("remove\012", 0); --- > send_to_server ("remove\n", 0); Index: src/rtag.c =================================================================== RCS file: /u/qdtlarb/Repository/cvs/src/rtag.c,v retrieving revision 1.1.1.1 retrieving revision 1.1.1.2 diff -r1.1.1.1 -r1.1.1.2 200c200 < send_to_server ("rtag\012", 0); --- > send_to_server ("rtag\n", 0); Index: src/server.c =================================================================== RCS file: /u/qdtlarb/Repository/cvs/src/server.c,v retrieving revision 1.1.1.1 retrieving revision 1.1.1.2 diff -r1.1.1.1 -r1.1.1.2 836c836 < (void) putenv (env); --- > (void) xputenv (env); 2747c2747 < if (getenv ("CVS_SERVER_SLEEP")) --- > if (xgetenv ("CVS_SERVER_SLEEP")) 2749c2749 < int secs = atoi (getenv ("CVS_SERVER_SLEEP")); --- > int secs = atoi (xgetenv ("CVS_SERVER_SLEEP")); 4294c4294 < buf_output0 (buf_to_net, "\012");; --- > buf_output0 (buf_to_net, "\n");; 4298c4298 < buf_output0 (buf_to_net, "ok\012"); --- > buf_output0 (buf_to_net, "ok\n"); 5155c5155 < (void) putenv (env); --- > (void) xputenv (env); 5159c5159 < (void) putenv (env); --- > (void) xputenv (env); 5366a5367,5368 > fprintf(stderr, "OS390 version does not support server passwords\n"); > /* 5367a5370 > */ 6167,6168c6170,6171 < buf_output0 (buf, "Mbinary\012"); < sprintf (size_text, "%lu\012", (unsigned long) len); --- > buf_output0 (buf, "Mbinary\n"); > sprintf (size_text, "%lu\n", (unsigned long) len); Index: src/status.c =================================================================== RCS file: /u/qdtlarb/Repository/cvs/src/status.c,v retrieving revision 1.1.1.1 retrieving revision 1.1.1.2 diff -r1.1.1.1 -r1.1.1.2 98c98 < send_to_server ("status\012", 0); --- > send_to_server ("status\n", 0); Index: src/subr.c =================================================================== RCS file: /u/qdtlarb/Repository/cvs/src/subr.c,v retrieving revision 1.1.1.1 retrieving revision 1.1.1.2 diff -r1.1.1.1 -r1.1.1.2 340,341c340,341 < if (((name = getlogin ()) || (name = getenv("LOGNAME")) || < (name = getenv("USER"))) && *name) --- > if (((name = getlogin ()) || (name = xgetenv("LOGNAME")) || > (name = xgetenv("USER"))) && *name) 359a360 > #if 0 371a373 > #endif Index: src/tag.c =================================================================== RCS file: /u/qdtlarb/Repository/cvs/src/tag.c,v retrieving revision 1.1.1.1 retrieving revision 1.1.1.2 diff -r1.1.1.1 -r1.1.1.2 188c188 < send_to_server ("tag\012", 0); --- > send_to_server ("tag\n", 0); Index: src/update.c =================================================================== RCS file: /u/qdtlarb/Repository/cvs/src/update.c,v retrieving revision 1.1.1.1 retrieving revision 1.1.1.2 diff -r1.1.1.1 -r1.1.1.2 336c336 < send_to_server ("update\012", 0); --- > send_to_server ("update\n", 0); Index: src/uss-bugs.c =================================================================== RCS file: uss-bugs.c diff -N uss-bugs.c 0a1,12 > #include <stdio.h> > #include <stdlib.h> > main() > { > char *p1; > char *p2; > p1 = getenv("HOME"); > printf("p1 = '%s'\n", p1); > p2 = getenv("PATH"); > printf("p1 = '%s'\n", p1); > printf("p2 = '%s'\n", p2); > } Index: src/watch.c =================================================================== RCS file: /u/qdtlarb/Repository/cvs/src/watch.c,v retrieving revision 1.1.1.1 retrieving revision 1.1.1.2 diff -r1.1.1.1 -r1.1.1.2 343c343 < "watch-add\012" : "watch-remove\012", --- > "watch-add\n" : "watch-remove\n", 520c520 < send_to_server ("watchers\012", 0); --- > send_to_server ("watchers\n", 0); Index: src/wrapper.c =================================================================== RCS file: /u/qdtlarb/Repository/cvs/src/wrapper.c,v retrieving revision 1.1.1.1 retrieving revision 1.1.1.2 diff -r1.1.1.1 -r1.1.1.2 157c157 < wrap_add (getenv (WRAPPER_ENV), 0); --- > wrap_add (xgetenv (WRAPPER_ENV), 0); 183c183 < send_to_server ("Argument -W\012Argument ", 0); --- > send_to_server ("Argument -W\nArgument ", 0); 187c187 < send_to_server ("'\012", 0); --- > send_to_server ("'\n", 0); Index: src/x =================================================================== RCS file: x diff -N x Binary files /dev/null and /tmp/cvsbCCDHaDDA differ Index: src/xgetenv.c =================================================================== RCS file: xgetenv.c diff -N xgetenv.c 0a1,140 > #include <stdio.h> > #include <string.h> > #include <stdlib.h> > #include <errno.h> > #include <assert.h> > > typedef struct EnvTableS { > const char *name; > const char *value; > struct EnvTableS *next; > } EnvTable; > > EnvTable *envTable = NULL; > > static EnvTable *find_env(const char *name); > static void put_slot(const char *name, const char *value); > > const char * > xgetenv(const char *name) > { > EnvTable *i = NULL; > char *value; > > /* > * First try to find the name in the EnvTable. > */ > i = find_env(name); > if (i != NULL) { > return i->value; > } > > /* > * If not found in memory, call systems getenv. > */ > value = getenv(name); > if (value == NULL) { > return NULL; > } > put_slot(strdup(name), strdup(value)); > > /* > * Return pointer to the memory value (it should be there now). > */ > i = find_env(name); > if (i != NULL) { > return i->value; > } > > return NULL; > } > > int > xputenv(const char *env) > { > char *name = strdup(env); > EnvTable *i = NULL; > char *value; > > /* > * Call the systems putenv. > */ > putenv(env); > > /* > * Split the name=value string. > */ > value = strchr(name, '='); > if (value == NULL) { > return ENOMEM; > } > *value++ = 0; > > /* > * Store in memory. > */ > put_slot(name, value); > > return 0; > } > > static void > put_slot(const char *name, const char *value) > { > /* > * Find or allocate EnvTable slot. > */ > EnvTable *i = NULL; > assert(name); > assert(value); > > i = find_env(name); > if (i == NULL) > { > i = malloc(sizeof(EnvTable)); > i->next = NULL; > assert(i); > if (envTable == NULL) { > envTable = i; > } else { > envTable->next = i; > } > } > > i->name = name;; > i->value = value; > } > > static EnvTable * > find_env(const char *env) > { > EnvTable *i = NULL; > for(i = envTable; i != NULL; i = i->next) > { > if (i->name != NULL && strcmp(env, i->name) == 0) { > break; > } > } > > return i; > } > > #ifdef MAIN > int main() > { > const char *p1; > const char *p2; > p1 = xgetenv("HOME"); > printf("p1 = '%s'\n", p1); > p2 = xgetenv("PATH"); > printf("p1 = '%s'\n", p1); > printf("p2 = '%s'\n", p2); > > xputenv("PATH=nisse"); > p1 = xgetenv("HOME"); > printf("p1 = '%s'\n", p1); > p2 = xgetenv("PATH"); > printf("p1 = '%s'\n", p1); > printf("p2 = '%s'\n", p2); > } > #endif Index: src/xgetenv.h =================================================================== RCS file: xgetenv.h diff -N xgetenv.h 0a1,5 > #ifndef _XGETENV_H > #define _XGETENV_H > const char *xgetenv(const char *name); > int xputenv(const char *env); > #endif Index: src/Makefile.in =================================================================== RCS file: /u/qdtlarb/Repository/cvs/src/Makefile.in,v retrieving revision 1.1.1.1 retrieving revision 1.2 diff -r1.1.1.1 -r1.2 46c46 < tag.c update.c watch.c wrapper.c vers_ts.c version.c zlib.c --- > tag.c update.c watch.c wrapper.c vers_ts.c version.c zlib.c xgetenv.c 53c53 < root.o rtag.o scramble.o server.o status.o tag.o update.o \ --- > root.o rtag.o scramble.o server.o status.o tag.o update.o xgetenv.o \ Index: vms/Makefile =================================================================== RCS file: Makefile diff -N Makefile 0a1,88 > # Generated automatically from Makefile.in by configure. > #### Under VMS, we use *.COM to build, not > #### this makefile. However, we need this file in order for 'make > #### dist' to work properly on Unix machines. > > srcdir = . > top_srcdir = .. > cvs_srcdir = ../src > > SHELL = /bin/sh > > prefix = /u/qdtlarb/EDUP/Cvs/1.10.8 > exec_prefix = ${prefix} > > DISTFILES = \ > ChangeLog \ > Makefile.in \ > build_vms.com \ > config.h \ > dir.h \ > filesubr.c \ > filutils.c \ > filutils.h \ > getpass.c \ > getwd.c \ > misc.c \ > misc.h \ > ndir.c \ > ndir.h \ > options.h \ > pathnames.h \ > pc.c \ > pipe.c \ > pipe.h \ > piped_child.c \ > pwd.c \ > pwd.h \ > rcmd.c \ > readlink.c \ > rmdir.c \ > startserver.c \ > stat.c \ > unlink.c \ > utime.c \ > vms-types.h \ > vms.h \ > vmsmunch.c \ > vmsmunch.h \ > vmsmunch_private.h \ > waitpid.c > > all: > > .PHONY: all install uninstall > all install uninstall: > > installdirs: > .PHONY: installdirs > > .PHONY: tags TAGS > tags TAGS: > > .PHONY: ls > ls: > @echo ${DISTFILES} > > .PHONY: clean distclean realclean mostlyclean > clean realclean mostlyclean: > > .PHONY: lint > lint: > > .PHONY: dist-dir > dist-dir: > mkdir ${DISTDIR} > for i in ${DISTFILES}; do \ > ln $(srcdir)/$${i} ${DISTDIR}; \ > done > > clean: > @echo make clean does nothing in vms subdir > > distclean: > rm -f Makefile > > subdir = vms > Makefile: ../config.status Makefile.in > cd .. && CONFIG_FILES=$(subdir)/$@ CONFIG_HEADERS= ./config.status