📄 ftpcmd.c
字号:
/* A Bison parser, made from ftpcmd.y by GNU Bison version 1.28 */#define YYBISON 1 /* Identify Bison output. */#define A 257#define B 258#define C 259#define E 260#define F 261#define I 262#define L 263#define N 264#define P 265#define R 266#define S 267#define T 268#define SP 269#define CRLF 270#define COMMA 271#define USER 272#define PASS 273#define ACCT 274#define REIN 275#define QUIT 276#define PORT 277#define PASV 278#define TYPE 279#define STRU 280#define MODE 281#define RETR 282#define STOR 283#define APPE 284#define MLFL 285#define MAIL 286#define MSND 287#define MSOM 288#define MSAM 289#define MRSQ 290#define MRCP 291#define ALLO 292#define REST 293#define RNFR 294#define RNTO 295#define ABOR 296#define DELE 297#define CWD 298#define LIST 299#define NLST 300#define SITE 301#define STAT 302#define HELP 303#define NOOP 304#define MKD 305#define RMD 306#define PWD 307#define CDUP 308#define STOU 309#define SMNT 310#define SYST 311#define SIZE 312#define MDTM 313#define UMASK 314#define IDLE 315#define CHMOD 316#define LEXERR 317#define STRING 318#define NUMBER 319#line 37 "ftpcmd.y"#ifndef lintstatic char sccsid[] = "@(#)ftpcmd.y 8.3 (Berkeley) 4/6/94";#endif /* not lint */#ifdef HAVE_CONFIG_H#include <config.h>#endif#include <sys/types.h>#include <sys/param.h>#include <sys/socket.h>#include <sys/stat.h>#include <netinet/in.h>#include <arpa/ftp.h>#include <ctype.h>#include <errno.h>#include <pwd.h>#include <setjmp.h>#include <signal.h>#include <stdio.h>#include <stdlib.h>#include <string.h>#include <syslog.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#include <unistd.h>#include <limits.h>#ifdef HAVE_SYS_UTSNAME_H#include <sys/utsname.h>#endif/* Include glob.h last, because it may define "const" which breaks system headers on some platforms. */#include <glob.h>#include "extern.h"#if ! defined (NBBY) && defined (CHAR_BIT)#define NBBY CHAR_BIT#endifoff_t restart_point;static char cbuf[512]; /* Command Buffer. */static char *fromname;static int cmd_type;static int cmd_form;static int cmd_bytesz;struct tab{ const char *name; short token; short state; short implemented; /* 1 if command is implemented */ const char *help;};extern struct tab cmdtab[];extern struct tab sitetab[];static char *copy (char *);static void help (struct tab *, char *);static struct tab *lookup (struct tab *, char *);static void sizecmd (char *);static int yylex (void);static void yyerror (const char *s);#line 117 "ftpcmd.y"typedef union { int i; char *s;} YYSTYPE;#include <stdio.h>#ifndef __cplusplus#ifndef __STDC__#define const#endif#endif#define YYFINAL 210#define YYFLAG -32768#define YYNTBASE 66#define YYTRANSLATE(x) ((unsigned)(x) <= 319 ? yytranslate[x] : 81)static const char yytranslate[] = { 0, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 1, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, 62, 63, 64, 65};#if YYDEBUG != 0static const short yyprhs[] = { 0, 0, 1, 4, 7, 12, 17, 23, 27, 32, 37, 42, 47, 56, 62, 68, 74, 78, 84, 88, 94, 100, 103, 109, 115, 118, 122, 128, 131, 136, 139, 145, 151, 155, 159, 164, 171, 177, 185, 195, 200, 208, 214, 217, 223, 229, 232, 235, 241, 246, 248, 249, 251, 253, 265, 267, 269, 271, 273, 277, 279, 283, 285, 287, 291, 294, 296, 298, 300, 302, 304, 306, 308, 310, 312};static const short yyrhs[] = { -1, 66, 67, 0, 66, 68, 0, 18, 15, 69, 16, 0, 19, 15, 70, 16, 0, 23, 80, 15, 72, 16, 0, 24, 80, 16, 0, 25, 15, 74, 16, 0, 26, 15, 75, 16, 0, 27, 15, 76, 16, 0, 38, 15, 65, 16, 0, 38, 15, 65, 15, 12, 15, 65, 16, 0, 28, 80, 15, 77, 16, 0, 29, 80, 15, 77, 16, 0, 30, 80, 15, 77, 16, 0, 46, 80, 16, 0, 46, 80, 15, 64, 16, 0, 45, 80, 16, 0, 45, 80, 15, 77, 16, 0, 48, 80, 15, 77, 16, 0, 48, 16, 0, 43, 80, 15, 77, 16, 0, 41, 80, 15, 77, 16, 0, 42, 16, 0, 44, 80, 16, 0, 44, 80, 15, 77, 16, 0, 49, 16, 0, 49, 15, 64, 16, 0, 50, 16, 0, 51, 80, 15, 77, 16, 0, 52, 80, 15, 77, 16, 0, 53, 80, 16, 0, 54, 80, 16, 0, 47, 15, 49, 16, 0, 47, 15, 49, 15, 64, 16, 0, 47, 15, 60, 80, 16, 0, 47, 15, 60, 80, 15, 79, 16, 0, 47, 15, 62, 80, 15, 79, 15, 77, 16, 0, 47, 15, 61, 16, 0, 47, 15, 80, 61, 15, 65, 16, 0, 55, 80, 15, 77, 16, 0, 57, 16, 0, 58, 80, 15, 77, 16, 0, 59, 80, 15, 77, 16, 0, 22, 16, 0, 1, 16, 0, 40, 80, 15, 77, 16, 0, 39, 15, 71, 16, 0, 64, 0, 0, 64, 0, 65, 0, 65, 17, 65, 17, 65, 17, 65, 17, 65, 17, 65, 0, 10, 0, 14, 0, 5, 0, 3, 0, 3, 15, 73, 0, 6, 0, 6, 15, 73, 0, 8, 0, 9, 0, 9, 15, 71, 0, 9, 71, 0, 7, 0, 12, 0, 11, 0, 13, 0, 4, 0, 5, 0, 78, 0, 64, 0, 65, 0, 0};#endif#if YYDEBUG != 0static const short yyrline[] = { 0, 152, 153, 160, 164, 169, 175, 197, 202, 237, 249, 261, 265, 269, 276, 283, 290, 295, 302, 307, 314, 321, 325, 332, 345, 349, 354, 361, 365, 382, 386, 393, 400, 405, 410, 414, 420, 430, 445, 459, 465, 481, 488, 534, 551, 573, 578, 584, 595, 610, 614, 618, 622, 626, 640, 644, 648, 655, 660, 665, 670, 675, 679, 684, 690, 698, 702, 706, 713, 717, 721, 728, 765, 769, 796};#endif#if YYDEBUG != 0 || defined (YYERROR_VERBOSE)static const char * const yytname[] = { "$","error","$undefined.","A","B","C","E","F","I","L","N","P","R","S","T","SP","CRLF","COMMA","USER","PASS","ACCT","REIN","QUIT","PORT","PASV","TYPE","STRU","MODE","RETR","STOR","APPE","MLFL","MAIL","MSND","MSOM","MSAM","MRSQ","MRCP","ALLO","REST","RNFR","RNTO","ABOR","DELE","CWD","LIST","NLST","SITE","STAT","HELP","NOOP","MKD","RMD","PWD","CDUP","STOU","SMNT","SYST","SIZE","MDTM","UMASK","IDLE","CHMOD","LEXERR","STRING","NUMBER","cmd_list","cmd","rcmd","username","password","byte_size","host_port","form_code","type_code","struct_code","mode_code","pathname","pathstring","octal_number","check_login", NULL};#endifstatic const short yyr1[] = { 0, 66, 66, 66, 67, 67, 67, 67, 67, 67, 67, 67, 67, 67, 67, 67, 67, 67, 67, 67, 67, 67, 67, 67, 67, 67, 67, 67, 67, 67, 67, 67, 67, 67, 67, 67, 67, 67, 67, 67, 67, 67, 67, 67, 67, 67, 67, 68, 68, 69, 70, 70, 71, 72, 73, 73, 73, 74, 74, 74, 74, 74, 74, 74, 74, 75, 75, 75, 76, 76, 76, 77, 78, 79, 80};static const short yyr2[] = { 0, 0, 2, 2, 4, 4, 5, 3, 4, 4, 4, 4, 8, 5, 5, 5, 3, 5, 3, 5, 5, 2, 5, 5, 2, 3, 5, 2, 4, 2, 5, 5, 3, 3, 4, 6, 5, 7, 9, 4, 7, 5, 2, 5, 5, 2, 2, 5, 4, 1, 0, 1, 1, 11, 1, 1, 1, 1, 3, 1, 3, 1, 1, 3, 2, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0};static const short yydefact[] = { 1, 0, 0, 0, 0, 0, 74, 74, 0, 0, 0, 74, 74, 74, 0, 0, 74, 74, 0, 74, 74, 74, 74, 0, 74, 0, 0, 74, 74, 74, 74, 74, 0, 74, 74, 2, 3, 46, 0, 50, 45, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 24, 0, 0, 0, 0, 0, 21, 0, 0, 27, 29, 0, 0, 0, 0, 0, 42, 0, 0, 49, 0, 51, 0, 0, 7, 57, 59, 61, 62, 0, 65, 67, 66, 0, 69, 70, 68, 0, 0, 0, 0, 0, 52, 0, 0, 0, 0, 0, 25, 0, 18, 0, 16, 0, 74, 0, 74, 0, 0, 0, 0, 0, 32, 33, 0, 0, 0, 4, 5, 0, 0, 0, 0, 0, 64, 8, 9, 10, 72, 0, 71, 0, 0, 0, 11, 48, 0, 0, 0, 0, 0, 0, 0, 34, 0, 39, 0, 0, 0, 28, 0, 0, 0, 0, 0, 0, 6, 56, 54, 55, 58, 60, 63, 13, 14, 15, 0, 47, 23, 22, 26, 19, 17, 0, 0, 36, 0, 0, 20, 30, 31, 41, 43, 44, 0, 0, 35, 73, 0, 0, 0, 0, 0, 37, 0, 40, 0, 12, 0, 0, 38, 0, 0, 0, 0, 53, 0, 0};static const short yydefgoto[] = { 1, 35, 36, 73, 75, 96, 123, 163, 82, 86, 90, 132, 133, 191, 41};static const short yypact[] = {-32768, 42, -7, 8, 20, 24,-32768,-32768, 44, 59, 62,-32768,-32768,-32768, 83, 89,-32768,-32768, 47,-32768,-32768,-32768,-32768, 97, 98, 16, 99,-32768,-32768,-32768,-32768,-32768, 100,-32768,-32768,-32768,-32768,-32768, 49, 53,-32768, 103, 104, 70, 6, 7, 106, 107, 108, 54, 60, 112, 113,-32768, 114, 39, 41, 87, -46,-32768, 115, 67,-32768,-32768, 117, 118, 119, 120, 122,-32768, 123, 124,-32768, 125,-32768, 126, 69,-32768, 128, 129,-32768, -13, 130,-32768,-32768,-32768, 131,-32768,-32768,-32768, 132, 76, 76, 76, 91,-32768, 133, 76, 76, 76, 76,-32768, 76,-32768, 81,-32768, 93,-32768, 134,-32768, 90, 76, 136, 76, 76,-32768,-32768, 76, 76, 76,-32768,-32768, 137, 139, 48, 48, 60,-32768,-32768,-32768,-32768,-32768, 140,-32768, 141, 142, 147,-32768,-32768, 144, 145, 146, 148, 149, 150, 105,-32768, 95,-32768, 138, 152, 154,-32768, 155, 156, 157, 158, 159, 111,-32768,-32768,-32768,-32768,-32768,-32768,-32768,-32768,-32768,-32768, 153,-32768,-32768,-32768,-32768,-32768,-32768, 161, 116,-32768, 116, 121,-32768,-32768,-32768,-32768,-32768,-32768, 162, 127,-32768,-32768, 164, 163, 166, 135, 167,-32768, 76,-32768, 168,-32768, 171, 143,-32768, 172, 151, 173, 160,-32768, 184,-32768};static const short yypgoto[] = {-32768,-32768,-32768,-32768,-32768, -77,-32768, 38,-32768,-32768,-32768, -92,-32768, 9, 17};#define YYLAST 225static const short yytable[] = { 134, 135, 126, 106, 127, 139, 140, 141, 142, 37, 143, 87, 88, 83, 107, 108, 109, 84, 85, 151, 89, 153, 154, 38, 42, 155, 156, 157, 46, 47, 48, 61, 62, 51, 52, 39, 54, 55, 56, 57, 40, 60, 209, 2, 64, 65, 66, 67, 68, 165, 70, 71, 95, 160, 100, 101, 102, 103, 161, 43, 3, 4, 162, 53, 5, 6, 7, 8, 9, 10, 11, 12, 13, 78, 44, 110, 79, 45, 80, 81, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 49, 32, 33, 34, 104, 105, 50, 201, 136, 137, 145, 146, 177, 178, 58, 72, 59, 63, 69, 74, 76, 94, 77, 91, 92, 93, 147, 95, 149, 97, 98, 99, 111, 112, 113, 114, 122, 115, 116, 117, 118, 119, 131, 120, 121, 124, 125, 144, 128, 129, 130, 138, 148, 150, 152, 179, 158, 159, 166, 167, 168, 169, 170, 171, 172, 164, 173, 174, 175, 180, 188, 176, 181, 182, 183, 184, 185, 186, 187, 189, 197, 194, 196, 190, 198, 200, 210, 202, 193, 203, 192, 205, 207, 0, 195, 0, 0, 0, 0, 0, 0, 0, 199, 0, 0, 0, 0, 0, 0, 0, 204, 0, 0, 0, 0, 0, 0, 0, 206, 0, 0, 0, 0, 0, 0, 0, 0, 208};static const short yycheck[] = { 92, 93, 15, 49, 81, 97, 98, 99, 100, 16, 102, 4, 5, 7, 60, 61, 62, 11, 12, 111, 13, 113, 114, 15, 7, 117, 118, 119, 11, 12, 13, 15, 16, 16, 17, 15, 19, 20, 21, 22, 16, 24, 0, 1, 27, 28, 29, 30, 31, 126, 33, 34, 65, 5, 15, 16, 15, 16, 10, 15, 18, 19, 14, 16, 22, 23, 24, 25, 26, 27, 28, 29, 30, 3, 15, 58, 6, 15, 8, 9, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, 53, 54, 55, 15, 57, 58, 59, 15, 16, 15, 197, 15, 16, 15, 16, 15, 16, 15, 64, 16, 16, 16, 64, 15, 65, 16, 15, 15, 15, 107, 65, 109, 15, 15, 15, 15, 64, 15, 15, 65, 16, 16, 15, 15, 15, 64, 16, 16, 15, 15, 64, 16, 16, 16, 16, 16, 61, 16, 15, 17, 16, 16, 16, 16, 12, 16, 16, 16, 125, 16, 16, 16, 15, 15, 64, 16, 16, 16, 16, 16, 16, 65, 16, 15, 17, 16, 65, 16, 16, 0, 17, 65, 16, 179, 17, 17, -1, 65, -1, -1, -1, -1, -1, -1, -1, 65, -1, -1, -1, -1, -1, -1, -1, 65, -1, -1, -1, -1, -1, -1, -1, 65, -1, -1, -1, -1, -1, -1, -1, -1, 65};/* -*-C-*- Note some compilers choke on comments on `#line' lines. */#line 3 "/usr/share/bison.simple"/* This file comes from bison-1.28. *//* Skeleton output parser for bison, Copyright (C) 1984, 1989, 1990 Free Software Foundation, Inc. This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. *//* As a special exception, when this file is copied by Bison into a Bison output file, you may use that output file without restriction. This special exception was added by the Free Software Foundation in version 1.24 of Bison. *//* This is the parser code that is written into each bison parser when the %semantic_parser declaration is not specified in the grammar. It was written by Richard Stallman by simplifying the hairy parser used when %semantic_parser is specified. */#ifndef YYSTACK_USE_ALLOCA#ifdef alloca#define YYSTACK_USE_ALLOCA#else /* alloca not defined */#ifdef __GNUC__#define YYSTACK_USE_ALLOCA#define alloca __builtin_alloca#else /* not GNU C. */#if (!defined (__STDC__) && defined (sparc)) || defined (__sparc__) || defined (__sparc) || defined (__sgi) || (defined (__sun) && defined (__i386))#define YYSTACK_USE_ALLOCA#include <alloca.h>#else /* not sparc *//* We think this test detects Watcom and Microsoft C. *//* This used to test MSDOS, but that is a bad idea since that symbol is in the user namespace. */#if (defined (_MSDOS) || defined (_MSDOS_)) && !defined (__TURBOC__)#if 0 /* No need for malloc.h, which pollutes the namespace; instead, just don't use alloca. */#include <malloc.h>#endif#else /* not MSDOS, or __TURBOC__ */#if defined(_AIX)/* I don't know what this was needed for, but it pollutes the namespace. So I turned it off. rms, 2 May 1997. *//* #include <malloc.h> */ #pragma alloca#define YYSTACK_USE_ALLOCA#else /* not MSDOS, or __TURBOC__, or _AIX */#if 0#ifdef __hpux /* haible@ilog.fr says this works for HPUX 9.05 and up, and on HPUX 10. Eventually we can turn this on. */#define YYSTACK_USE_ALLOCA#define alloca __builtin_alloca#endif /* __hpux */#endif#endif /* not _AIX */#endif /* not MSDOS, or __TURBOC__ */#endif /* not sparc */#endif /* not GNU C */#endif /* alloca not defined */#endif /* YYSTACK_USE_ALLOCA not defined */#ifdef YYSTACK_USE_ALLOCA#define YYSTACK_ALLOC alloca#else#define YYSTACK_ALLOC malloc#endif/* Note: there must be only one dollar sign in this file. It is replaced by the list of actions, each action as one case of the switch. */#define yyerrok (yyerrstatus = 0)#define yyclearin (yychar = YYEMPTY)#define YYEMPTY -2#define YYEOF 0#define YYACCEPT goto yyacceptlab#define YYABORT goto yyabortlab#define YYERROR goto yyerrlab1/* Like YYERROR except do call yyerror. This remains here temporarily to ease the transition to the new meaning of YYERROR, for GCC. Once GCC version 2 has supplanted version 1, this can go. */#define YYFAIL goto yyerrlab#define YYRECOVERING() (!!yyerrstatus)#define YYBACKUP(token, value) \do \ if (yychar == YYEMPTY && yylen == 1) \ { yychar = (token), yylval = (value); \ yychar1 = YYTRANSLATE (yychar); \ YYPOPSTACK; \ goto yybackup; \ } \ else \ { yyerror ("syntax error: cannot back up"); YYERROR; } \while (0)#define YYTERROR 1#define YYERRCODE 256#ifndef YYPURE#define YYLEX yylex()#endif#ifdef YYPURE#ifdef YYLSP_NEEDED#ifdef YYLEX_PARAM#define YYLEX yylex(&yylval, &yylloc, YYLEX_PARAM)#else#define YYLEX yylex(&yylval, &yylloc)#endif#else /* not YYLSP_NEEDED */#ifdef YYLEX_PARAM#define YYLEX yylex(&yylval, YYLEX_PARAM)#else#define YYLEX yylex(&yylval)#endif#endif /* not YYLSP_NEEDED */#endif/* If nonreentrant, generate the variables here */#ifndef YYPUREint yychar; /* the lookahead symbol */YYSTYPE yylval; /* the semantic value of the */ /* lookahead symbol */#ifdef YYLSP_NEEDEDYYLTYPE yylloc; /* location data for the lookahead */ /* symbol */#endifint yynerrs; /* number of parse errors so far */#endif /* not YYPURE */#if YYDEBUG != 0int yydebug; /* nonzero means print parse trace *//* Since this is uninitialized, it does not stop multiple parsers from coexisting. */#endif/* YYINITDEPTH indicates the initial size of the parser's stacks */#ifndef YYINITDEPTH#define YYINITDEPTH 200#endif/* YYMAXDEPTH is the maximum size the stacks can grow to (effective only if the built-in stack extension method is used). */#if YYMAXDEPTH == 0#undef YYMAXDEPTH#endif#ifndef YYMAXDEPTH#define YYMAXDEPTH 10000#endif/* Define __yy_memcpy. Note that the size argument should be passed with type unsigned int, because that is what the non-GCC definitions require. With GCC, __builtin_memcpy takes an arg of type size_t, but it can handle unsigned int. */#if __GNUC__ > 1 /* GNU C and GNU C++ define this. */#define __yy_memcpy(TO,FROM,COUNT) __builtin_memcpy(TO,FROM,COUNT)#else /* not GNU C or C++ */#ifndef __cplusplus/* This is the most reliable way to avoid incompatibilities in available built-in functions on various systems. */static void__yy_memcpy (to, from, count) char *to; char *from; unsigned int count;{ register char *f = from; register char *t = to; register int i = count;
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -