update to version 1.9 of Berkeley yacc, from vangogh

This commit is contained in:
cgd 1993-05-28 12:32:12 +00:00
parent 6e8052b9c6
commit 1370992abd
4 changed files with 1322 additions and 126 deletions

View File

@ -1,6 +1,13 @@
#ifndef lint
char yysccsid[] = "@(#)yaccpar 1.3 (Berkeley) 01/21/90";
static char yysccsid[] = "@(#)yaccpar 1.9 (Berkeley) 02/21/93";
#endif
#define YYBYACC 1
#define YYMAJOR 1
#define YYMINOR 9
#define yyclearin (yychar=(-1))
#define yyerrok (yyerrflag=0)
#define YYRECOVERING (yyerrflag!=0)
#define YYPREFIX "yy"
#define YYERRCODE 256
short yylhs[] = { -1,
0,
@ -43,13 +50,15 @@ char *yyrule[] = {
#ifndef YYSTYPE
typedef int YYSTYPE;
#endif
#define yyclearin (yychar=(-1))
#define yyerrok (yyerrflag=0)
#ifndef YYSTACKSIZE
#ifdef YYSTACKSIZE
#undef YYMAXDEPTH
#define YYMAXDEPTH YYSTACKSIZE
#else
#ifdef YYMAXDEPTH
#define YYSTACKSIZE YYMAXDEPTH
#else
#define YYSTACKSIZE 300
#define YYSTACKSIZE 500
#define YYMAXDEPTH 500
#endif
#endif
int yydebug;
@ -60,15 +69,16 @@ short *yyssp;
YYSTYPE *yyvsp;
YYSTYPE yyval;
YYSTYPE yylval;
#define yystacksize YYSTACKSIZE
short yyss[YYSTACKSIZE];
YYSTYPE yyvs[YYSTACKSIZE];
#define yystacksize YYSTACKSIZE
#line 4 "error.y"
main(){printf("yyparse() = %d\n",yyparse());}
yylex(){return-1;}
yyerror(s)char*s;{printf("%s\n",s);}
#line 70 "error.tab.c"
#line 80 "error.tab.c"
#define YYABORT goto yyabort
#define YYREJECT goto yyabort
#define YYACCEPT goto yyaccept
#define YYERROR goto yyerrlab
int
@ -82,9 +92,7 @@ yyparse()
if (yys = getenv("YYDEBUG"))
{
yyn = *yys;
if (yyn == '0')
yydebug = 0;
else if (yyn >= '1' && yyn <= '9')
if (yyn >= '0' && yyn <= '9')
yydebug = yyn - '0';
}
#endif
@ -108,8 +116,8 @@ yyloop:
yys = 0;
if (yychar <= YYMAXTOKEN) yys = yyname[yychar];
if (!yys) yys = "illegal-symbol";
printf("yydebug: state %d, reading %d (%s)\n", yystate,
yychar, yys);
printf("%sdebug: state %d, reading %d (%s)\n",
YYPREFIX, yystate, yychar, yys);
}
#endif
}
@ -118,8 +126,8 @@ yyloop:
{
#if YYDEBUG
if (yydebug)
printf("yydebug: state %d, shifting to state %d\n",
yystate, yytable[yyn]);
printf("%sdebug: state %d, shifting to state %d\n",
YYPREFIX, yystate, yytable[yyn]);
#endif
if (yyssp >= yyss + yystacksize - 1)
{
@ -159,8 +167,8 @@ yyinrecovery:
{
#if YYDEBUG
if (yydebug)
printf("yydebug: state %d, error recovery shifting\
to state %d\n", *yyssp, yytable[yyn]);
printf("%sdebug: state %d, error recovery shifting\
to state %d\n", YYPREFIX, *yyssp, yytable[yyn]);
#endif
if (yyssp >= yyss + yystacksize - 1)
{
@ -174,8 +182,8 @@ yyinrecovery:
{
#if YYDEBUG
if (yydebug)
printf("yydebug: error recovery discarding state %d\n",
*yyssp);
printf("%sdebug: error recovery discarding state %d\n",
YYPREFIX, *yyssp);
#endif
if (yyssp <= yyss) goto yyabort;
--yyssp;
@ -192,8 +200,8 @@ yyinrecovery:
yys = 0;
if (yychar <= YYMAXTOKEN) yys = yyname[yychar];
if (!yys) yys = "illegal-symbol";
printf("yydebug: state %d, error recovery discards token %d (%s)\n",
yystate, yychar, yys);
printf("%sdebug: state %d, error recovery discards token %d (%s)\n",
YYPREFIX, yystate, yychar, yys);
}
#endif
yychar = (-1);
@ -202,8 +210,8 @@ yyinrecovery:
yyreduce:
#if YYDEBUG
if (yydebug)
printf("yydebug: state %d, reducing by rule %d (%s)\n",
yystate, yyn, yyrule[yyn]);
printf("%sdebug: state %d, reducing by rule %d (%s)\n",
YYPREFIX, yystate, yyn, yyrule[yyn]);
#endif
yym = yylen[yyn];
yyval = yyvsp[1-yym];
@ -216,10 +224,10 @@ yyreduce:
yym = yylhs[yyn];
if (yystate == 0 && yym == 0)
{
#ifdef YYDEBUG
#if YYDEBUG
if (yydebug)
printf("yydebug: after reduction, shifting from state 0 to\
state %d\n", YYFINAL);
printf("%sdebug: after reduction, shifting from state 0 to\
state %d\n", YYPREFIX, YYFINAL);
#endif
yystate = YYFINAL;
*++yyssp = YYFINAL;
@ -233,8 +241,8 @@ yyreduce:
yys = 0;
if (yychar <= YYMAXTOKEN) yys = yyname[yychar];
if (!yys) yys = "illegal-symbol";
printf("yydebug: state %d, reading %d (%s)\n",
YYFINAL, yychar, yys);
printf("%sdebug: state %d, reading %d (%s)\n",
YYPREFIX, YYFINAL, yychar, yys);
}
#endif
}
@ -246,10 +254,10 @@ yyreduce:
yystate = yytable[yyn];
else
yystate = yydgoto[yym];
#ifdef YYDEBUG
#if YYDEBUG
if (yydebug)
printf("yydebug: after reduction, shifting from state %d \
to state %d\n", *yyssp, yystate);
printf("%sdebug: after reduction, shifting from state %d \
to state %d\n", YYPREFIX, *yyssp, yystate);
#endif
if (yyssp >= yyss + yystacksize - 1)
{

View File

View File

@ -1,6 +1,62 @@
#ifndef lint
char yysccsid[] = "@(#)yaccpar 1.3 (Berkeley) 01/21/90";
static char yysccsid[] = "@(#)yaccpar 1.9 (Berkeley) 02/21/93";
#endif
#define YYBYACC 1
#define YYMAJOR 1
#define YYMINOR 9
#define yyclearin (yychar=(-1))
#define yyerrok (yyerrflag=0)
#define YYRECOVERING (yyerrflag!=0)
#define YYPREFIX "yy"
#line 26 "ftp.y"
#ifndef lint
static char sccsid[] = "@(#)ftpcmd.y 5.20.1.1 (Berkeley) 3/2/89";
#endif /* not lint */
#include <sys/param.h>
#include <sys/socket.h>
#include <netinet/in.h>
#include <arpa/ftp.h>
#include <stdio.h>
#include <signal.h>
#include <ctype.h>
#include <pwd.h>
#include <setjmp.h>
#include <syslog.h>
#include <sys/stat.h>
#include <time.h>
extern struct sockaddr_in data_dest;
extern int logged_in;
extern struct passwd *pw;
extern int guest;
extern int logging;
extern int type;
extern int form;
extern int debug;
extern int timeout;
extern int maxtimeout;
extern int pdata;
extern char hostname[], remotehost[];
extern char proctitle[];
extern char *globerr;
extern int usedefault;
extern int transflag;
extern char tmpline[];
char **glob();
static int cmd_type;
static int cmd_form;
static int cmd_bytesz;
char cbuf[512];
char *fromname;
char *index();
#line 60 "ftp.tab.c"
#define A 257
#define B 258
#define C 259
@ -65,55 +121,6 @@ char yysccsid[] = "@(#)yaccpar 1.3 (Berkeley) 01/21/90";
#define CHMOD 318
#define LEXERR 319
#define YYERRCODE 256
#line 26 "ftp.y"
#ifndef lint
static char sccsid[] = "@(#)ftpcmd.y 5.20.1.1 (Berkeley) 3/2/89";
#endif /* not lint */
#include <sys//param.h>
#include <sys//socket.h>
#include <netinet//in.h>
#include <arpa//ftp.h>
#include <stdio.h>
#include <signal.h>
#include <ctype.h>
#include <pwd.h>
#include <setjmp.h>
#include <syslog.h>
#include <sys//stat.h>
#include <time.h>
extern struct sockaddr_in data_dest;
extern int logged_in;
extern struct passwd *pw;
extern int guest;
extern int logging;
extern int type;
extern int form;
extern int debug;
extern int timeout;
extern int maxtimeout;
extern int pdata;
extern char hostname[], remotehost[];
extern char proctitle[];
extern char *globerr;
extern int usedefault;
extern int transflag;
extern char tmpline[];
char **glob();
static int cmd_type;
static int cmd_form;
static int cmd_bytesz;
char cbuf[512];
char *fromname;
char *index();
#line 116 "ftp.tab.c"
short yylhs[] = { -1,
0, 0, 0, 1, 1, 1, 1, 1, 1, 1,
1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
@ -351,13 +358,15 @@ char *yyrule[] = {
#ifndef YYSTYPE
typedef int YYSTYPE;
#endif
#define yyclearin (yychar=(-1))
#define yyerrok (yyerrflag=0)
#ifndef YYSTACKSIZE
#ifdef YYSTACKSIZE
#undef YYMAXDEPTH
#define YYMAXDEPTH YYSTACKSIZE
#else
#ifdef YYMAXDEPTH
#define YYSTACKSIZE YYMAXDEPTH
#else
#define YYSTACKSIZE 300
#define YYSTACKSIZE 500
#define YYMAXDEPTH 500
#endif
#endif
int yydebug;
@ -368,9 +377,9 @@ short *yyssp;
YYSTYPE *yyvsp;
YYSTYPE yyval;
YYSTYPE yylval;
#define yystacksize YYSTACKSIZE
short yyss[YYSTACKSIZE];
YYSTYPE yyvs[YYSTACKSIZE];
#define yystacksize YYSTACKSIZE
#line 658 "ftp.y"
extern jmp_buf errcatch;
@ -895,8 +904,9 @@ char *filename;
reply(504, "SIZE not implemented for Type %c.", "?AEIL"[type]);
}
}
#line 898 "ftp.tab.c"
#line 908 "ftp.tab.c"
#define YYABORT goto yyabort
#define YYREJECT goto yyabort
#define YYACCEPT goto yyaccept
#define YYERROR goto yyerrlab
int
@ -910,9 +920,7 @@ yyparse()
if (yys = getenv("YYDEBUG"))
{
yyn = *yys;
if (yyn == '0')
yydebug = 0;
else if (yyn >= '1' && yyn <= '9')
if (yyn >= '0' && yyn <= '9')
yydebug = yyn - '0';
}
#endif
@ -936,8 +944,8 @@ yyloop:
yys = 0;
if (yychar <= YYMAXTOKEN) yys = yyname[yychar];
if (!yys) yys = "illegal-symbol";
printf("yydebug: state %d, reading %d (%s)\n", yystate,
yychar, yys);
printf("%sdebug: state %d, reading %d (%s)\n",
YYPREFIX, yystate, yychar, yys);
}
#endif
}
@ -946,8 +954,8 @@ yyloop:
{
#if YYDEBUG
if (yydebug)
printf("yydebug: state %d, shifting to state %d\n",
yystate, yytable[yyn]);
printf("%sdebug: state %d, shifting to state %d\n",
YYPREFIX, yystate, yytable[yyn]);
#endif
if (yyssp >= yyss + yystacksize - 1)
{
@ -987,8 +995,8 @@ yyinrecovery:
{
#if YYDEBUG
if (yydebug)
printf("yydebug: state %d, error recovery shifting\
to state %d\n", *yyssp, yytable[yyn]);
printf("%sdebug: state %d, error recovery shifting\
to state %d\n", YYPREFIX, *yyssp, yytable[yyn]);
#endif
if (yyssp >= yyss + yystacksize - 1)
{
@ -1002,8 +1010,8 @@ yyinrecovery:
{
#if YYDEBUG
if (yydebug)
printf("yydebug: error recovery discarding state %d\n",
*yyssp);
printf("%sdebug: error recovery discarding state %d\n",
YYPREFIX, *yyssp);
#endif
if (yyssp <= yyss) goto yyabort;
--yyssp;
@ -1020,8 +1028,8 @@ yyinrecovery:
yys = 0;
if (yychar <= YYMAXTOKEN) yys = yyname[yychar];
if (!yys) yys = "illegal-symbol";
printf("yydebug: state %d, error recovery discards token %d (%s)\n",
yystate, yychar, yys);
printf("%sdebug: state %d, error recovery discards token %d (%s)\n",
YYPREFIX, yystate, yychar, yys);
}
#endif
yychar = (-1);
@ -1030,8 +1038,8 @@ yyinrecovery:
yyreduce:
#if YYDEBUG
if (yydebug)
printf("yydebug: state %d, reducing by rule %d (%s)\n",
yystate, yyn, yyrule[yyn]);
printf("%sdebug: state %d, reducing by rule %d (%s)\n",
YYPREFIX, yystate, yyn, yyrule[yyn]);
#endif
yym = yylen[yyn];
yyval = yyvsp[1-yym];
@ -1497,7 +1505,7 @@ break;
case 49:
#line 493 "ftp.y"
{
*(char **)&(yyval ) = "";
*(char **)&(yyval) = "";
}
break;
case 52:
@ -1515,19 +1523,19 @@ break;
case 53:
#line 516 "ftp.y"
{
yyval = FORM_N;
yyval = FORM_N;
}
break;
case 54:
#line 520 "ftp.y"
{
yyval = FORM_T;
yyval = FORM_T;
}
break;
case 55:
#line 524 "ftp.y"
{
yyval = FORM_C;
yyval = FORM_C;
}
break;
case 56:
@ -1588,37 +1596,37 @@ break;
case 64:
#line 572 "ftp.y"
{
yyval = STRU_F;
yyval = STRU_F;
}
break;
case 65:
#line 576 "ftp.y"
{
yyval = STRU_R;
yyval = STRU_R;
}
break;
case 66:
#line 580 "ftp.y"
{
yyval = STRU_P;
yyval = STRU_P;
}
break;
case 67:
#line 586 "ftp.y"
{
yyval = MODE_S;
yyval = MODE_S;
}
break;
case 68:
#line 590 "ftp.y"
{
yyval = MODE_B;
yyval = MODE_B;
}
break;
case 69:
#line 594 "ftp.y"
{
yyval = MODE_C;
yyval = MODE_C;
}
break;
case 70:
@ -1630,14 +1638,14 @@ case 70:
* This is a valid reply in some cases but not in others.
*/
if (logged_in && yyvsp[0] && strncmp((char *) yyvsp[0], "~", 1) == 0) {
*(char **)&(yyval ) = *glob((char *) yyvsp[0]);
*(char **)&(yyval) = *glob((char *) yyvsp[0]);
if (globerr != NULL) {
reply(550, globerr);
yyval = NULL;
yyval = NULL;
}
free((char *) yyvsp[0]);
} else
yyval = yyvsp[0];
yyval = yyvsp[0];
}
break;
case 72:
@ -1662,21 +1670,21 @@ case 72:
multby *= 8;
dec /= 10;
}
yyval = ret;
yyval = ret;
}
break;
case 73:
#line 647 "ftp.y"
{
if (logged_in)
yyval = 1;
yyval = 1;
else {
reply(530, "Please login with USER and PASS.");
yyval = 0;
yyval = 0;
}
}
break;
#line 1679 "ftp.tab.c"
#line 1688 "ftp.tab.c"
}
yyssp -= yym;
yystate = *yyssp;
@ -1684,10 +1692,10 @@ break;
yym = yylhs[yyn];
if (yystate == 0 && yym == 0)
{
#ifdef YYDEBUG
#if YYDEBUG
if (yydebug)
printf("yydebug: after reduction, shifting from state 0 to\
state %d\n", YYFINAL);
printf("%sdebug: after reduction, shifting from state 0 to\
state %d\n", YYPREFIX, YYFINAL);
#endif
yystate = YYFINAL;
*++yyssp = YYFINAL;
@ -1701,8 +1709,8 @@ break;
yys = 0;
if (yychar <= YYMAXTOKEN) yys = yyname[yychar];
if (!yys) yys = "illegal-symbol";
printf("yydebug: state %d, reading %d (%s)\n",
YYFINAL, yychar, yys);
printf("%sdebug: state %d, reading %d (%s)\n",
YYPREFIX, YYFINAL, yychar, yys);
}
#endif
}
@ -1714,10 +1722,10 @@ break;
yystate = yytable[yyn];
else
yystate = yydgoto[yym];
#ifdef YYDEBUG
#if YYDEBUG
if (yydebug)
printf("yydebug: after reduction, shifting from state %d \
to state %d\n", *yyssp, yystate);
printf("%sdebug: after reduction, shifting from state %d \
to state %d\n", YYPREFIX, *yyssp, yystate);
#endif
if (yyssp >= yyss + yystacksize - 1)
{

1180
usr.bin/yacc/test/ftp.y Normal file

File diff suppressed because it is too large Load Diff