1 /* A Bison parser, made by GNU Bison 2.3. */
3 /* Skeleton implementation for Bison's Yacc-like parsers in C
5 Copyright (C) 1984, 1989, 1990, 2000, 2001, 2002, 2003, 2004, 2005, 2006
6 Free Software Foundation, Inc.
8 This program is free software; you can redistribute it and/or modify
9 it under the terms of the GNU General Public License as published by
10 the Free Software Foundation; either version 2, or (at your option)
13 This program is distributed in the hope that it will be useful,
14 but WITHOUT ANY WARRANTY; without even the implied warranty of
15 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16 GNU General Public License for more details.
18 You should have received a copy of the GNU General Public License
19 along with this program; if not, write to the Free Software
20 Foundation, Inc., 51 Franklin Street, Fifth Floor,
21 Boston, MA 02110-1301, USA. */
23 /* As a special exception, you may create a larger work that contains
24 part or all of the Bison parser skeleton and distribute that work
25 under terms of your choice, so long as that work isn't itself a
26 parser generator using the skeleton or a modified version thereof
27 as a parser skeleton. Alternatively, if you modify or redistribute
28 the parser skeleton itself, you may (at your option) remove this
29 special exception, which will cause the skeleton and the resulting
30 Bison output files to be licensed under the GNU General Public
31 License without this special exception.
33 This special exception was added by the Free Software Foundation in
34 version 2.2 of Bison. */
36 /* C LALR(1) parser skeleton written by Richard Stallman, by
37 simplifying the original so-called "semantic" parser. */
39 /* All symbols defined below should begin with yy or YY, to avoid
40 infringing on user name space. This should be done even for local
41 variables, as they might otherwise be expanded by user macros.
42 There are some unavoidable exceptions within include files to
43 define necessary library symbols; they are noted "INFRINGES ON
44 USER NAME SPACE" below. */
46 /* Identify Bison output. */
50 #define YYBISON_VERSION "2.3"
53 #define YYSKELETON_NAME "yacc.c"
58 /* Using locations. */
59 #define YYLSP_NEEDED 0
66 /* Put the tokens into the symbol table, so that GDB and other debuggers
227 #define KRBTKFILE 331
240 /* Copy the first part of user declarations. */
244 #include "ftpd_locl.h"
245 __RCSID("$Heimdal: ftpcmd.y 15677 2005-07-19 18:33:08Z lha $"
250 static int hasyyerrored
;
255 static int cmd_bytesz
;
263 short implemented
; /* 1 if command is implemented */
267 extern struct tab cmdtab
[];
268 extern struct tab sitetab
[];
270 static char *copy (char *);
271 static void help (struct tab
*, char *);
273 lookup (struct tab
*, char *);
274 static void sizecmd (char *);
275 static RETSIGTYPE
toolong (int);
276 static int yylex (void);
278 /* This is for bison */
280 #if !defined(alloca) && !defined(HAVE_ALLOCA)
281 #define alloca(x) malloc(x)
286 /* Enabling traces. */
291 /* Enabling verbose error messages. */
292 #ifdef YYERROR_VERBOSE
293 # undef YYERROR_VERBOSE
294 # define YYERROR_VERBOSE 1
296 # define YYERROR_VERBOSE 0
299 /* Enabling the token table. */
300 #ifndef YYTOKEN_TABLE
301 # define YYTOKEN_TABLE 0
304 #if ! defined YYSTYPE && ! defined YYSTYPE_IS_DECLARED
305 typedef union YYSTYPE
311 /* Line 193 of yacc.c. */
314 # define yystype YYSTYPE /* obsolescent; will be withdrawn */
315 # define YYSTYPE_IS_DECLARED 1
316 # define YYSTYPE_IS_TRIVIAL 1
321 /* Copy the second part of user declarations. */
324 /* Line 216 of yacc.c. */
332 typedef YYTYPE_UINT8 yytype_uint8
;
334 typedef unsigned char yytype_uint8
;
338 typedef YYTYPE_INT8 yytype_int8
;
339 #elif (defined __STDC__ || defined __C99__FUNC__ \
340 || defined __cplusplus || defined _MSC_VER)
341 typedef signed char yytype_int8
;
343 typedef short int yytype_int8
;
347 typedef YYTYPE_UINT16 yytype_uint16
;
349 typedef unsigned short int yytype_uint16
;
353 typedef YYTYPE_INT16 yytype_int16
;
355 typedef short int yytype_int16
;
359 # ifdef __SIZE_TYPE__
360 # define YYSIZE_T __SIZE_TYPE__
361 # elif defined size_t
362 # define YYSIZE_T size_t
363 # elif ! defined YYSIZE_T && (defined __STDC__ || defined __C99__FUNC__ \
364 || defined __cplusplus || defined _MSC_VER)
365 # include <stddef.h> /* INFRINGES ON USER NAME SPACE */
366 # define YYSIZE_T size_t
368 # define YYSIZE_T unsigned int
372 #define YYSIZE_MAXIMUM ((YYSIZE_T) -1)
375 # if defined YYENABLE_NLS && YYENABLE_NLS
377 # include <libintl.h> /* INFRINGES ON USER NAME SPACE */
378 # define YY_(msgid) dgettext ("bison-runtime", msgid)
382 # define YY_(msgid) msgid
386 /* Suppress unused-variable warnings by "using" E. */
387 #if ! defined lint || defined __GNUC__
388 # define YYUSE(e) ((void) (e))
390 # define YYUSE(e) /* empty */
393 /* Identity function, used to suppress warnings about constant conditions. */
397 #if (defined __STDC__ || defined __C99__FUNC__ \
398 || defined __cplusplus || defined _MSC_VER)
411 #if ! defined yyoverflow || YYERROR_VERBOSE
413 /* The parser invokes alloca or malloc; define the necessary symbols. */
415 # ifdef YYSTACK_USE_ALLOCA
416 # if YYSTACK_USE_ALLOCA
418 # define YYSTACK_ALLOC __builtin_alloca
419 # elif defined __BUILTIN_VA_ARG_INCR
420 # include <alloca.h> /* INFRINGES ON USER NAME SPACE */
422 # define YYSTACK_ALLOC __alloca
423 # elif defined _MSC_VER
424 # include <malloc.h> /* INFRINGES ON USER NAME SPACE */
425 # define alloca _alloca
427 # define YYSTACK_ALLOC alloca
428 # if ! defined _ALLOCA_H && ! defined _STDLIB_H && (defined __STDC__ || defined __C99__FUNC__ \
429 || defined __cplusplus || defined _MSC_VER)
430 # include <stdlib.h> /* INFRINGES ON USER NAME SPACE */
439 # ifdef YYSTACK_ALLOC
440 /* Pacify GCC's `empty if-body' warning. */
441 # define YYSTACK_FREE(Ptr) do { /* empty */; } while (YYID (0))
442 # ifndef YYSTACK_ALLOC_MAXIMUM
443 /* The OS might guarantee only one guard page at the bottom of the stack,
444 and a page size can be as small as 4096 bytes. So we cannot safely
445 invoke alloca (N) if N exceeds 4096. Use a slightly smaller number
446 to allow for a few compiler-allocated temporary stack slots. */
447 # define YYSTACK_ALLOC_MAXIMUM 4032 /* reasonable circa 2006 */
450 # define YYSTACK_ALLOC YYMALLOC
451 # define YYSTACK_FREE YYFREE
452 # ifndef YYSTACK_ALLOC_MAXIMUM
453 # define YYSTACK_ALLOC_MAXIMUM YYSIZE_MAXIMUM
455 # if (defined __cplusplus && ! defined _STDLIB_H \
456 && ! ((defined YYMALLOC || defined malloc) \
457 && (defined YYFREE || defined free)))
458 # include <stdlib.h> /* INFRINGES ON USER NAME SPACE */
464 # define YYMALLOC malloc
465 # if ! defined malloc && ! defined _STDLIB_H && (defined __STDC__ || defined __C99__FUNC__ \
466 || defined __cplusplus || defined _MSC_VER)
467 void *malloc (YYSIZE_T
); /* INFRINGES ON USER NAME SPACE */
472 # if ! defined free && ! defined _STDLIB_H && (defined __STDC__ || defined __C99__FUNC__ \
473 || defined __cplusplus || defined _MSC_VER)
474 void free (void *); /* INFRINGES ON USER NAME SPACE */
478 #endif /* ! defined yyoverflow || YYERROR_VERBOSE */
481 #if (! defined yyoverflow \
482 && (! defined __cplusplus \
483 || (defined YYSTYPE_IS_TRIVIAL && YYSTYPE_IS_TRIVIAL)))
485 /* A type that is properly aligned for any stack member. */
492 /* The size of the maximum gap between one aligned stack and the next. */
493 # define YYSTACK_GAP_MAXIMUM (sizeof (union yyalloc) - 1)
495 /* The size of an array large to enough to hold all stacks, each with
497 # define YYSTACK_BYTES(N) \
498 ((N) * (sizeof (yytype_int16) + sizeof (YYSTYPE)) \
499 + YYSTACK_GAP_MAXIMUM)
501 /* Copy COUNT objects from FROM to TO. The source and destination do
504 # if defined __GNUC__ && 1 < __GNUC__
505 # define YYCOPY(To, From, Count) \
506 __builtin_memcpy (To, From, (Count) * sizeof (*(From)))
508 # define YYCOPY(To, From, Count) \
512 for (yyi = 0; yyi < (Count); yyi++) \
513 (To)[yyi] = (From)[yyi]; \
519 /* Relocate STACK from its old location to the new one. The
520 local variables YYSIZE and YYSTACKSIZE give the old and new number of
521 elements in the stack, and YYPTR gives the new location of the
522 stack. Advance YYPTR to a properly aligned location for the next
524 # define YYSTACK_RELOCATE(Stack) \
527 YYSIZE_T yynewbytes; \
528 YYCOPY (&yyptr->Stack, Stack, yysize); \
529 Stack = &yyptr->Stack; \
530 yynewbytes = yystacksize * sizeof (*Stack) + YYSTACK_GAP_MAXIMUM; \
531 yyptr += yynewbytes / sizeof (*yyptr); \
537 /* YYFINAL -- State number of the termination state. */
539 /* YYLAST -- Last index in YYTABLE. */
542 /* YYNTOKENS -- Number of terminals. */
544 /* YYNNTS -- Number of nonterminals. */
546 /* YYNRULES -- Number of rules. */
548 /* YYNRULES -- Number of states. */
549 #define YYNSTATES 317
551 /* YYTRANSLATE(YYLEX) -- Bison symbol number corresponding to YYLEX. */
553 #define YYMAXUTOK 339
555 #define YYTRANSLATE(YYX) \
556 ((unsigned int) (YYX) <= YYMAXUTOK ? yytranslate[YYX] : YYUNDEFTOK)
558 /* YYTRANSLATE[YYLEX] -- Bison symbol number corresponding to YYLEX. */
559 static const yytype_uint8 yytranslate
[] =
561 0, 2, 2, 2, 2, 2, 2, 2, 2, 2,
562 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
563 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
564 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
565 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
566 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
567 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
568 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
569 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
570 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
571 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
572 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
573 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
574 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
575 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
576 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
577 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
578 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
579 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
580 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
581 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
582 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
583 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
584 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
585 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
586 2, 2, 2, 2, 2, 2, 1, 2, 3, 4,
587 5, 6, 7, 8, 9, 10, 11, 12, 13, 14,
588 15, 16, 17, 18, 19, 20, 21, 22, 23, 24,
589 25, 26, 27, 28, 29, 30, 31, 32, 33, 34,
590 35, 36, 37, 38, 39, 40, 41, 42, 43, 44,
591 45, 46, 47, 48, 49, 50, 51, 52, 53, 54,
592 55, 56, 57, 58, 59, 60, 61, 62, 63, 64,
593 65, 66, 67, 68, 69, 70, 71, 72, 73, 74,
594 75, 76, 77, 78, 79, 80, 81, 82, 83, 84
598 /* YYPRHS[YYN] -- Index of the first RHS symbol of rule number YYN in
600 static const yytype_uint16 yyprhs
[] =
602 0, 0, 3, 4, 7, 10, 16, 22, 28, 34,
603 38, 42, 48, 54, 60, 66, 72, 82, 88, 94,
604 100, 104, 110, 114, 120, 126, 130, 136, 142, 146,
605 150, 156, 160, 166, 170, 176, 182, 186, 190, 194,
606 200, 206, 214, 220, 228, 238, 244, 252, 260, 266,
607 272, 280, 286, 294, 302, 308, 314, 318, 324, 330,
608 334, 337, 343, 349, 354, 359, 365, 371, 375, 380,
609 385, 390, 392, 393, 395, 397, 409, 411, 413, 415,
610 417, 421, 423, 427, 429, 431, 435, 438, 440, 442,
611 444, 446, 448, 450, 452, 454, 456, 458, 460
614 /* YYRHS -- A `-1'-separated list of the rules' RHS. */
615 static const yytype_int8 yyrhs
[] =
617 86, 0, -1, -1, 86, 87, -1, 86, 88, -1,
618 18, 15, 89, 16, 102, -1, 19, 15, 90, 16,
619 102, -1, 23, 15, 92, 16, 102, -1, 60, 15,
620 83, 16, 102, -1, 24, 16, 101, -1, 61, 16,
621 101, -1, 61, 15, 83, 16, 101, -1, 25, 15,
622 94, 16, 102, -1, 26, 15, 95, 16, 102, -1,
623 27, 15, 96, 16, 102, -1, 38, 15, 84, 16,
624 102, -1, 38, 15, 84, 15, 12, 15, 84, 16,
625 102, -1, 28, 15, 97, 16, 101, -1, 29, 15,
626 97, 16, 101, -1, 30, 15, 97, 16, 101, -1,
627 46, 16, 101, -1, 46, 15, 83, 16, 101, -1,
628 45, 16, 101, -1, 45, 15, 97, 16, 101, -1,
629 48, 15, 97, 16, 101, -1, 48, 16, 102, -1,
630 43, 15, 97, 16, 100, -1, 41, 15, 97, 16,
631 100, -1, 42, 16, 102, -1, 44, 16, 101, -1,
632 44, 15, 97, 16, 101, -1, 49, 16, 102, -1,
633 49, 15, 83, 16, 102, -1, 50, 16, 102, -1,
634 51, 15, 97, 16, 101, -1, 52, 15, 97, 16,
635 100, -1, 53, 16, 101, -1, 54, 16, 101, -1,
636 80, 16, 102, -1, 81, 15, 83, 16, 102, -1,
637 47, 15, 49, 16, 102, -1, 47, 15, 49, 15,
638 83, 16, 102, -1, 47, 15, 62, 16, 101, -1,
639 47, 15, 62, 15, 99, 16, 100, -1, 47, 15,
640 64, 15, 99, 15, 97, 16, 100, -1, 47, 15,
641 63, 16, 102, -1, 47, 15, 63, 15, 84, 16,
642 102, -1, 47, 15, 73, 15, 83, 16, 101, -1,
643 47, 15, 74, 16, 101, -1, 47, 15, 75, 16,
644 101, -1, 47, 15, 76, 15, 83, 16, 101, -1,
645 47, 15, 77, 16, 101, -1, 47, 15, 77, 15,
646 83, 16, 101, -1, 47, 15, 78, 15, 83, 16,
647 101, -1, 47, 15, 79, 16, 102, -1, 55, 15,
648 97, 16, 101, -1, 57, 16, 102, -1, 58, 15,
649 97, 16, 101, -1, 59, 15, 97, 16, 101, -1,
650 22, 16, 102, -1, 1, 16, -1, 40, 15, 97,
651 16, 100, -1, 39, 15, 91, 16, 102, -1, 65,
652 15, 83, 16, -1, 66, 15, 83, 16, -1, 68,
653 15, 84, 16, 102, -1, 67, 15, 83, 16, 102,
654 -1, 69, 16, 102, -1, 70, 15, 83, 16, -1,
655 71, 15, 83, 16, -1, 72, 15, 83, 16, -1,
656 83, -1, -1, 83, -1, 84, -1, 84, 17, 84,
657 17, 84, 17, 84, 17, 84, 17, 84, -1, 10,
658 -1, 14, -1, 5, -1, 3, -1, 3, 15, 93,
659 -1, 6, -1, 6, 15, 93, -1, 8, -1, 9,
660 -1, 9, 15, 91, -1, 9, 91, -1, 7, -1,
661 12, -1, 11, -1, 13, -1, 4, -1, 5, -1,
662 98, -1, 83, -1, 84, -1, 101, -1, 102, -1,
666 /* YYRLINE[YYN] -- source line where rule number YYN was defined. */
667 static const yytype_uint16 yyrline
[] =
669 0, 129, 129, 131, 136, 140, 146, 153, 164, 170,
670 175, 180, 186, 223, 237, 251, 257, 263, 272, 281,
671 290, 295, 304, 309, 315, 322, 327, 334, 348, 353,
672 358, 365, 370, 387, 392, 399, 406, 411, 416, 426,
673 433, 438, 443, 451, 464, 478, 485, 502, 525, 530,
674 539, 552, 563, 576, 583, 588, 595, 613, 630, 658,
675 665, 671, 681, 691, 696, 701, 706, 711, 716, 721,
676 726, 734, 739, 742, 746, 750, 763, 767, 771, 778,
677 783, 788, 793, 798, 802, 807, 813, 821, 825, 829,
678 836, 840, 844, 851, 879, 883, 909, 917, 928
682 #if YYDEBUG || YYERROR_VERBOSE || YYTOKEN_TABLE
683 /* YYTNAME[SYMBOL-NUM] -- String name of the symbol SYMBOL-NUM.
684 First, the terminals, then, starting at YYNTOKENS, nonterminals. */
685 static const char *const yytname
[] =
687 "$end", "error", "$undefined", "A", "B", "C", "E", "F", "I", "L", "N",
688 "P", "R", "S", "T", "SP", "CRLF", "COMMA", "USER", "PASS", "ACCT",
689 "REIN", "QUIT", "PORT", "PASV", "TYPE", "STRU", "MODE", "RETR", "STOR",
690 "APPE", "MLFL", "MAIL", "MSND", "MSOM", "MSAM", "MRSQ", "MRCP", "ALLO",
691 "REST", "RNFR", "RNTO", "ABOR", "DELE", "CWD", "LIST", "NLST", "SITE",
692 "sTAT", "HELP", "NOOP", "MKD", "RMD", "PWD", "CDUP", "STOU", "SMNT",
693 "SYST", "SIZE", "MDTM", "EPRT", "EPSV", "UMASK", "IDLE", "CHMOD", "AUTH",
694 "ADAT", "PROT", "PBSZ", "CCC", "MIC", "CONF", "ENC", "KAUTH", "KLIST",
695 "KDESTROY", "KRBTKFILE", "AFSLOG", "LOCATE", "URL", "FEAT", "OPTS",
696 "LEXERR", "STRING", "NUMBER", "$accept", "cmd_list", "cmd", "rcmd",
697 "username", "password", "byte_size", "host_port", "form_code",
698 "type_code", "struct_code", "mode_code", "pathname", "pathstring",
699 "octal_number", "check_login_no_guest", "check_login", "check_secure", 0
704 /* YYTOKNUM[YYLEX-NUM] -- Internal token number corresponding to
706 static const yytype_uint16 yytoknum
[] =
708 0, 256, 257, 258, 259, 260, 261, 262, 263, 264,
709 265, 266, 267, 268, 269, 270, 271, 272, 273, 274,
710 275, 276, 277, 278, 279, 280, 281, 282, 283, 284,
711 285, 286, 287, 288, 289, 290, 291, 292, 293, 294,
712 295, 296, 297, 298, 299, 300, 301, 302, 303, 304,
713 305, 306, 307, 308, 309, 310, 311, 312, 313, 314,
714 315, 316, 317, 318, 319, 320, 321, 322, 323, 324,
715 325, 326, 327, 328, 329, 330, 331, 332, 333, 334,
716 335, 336, 337, 338, 339
720 /* YYR1[YYN] -- Symbol number of symbol that rule YYN derives. */
721 static const yytype_uint8 yyr1
[] =
723 0, 85, 86, 86, 86, 87, 87, 87, 87, 87,
724 87, 87, 87, 87, 87, 87, 87, 87, 87, 87,
725 87, 87, 87, 87, 87, 87, 87, 87, 87, 87,
726 87, 87, 87, 87, 87, 87, 87, 87, 87, 87,
727 87, 87, 87, 87, 87, 87, 87, 87, 87, 87,
728 87, 87, 87, 87, 87, 87, 87, 87, 87, 87,
729 87, 88, 88, 88, 88, 88, 88, 88, 88, 88,
730 88, 89, 90, 90, 91, 92, 93, 93, 93, 94,
731 94, 94, 94, 94, 94, 94, 94, 95, 95, 95,
732 96, 96, 96, 97, 98, 99, 100, 101, 102
735 /* YYR2[YYN] -- Number of symbols composing right hand side of rule YYN. */
736 static const yytype_uint8 yyr2
[] =
738 0, 2, 0, 2, 2, 5, 5, 5, 5, 3,
739 3, 5, 5, 5, 5, 5, 9, 5, 5, 5,
740 3, 5, 3, 5, 5, 3, 5, 5, 3, 3,
741 5, 3, 5, 3, 5, 5, 3, 3, 3, 5,
742 5, 7, 5, 7, 9, 5, 7, 7, 5, 5,
743 7, 5, 7, 7, 5, 5, 3, 5, 5, 3,
744 2, 5, 5, 4, 4, 5, 5, 3, 4, 4,
745 4, 1, 0, 1, 1, 11, 1, 1, 1, 1,
746 3, 1, 3, 1, 1, 3, 2, 1, 1, 1,
747 1, 1, 1, 1, 1, 1, 1, 1, 0
750 /* YYDEFACT[STATE-NAME] -- Default rule to reduce with in state
751 STATE-NUM when YYTABLE doesn't specify something else to do. Zero
752 means the default is an error. */
753 static const yytype_uint8 yydefact
[] =
755 2, 0, 1, 0, 0, 0, 0, 0, 0, 0,
756 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
757 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
758 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
759 0, 0, 0, 0, 0, 0, 0, 0, 3, 4,
760 60, 0, 72, 98, 0, 98, 0, 0, 0, 0,
761 0, 0, 0, 0, 0, 0, 98, 0, 0, 98,
762 0, 98, 0, 98, 0, 0, 98, 0, 98, 98,
763 0, 0, 98, 98, 0, 98, 0, 0, 0, 0,
764 98, 0, 0, 0, 0, 98, 0, 0, 0, 98,
765 0, 71, 0, 73, 0, 59, 0, 0, 9, 97,
766 79, 81, 83, 84, 0, 87, 89, 88, 0, 91,
767 92, 90, 0, 94, 0, 93, 0, 0, 0, 74,
768 0, 0, 0, 28, 0, 0, 29, 0, 22, 0,
769 20, 0, 0, 0, 0, 0, 0, 0, 0, 0,
770 0, 0, 0, 25, 0, 31, 33, 0, 0, 36,
771 37, 0, 56, 0, 0, 0, 0, 10, 0, 0,
772 0, 0, 67, 0, 0, 0, 38, 0, 98, 98,
773 0, 98, 0, 0, 0, 86, 98, 98, 98, 98,
774 98, 98, 0, 98, 98, 98, 98, 98, 98, 98,
775 98, 0, 98, 0, 98, 0, 98, 0, 0, 98,
776 98, 0, 0, 98, 0, 98, 98, 98, 98, 98,
777 98, 98, 98, 98, 98, 63, 64, 98, 98, 68,
778 69, 70, 98, 5, 6, 0, 7, 78, 76, 77,
779 80, 82, 85, 12, 13, 14, 17, 18, 19, 0,
780 15, 62, 61, 96, 27, 26, 30, 23, 21, 0,
781 40, 95, 0, 42, 0, 45, 0, 0, 48, 49,
782 0, 0, 51, 0, 54, 24, 32, 34, 35, 55,
783 57, 58, 8, 11, 66, 65, 39, 0, 0, 98,
784 98, 98, 0, 98, 98, 98, 98, 0, 0, 41,
785 43, 46, 0, 47, 50, 52, 53, 0, 98, 98,
786 0, 16, 44, 0, 0, 0, 75
789 /* YYDEFGOTO[NTERM-NUM]. */
790 static const yytype_int16 yydefgoto
[] =
792 -1, 1, 48, 49, 102, 104, 130, 107, 240, 114,
793 118, 122, 124, 125, 262, 252, 253, 109
796 /* YYPACT[STATE-NUM] -- Index in YYTABLE of the portion describing
798 #define YYPACT_NINF -196
799 static const yytype_int16 yypact
[] =
801 -196, 246, -196, 3, 13, 20, 11, 24, 21, 26,
802 30, 45, 66, 67, 68, 69, 70, 71, 72, 76,
803 73, -7, -5, 15, 78, 28, 32, 80, 79, 82,
804 83, 91, 93, 94, 96, 97, 98, 38, 100, 101,
805 102, 103, 104, 106, 107, 108, 111, 109, -196, -196,
806 -196, -66, 36, -196, 14, -196, 12, 22, 1, 46,
807 46, 46, 25, 48, 46, 46, -196, 46, 46, -196,
808 46, -196, 53, -196, 27, 46, -196, 55, -196, -196,
809 46, 46, -196, -196, 46, -196, 46, 46, 56, 59,
810 -196, 60, 61, 62, 63, -196, 65, 77, 85, -196,
811 86, -196, 114, -196, 115, -196, 120, 130, -196, -196,
812 135, 136, -196, -11, 138, -196, -196, -196, 139, -196,
813 -196, -196, 143, -196, 145, -196, 147, 156, 47, -196,
814 157, 162, 165, -196, 166, 168, -196, 170, -196, 174,
815 -196, 49, 52, 54, 137, 177, 178, 179, 181, 64,
816 182, 183, 184, -196, 185, -196, -196, 186, 187, -196,
817 -196, 188, -196, 189, 190, 191, 192, -196, 193, 194,
818 195, 196, -196, 197, 198, 199, -196, 200, -196, -196,
819 133, -196, 2, 2, 48, -196, -196, -196, -196, -196,
820 -196, -196, 206, -196, -196, -196, -196, -196, -196, -196,
821 -196, 110, -196, 140, -196, 141, -196, 140, 144, -196,
822 -196, 146, 148, -196, 149, -196, -196, -196, -196, -196,
823 -196, -196, -196, -196, -196, -196, -196, -196, -196, -196,
824 -196, -196, -196, -196, -196, 202, -196, -196, -196, -196,
825 -196, -196, -196, -196, -196, -196, -196, -196, -196, 205,
826 -196, -196, -196, -196, -196, -196, -196, -196, -196, 207,
827 -196, -196, 210, -196, 212, -196, 215, 217, -196, -196,
828 218, 219, -196, 221, -196, -196, -196, -196, -196, -196,
829 -196, -196, -196, -196, -196, -196, -196, 155, 158, -196,
830 -196, -196, 46, -196, -196, -196, -196, 204, 224, -196,
831 -196, -196, 225, -196, -196, -196, -196, 159, -196, -196,
832 227, -196, -196, 161, 231, 167, -196
835 /* YYPGOTO[NTERM-NUM]. */
836 static const yytype_int16 yypgoto
[] =
838 -196, -196, -196, -196, -196, -196, -110, -196, 39, -196,
839 -196, -196, -9, -196, 42, -195, -33, -53
842 /* YYTABLE[YYPACT[STATE-NUM]]. What to do in state STATE-NUM. If
843 positive, shift that token. If negative, reduce the rule which
844 number is the opposite. If zero, do what YYDEFACT says.
845 If YYTABLE_NINF, syntax error. */
846 #define YYTABLE_NINF -1
847 static const yytype_uint16 yytable
[] =
849 105, 254, 255, 185, 184, 119, 120, 237, 68, 69,
850 70, 71, 238, 133, 121, 110, 239, 101, 111, 50,
851 112, 113, 108, 153, 278, 155, 156, 53, 51, 115,
852 72, 73, 162, 116, 117, 52, 136, 55, 138, 54,
853 140, 56, 172, 75, 76, 57, 176, 77, 78, 159,
854 160, 126, 127, 89, 90, 131, 132, 167, 134, 135,
855 58, 137, 192, 193, 201, 202, 152, 203, 204, 205,
856 206, 157, 158, 129, 242, 161, 141, 163, 164, 212,
857 213, 59, 60, 61, 62, 63, 64, 65, 67, 142,
858 143, 144, 66, 74, 80, 300, 79, 81, 106, 82,
859 145, 146, 147, 148, 149, 150, 151, 83, 84, 128,
860 85, 86, 87, 88, 312, 91, 92, 93, 94, 103,
861 95, 96, 97, 98, 100, 233, 234, 99, 236, 123,
862 178, 179, 129, 243, 244, 245, 139, 180, 154, 165,
863 250, 251, 166, 168, 169, 170, 181, 171, 173, 260,
864 182, 183, 207, 265, 186, 187, 246, 247, 248, 188,
865 174, 189, 274, 190, 276, 256, 257, 258, 175, 177,
866 282, 263, 191, 194, 284, 285, 268, 269, 195, 286,
867 272, 196, 197, 275, 198, 277, 199, 279, 280, 281,
868 200, 283, 208, 259, 209, 210, 211, 214, 0, 215,
869 216, 217, 218, 219, 220, 221, 222, 223, 224, 225,
870 226, 227, 228, 229, 230, 231, 232, 235, 249, 287,
871 288, 307, 241, 289, 261, 264, 290, 267, 291, 270,
872 292, 271, 273, 293, 294, 295, 299, 296, 301, 297,
873 308, 309, 298, 310, 313, 314, 2, 3, 315, 266,
874 0, 316, 0, 0, 0, 311, 0, 0, 0, 0,
875 303, 304, 305, 306, 4, 5, 0, 0, 6, 7,
876 8, 9, 10, 11, 12, 13, 14, 0, 0, 0,
877 0, 0, 0, 302, 15, 16, 17, 18, 19, 20,
878 21, 22, 23, 24, 25, 26, 27, 28, 29, 30,
879 31, 32, 0, 33, 34, 35, 36, 37, 0, 0,
880 0, 38, 39, 40, 41, 42, 43, 44, 45, 0,
881 0, 0, 0, 0, 0, 0, 46, 47
884 static const yytype_int16 yycheck
[] =
886 53, 196, 197, 113, 15, 4, 5, 5, 15, 16,
887 15, 16, 10, 66, 13, 3, 14, 83, 6, 16,
888 8, 9, 55, 76, 219, 78, 79, 16, 15, 7,
889 15, 16, 85, 11, 12, 15, 69, 16, 71, 15,
890 73, 15, 95, 15, 16, 15, 99, 15, 16, 82,
891 83, 60, 61, 15, 16, 64, 65, 90, 67, 68,
892 15, 70, 15, 16, 15, 16, 75, 15, 16, 15,
893 16, 80, 81, 84, 184, 84, 49, 86, 87, 15,
894 16, 15, 15, 15, 15, 15, 15, 15, 15, 62,
895 63, 64, 16, 15, 15, 290, 16, 15, 84, 16,
896 73, 74, 75, 76, 77, 78, 79, 16, 15, 84,
897 16, 15, 15, 15, 309, 15, 15, 15, 15, 83,
898 16, 15, 15, 15, 15, 178, 179, 16, 181, 83,
899 16, 16, 84, 186, 187, 188, 83, 17, 83, 83,
900 193, 194, 83, 83, 83, 83, 16, 84, 83, 202,
901 15, 15, 15, 206, 16, 16, 189, 190, 191, 16,
902 83, 16, 215, 16, 217, 198, 199, 200, 83, 83,
903 223, 204, 16, 16, 227, 228, 209, 210, 16, 232,
904 213, 16, 16, 216, 16, 218, 16, 220, 221, 222,
905 16, 224, 15, 83, 16, 16, 15, 15, -1, 16,
906 16, 16, 16, 16, 16, 16, 16, 16, 16, 16,
907 16, 16, 16, 16, 16, 16, 16, 84, 12, 17,
908 15, 17, 183, 16, 84, 84, 16, 83, 16, 83,
909 15, 83, 83, 16, 16, 16, 289, 16, 291, 84,
910 16, 16, 84, 84, 17, 84, 0, 1, 17, 207,
911 -1, 84, -1, -1, -1, 308, -1, -1, -1, -1,
912 293, 294, 295, 296, 18, 19, -1, -1, 22, 23,
913 24, 25, 26, 27, 28, 29, 30, -1, -1, -1,
914 -1, -1, -1, 292, 38, 39, 40, 41, 42, 43,
915 44, 45, 46, 47, 48, 49, 50, 51, 52, 53,
916 54, 55, -1, 57, 58, 59, 60, 61, -1, -1,
917 -1, 65, 66, 67, 68, 69, 70, 71, 72, -1,
918 -1, -1, -1, -1, -1, -1, 80, 81
921 /* YYSTOS[STATE-NUM] -- The (internal number of the) accessing
922 symbol of state STATE-NUM. */
923 static const yytype_uint8 yystos
[] =
925 0, 86, 0, 1, 18, 19, 22, 23, 24, 25,
926 26, 27, 28, 29, 30, 38, 39, 40, 41, 42,
927 43, 44, 45, 46, 47, 48, 49, 50, 51, 52,
928 53, 54, 55, 57, 58, 59, 60, 61, 65, 66,
929 67, 68, 69, 70, 71, 72, 80, 81, 87, 88,
930 16, 15, 15, 16, 15, 16, 15, 15, 15, 15,
931 15, 15, 15, 15, 15, 15, 16, 15, 15, 16,
932 15, 16, 15, 16, 15, 15, 16, 15, 16, 16,
933 15, 15, 16, 16, 15, 16, 15, 15, 15, 15,
934 16, 15, 15, 15, 15, 16, 15, 15, 15, 16,
935 15, 83, 89, 83, 90, 102, 84, 92, 101, 102,
936 3, 6, 8, 9, 94, 7, 11, 12, 95, 4,
937 5, 13, 96, 83, 97, 98, 97, 97, 84, 84,
938 91, 97, 97, 102, 97, 97, 101, 97, 101, 83,
939 101, 49, 62, 63, 64, 73, 74, 75, 76, 77,
940 78, 79, 97, 102, 83, 102, 102, 97, 97, 101,
941 101, 97, 102, 97, 97, 83, 83, 101, 83, 83,
942 83, 84, 102, 83, 83, 83, 102, 83, 16, 16,
943 17, 16, 15, 15, 15, 91, 16, 16, 16, 16,
944 16, 16, 15, 16, 16, 16, 16, 16, 16, 16,
945 16, 15, 16, 15, 16, 15, 16, 15, 15, 16,
946 16, 15, 15, 16, 15, 16, 16, 16, 16, 16,
947 16, 16, 16, 16, 16, 16, 16, 16, 16, 16,
948 16, 16, 16, 102, 102, 84, 102, 5, 10, 14,
949 93, 93, 91, 102, 102, 102, 101, 101, 101, 12,
950 102, 102, 100, 101, 100, 100, 101, 101, 101, 83,
951 102, 84, 99, 101, 84, 102, 99, 83, 101, 101,
952 83, 83, 101, 83, 102, 101, 102, 101, 100, 101,
953 101, 101, 102, 101, 102, 102, 102, 17, 15, 16,
954 16, 16, 15, 16, 16, 16, 16, 84, 84, 102,
955 100, 102, 97, 101, 101, 101, 101, 17, 16, 16,
956 84, 102, 100, 17, 84, 17, 84
959 #define yyerrok (yyerrstatus = 0)
960 #define yyclearin (yychar = YYEMPTY)
964 #define YYACCEPT goto yyacceptlab
965 #define YYABORT goto yyabortlab
966 #define YYERROR goto yyerrorlab
969 /* Like YYERROR except do call yyerror. This remains here temporarily
970 to ease the transition to the new meaning of YYERROR, for GCC.
971 Once GCC version 2 has supplanted version 1, this can go. */
973 #define YYFAIL goto yyerrlab
975 #define YYRECOVERING() (!!yyerrstatus)
977 #define YYBACKUP(Token, Value) \
979 if (yychar == YYEMPTY && yylen == 1) \
983 yytoken = YYTRANSLATE (yychar); \
989 yyerror (YY_("syntax error: cannot back up")); \
996 #define YYERRCODE 256
999 /* YYLLOC_DEFAULT -- Set CURRENT to span from RHS[1] to RHS[N].
1000 If N is 0, then set CURRENT to the empty location which ends
1001 the previous symbol: RHS[0] (always defined). */
1003 #define YYRHSLOC(Rhs, K) ((Rhs)[K])
1004 #ifndef YYLLOC_DEFAULT
1005 # define YYLLOC_DEFAULT(Current, Rhs, N) \
1009 (Current).first_line = YYRHSLOC (Rhs, 1).first_line; \
1010 (Current).first_column = YYRHSLOC (Rhs, 1).first_column; \
1011 (Current).last_line = YYRHSLOC (Rhs, N).last_line; \
1012 (Current).last_column = YYRHSLOC (Rhs, N).last_column; \
1016 (Current).first_line = (Current).last_line = \
1017 YYRHSLOC (Rhs, 0).last_line; \
1018 (Current).first_column = (Current).last_column = \
1019 YYRHSLOC (Rhs, 0).last_column; \
1025 /* YY_LOCATION_PRINT -- Print the location on the stream.
1026 This macro was not mandated originally: define only if we know
1027 we won't break user code: when these are the locations we know. */
1029 #ifndef YY_LOCATION_PRINT
1030 # if defined YYLTYPE_IS_TRIVIAL && YYLTYPE_IS_TRIVIAL
1031 # define YY_LOCATION_PRINT(File, Loc) \
1032 fprintf (File, "%d.%d-%d.%d", \
1033 (Loc).first_line, (Loc).first_column, \
1034 (Loc).last_line, (Loc).last_column)
1036 # define YY_LOCATION_PRINT(File, Loc) ((void) 0)
1041 /* YYLEX -- calling `yylex' with the right arguments. */
1044 # define YYLEX yylex (YYLEX_PARAM)
1046 # define YYLEX yylex ()
1049 /* Enable debugging if requested. */
1053 # include <stdio.h> /* INFRINGES ON USER NAME SPACE */
1054 # define YYFPRINTF fprintf
1057 # define YYDPRINTF(Args) \
1063 # define YY_SYMBOL_PRINT(Title, Type, Value, Location) \
1067 YYFPRINTF (stderr, "%s ", Title); \
1068 yy_symbol_print (stderr, \
1070 YYFPRINTF (stderr, "\n"); \
1075 /*--------------------------------.
1076 | Print this symbol on YYOUTPUT. |
1077 `--------------------------------*/
1080 #if (defined __STDC__ || defined __C99__FUNC__ \
1081 || defined __cplusplus || defined _MSC_VER)
1083 yy_symbol_value_print (FILE *yyoutput
, int yytype
, YYSTYPE
const * const yyvaluep
)
1086 yy_symbol_value_print (yyoutput
, yytype
, yyvaluep
)
1089 YYSTYPE
const * const yyvaluep
;
1095 if (yytype
< YYNTOKENS
)
1096 YYPRINT (yyoutput
, yytoknum
[yytype
], *yyvaluep
);
1108 /*--------------------------------.
1109 | Print this symbol on YYOUTPUT. |
1110 `--------------------------------*/
1112 #if (defined __STDC__ || defined __C99__FUNC__ \
1113 || defined __cplusplus || defined _MSC_VER)
1115 yy_symbol_print (FILE *yyoutput
, int yytype
, YYSTYPE
const * const yyvaluep
)
1118 yy_symbol_print (yyoutput
, yytype
, yyvaluep
)
1121 YYSTYPE
const * const yyvaluep
;
1124 if (yytype
< YYNTOKENS
)
1125 YYFPRINTF (yyoutput
, "token %s (", yytname
[yytype
]);
1127 YYFPRINTF (yyoutput
, "nterm %s (", yytname
[yytype
]);
1129 yy_symbol_value_print (yyoutput
, yytype
, yyvaluep
);
1130 YYFPRINTF (yyoutput
, ")");
1133 /*------------------------------------------------------------------.
1134 | yy_stack_print -- Print the state stack from its BOTTOM up to its |
1136 `------------------------------------------------------------------*/
1138 #if (defined __STDC__ || defined __C99__FUNC__ \
1139 || defined __cplusplus || defined _MSC_VER)
1141 yy_stack_print (yytype_int16
*bottom
, yytype_int16
*top
)
1144 yy_stack_print (bottom
, top
)
1145 yytype_int16
*bottom
;
1149 YYFPRINTF (stderr
, "Stack now");
1150 for (; bottom
<= top
; ++bottom
)
1151 YYFPRINTF (stderr
, " %d", *bottom
);
1152 YYFPRINTF (stderr
, "\n");
1155 # define YY_STACK_PRINT(Bottom, Top) \
1158 yy_stack_print ((Bottom), (Top)); \
1162 /*------------------------------------------------.
1163 | Report that the YYRULE is going to be reduced. |
1164 `------------------------------------------------*/
1166 #if (defined __STDC__ || defined __C99__FUNC__ \
1167 || defined __cplusplus || defined _MSC_VER)
1169 yy_reduce_print (YYSTYPE
*yyvsp
, int yyrule
)
1172 yy_reduce_print (yyvsp
, yyrule
)
1177 int yynrhs
= yyr2
[yyrule
];
1179 unsigned long int yylno
= yyrline
[yyrule
];
1180 YYFPRINTF (stderr
, "Reducing stack by rule %d (line %lu):\n",
1182 /* The symbols being reduced. */
1183 for (yyi
= 0; yyi
< yynrhs
; yyi
++)
1185 fprintf (stderr
, " $%d = ", yyi
+ 1);
1186 yy_symbol_print (stderr
, yyrhs
[yyprhs
[yyrule
] + yyi
],
1187 &(yyvsp
[(yyi
+ 1) - (yynrhs
)])
1189 fprintf (stderr
, "\n");
1193 # define YY_REDUCE_PRINT(Rule) \
1196 yy_reduce_print (yyvsp, Rule); \
1199 /* Nonzero means print parse trace. It is left uninitialized so that
1200 multiple parsers can coexist. */
1202 #else /* !YYDEBUG */
1203 # define YYDPRINTF(Args)
1204 # define YY_SYMBOL_PRINT(Title, Type, Value, Location)
1205 # define YY_STACK_PRINT(Bottom, Top)
1206 # define YY_REDUCE_PRINT(Rule)
1207 #endif /* !YYDEBUG */
1210 /* YYINITDEPTH -- initial size of the parser's stacks. */
1212 # define YYINITDEPTH 200
1215 /* YYMAXDEPTH -- maximum size the stacks can grow to (effective only
1216 if the built-in stack extension method is used).
1218 Do not make this value too large; the results are undefined if
1219 YYSTACK_ALLOC_MAXIMUM < YYSTACK_BYTES (YYMAXDEPTH)
1220 evaluated with infinite-precision integer arithmetic. */
1223 # define YYMAXDEPTH 10000
1231 # if defined __GLIBC__ && defined _STRING_H
1232 # define yystrlen strlen
1234 /* Return the length of YYSTR. */
1235 #if (defined __STDC__ || defined __C99__FUNC__ \
1236 || defined __cplusplus || defined _MSC_VER)
1238 yystrlen (const char *yystr
)
1246 for (yylen
= 0; yystr
[yylen
]; yylen
++)
1254 # if defined __GLIBC__ && defined _STRING_H && defined _GNU_SOURCE
1255 # define yystpcpy stpcpy
1257 /* Copy YYSRC to YYDEST, returning the address of the terminating '\0' in
1259 #if (defined __STDC__ || defined __C99__FUNC__ \
1260 || defined __cplusplus || defined _MSC_VER)
1262 yystpcpy (char *yydest
, const char *yysrc
)
1265 yystpcpy (yydest
, yysrc
)
1271 const char *yys
= yysrc
;
1273 while ((*yyd
++ = *yys
++) != '\0')
1282 /* Copy to YYRES the contents of YYSTR after stripping away unnecessary
1283 quotes and backslashes, so that it's suitable for yyerror. The
1284 heuristic is that double-quoting is unnecessary unless the string
1285 contains an apostrophe, a comma, or backslash (other than
1286 backslash-backslash). YYSTR is taken from yytname. If YYRES is
1287 null, do not copy; instead, return the length of what the result
1290 yytnamerr (char *yyres
, const char *yystr
)
1295 char const *yyp
= yystr
;
1302 goto do_not_strip_quotes
;
1306 goto do_not_strip_quotes
;
1319 do_not_strip_quotes
: ;
1323 return yystrlen (yystr
);
1325 return yystpcpy (yyres
, yystr
) - yyres
;
1329 /* Copy into YYRESULT an error message about the unexpected token
1330 YYCHAR while in state YYSTATE. Return the number of bytes copied,
1331 including the terminating null byte. If YYRESULT is null, do not
1332 copy anything; just return the number of bytes that would be
1333 copied. As a special case, return 0 if an ordinary "syntax error"
1334 message will do. Return YYSIZE_MAXIMUM if overflow occurs during
1335 size calculation. */
1337 yysyntax_error (char *yyresult
, int yystate
, int yychar
)
1339 int yyn
= yypact
[yystate
];
1341 if (! (YYPACT_NINF
< yyn
&& yyn
<= YYLAST
))
1345 int yytype
= YYTRANSLATE (yychar
);
1346 YYSIZE_T yysize0
= yytnamerr (0, yytname
[yytype
]);
1347 YYSIZE_T yysize
= yysize0
;
1349 int yysize_overflow
= 0;
1350 enum { YYERROR_VERBOSE_ARGS_MAXIMUM
= 5 };
1351 char const *yyarg
[YYERROR_VERBOSE_ARGS_MAXIMUM
];
1355 /* This is so xgettext sees the translatable formats that are
1356 constructed on the fly. */
1357 YY_("syntax error, unexpected %s");
1358 YY_("syntax error, unexpected %s, expecting %s");
1359 YY_("syntax error, unexpected %s, expecting %s or %s");
1360 YY_("syntax error, unexpected %s, expecting %s or %s or %s");
1361 YY_("syntax error, unexpected %s, expecting %s or %s or %s or %s");
1365 static char const yyunexpected
[] = "syntax error, unexpected %s";
1366 static char const yyexpecting
[] = ", expecting %s";
1367 static char const yyor
[] = " or %s";
1368 char yyformat
[sizeof yyunexpected
1369 + sizeof yyexpecting
- 1
1370 + ((YYERROR_VERBOSE_ARGS_MAXIMUM
- 2)
1371 * (sizeof yyor
- 1))];
1372 char const *yyprefix
= yyexpecting
;
1374 /* Start YYX at -YYN if negative to avoid negative indexes in
1376 int yyxbegin
= yyn
< 0 ? -yyn
: 0;
1378 /* Stay within bounds of both yycheck and yytname. */
1379 int yychecklim
= YYLAST
- yyn
+ 1;
1380 int yyxend
= yychecklim
< YYNTOKENS
? yychecklim
: YYNTOKENS
;
1383 yyarg
[0] = yytname
[yytype
];
1384 yyfmt
= yystpcpy (yyformat
, yyunexpected
);
1386 for (yyx
= yyxbegin
; yyx
< yyxend
; ++yyx
)
1387 if (yycheck
[yyx
+ yyn
] == yyx
&& yyx
!= YYTERROR
)
1389 if (yycount
== YYERROR_VERBOSE_ARGS_MAXIMUM
)
1393 yyformat
[sizeof yyunexpected
- 1] = '\0';
1396 yyarg
[yycount
++] = yytname
[yyx
];
1397 yysize1
= yysize
+ yytnamerr (0, yytname
[yyx
]);
1398 yysize_overflow
|= (yysize1
< yysize
);
1400 yyfmt
= yystpcpy (yyfmt
, yyprefix
);
1404 yyf
= YY_(yyformat
);
1405 yysize1
= yysize
+ yystrlen (yyf
);
1406 yysize_overflow
|= (yysize1
< yysize
);
1409 if (yysize_overflow
)
1410 return YYSIZE_MAXIMUM
;
1414 /* Avoid sprintf, as that infringes on the user's name space.
1415 Don't have undefined behavior even if the translation
1416 produced a string with the wrong number of "%s"s. */
1417 char *yyp
= yyresult
;
1419 while ((*yyp
= *yyf
) != '\0')
1421 if (*yyp
== '%' && yyf
[1] == 's' && yyi
< yycount
)
1423 yyp
+= yytnamerr (yyp
, yyarg
[yyi
++]);
1436 #endif /* YYERROR_VERBOSE */
1439 /*-----------------------------------------------.
1440 | Release the memory associated to this symbol. |
1441 `-----------------------------------------------*/
1444 #if (defined __STDC__ || defined __C99__FUNC__ \
1445 || defined __cplusplus || defined _MSC_VER)
1447 yydestruct (const char *yymsg
, int yytype
, YYSTYPE
*yyvaluep
)
1450 yydestruct (yymsg
, yytype
, yyvaluep
)
1460 YY_SYMBOL_PRINT (yymsg
, yytype
, yyvaluep
, yylocationp
);
1471 /* Prevent warnings from -Wmissing-prototypes. */
1473 #ifdef YYPARSE_PARAM
1474 #if defined __STDC__ || defined __cplusplus
1475 int yyparse (void *YYPARSE_PARAM
);
1479 #else /* ! YYPARSE_PARAM */
1480 #if defined __STDC__ || defined __cplusplus
1485 #endif /* ! YYPARSE_PARAM */
1489 /* The look-ahead symbol. */
1492 /* The semantic value of the look-ahead symbol. */
1495 /* Number of syntax errors so far. */
1504 #ifdef YYPARSE_PARAM
1505 #if (defined __STDC__ || defined __C99__FUNC__ \
1506 || defined __cplusplus || defined _MSC_VER)
1508 yyparse (void *YYPARSE_PARAM
)
1511 yyparse (YYPARSE_PARAM
)
1512 void *YYPARSE_PARAM
;
1514 #else /* ! YYPARSE_PARAM */
1515 #if (defined __STDC__ || defined __C99__FUNC__ \
1516 || defined __cplusplus || defined _MSC_VER)
1530 /* Number of tokens to shift before error messages enabled. */
1532 /* Look-ahead token as an internal (translated) token number. */
1535 /* Buffer for error messages, and its allocated size. */
1537 char *yymsg
= yymsgbuf
;
1538 YYSIZE_T yymsg_alloc
= sizeof yymsgbuf
;
1541 /* Three stacks and their tools:
1542 `yyss': related to states,
1543 `yyvs': related to semantic values,
1544 `yyls': related to locations.
1546 Refer to the stacks thru separate pointers, to allow yyoverflow
1547 to reallocate them elsewhere. */
1549 /* The state stack. */
1550 yytype_int16 yyssa
[YYINITDEPTH
];
1551 yytype_int16
*yyss
= yyssa
;
1552 yytype_int16
*yyssp
;
1554 /* The semantic value stack. */
1555 YYSTYPE yyvsa
[YYINITDEPTH
];
1556 YYSTYPE
*yyvs
= yyvsa
;
1561 #define YYPOPSTACK(N) (yyvsp -= (N), yyssp -= (N))
1563 YYSIZE_T yystacksize
= YYINITDEPTH
;
1565 /* The variables used to return semantic value and location from the
1570 /* The number of symbols on the RHS of the reduced rule.
1571 Keep to zero when no symbol should be popped. */
1574 YYDPRINTF ((stderr
, "Starting parse\n"));
1579 yychar
= YYEMPTY
; /* Cause a token to be read. */
1581 /* Initialize stack pointers.
1582 Waste one element of value and location stack
1583 so that they stay on the same level as the state stack.
1584 The wasted elements are never initialized. */
1591 /*------------------------------------------------------------.
1592 | yynewstate -- Push a new state, which is found in yystate. |
1593 `------------------------------------------------------------*/
1595 /* In all cases, when you get here, the value and location stacks
1596 have just been pushed. So pushing a state here evens the stacks. */
1602 if (yyss
+ yystacksize
- 1 <= yyssp
)
1604 /* Get the current used size of the three stacks, in elements. */
1605 YYSIZE_T yysize
= yyssp
- yyss
+ 1;
1609 /* Give user a chance to reallocate the stack. Use copies of
1610 these so that the &'s don't force the real ones into
1612 YYSTYPE
*yyvs1
= yyvs
;
1613 yytype_int16
*yyss1
= yyss
;
1616 /* Each stack pointer address is followed by the size of the
1617 data in use in that stack, in bytes. This used to be a
1618 conditional around just the two extra args, but that might
1619 be undefined if yyoverflow is a macro. */
1620 yyoverflow (YY_("memory exhausted"),
1621 &yyss1
, yysize
* sizeof (*yyssp
),
1622 &yyvs1
, yysize
* sizeof (*yyvsp
),
1629 #else /* no yyoverflow */
1630 # ifndef YYSTACK_RELOCATE
1631 goto yyexhaustedlab
;
1633 /* Extend the stack our own way. */
1634 if (YYMAXDEPTH
<= yystacksize
)
1635 goto yyexhaustedlab
;
1637 if (YYMAXDEPTH
< yystacksize
)
1638 yystacksize
= YYMAXDEPTH
;
1641 yytype_int16
*yyss1
= yyss
;
1642 union yyalloc
*yyptr
=
1643 (union yyalloc
*) YYSTACK_ALLOC (YYSTACK_BYTES (yystacksize
));
1645 goto yyexhaustedlab
;
1646 YYSTACK_RELOCATE (yyss
);
1647 YYSTACK_RELOCATE (yyvs
);
1649 # undef YYSTACK_RELOCATE
1651 YYSTACK_FREE (yyss1
);
1654 #endif /* no yyoverflow */
1656 yyssp
= yyss
+ yysize
- 1;
1657 yyvsp
= yyvs
+ yysize
- 1;
1660 YYDPRINTF ((stderr
, "Stack size increased to %lu\n",
1661 (unsigned long int) yystacksize
));
1663 if (yyss
+ yystacksize
- 1 <= yyssp
)
1667 YYDPRINTF ((stderr
, "Entering state %d\n", yystate
));
1676 /* Do appropriate processing given the current state. Read a
1677 look-ahead token if we need one and don't already have one. */
1679 /* First try to decide what to do without reference to look-ahead token. */
1680 yyn
= yypact
[yystate
];
1681 if (yyn
== YYPACT_NINF
)
1684 /* Not known => get a look-ahead token if don't already have one. */
1686 /* YYCHAR is either YYEMPTY or YYEOF or a valid look-ahead symbol. */
1687 if (yychar
== YYEMPTY
)
1689 YYDPRINTF ((stderr
, "Reading a token: "));
1693 if (yychar
<= YYEOF
)
1695 yychar
= yytoken
= YYEOF
;
1696 YYDPRINTF ((stderr
, "Now at end of input.\n"));
1700 yytoken
= YYTRANSLATE (yychar
);
1701 YY_SYMBOL_PRINT ("Next token is", yytoken
, &yylval
, &yylloc
);
1704 /* If the proper action on seeing token YYTOKEN is to reduce or to
1705 detect an error, take that action. */
1707 if (yyn
< 0 || YYLAST
< yyn
|| yycheck
[yyn
] != yytoken
)
1712 if (yyn
== 0 || yyn
== YYTABLE_NINF
)
1721 /* Count tokens shifted since error; after three, turn off error
1726 /* Shift the look-ahead token. */
1727 YY_SYMBOL_PRINT ("Shifting", yytoken
, &yylval
, &yylloc
);
1729 /* Discard the shifted token unless it is eof. */
1730 if (yychar
!= YYEOF
)
1739 /*-----------------------------------------------------------.
1740 | yydefault -- do the default action for the current state. |
1741 `-----------------------------------------------------------*/
1743 yyn
= yydefact
[yystate
];
1749 /*-----------------------------.
1750 | yyreduce -- Do a reduction. |
1751 `-----------------------------*/
1753 /* yyn is the number of a rule to reduce with. */
1756 /* If YYLEN is nonzero, implement the default value of the action:
1759 Otherwise, the following line sets YYVAL to garbage.
1760 This behavior is undocumented and Bison
1761 users should not rely upon it. Assigning to YYVAL
1762 unconditionally makes the parser a bit smaller, and it avoids a
1763 GCC warning that YYVAL may be used uninitialized. */
1764 yyval
= yyvsp
[1-yylen
];
1767 YY_REDUCE_PRINT (yyn
);
1771 #line 132 "ftpcmd.y"
1773 fromname
= (char *) 0;
1774 restart_point
= (off_t
) 0;
1779 #line 141 "ftpcmd.y"
1781 if ((yyvsp
[(5) - (5)].i
))
1782 user((yyvsp
[(3) - (5)].s
));
1783 free((yyvsp
[(3) - (5)].s
));
1788 #line 147 "ftpcmd.y"
1790 if ((yyvsp
[(5) - (5)].i
))
1791 pass((yyvsp
[(3) - (5)].s
));
1792 memset ((yyvsp
[(3) - (5)].s
), 0, strlen((yyvsp
[(3) - (5)].s
)));
1793 free((yyvsp
[(3) - (5)].s
));
1798 #line 154 "ftpcmd.y"
1800 if ((yyvsp
[(5) - (5)].i
)) {
1806 reply(200, "PORT command successful.");
1812 #line 165 "ftpcmd.y"
1814 if ((yyvsp
[(5) - (5)].i
))
1815 eprt ((yyvsp
[(3) - (5)].s
));
1816 free ((yyvsp
[(3) - (5)].s
));
1821 #line 171 "ftpcmd.y"
1823 if((yyvsp
[(3) - (3)].i
))
1829 #line 176 "ftpcmd.y"
1831 if((yyvsp
[(3) - (3)].i
))
1837 #line 181 "ftpcmd.y"
1839 if((yyvsp
[(5) - (5)].i
))
1840 epsv ((yyvsp
[(3) - (5)].s
));
1841 free ((yyvsp
[(3) - (5)].s
));
1846 #line 187 "ftpcmd.y"
1848 if ((yyvsp
[(5) - (5)].i
)) {
1852 if (cmd_form
== FORM_N
) {
1853 reply(200, "Type set to A.");
1857 reply(504, "Form must be N.");
1861 reply(504, "Type E not implemented.");
1865 reply(200, "Type set to I.");
1871 if (cmd_bytesz
== 8) {
1873 "Type set to L (byte size 8).");
1876 reply(504, "Byte size must be 8.");
1877 #else /* NBBY == 8 */
1878 UNIMPLEMENTED
for NBBY
!= 8
1879 #endif /* NBBY == 8 */
1886 #line 224 "ftpcmd.y"
1888 if ((yyvsp
[(5) - (5)].i
)) {
1889 switch ((yyvsp
[(3) - (5)].i
)) {
1892 reply(200, "STRU F ok.");
1896 reply(504, "Unimplemented STRU type.");
1903 #line 238 "ftpcmd.y"
1905 if ((yyvsp
[(5) - (5)].i
)) {
1906 switch ((yyvsp
[(3) - (5)].i
)) {
1909 reply(200, "MODE S ok.");
1913 reply(502, "Unimplemented MODE type.");
1920 #line 252 "ftpcmd.y"
1922 if ((yyvsp
[(5) - (5)].i
)) {
1923 reply(202, "ALLO command ignored.");
1929 #line 258 "ftpcmd.y"
1931 if ((yyvsp
[(9) - (9)].i
)) {
1932 reply(202, "ALLO command ignored.");
1938 #line 264 "ftpcmd.y"
1940 char *name
= (yyvsp
[(3) - (5)].s
);
1942 if ((yyvsp
[(5) - (5)].i
) && name
!= NULL
)
1950 #line 273 "ftpcmd.y"
1952 char *name
= (yyvsp
[(3) - (5)].s
);
1954 if ((yyvsp
[(5) - (5)].i
) && name
!= NULL
)
1955 do_store(name
, "w", 0);
1962 #line 282 "ftpcmd.y"
1964 char *name
= (yyvsp
[(3) - (5)].s
);
1966 if ((yyvsp
[(5) - (5)].i
) && name
!= NULL
)
1967 do_store(name
, "a", 0);
1974 #line 291 "ftpcmd.y"
1976 if ((yyvsp
[(3) - (3)].i
))
1977 send_file_list(".");
1982 #line 296 "ftpcmd.y"
1984 char *name
= (yyvsp
[(3) - (5)].s
);
1986 if ((yyvsp
[(5) - (5)].i
) && name
!= NULL
)
1987 send_file_list(name
);
1994 #line 305 "ftpcmd.y"
1996 if((yyvsp
[(3) - (3)].i
))
2002 #line 310 "ftpcmd.y"
2004 if((yyvsp
[(5) - (5)].i
))
2005 list_file((yyvsp
[(3) - (5)].s
));
2006 free((yyvsp
[(3) - (5)].s
));
2011 #line 316 "ftpcmd.y"
2013 if ((yyvsp
[(5) - (5)].i
) && (yyvsp
[(3) - (5)].s
) != NULL
)
2014 statfilecmd((yyvsp
[(3) - (5)].s
));
2015 if ((yyvsp
[(3) - (5)].s
) != NULL
)
2016 free((yyvsp
[(3) - (5)].s
));
2021 #line 323 "ftpcmd.y"
2023 if ((yyvsp
[(3) - (3)].i
))
2029 #line 328 "ftpcmd.y"
2031 if ((yyvsp
[(5) - (5)].i
) && (yyvsp
[(3) - (5)].s
) != NULL
)
2032 do_delete((yyvsp
[(3) - (5)].s
));
2033 if ((yyvsp
[(3) - (5)].s
) != NULL
)
2034 free((yyvsp
[(3) - (5)].s
));
2039 #line 335 "ftpcmd.y"
2041 if((yyvsp
[(5) - (5)].i
)){
2043 renamecmd(fromname
, (yyvsp
[(3) - (5)].s
));
2045 fromname
= (char *) 0;
2047 reply(503, "Bad sequence of commands.");
2050 if ((yyvsp
[(3) - (5)].s
) != NULL
)
2051 free((yyvsp
[(3) - (5)].s
));
2056 #line 349 "ftpcmd.y"
2058 if ((yyvsp
[(3) - (3)].i
))
2059 reply(225, "ABOR command successful.");
2064 #line 354 "ftpcmd.y"
2066 if ((yyvsp
[(3) - (3)].i
))
2072 #line 359 "ftpcmd.y"
2074 if ((yyvsp
[(5) - (5)].i
) && (yyvsp
[(3) - (5)].s
) != NULL
)
2075 cwd((yyvsp
[(3) - (5)].s
));
2076 if ((yyvsp
[(3) - (5)].s
) != NULL
)
2077 free((yyvsp
[(3) - (5)].s
));
2082 #line 366 "ftpcmd.y"
2084 if ((yyvsp
[(3) - (3)].i
))
2085 help(cmdtab
, (char *) 0);
2090 #line 371 "ftpcmd.y"
2092 if ((yyvsp
[(5) - (5)].i
)) {
2093 char *cp
= (yyvsp
[(3) - (5)].s
);
2095 if (strncasecmp(cp
, "SITE", 4) == 0) {
2096 cp
= (yyvsp
[(3) - (5)].s
) + 4;
2102 help(sitetab
, (char *) 0);
2104 help(cmdtab
, (yyvsp
[(3) - (5)].s
));
2110 #line 388 "ftpcmd.y"
2112 if ((yyvsp
[(3) - (3)].i
))
2113 reply(200, "NOOP command successful.");
2118 #line 393 "ftpcmd.y"
2120 if ((yyvsp
[(5) - (5)].i
) && (yyvsp
[(3) - (5)].s
) != NULL
)
2121 makedir((yyvsp
[(3) - (5)].s
));
2122 if ((yyvsp
[(3) - (5)].s
) != NULL
)
2123 free((yyvsp
[(3) - (5)].s
));
2128 #line 400 "ftpcmd.y"
2130 if ((yyvsp
[(5) - (5)].i
) && (yyvsp
[(3) - (5)].s
) != NULL
)
2131 removedir((yyvsp
[(3) - (5)].s
));
2132 if ((yyvsp
[(3) - (5)].s
) != NULL
)
2133 free((yyvsp
[(3) - (5)].s
));
2138 #line 407 "ftpcmd.y"
2140 if ((yyvsp
[(3) - (3)].i
))
2146 #line 412 "ftpcmd.y"
2148 if ((yyvsp
[(3) - (3)].i
))
2154 #line 417 "ftpcmd.y"
2156 if ((yyvsp
[(3) - (3)].i
)) {
2157 lreply(211, "Supported features:");
2159 lreply(0, " REST STREAM");
2167 #line 427 "ftpcmd.y"
2169 if ((yyvsp
[(5) - (5)].i
))
2170 reply(501, "Bad options");
2171 free ((yyvsp
[(3) - (5)].s
));
2176 #line 434 "ftpcmd.y"
2178 if ((yyvsp
[(5) - (5)].i
))
2179 help(sitetab
, (char *) 0);
2184 #line 439 "ftpcmd.y"
2186 if ((yyvsp
[(7) - (7)].i
))
2187 help(sitetab
, (yyvsp
[(5) - (7)].s
));
2192 #line 444 "ftpcmd.y"
2194 if ((yyvsp
[(5) - (5)].i
)) {
2195 int oldmask
= umask(0);
2197 reply(200, "Current UMASK is %03o", oldmask
);
2203 #line 452 "ftpcmd.y"
2205 if ((yyvsp
[(7) - (7)].i
)) {
2206 if (((yyvsp
[(5) - (7)].i
) == -1) || ((yyvsp
[(5) - (7)].i
) > 0777)) {
2207 reply(501, "Bad UMASK value");
2209 int oldmask
= umask((yyvsp
[(5) - (7)].i
));
2211 "UMASK set to %03o (was %03o)",
2212 (yyvsp
[(5) - (7)].i
), oldmask
);
2219 #line 465 "ftpcmd.y"
2221 if ((yyvsp
[(9) - (9)].i
) && (yyvsp
[(7) - (9)].s
) != NULL
) {
2222 if ((yyvsp
[(5) - (9)].i
) > 0777)
2224 "CHMOD: Mode value must be between 0 and 0777");
2225 else if (chmod((yyvsp
[(7) - (9)].s
), (yyvsp
[(5) - (9)].i
)) < 0)
2226 perror_reply(550, (yyvsp
[(7) - (9)].s
));
2228 reply(200, "CHMOD command successful.");
2230 if ((yyvsp
[(7) - (9)].s
) != NULL
)
2231 free((yyvsp
[(7) - (9)].s
));
2236 #line 479 "ftpcmd.y"
2238 if ((yyvsp
[(5) - (5)].i
))
2240 "Current IDLE time limit is %d seconds; max %d",
2241 ftpd_timeout
, maxtimeout
);
2246 #line 486 "ftpcmd.y"
2248 if ((yyvsp
[(7) - (7)].i
)) {
2249 if ((yyvsp
[(5) - (7)].i
) < 30 || (yyvsp
[(5) - (7)].i
) > maxtimeout
) {
2251 "Maximum IDLE time must be between 30 and %d seconds",
2254 ftpd_timeout
= (yyvsp
[(5) - (7)].i
);
2255 alarm((unsigned) ftpd_timeout
);
2257 "Maximum IDLE time set to %d seconds",
2265 #line 503 "ftpcmd.y"
2271 reply(500, "Can't be done as guest.");
2273 if((yyvsp
[(7) - (7)].i
) && (yyvsp
[(5) - (7)].s
) != NULL
){
2274 p
= strpbrk((yyvsp
[(5) - (7)].s
), " \t");
2277 kauth((yyvsp
[(5) - (7)].s
), p
+ strspn(p
, " \t"));
2279 kauth((yyvsp
[(5) - (7)].s
), NULL
);
2282 if((yyvsp
[(5) - (7)].s
) != NULL
)
2283 free((yyvsp
[(5) - (7)].s
));
2285 reply(500, "Command not implemented.");
2291 #line 526 "ftpcmd.y"
2293 if((yyvsp
[(5) - (5)].i
))
2299 #line 531 "ftpcmd.y"
2302 if((yyvsp
[(5) - (5)].i
))
2305 reply(500, "Command not implemented.");
2311 #line 540 "ftpcmd.y"
2315 reply(500, "Can't be done as guest.");
2316 else if((yyvsp
[(7) - (7)].i
) && (yyvsp
[(5) - (7)].s
))
2317 krbtkfile((yyvsp
[(5) - (7)].s
));
2318 if((yyvsp
[(5) - (7)].s
))
2319 free((yyvsp
[(5) - (7)].s
));
2321 reply(500, "Command not implemented.");
2327 #line 553 "ftpcmd.y"
2329 #if defined(KRB4) || defined(KRB5)
2331 reply(500, "Can't be done as guest.");
2332 else if((yyvsp
[(5) - (5)].i
))
2335 reply(500, "Command not implemented.");
2341 #line 564 "ftpcmd.y"
2343 #if defined(KRB4) || defined(KRB5)
2345 reply(500, "Can't be done as guest.");
2346 else if((yyvsp
[(7) - (7)].i
))
2347 afslog((yyvsp
[(5) - (7)].s
), 0);
2348 if((yyvsp
[(5) - (7)].s
))
2349 free((yyvsp
[(5) - (7)].s
));
2351 reply(500, "Command not implemented.");
2357 #line 577 "ftpcmd.y"
2359 if((yyvsp
[(7) - (7)].i
) && (yyvsp
[(5) - (7)].s
) != NULL
)
2360 find((yyvsp
[(5) - (7)].s
));
2361 if((yyvsp
[(5) - (7)].s
) != NULL
)
2362 free((yyvsp
[(5) - (7)].s
));
2367 #line 584 "ftpcmd.y"
2369 if ((yyvsp
[(5) - (5)].i
))
2370 reply(200, "http://www.pdc.kth.se/heimdal/");
2375 #line 589 "ftpcmd.y"
2377 if ((yyvsp
[(5) - (5)].i
) && (yyvsp
[(3) - (5)].s
) != NULL
)
2378 do_store((yyvsp
[(3) - (5)].s
), "w", 1);
2379 if ((yyvsp
[(3) - (5)].s
) != NULL
)
2380 free((yyvsp
[(3) - (5)].s
));
2385 #line 596 "ftpcmd.y"
2387 if ((yyvsp
[(3) - (3)].i
)) {
2388 #if !defined(WIN32) && !defined(__EMX__) && !defined(__OS2__) && !defined(__CYGWIN32__)
2389 reply(215, "UNIX Type: L%d", NBBY
);
2391 reply(215, "UNKNOWN Type: L%d", NBBY
);
2398 #line 614 "ftpcmd.y"
2400 if ((yyvsp
[(5) - (5)].i
) && (yyvsp
[(3) - (5)].s
) != NULL
)
2401 sizecmd((yyvsp
[(3) - (5)].s
));
2402 if ((yyvsp
[(3) - (5)].s
) != NULL
)
2403 free((yyvsp
[(3) - (5)].s
));
2408 #line 631 "ftpcmd.y"
2410 if ((yyvsp
[(5) - (5)].i
) && (yyvsp
[(3) - (5)].s
) != NULL
) {
2412 if (stat((yyvsp
[(3) - (5)].s
), &stbuf
) < 0)
2413 reply(550, "%s: %s",
2414 (yyvsp
[(3) - (5)].s
), strerror(errno
));
2415 else if (!S_ISREG(stbuf
.st_mode
)) {
2417 "%s: not a plain file.", (yyvsp
[(3) - (5)].s
));
2420 time_t mtime
= stbuf
.st_mtime
;
2424 "%04d%02d%02d%02d%02d%02d",
2433 if ((yyvsp
[(3) - (5)].s
) != NULL
)
2434 free((yyvsp
[(3) - (5)].s
));
2439 #line 659 "ftpcmd.y"
2441 if ((yyvsp
[(3) - (3)].i
)) {
2442 reply(221, "Goodbye.");
2449 #line 666 "ftpcmd.y"
2456 #line 672 "ftpcmd.y"
2458 restart_point
= (off_t
) 0;
2459 if ((yyvsp
[(5) - (5)].i
) && (yyvsp
[(3) - (5)].s
)) {
2460 fromname
= renamefrom((yyvsp
[(3) - (5)].s
));
2461 if (fromname
== (char *) 0 && (yyvsp
[(3) - (5)].s
)) {
2462 free((yyvsp
[(3) - (5)].s
));
2469 #line 682 "ftpcmd.y"
2471 if ((yyvsp
[(5) - (5)].i
)) {
2472 fromname
= (char *) 0;
2473 restart_point
= (yyvsp
[(3) - (5)].i
); /* XXX $3 is only "int" */
2474 reply(350, "Restarting at %ld. %s",
2475 (long)restart_point
,
2476 "Send STORE or RETRIEVE to initiate transfer.");
2482 #line 692 "ftpcmd.y"
2484 auth((yyvsp
[(3) - (4)].s
));
2485 free((yyvsp
[(3) - (4)].s
));
2490 #line 697 "ftpcmd.y"
2492 adat((yyvsp
[(3) - (4)].s
));
2493 free((yyvsp
[(3) - (4)].s
));
2498 #line 702 "ftpcmd.y"
2500 if ((yyvsp
[(5) - (5)].i
))
2501 pbsz((yyvsp
[(3) - (5)].i
));
2506 #line 707 "ftpcmd.y"
2508 if ((yyvsp
[(5) - (5)].i
))
2509 prot((yyvsp
[(3) - (5)].s
));
2514 #line 712 "ftpcmd.y"
2516 if ((yyvsp
[(3) - (3)].i
))
2522 #line 717 "ftpcmd.y"
2524 mec((yyvsp
[(3) - (4)].s
), prot_safe
);
2525 free((yyvsp
[(3) - (4)].s
));
2530 #line 722 "ftpcmd.y"
2532 mec((yyvsp
[(3) - (4)].s
), prot_confidential
);
2533 free((yyvsp
[(3) - (4)].s
));
2538 #line 727 "ftpcmd.y"
2540 mec((yyvsp
[(3) - (4)].s
), prot_private
);
2541 free((yyvsp
[(3) - (4)].s
));
2546 #line 739 "ftpcmd.y"
2548 (yyval
.s
) = (char *)calloc(1, sizeof(char));
2553 #line 752 "ftpcmd.y"
2555 struct sockaddr_in
*sin4
= (struct sockaddr_in
*)data_dest
;
2557 sin4
->sin_family
= AF_INET
;
2558 sin4
->sin_port
= htons((yyvsp
[(9) - (11)].i
) * 256 + (yyvsp
[(11) - (11)].i
));
2559 sin4
->sin_addr
.s_addr
=
2560 htonl(((yyvsp
[(1) - (11)].i
) << 24) | ((yyvsp
[(3) - (11)].i
) << 16) | ((yyvsp
[(5) - (11)].i
) << 8) | (yyvsp
[(7) - (11)].i
));
2565 #line 764 "ftpcmd.y"
2572 #line 768 "ftpcmd.y"
2579 #line 772 "ftpcmd.y"
2586 #line 779 "ftpcmd.y"
2594 #line 784 "ftpcmd.y"
2597 cmd_form
= (yyvsp
[(3) - (3)].i
);
2602 #line 789 "ftpcmd.y"
2610 #line 794 "ftpcmd.y"
2613 cmd_form
= (yyvsp
[(3) - (3)].i
);
2618 #line 799 "ftpcmd.y"
2625 #line 803 "ftpcmd.y"
2633 #line 808 "ftpcmd.y"
2636 cmd_bytesz
= (yyvsp
[(3) - (3)].i
);
2641 #line 814 "ftpcmd.y"
2644 cmd_bytesz
= (yyvsp
[(2) - (2)].i
);
2649 #line 822 "ftpcmd.y"
2656 #line 826 "ftpcmd.y"
2663 #line 830 "ftpcmd.y"
2670 #line 837 "ftpcmd.y"
2677 #line 841 "ftpcmd.y"
2684 #line 845 "ftpcmd.y"
2691 #line 852 "ftpcmd.y"
2694 * Problem: this production is used for all pathname
2695 * processing, but only gives a 550 error reply.
2696 * This is a valid reply in some cases but not in others.
2698 if (logged_in
&& (yyvsp
[(1) - (1)].s
) && *(yyvsp
[(1) - (1)].s
) == '~') {
2701 GLOB_BRACE
|GLOB_NOCHECK
|GLOB_QUOTE
|GLOB_TILDE
;
2703 memset(&gl
, 0, sizeof(gl
));
2704 if (glob((yyvsp
[(1) - (1)].s
), flags
, NULL
, &gl
) ||
2706 reply(550, "not found");
2709 (yyval
.s
) = strdup(gl
.gl_pathv
[0]);
2712 free((yyvsp
[(1) - (1)].s
));
2714 (yyval
.s
) = (yyvsp
[(1) - (1)].s
);
2719 #line 884 "ftpcmd.y"
2721 int ret
, dec
, multby
, digit
;
2724 * Convert a number that was read as decimal number
2725 * to what it would be if it had been read as octal.
2727 dec
= (yyvsp
[(1) - (1)].i
);
2736 ret
+= digit
* multby
;
2745 #line 910 "ftpcmd.y"
2747 (yyval
.i
) = (yyvsp
[(1) - (1)].i
) && !guest
;
2748 if((yyvsp
[(1) - (1)].i
) && !(yyval
.i
))
2749 reply(550, "Permission denied");
2754 #line 918 "ftpcmd.y"
2756 if((yyvsp
[(1) - (1)].i
)) {
2757 if(((yyval
.i
) = logged_in
) == 0)
2758 reply(530, "Please login with USER and PASS.");
2765 #line 928 "ftpcmd.y"
2768 if(sec_complete
&& !ccc_passed
&& !secure_command()) {
2770 reply(533, "Command protection level denied "
2771 "for paranoid reasons.");
2777 /* Line 1267 of yacc.c. */
2778 #line 2778 "ftpcmd.c"
2781 YY_SYMBOL_PRINT ("-> $$ =", yyr1
[yyn
], &yyval
, &yyloc
);
2785 YY_STACK_PRINT (yyss
, yyssp
);
2790 /* Now `shift' the result of the reduction. Determine what state
2791 that goes to, based on the state we popped back to and the rule
2792 number reduced by. */
2796 yystate
= yypgoto
[yyn
- YYNTOKENS
] + *yyssp
;
2797 if (0 <= yystate
&& yystate
<= YYLAST
&& yycheck
[yystate
] == *yyssp
)
2798 yystate
= yytable
[yystate
];
2800 yystate
= yydefgoto
[yyn
- YYNTOKENS
];
2805 /*------------------------------------.
2806 | yyerrlab -- here on detecting error |
2807 `------------------------------------*/
2809 /* If not already recovering from an error, report this error. */
2813 #if ! YYERROR_VERBOSE
2814 yyerror (YY_("syntax error"));
2817 YYSIZE_T yysize
= yysyntax_error (0, yystate
, yychar
);
2818 if (yymsg_alloc
< yysize
&& yymsg_alloc
< YYSTACK_ALLOC_MAXIMUM
)
2820 YYSIZE_T yyalloc
= 2 * yysize
;
2821 if (! (yysize
<= yyalloc
&& yyalloc
<= YYSTACK_ALLOC_MAXIMUM
))
2822 yyalloc
= YYSTACK_ALLOC_MAXIMUM
;
2823 if (yymsg
!= yymsgbuf
)
2824 YYSTACK_FREE (yymsg
);
2825 yymsg
= (char *) YYSTACK_ALLOC (yyalloc
);
2827 yymsg_alloc
= yyalloc
;
2831 yymsg_alloc
= sizeof yymsgbuf
;
2835 if (0 < yysize
&& yysize
<= yymsg_alloc
)
2837 (void) yysyntax_error (yymsg
, yystate
, yychar
);
2842 yyerror (YY_("syntax error"));
2844 goto yyexhaustedlab
;
2852 if (yyerrstatus
== 3)
2854 /* If just tried and failed to reuse look-ahead token after an
2855 error, discard it. */
2857 if (yychar
<= YYEOF
)
2859 /* Return failure if at end of input. */
2860 if (yychar
== YYEOF
)
2865 yydestruct ("Error: discarding",
2871 /* Else will try to reuse look-ahead token after shifting the error
2876 /*---------------------------------------------------.
2877 | yyerrorlab -- error raised explicitly by YYERROR. |
2878 `---------------------------------------------------*/
2881 /* Pacify compilers like GCC when the user code never invokes
2882 YYERROR and the label yyerrorlab therefore never appears in user
2884 if (/*CONSTCOND*/ 0)
2887 /* Do not reclaim the symbols of the rule which action triggered
2891 YY_STACK_PRINT (yyss
, yyssp
);
2896 /*-------------------------------------------------------------.
2897 | yyerrlab1 -- common code for both syntax error and YYERROR. |
2898 `-------------------------------------------------------------*/
2900 yyerrstatus
= 3; /* Each real token shifted decrements this. */
2904 yyn
= yypact
[yystate
];
2905 if (yyn
!= YYPACT_NINF
)
2908 if (0 <= yyn
&& yyn
<= YYLAST
&& yycheck
[yyn
] == YYTERROR
)
2916 /* Pop the current state because it cannot handle the error token. */
2921 yydestruct ("Error: popping",
2922 yystos
[yystate
], yyvsp
);
2925 YY_STACK_PRINT (yyss
, yyssp
);
2934 /* Shift the error token. */
2935 YY_SYMBOL_PRINT ("Shifting", yystos
[yyn
], yyvsp
, yylsp
);
2941 /*-------------------------------------.
2942 | yyacceptlab -- YYACCEPT comes here. |
2943 `-------------------------------------*/
2948 /*-----------------------------------.
2949 | yyabortlab -- YYABORT comes here. |
2950 `-----------------------------------*/
2956 /*-------------------------------------------------.
2957 | yyexhaustedlab -- memory exhaustion comes here. |
2958 `-------------------------------------------------*/
2960 yyerror (YY_("memory exhausted"));
2966 if (yychar
!= YYEOF
&& yychar
!= YYEMPTY
)
2967 yydestruct ("Cleanup: discarding lookahead",
2969 /* Do not reclaim the symbols of the rule which action triggered
2970 this YYABORT or YYACCEPT. */
2972 YY_STACK_PRINT (yyss
, yyssp
);
2973 while (yyssp
!= yyss
)
2975 yydestruct ("Cleanup: popping",
2976 yystos
[*yyssp
], yyvsp
);
2981 YYSTACK_FREE (yyss
);
2984 if (yymsg
!= yymsgbuf
)
2985 YYSTACK_FREE (yymsg
);
2987 /* Make sure YYID is used. */
2988 return YYID (yyresult
);
2992 #line 938 "ftpcmd.y"
2995 #define CMD 0 /* beginning of command */
2996 #define ARGS 1 /* expect miscellaneous arguments */
2997 #define STR1 2 /* expect SP followed by STRING */
2998 #define STR2 3 /* expect STRING */
2999 #define OSTR 4 /* optional SP then STRING */
3000 #define ZSTR1 5 /* SP then optional STRING */
3001 #define ZSTR2 6 /* optional STRING after SP */
3002 #define SITECMD 7 /* SITE command */
3003 #define NSTR 8 /* Number followed by a string */
3005 struct tab cmdtab
[] = { /* In order defined in RFC 765 */
3006 { "USER", USER
, STR1
, 1, "<sp> username" },
3007 { "PASS", PASS
, ZSTR1
, 1, "<sp> password" },
3008 { "ACCT", ACCT
, STR1
, 0, "(specify account)" },
3009 { "SMNT", SMNT
, ARGS
, 0, "(structure mount)" },
3010 { "REIN", REIN
, ARGS
, 0, "(reinitialize server state)" },
3011 { "QUIT", QUIT
, ARGS
, 1, "(terminate service)", },
3012 { "PORT", PORT
, ARGS
, 1, "<sp> b0, b1, b2, b3, b4" },
3013 { "EPRT", EPRT
, STR1
, 1, "<sp> string" },
3014 { "PASV", PASV
, ARGS
, 1, "(set server in passive mode)" },
3015 { "EPSV", EPSV
, OSTR
, 1, "[<sp> foo]" },
3016 { "TYPE", TYPE
, ARGS
, 1, "<sp> [ A | E | I | L ]" },
3017 { "STRU", STRU
, ARGS
, 1, "(specify file structure)" },
3018 { "MODE", MODE
, ARGS
, 1, "(specify transfer mode)" },
3019 { "RETR", RETR
, STR1
, 1, "<sp> file-name" },
3020 { "STOR", STOR
, STR1
, 1, "<sp> file-name" },
3021 { "APPE", APPE
, STR1
, 1, "<sp> file-name" },
3022 { "MLFL", MLFL
, OSTR
, 0, "(mail file)" },
3023 { "MAIL", MAIL
, OSTR
, 0, "(mail to user)" },
3024 { "MSND", MSND
, OSTR
, 0, "(mail send to terminal)" },
3025 { "MSOM", MSOM
, OSTR
, 0, "(mail send to terminal or mailbox)" },
3026 { "MSAM", MSAM
, OSTR
, 0, "(mail send to terminal and mailbox)" },
3027 { "MRSQ", MRSQ
, OSTR
, 0, "(mail recipient scheme question)" },
3028 { "MRCP", MRCP
, STR1
, 0, "(mail recipient)" },
3029 { "ALLO", ALLO
, ARGS
, 1, "allocate storage (vacuously)" },
3030 { "REST", REST
, ARGS
, 1, "<sp> offset (restart command)" },
3031 { "RNFR", RNFR
, STR1
, 1, "<sp> file-name" },
3032 { "RNTO", RNTO
, STR1
, 1, "<sp> file-name" },
3033 { "ABOR", ABOR
, ARGS
, 1, "(abort operation)" },
3034 { "DELE", DELE
, STR1
, 1, "<sp> file-name" },
3035 { "CWD", CWD
, OSTR
, 1, "[ <sp> directory-name ]" },
3036 { "XCWD", CWD
, OSTR
, 1, "[ <sp> directory-name ]" },
3037 { "LIST", LIST
, OSTR
, 1, "[ <sp> path-name ]" },
3038 { "NLST", NLST
, OSTR
, 1, "[ <sp> path-name ]" },
3039 { "SITE", SITE
, SITECMD
, 1, "site-cmd [ <sp> arguments ]" },
3040 { "SYST", SYST
, ARGS
, 1, "(get type of operating system)" },
3041 { "STAT", sTAT
, OSTR
, 1, "[ <sp> path-name ]" },
3042 { "HELP", HELP
, OSTR
, 1, "[ <sp> <string> ]" },
3043 { "NOOP", NOOP
, ARGS
, 1, "" },
3044 { "MKD", MKD
, STR1
, 1, "<sp> path-name" },
3045 { "XMKD", MKD
, STR1
, 1, "<sp> path-name" },
3046 { "RMD", RMD
, STR1
, 1, "<sp> path-name" },
3047 { "XRMD", RMD
, STR1
, 1, "<sp> path-name" },
3048 { "PWD", PWD
, ARGS
, 1, "(return current directory)" },
3049 { "XPWD", PWD
, ARGS
, 1, "(return current directory)" },
3050 { "CDUP", CDUP
, ARGS
, 1, "(change to parent directory)" },
3051 { "XCUP", CDUP
, ARGS
, 1, "(change to parent directory)" },
3052 { "STOU", STOU
, STR1
, 1, "<sp> file-name" },
3053 { "SIZE", SIZE
, OSTR
, 1, "<sp> path-name" },
3054 { "MDTM", MDTM
, OSTR
, 1, "<sp> path-name" },
3056 /* extensions from RFC2228 */
3057 { "AUTH", AUTH
, STR1
, 1, "<sp> auth-type" },
3058 { "ADAT", ADAT
, STR1
, 1, "<sp> auth-data" },
3059 { "PBSZ", PBSZ
, ARGS
, 1, "<sp> buffer-size" },
3060 { "PROT", PROT
, STR1
, 1, "<sp> prot-level" },
3061 { "CCC", CCC
, ARGS
, 1, "" },
3062 { "MIC", MIC
, STR1
, 1, "<sp> integrity command" },
3063 { "CONF", CONF
, STR1
, 1, "<sp> confidentiality command" },
3064 { "ENC", ENC
, STR1
, 1, "<sp> privacy command" },
3067 { "FEAT", FEAT
, ARGS
, 1, "" },
3068 { "OPTS", OPTS
, ARGS
, 1, "<sp> command [<sp> options]" },
3070 { NULL
, 0, 0, 0, 0 }
3073 struct tab sitetab
[] = {
3074 { "UMASK", UMASK
, ARGS
, 1, "[ <sp> umask ]" },
3075 { "IDLE", IDLE
, ARGS
, 1, "[ <sp> maximum-idle-time ]" },
3076 { "CHMOD", CHMOD
, NSTR
, 1, "<sp> mode <sp> file-name" },
3077 { "HELP", HELP
, OSTR
, 1, "[ <sp> <string> ]" },
3079 { "KAUTH", KAUTH
, STR1
, 1, "<sp> principal [ <sp> ticket ]" },
3080 { "KLIST", KLIST
, ARGS
, 1, "(show ticket file)" },
3081 { "KDESTROY", KDESTROY
, ARGS
, 1, "(destroy tickets)" },
3082 { "KRBTKFILE", KRBTKFILE
, STR1
, 1, "<sp> ticket-file" },
3083 { "AFSLOG", AFSLOG
, OSTR
, 1, "[<sp> cell]" },
3085 { "LOCATE", LOCATE
, STR1
, 1, "<sp> globexpr" },
3086 { "FIND", LOCATE
, STR1
, 1, "<sp> globexpr" },
3088 { "URL", URL
, ARGS
, 1, "?" },
3090 { NULL
, 0, 0, 0, 0 }
3094 lookup(struct tab
*p
, char *cmd
)
3097 for (; p
->name
!= NULL
; p
++)
3098 if (strcmp(cmd
, p
->name
) == 0)
3104 * ftpd_getline - a hacked up version of fgets to ignore TELNET escape codes.
3107 ftpd_getline(char *s
, int n
)
3114 /* might still be data within the security MIC/CONF/ENC */
3116 strlcpy(s
, ftp_command
, n
);
3118 syslog(LOG_DEBUG
, "command: %s", s
);
3121 while ((c
= getc(stdin
)) != EOF
) {
3124 if ((c
= getc(stdin
)) != EOF
) {
3130 printf("%c%c%c", IAC
, DONT
, 0377&c
);
3136 printf("%c%c%c", IAC
, WONT
, 0377&c
);
3142 continue; /* ignore command */
3147 if (--n
<= 0 || c
== '\n')
3150 if (c
== EOF
&& cs
== s
)
3154 if (!guest
&& strncasecmp("pass ", s
, 5) == 0) {
3155 /* Don't syslog passwords */
3156 syslog(LOG_DEBUG
, "command: %.5s ???", s
);
3161 /* Don't syslog trailing CR-LF */
3164 while (cp
>= s
&& (*cp
== '\n' || *cp
== '\r')) {
3168 syslog(LOG_DEBUG
, "command: %.*s", len
, s
);
3172 fprintf(stderr
, "%s\n", s
);
3182 "Timeout (%d seconds): closing control connection.",
3185 syslog(LOG_INFO
, "User %s timed out after %d seconds",
3186 (pw
? pw
-> pw_name
: "unknown"), ftpd_timeout
);
3194 static int cpos
, state
;
3206 signal(SIGALRM
, toolong
);
3207 alarm((unsigned) ftpd_timeout
);
3208 if (ftpd_getline(cbuf
, sizeof(cbuf
)-1) == NULL
) {
3209 reply(221, "You could at least say goodbye.");
3213 #ifdef HAVE_SETPROCTITLE
3214 if (strncasecmp(cbuf
, "PASS", 4) != 0)
3215 setproctitle("%s: %s", proctitle
, cbuf
);
3216 #endif /* HAVE_SETPROCTITLE */
3217 if ((cp
= strchr(cbuf
, '\r'))) {
3221 if ((cp
= strpbrk(cbuf
, " \n")))
3228 p
= lookup(cmdtab
, cbuf
);
3231 if (p
->implemented
== 0) {
3243 if (cbuf
[cpos
] == ' ') {
3248 if ((cp2
= strpbrk(cp
, " \n")))
3253 p
= lookup(sitetab
, cp
);
3256 if (p
->implemented
== 0) {
3270 if (cbuf
[cpos
] == '\n') {
3279 if (cbuf
[cpos
] == ' ') {
3290 if (cbuf
[cpos
] == '\n') {
3301 * Make sure the string is nonempty and \n terminated.
3303 if (n
> 1 && cbuf
[cpos
] == '\n') {
3305 yylval
.s
= copy(cp
);
3313 if (cbuf
[cpos
] == ' ') {
3317 if (isdigit((unsigned char)cbuf
[cpos
])) {
3319 while (isdigit((unsigned char)cbuf
[++cpos
]))
3323 yylval
.i
= atoi(cp
);
3332 if (isdigit((unsigned char)cbuf
[cpos
])) {
3334 while (isdigit((unsigned char)cbuf
[++cpos
]))
3338 yylval
.i
= atoi(cp
);
3342 switch (cbuf
[cpos
++]) {
3406 fatal("Unknown state in scanner.");
3423 if ((cp
= strchr(cbuf
,'\n')))
3425 reply(500, "'%s': command not understood.", cbuf
);
3436 fatal("Ran out of memory.");
3441 help(struct tab
*ctab
, char *s
)
3448 if (ctab
== sitetab
)
3452 width
= 0, NCMDS
= 0;
3453 for (c
= ctab
; c
->name
!= NULL
; c
++) {
3454 int len
= strlen(c
->name
);
3460 width
= (width
+ 8) &~ 7;
3465 lreply(214, "The following %scommands are recognized %s.",
3466 t
, "(* =>'s unimplemented)");
3467 columns
= 76 / width
;
3470 lines
= (NCMDS
+ columns
- 1) / columns
;
3471 for (i
= 0; i
< lines
; i
++) {
3472 strlcpy (buf
, " ", sizeof(buf
));
3473 for (j
= 0; j
< columns
; j
++) {
3474 c
= ctab
+ j
* lines
+ i
;
3475 snprintf (buf
+ strlen(buf
),
3476 sizeof(buf
) - strlen(buf
),
3479 c
->implemented
? ' ' : '*');
3480 if (c
+ lines
>= &ctab
[NCMDS
])
3482 w
= strlen(c
->name
) + 1;
3490 lreply(214, "%s", buf
);
3492 reply(214, "Direct comments to kth-krb-bugs@pdc.kth.se");
3496 c
= lookup(ctab
, s
);
3497 if (c
== (struct tab
*)0) {
3498 reply(502, "Unknown command %s.", s
);
3502 reply(214, "Syntax: %s%s %s", t
, c
->name
, c
->help
);
3504 reply(214, "%s%-*s\t%s; unimplemented.", t
, width
,
3509 sizecmd(char *filename
)
3515 if (stat(filename
, &stbuf
) < 0 || !S_ISREG(stbuf
.st_mode
))
3516 reply(550, "%s: not a plain file.", filename
);
3518 reply(213, "%lu", (unsigned long)stbuf
.st_size
);
3526 fin
= fopen(filename
, "r");
3528 perror_reply(550, filename
);
3531 if (fstat(fileno(fin
), &stbuf
) < 0 || !S_ISREG(stbuf
.st_mode
)) {
3532 reply(550, "%s: not a plain file.", filename
);
3538 while((c
=getc(fin
)) != EOF
) {
3539 if (c
== '\n') /* will get expanded to \r\n */
3545 reply(213, "%lu", (unsigned long)count
);
3549 reply(504, "SIZE not implemented for Type %c.", "?AEIL"[type
]);