(root)/
Linux-PAM-1.5.3/
conf/
pam_conv1/
pam_conv_y.c
       1  /* A Bison parser, made by GNU Bison 3.7.6.  */
       2  
       3  /* Bison implementation for Yacc-like parsers in C
       4  
       5     Copyright (C) 1984, 1989-1990, 2000-2015, 2018-2021 Free Software Foundation,
       6     Inc.
       7  
       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 3 of the License, or
      11     (at your option) any later version.
      12  
      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.
      17  
      18     You should have received a copy of the GNU General Public License
      19     along with this program.  If not, see <https://www.gnu.org/licenses/>.  */
      20  
      21  /* As a special exception, you may create a larger work that contains
      22     part or all of the Bison parser skeleton and distribute that work
      23     under terms of your choice, so long as that work isn't itself a
      24     parser generator using the skeleton or a modified version thereof
      25     as a parser skeleton.  Alternatively, if you modify or redistribute
      26     the parser skeleton itself, you may (at your option) remove this
      27     special exception, which will cause the skeleton and the resulting
      28     Bison output files to be licensed under the GNU General Public
      29     License without this special exception.
      30  
      31     This special exception was added by the Free Software Foundation in
      32     version 2.2 of Bison.  */
      33  
      34  /* C LALR(1) parser skeleton written by Richard Stallman, by
      35     simplifying the original so-called "semantic" parser.  */
      36  
      37  /* DO NOT RELY ON FEATURES THAT ARE NOT DOCUMENTED in the manual,
      38     especially those whose name start with YY_ or yy_.  They are
      39     private implementation details that can be changed or removed.  */
      40  
      41  /* All symbols defined below should begin with yy or YY, to avoid
      42     infringing on user name space.  This should be done even for local
      43     variables, as they might otherwise be expanded by user macros.
      44     There are some unavoidable exceptions within include files to
      45     define necessary library symbols; they are noted "INFRINGES ON
      46     USER NAME SPACE" below.  */
      47  
      48  /* Identify Bison output, and Bison version.  */
      49  #define YYBISON 30706
      50  
      51  /* Bison version string.  */
      52  #define YYBISON_VERSION "3.7.6"
      53  
      54  /* Skeleton name.  */
      55  #define YYSKELETON_NAME "yacc.c"
      56  
      57  /* Pure parsers.  */
      58  #define YYPURE 0
      59  
      60  /* Push parsers.  */
      61  #define YYPUSH 0
      62  
      63  /* Pull parsers.  */
      64  #define YYPULL 1
      65  
      66  
      67  
      68  
      69  /* First part of user prologue.  */
      70  #line 1 "pam_conv_y.y"
      71  
      72  
      73  /*
      74   * $Id$
      75   *
      76   * Copyright (c) Andrew G. Morgan 1997 <morgan@parc.power.net>
      77   *
      78   * This file is covered by the Linux-PAM License (which should be
      79   * distributed with this file.)
      80   */
      81  
      82  #ifdef HAVE_CONFIG_H
      83  #  include <config.h>
      84  #endif
      85  
      86  #include <string.h>
      87  #include <stdio.h>
      88  #include <stdarg.h>
      89  #include <stdlib.h>
      90  #include <ctype.h>
      91  #include <sys/stat.h>
      92  
      93  #include <security/_pam_types.h>
      94  
      95      extern int yylex(void);
      96  
      97      int current_line=1;
      98      extern char *yytext;
      99  
     100  /* XXX - later we'll change this to be the specific conf file(s) */
     101  #define newpamf stderr
     102  
     103  #define PAM_D                "./pam.d"
     104  #define PAM_D_MODE           0755
     105  #define PAM_D_MAGIC_HEADER   \
     106      "#%%PAM-1.0\n" \
     107      "#[For version 1.0 syntax, the above header is optional]\n"
     108  
     109  #define PAM_D_FILE_FMT       PAM_D "/%s"
     110  
     111      const char *old_to_new_ctrl_flag(const char *old);
     112      void yyerror(const char *format, ...);
     113  
     114  #line 115 "pam_conv_y.c"
     115  
     116  # ifndef YY_CAST
     117  #  ifdef __cplusplus
     118  #   define YY_CAST(Type, Val) static_cast<Type> (Val)
     119  #   define YY_REINTERPRET_CAST(Type, Val) reinterpret_cast<Type> (Val)
     120  #  else
     121  #   define YY_CAST(Type, Val) ((Type) (Val))
     122  #   define YY_REINTERPRET_CAST(Type, Val) ((Type) (Val))
     123  #  endif
     124  # endif
     125  # ifndef YY_NULLPTR
     126  #  if defined __cplusplus
     127  #   if 201103L <= __cplusplus
     128  #    define YY_NULLPTR nullptr
     129  #   else
     130  #    define YY_NULLPTR 0
     131  #   endif
     132  #  else
     133  #   define YY_NULLPTR ((void*)0)
     134  #  endif
     135  # endif
     136  
     137  /* Use api.header.include to #include this header
     138     instead of duplicating it here.  */
     139  #ifndef YY_YY_PAM_CONV_Y_H_INCLUDED
     140  # define YY_YY_PAM_CONV_Y_H_INCLUDED
     141  /* Debug traces.  */
     142  #ifndef YYDEBUG
     143  # define YYDEBUG 0
     144  #endif
     145  #if YYDEBUG
     146  extern int yydebug;
     147  #endif
     148  
     149  /* Token kinds.  */
     150  #ifndef YYTOKENTYPE
     151  # define YYTOKENTYPE
     152    enum yytokentype
     153    {
     154      YYEMPTY = -2,
     155      YYEOF = 0,                     /* "end of file"  */
     156      YYerror = 256,                 /* error  */
     157      YYUNDEF = 257,                 /* "invalid token"  */
     158      NL = 258,                      /* NL  */
     159      EOFILE = 259,                  /* EOFILE  */
     160      TOK = 260                      /* TOK  */
     161    };
     162    typedef enum yytokentype yytoken_kind_t;
     163  #endif
     164  /* Token kinds.  */
     165  #define YYEMPTY -2
     166  #define YYEOF 0
     167  #define YYerror 256
     168  #define YYUNDEF 257
     169  #define NL 258
     170  #define EOFILE 259
     171  #define TOK 260
     172  
     173  /* Value type.  */
     174  #if ! defined YYSTYPE && ! defined YYSTYPE_IS_DECLARED
     175  union YYSTYPE
     176  {
     177  #line 45 "pam_conv_y.y"
     178  
     179      int def;
     180      char *string;
     181  
     182  #line 183 "pam_conv_y.c"
     183  
     184  };
     185  typedef union YYSTYPE YYSTYPE;
     186  # define YYSTYPE_IS_TRIVIAL 1
     187  # define YYSTYPE_IS_DECLARED 1
     188  #endif
     189  
     190  
     191  extern YYSTYPE yylval;
     192  
     193  int yyparse (void);
     194  
     195  #endif /* !YY_YY_PAM_CONV_Y_H_INCLUDED  */
     196  /* Symbol kind.  */
     197  enum yysymbol_kind_t
     198  {
     199    YYSYMBOL_YYEMPTY = -2,
     200    YYSYMBOL_YYEOF = 0,                      /* "end of file"  */
     201    YYSYMBOL_YYerror = 1,                    /* error  */
     202    YYSYMBOL_YYUNDEF = 2,                    /* "invalid token"  */
     203    YYSYMBOL_NL = 3,                         /* NL  */
     204    YYSYMBOL_EOFILE = 4,                     /* EOFILE  */
     205    YYSYMBOL_TOK = 5,                        /* TOK  */
     206    YYSYMBOL_YYACCEPT = 6,                   /* $accept  */
     207    YYSYMBOL_complete = 7,                   /* complete  */
     208    YYSYMBOL_line = 8,                       /* line  */
     209    YYSYMBOL_tokenls = 9,                    /* tokenls  */
     210    YYSYMBOL_path = 10,                      /* path  */
     211    YYSYMBOL_tok = 11                        /* tok  */
     212  };
     213  typedef enum yysymbol_kind_t yysymbol_kind_t;
     214  
     215  
     216  
     217  
     218  #ifdef short
     219  # undef short
     220  #endif
     221  
     222  /* On compilers that do not define __PTRDIFF_MAX__ etc., make sure
     223     <limits.h> and (if available) <stdint.h> are included
     224     so that the code can choose integer types of a good width.  */
     225  
     226  #ifndef __PTRDIFF_MAX__
     227  # include <limits.h> /* INFRINGES ON USER NAME SPACE */
     228  # if defined __STDC_VERSION__ && 199901 <= __STDC_VERSION__
     229  #  include <stdint.h> /* INFRINGES ON USER NAME SPACE */
     230  #  define YY_STDINT_H
     231  # endif
     232  #endif
     233  
     234  /* Narrow types that promote to a signed type and that can represent a
     235     signed or unsigned integer of at least N bits.  In tables they can
     236     save space and decrease cache pressure.  Promoting to a signed type
     237     helps avoid bugs in integer arithmetic.  */
     238  
     239  #ifdef __INT_LEAST8_MAX__
     240  typedef __INT_LEAST8_TYPE__ yytype_int8;
     241  #elif defined YY_STDINT_H
     242  typedef int_least8_t yytype_int8;
     243  #else
     244  typedef signed char yytype_int8;
     245  #endif
     246  
     247  #ifdef __INT_LEAST16_MAX__
     248  typedef __INT_LEAST16_TYPE__ yytype_int16;
     249  #elif defined YY_STDINT_H
     250  typedef int_least16_t yytype_int16;
     251  #else
     252  typedef short yytype_int16;
     253  #endif
     254  
     255  /* Work around bug in HP-UX 11.23, which defines these macros
     256     incorrectly for preprocessor constants.  This workaround can likely
     257     be removed in 2023, as HPE has promised support for HP-UX 11.23
     258     (aka HP-UX 11i v2) only through the end of 2022; see Table 2 of
     259     <https://h20195.www2.hpe.com/V2/getpdf.aspx/4AA4-7673ENW.pdf>.  */
     260  #ifdef __hpux
     261  # undef UINT_LEAST8_MAX
     262  # undef UINT_LEAST16_MAX
     263  # define UINT_LEAST8_MAX 255
     264  # define UINT_LEAST16_MAX 65535
     265  #endif
     266  
     267  #if defined __UINT_LEAST8_MAX__ && __UINT_LEAST8_MAX__ <= __INT_MAX__
     268  typedef __UINT_LEAST8_TYPE__ yytype_uint8;
     269  #elif (!defined __UINT_LEAST8_MAX__ && defined YY_STDINT_H \
     270         && UINT_LEAST8_MAX <= INT_MAX)
     271  typedef uint_least8_t yytype_uint8;
     272  #elif !defined __UINT_LEAST8_MAX__ && UCHAR_MAX <= INT_MAX
     273  typedef unsigned char yytype_uint8;
     274  #else
     275  typedef short yytype_uint8;
     276  #endif
     277  
     278  #if defined __UINT_LEAST16_MAX__ && __UINT_LEAST16_MAX__ <= __INT_MAX__
     279  typedef __UINT_LEAST16_TYPE__ yytype_uint16;
     280  #elif (!defined __UINT_LEAST16_MAX__ && defined YY_STDINT_H \
     281         && UINT_LEAST16_MAX <= INT_MAX)
     282  typedef uint_least16_t yytype_uint16;
     283  #elif !defined __UINT_LEAST16_MAX__ && USHRT_MAX <= INT_MAX
     284  typedef unsigned short yytype_uint16;
     285  #else
     286  typedef int yytype_uint16;
     287  #endif
     288  
     289  #ifndef YYPTRDIFF_T
     290  # if defined __PTRDIFF_TYPE__ && defined __PTRDIFF_MAX__
     291  #  define YYPTRDIFF_T __PTRDIFF_TYPE__
     292  #  define YYPTRDIFF_MAXIMUM __PTRDIFF_MAX__
     293  # elif defined PTRDIFF_MAX
     294  #  ifndef ptrdiff_t
     295  #   include <stddef.h> /* INFRINGES ON USER NAME SPACE */
     296  #  endif
     297  #  define YYPTRDIFF_T ptrdiff_t
     298  #  define YYPTRDIFF_MAXIMUM PTRDIFF_MAX
     299  # else
     300  #  define YYPTRDIFF_T long
     301  #  define YYPTRDIFF_MAXIMUM LONG_MAX
     302  # endif
     303  #endif
     304  
     305  #ifndef YYSIZE_T
     306  # ifdef __SIZE_TYPE__
     307  #  define YYSIZE_T __SIZE_TYPE__
     308  # elif defined size_t
     309  #  define YYSIZE_T size_t
     310  # elif defined __STDC_VERSION__ && 199901 <= __STDC_VERSION__
     311  #  include <stddef.h> /* INFRINGES ON USER NAME SPACE */
     312  #  define YYSIZE_T size_t
     313  # else
     314  #  define YYSIZE_T unsigned
     315  # endif
     316  #endif
     317  
     318  #define YYSIZE_MAXIMUM                                  \
     319    YY_CAST (YYPTRDIFF_T,                                 \
     320             (YYPTRDIFF_MAXIMUM < YY_CAST (YYSIZE_T, -1)  \
     321              ? YYPTRDIFF_MAXIMUM                         \
     322              : YY_CAST (YYSIZE_T, -1)))
     323  
     324  #define YYSIZEOF(X) YY_CAST (YYPTRDIFF_T, sizeof (X))
     325  
     326  
     327  /* Stored state numbers (used for stacks). */
     328  typedef yytype_int8 yy_state_t;
     329  
     330  /* State numbers in computations.  */
     331  typedef int yy_state_fast_t;
     332  
     333  #ifndef YY_
     334  # if defined YYENABLE_NLS && YYENABLE_NLS
     335  #  if ENABLE_NLS
     336  #   include <libintl.h> /* INFRINGES ON USER NAME SPACE */
     337  #   define YY_(Msgid) dgettext ("bison-runtime", Msgid)
     338  #  endif
     339  # endif
     340  # ifndef YY_
     341  #  define YY_(Msgid) Msgid
     342  # endif
     343  #endif
     344  
     345  
     346  #ifndef YY_ATTRIBUTE_PURE
     347  # if defined __GNUC__ && 2 < __GNUC__ + (96 <= __GNUC_MINOR__)
     348  #  define YY_ATTRIBUTE_PURE __attribute__ ((__pure__))
     349  # else
     350  #  define YY_ATTRIBUTE_PURE
     351  # endif
     352  #endif
     353  
     354  #ifndef YY_ATTRIBUTE_UNUSED
     355  # if defined __GNUC__ && 2 < __GNUC__ + (7 <= __GNUC_MINOR__)
     356  #  define YY_ATTRIBUTE_UNUSED __attribute__ ((__unused__))
     357  # else
     358  #  define YY_ATTRIBUTE_UNUSED
     359  # endif
     360  #endif
     361  
     362  /* Suppress unused-variable warnings by "using" E.  */
     363  #if ! defined lint || defined __GNUC__
     364  # define YY_USE(E) ((void) (E))
     365  #else
     366  # define YY_USE(E) /* empty */
     367  #endif
     368  
     369  #if defined __GNUC__ && ! defined __ICC && 407 <= __GNUC__ * 100 + __GNUC_MINOR__
     370  /* Suppress an incorrect diagnostic about yylval being uninitialized.  */
     371  # define YY_IGNORE_MAYBE_UNINITIALIZED_BEGIN                            \
     372      _Pragma ("GCC diagnostic push")                                     \
     373      _Pragma ("GCC diagnostic ignored \"-Wuninitialized\"")              \
     374      _Pragma ("GCC diagnostic ignored \"-Wmaybe-uninitialized\"")
     375  # define YY_IGNORE_MAYBE_UNINITIALIZED_END      \
     376      _Pragma ("GCC diagnostic pop")
     377  #else
     378  # define YY_INITIAL_VALUE(Value) Value
     379  #endif
     380  #ifndef YY_IGNORE_MAYBE_UNINITIALIZED_BEGIN
     381  # define YY_IGNORE_MAYBE_UNINITIALIZED_BEGIN
     382  # define YY_IGNORE_MAYBE_UNINITIALIZED_END
     383  #endif
     384  #ifndef YY_INITIAL_VALUE
     385  # define YY_INITIAL_VALUE(Value) /* Nothing. */
     386  #endif
     387  
     388  #if defined __cplusplus && defined __GNUC__ && ! defined __ICC && 6 <= __GNUC__
     389  # define YY_IGNORE_USELESS_CAST_BEGIN                          \
     390      _Pragma ("GCC diagnostic push")                            \
     391      _Pragma ("GCC diagnostic ignored \"-Wuseless-cast\"")
     392  # define YY_IGNORE_USELESS_CAST_END            \
     393      _Pragma ("GCC diagnostic pop")
     394  #endif
     395  #ifndef YY_IGNORE_USELESS_CAST_BEGIN
     396  # define YY_IGNORE_USELESS_CAST_BEGIN
     397  # define YY_IGNORE_USELESS_CAST_END
     398  #endif
     399  
     400  
     401  #define YY_ASSERT(E) ((void) (0 && (E)))
     402  
     403  #if !defined yyoverflow
     404  
     405  /* The parser invokes alloca or malloc; define the necessary symbols.  */
     406  
     407  # ifdef YYSTACK_USE_ALLOCA
     408  #  if YYSTACK_USE_ALLOCA
     409  #   ifdef __GNUC__
     410  #    define YYSTACK_ALLOC __builtin_alloca
     411  #   elif defined __BUILTIN_VA_ARG_INCR
     412  #    include <alloca.h> /* INFRINGES ON USER NAME SPACE */
     413  #   elif defined _AIX
     414  #    define YYSTACK_ALLOC __alloca
     415  #   elif defined _MSC_VER
     416  #    include <malloc.h> /* INFRINGES ON USER NAME SPACE */
     417  #    define alloca _alloca
     418  #   else
     419  #    define YYSTACK_ALLOC alloca
     420  #    if ! defined _ALLOCA_H && ! defined EXIT_SUCCESS
     421  #     include <stdlib.h> /* INFRINGES ON USER NAME SPACE */
     422        /* Use EXIT_SUCCESS as a witness for stdlib.h.  */
     423  #     ifndef EXIT_SUCCESS
     424  #      define EXIT_SUCCESS 0
     425  #     endif
     426  #    endif
     427  #   endif
     428  #  endif
     429  # endif
     430  
     431  # ifdef YYSTACK_ALLOC
     432     /* Pacify GCC's 'empty if-body' warning.  */
     433  #  define YYSTACK_FREE(Ptr) do { /* empty */; } while (0)
     434  #  ifndef YYSTACK_ALLOC_MAXIMUM
     435      /* The OS might guarantee only one guard page at the bottom of the stack,
     436         and a page size can be as small as 4096 bytes.  So we cannot safely
     437         invoke alloca (N) if N exceeds 4096.  Use a slightly smaller number
     438         to allow for a few compiler-allocated temporary stack slots.  */
     439  #   define YYSTACK_ALLOC_MAXIMUM 4032 /* reasonable circa 2006 */
     440  #  endif
     441  # else
     442  #  define YYSTACK_ALLOC YYMALLOC
     443  #  define YYSTACK_FREE YYFREE
     444  #  ifndef YYSTACK_ALLOC_MAXIMUM
     445  #   define YYSTACK_ALLOC_MAXIMUM YYSIZE_MAXIMUM
     446  #  endif
     447  #  if (defined __cplusplus && ! defined EXIT_SUCCESS \
     448         && ! ((defined YYMALLOC || defined malloc) \
     449               && (defined YYFREE || defined free)))
     450  #   include <stdlib.h> /* INFRINGES ON USER NAME SPACE */
     451  #   ifndef EXIT_SUCCESS
     452  #    define EXIT_SUCCESS 0
     453  #   endif
     454  #  endif
     455  #  ifndef YYMALLOC
     456  #   define YYMALLOC malloc
     457  #   if ! defined malloc && ! defined EXIT_SUCCESS
     458  void *malloc (YYSIZE_T); /* INFRINGES ON USER NAME SPACE */
     459  #   endif
     460  #  endif
     461  #  ifndef YYFREE
     462  #   define YYFREE free
     463  #   if ! defined free && ! defined EXIT_SUCCESS
     464  void free (void *); /* INFRINGES ON USER NAME SPACE */
     465  #   endif
     466  #  endif
     467  # endif
     468  #endif /* !defined yyoverflow */
     469  
     470  #if (! defined yyoverflow \
     471       && (! defined __cplusplus \
     472           || (defined YYSTYPE_IS_TRIVIAL && YYSTYPE_IS_TRIVIAL)))
     473  
     474  /* A type that is properly aligned for any stack member.  */
     475  union yyalloc
     476  {
     477    yy_state_t yyss_alloc;
     478    YYSTYPE yyvs_alloc;
     479  };
     480  
     481  /* The size of the maximum gap between one aligned stack and the next.  */
     482  # define YYSTACK_GAP_MAXIMUM (YYSIZEOF (union yyalloc) - 1)
     483  
     484  /* The size of an array large to enough to hold all stacks, each with
     485     N elements.  */
     486  # define YYSTACK_BYTES(N) \
     487       ((N) * (YYSIZEOF (yy_state_t) + YYSIZEOF (YYSTYPE)) \
     488        + YYSTACK_GAP_MAXIMUM)
     489  
     490  # define YYCOPY_NEEDED 1
     491  
     492  /* Relocate STACK from its old location to the new one.  The
     493     local variables YYSIZE and YYSTACKSIZE give the old and new number of
     494     elements in the stack, and YYPTR gives the new location of the
     495     stack.  Advance YYPTR to a properly aligned location for the next
     496     stack.  */
     497  # define YYSTACK_RELOCATE(Stack_alloc, Stack)                           \
     498      do                                                                  \
     499        {                                                                 \
     500          YYPTRDIFF_T yynewbytes;                                         \
     501          YYCOPY (&yyptr->Stack_alloc, Stack, yysize);                    \
     502          Stack = &yyptr->Stack_alloc;                                    \
     503          yynewbytes = yystacksize * YYSIZEOF (*Stack) + YYSTACK_GAP_MAXIMUM; \
     504          yyptr += yynewbytes / YYSIZEOF (*yyptr);                        \
     505        }                                                                 \
     506      while (0)
     507  
     508  #endif
     509  
     510  #if defined YYCOPY_NEEDED && YYCOPY_NEEDED
     511  /* Copy COUNT objects from SRC to DST.  The source and destination do
     512     not overlap.  */
     513  # ifndef YYCOPY
     514  #  if defined __GNUC__ && 1 < __GNUC__
     515  #   define YYCOPY(Dst, Src, Count) \
     516        __builtin_memcpy (Dst, Src, YY_CAST (YYSIZE_T, (Count)) * sizeof (*(Src)))
     517  #  else
     518  #   define YYCOPY(Dst, Src, Count)              \
     519        do                                        \
     520          {                                       \
     521            YYPTRDIFF_T yyi;                      \
     522            for (yyi = 0; yyi < (Count); yyi++)   \
     523              (Dst)[yyi] = (Src)[yyi];            \
     524          }                                       \
     525        while (0)
     526  #  endif
     527  # endif
     528  #endif /* !YYCOPY_NEEDED */
     529  
     530  /* YYFINAL -- State number of the termination state.  */
     531  #define YYFINAL  2
     532  /* YYLAST -- Last index in YYTABLE.  */
     533  #define YYLAST   13
     534  
     535  /* YYNTOKENS -- Number of terminals.  */
     536  #define YYNTOKENS  6
     537  /* YYNNTS -- Number of nonterminals.  */
     538  #define YYNNTS  6
     539  /* YYNRULES -- Number of rules.  */
     540  #define YYNRULES  11
     541  /* YYNSTATES -- Number of states.  */
     542  #define YYNSTATES  17
     543  
     544  /* YYMAXUTOK -- Last valid token kind.  */
     545  #define YYMAXUTOK   260
     546  
     547  
     548  /* YYTRANSLATE(TOKEN-NUM) -- Symbol number corresponding to TOKEN-NUM
     549     as returned by yylex, with out-of-bounds checking.  */
     550  #define YYTRANSLATE(YYX)                                \
     551    (0 <= (YYX) && (YYX) <= YYMAXUTOK                     \
     552     ? YY_CAST (yysymbol_kind_t, yytranslate[YYX])        \
     553     : YYSYMBOL_YYUNDEF)
     554  
     555  /* YYTRANSLATE[TOKEN-NUM] -- Symbol number corresponding to TOKEN-NUM
     556     as returned by yylex.  */
     557  static const yytype_int8 yytranslate[] =
     558  {
     559         0,     2,     2,     2,     2,     2,     2,     2,     2,     2,
     560         2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
     561         2,     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,     1,     2,     3,     4,
     585         5
     586  };
     587  
     588  #if YYDEBUG
     589    /* YYRLINE[YYN] -- Source line where rule number YYN was defined.  */
     590  static const yytype_uint8 yyrline[] =
     591  {
     592         0,    59,    59,    60,    61,    62,    68,   132,   138,   141,
     593       157,   163
     594  };
     595  #endif
     596  
     597  /** Accessing symbol of state STATE.  */
     598  #define YY_ACCESSING_SYMBOL(State) YY_CAST (yysymbol_kind_t, yystos[State])
     599  
     600  #if YYDEBUG || 0
     601  /* The user-facing name of the symbol whose (internal) number is
     602     YYSYMBOL.  No bounds checking.  */
     603  static const char *yysymbol_name (yysymbol_kind_t yysymbol) YY_ATTRIBUTE_UNUSED;
     604  
     605  /* YYTNAME[SYMBOL-NUM] -- String name of the symbol SYMBOL-NUM.
     606     First, the terminals, then, starting at YYNTOKENS, nonterminals.  */
     607  static const char *const yytname[] =
     608  {
     609    "\"end of file\"", "error", "\"invalid token\"", "NL", "EOFILE", "TOK",
     610    "$accept", "complete", "line", "tokenls", "path", "tok", YY_NULLPTR
     611  };
     612  
     613  static const char *
     614  yysymbol_name (yysymbol_kind_t yysymbol)
     615  {
     616    return yytname[yysymbol];
     617  }
     618  #endif
     619  
     620  #ifdef YYPRINT
     621  /* YYTOKNUM[NUM] -- (External) token number corresponding to the
     622     (internal) symbol number NUM (which must be that of a token).  */
     623  static const yytype_int16 yytoknum[] =
     624  {
     625         0,   256,   257,   258,   259,   260
     626  };
     627  #endif
     628  
     629  #define YYPACT_NINF (-9)
     630  
     631  #define yypact_value_is_default(Yyn) \
     632    ((Yyn) == YYPACT_NINF)
     633  
     634  #define YYTABLE_NINF (-1)
     635  
     636  #define yytable_value_is_error(Yyn) \
     637    0
     638  
     639    /* YYPACT[STATE-NUM] -- Index in YYTABLE of the portion describing
     640       STATE-NUM.  */
     641  static const yytype_int8 yypact[] =
     642  {
     643        -9,     4,    -9,     7,    -9,    -9,    -9,    -9,     6,    -9,
     644         6,     8,    -9,    -9,    -2,    -9,    -9
     645  };
     646  
     647    /* YYDEFACT[STATE-NUM] -- Default reduction number in state STATE-NUM.
     648       Performed when YYTABLE does not specify something else to do.  Zero
     649       means the default is an error.  */
     650  static const yytype_int8 yydefact[] =
     651  {
     652         2,     0,     1,     0,     3,     5,    11,     4,     0,     7,
     653         0,     0,    10,     8,     0,     6,     9
     654  };
     655  
     656    /* YYPGOTO[NTERM-NUM].  */
     657  static const yytype_int8 yypgoto[] =
     658  {
     659        -9,    -9,    -9,    -9,    -9,    -8
     660  };
     661  
     662    /* YYDEFGOTO[NTERM-NUM].  */
     663  static const yytype_int8 yydefgoto[] =
     664  {
     665         0,     1,     7,    14,    13,     8
     666  };
     667  
     668    /* YYTABLE[YYPACT[STATE-NUM]] -- What to do in state STATE-NUM.  If
     669       positive, shift that token.  If negative, reduce the rule whose
     670       number is the opposite.  If YYTABLE_NINF, syntax error.  */
     671  static const yytype_int8 yytable[] =
     672  {
     673        10,    15,    11,     6,     2,     3,    16,     4,     5,     6,
     674         9,     6,     0,    12
     675  };
     676  
     677  static const yytype_int8 yycheck[] =
     678  {
     679         8,     3,    10,     5,     0,     1,    14,     3,     4,     5,
     680         3,     5,    -1,     5
     681  };
     682  
     683    /* YYSTOS[STATE-NUM] -- The (internal number of the) accessing
     684       symbol of state STATE-NUM.  */
     685  static const yytype_int8 yystos[] =
     686  {
     687         0,     7,     0,     1,     3,     4,     5,     8,    11,     3,
     688        11,    11,     5,    10,     9,     3,    11
     689  };
     690  
     691    /* YYR1[YYN] -- Symbol number of symbol that rule YYN derives.  */
     692  static const yytype_int8 yyr1[] =
     693  {
     694         0,     6,     7,     7,     7,     7,     8,     8,     9,     9,
     695        10,    11
     696  };
     697  
     698    /* YYR2[YYN] -- Number of symbols on the right hand side of rule YYN.  */
     699  static const yytype_int8 yyr2[] =
     700  {
     701         0,     2,     0,     2,     2,     2,     6,     2,     0,     2,
     702         1,     1
     703  };
     704  
     705  
     706  enum { YYENOMEM = -2 };
     707  
     708  #define yyerrok         (yyerrstatus = 0)
     709  #define yyclearin       (yychar = YYEMPTY)
     710  
     711  #define YYACCEPT        goto yyacceptlab
     712  #define YYABORT         goto yyabortlab
     713  #define YYERROR         goto yyerrorlab
     714  
     715  
     716  #define YYRECOVERING()  (!!yyerrstatus)
     717  
     718  #define YYBACKUP(Token, Value)                                    \
     719    do                                                              \
     720      if (yychar == YYEMPTY)                                        \
     721        {                                                           \
     722          yychar = (Token);                                         \
     723          yylval = (Value);                                         \
     724          YYPOPSTACK (yylen);                                       \
     725          yystate = *yyssp;                                         \
     726          goto yybackup;                                            \
     727        }                                                           \
     728      else                                                          \
     729        {                                                           \
     730          yyerror (YY_("syntax error: cannot back up")); \
     731          YYERROR;                                                  \
     732        }                                                           \
     733    while (0)
     734  
     735  /* Backward compatibility with an undocumented macro.
     736     Use YYerror or YYUNDEF. */
     737  #define YYERRCODE YYUNDEF
     738  
     739  
     740  /* Enable debugging if requested.  */
     741  #if YYDEBUG
     742  
     743  # ifndef YYFPRINTF
     744  #  include <stdio.h> /* INFRINGES ON USER NAME SPACE */
     745  #  define YYFPRINTF fprintf
     746  # endif
     747  
     748  # define YYDPRINTF(Args)                        \
     749  do {                                            \
     750    if (yydebug)                                  \
     751      YYFPRINTF Args;                             \
     752  } while (0)
     753  
     754  /* This macro is provided for backward compatibility. */
     755  # ifndef YY_LOCATION_PRINT
     756  #  define YY_LOCATION_PRINT(File, Loc) ((void) 0)
     757  # endif
     758  
     759  
     760  # define YY_SYMBOL_PRINT(Title, Kind, Value, Location)                    \
     761  do {                                                                      \
     762    if (yydebug)                                                            \
     763      {                                                                     \
     764        YYFPRINTF (stderr, "%s ", Title);                                   \
     765        yy_symbol_print (stderr,                                            \
     766                    Kind, Value); \
     767        YYFPRINTF (stderr, "\n");                                           \
     768      }                                                                     \
     769  } while (0)
     770  
     771  
     772  /*-----------------------------------.
     773  | Print this symbol's value on YYO.  |
     774  `-----------------------------------*/
     775  
     776  static void
     777  yy_symbol_value_print (FILE *yyo,
     778                         yysymbol_kind_t yykind, YYSTYPE const * const yyvaluep)
     779  {
     780    FILE *yyoutput = yyo;
     781    YY_USE (yyoutput);
     782    if (!yyvaluep)
     783      return;
     784  # ifdef YYPRINT
     785    if (yykind < YYNTOKENS)
     786      YYPRINT (yyo, yytoknum[yykind], *yyvaluep);
     787  # endif
     788    YY_IGNORE_MAYBE_UNINITIALIZED_BEGIN
     789    YY_USE (yykind);
     790    YY_IGNORE_MAYBE_UNINITIALIZED_END
     791  }
     792  
     793  
     794  /*---------------------------.
     795  | Print this symbol on YYO.  |
     796  `---------------------------*/
     797  
     798  static void
     799  yy_symbol_print (FILE *yyo,
     800                   yysymbol_kind_t yykind, YYSTYPE const * const yyvaluep)
     801  {
     802    YYFPRINTF (yyo, "%s %s (",
     803               yykind < YYNTOKENS ? "token" : "nterm", yysymbol_name (yykind));
     804  
     805    yy_symbol_value_print (yyo, yykind, yyvaluep);
     806    YYFPRINTF (yyo, ")");
     807  }
     808  
     809  /*------------------------------------------------------------------.
     810  | yy_stack_print -- Print the state stack from its BOTTOM up to its |
     811  | TOP (included).                                                   |
     812  `------------------------------------------------------------------*/
     813  
     814  static void
     815  yy_stack_print (yy_state_t *yybottom, yy_state_t *yytop)
     816  {
     817    YYFPRINTF (stderr, "Stack now");
     818    for (; yybottom <= yytop; yybottom++)
     819      {
     820        int yybot = *yybottom;
     821        YYFPRINTF (stderr, " %d", yybot);
     822      }
     823    YYFPRINTF (stderr, "\n");
     824  }
     825  
     826  # define YY_STACK_PRINT(Bottom, Top)                            \
     827  do {                                                            \
     828    if (yydebug)                                                  \
     829      yy_stack_print ((Bottom), (Top));                           \
     830  } while (0)
     831  
     832  
     833  /*------------------------------------------------.
     834  | Report that the YYRULE is going to be reduced.  |
     835  `------------------------------------------------*/
     836  
     837  static void
     838  yy_reduce_print (yy_state_t *yyssp, YYSTYPE *yyvsp,
     839                   int yyrule)
     840  {
     841    int yylno = yyrline[yyrule];
     842    int yynrhs = yyr2[yyrule];
     843    int yyi;
     844    YYFPRINTF (stderr, "Reducing stack by rule %d (line %d):\n",
     845               yyrule - 1, yylno);
     846    /* The symbols being reduced.  */
     847    for (yyi = 0; yyi < yynrhs; yyi++)
     848      {
     849        YYFPRINTF (stderr, "   $%d = ", yyi + 1);
     850        yy_symbol_print (stderr,
     851                         YY_ACCESSING_SYMBOL (+yyssp[yyi + 1 - yynrhs]),
     852                         &yyvsp[(yyi + 1) - (yynrhs)]);
     853        YYFPRINTF (stderr, "\n");
     854      }
     855  }
     856  
     857  # define YY_REDUCE_PRINT(Rule)          \
     858  do {                                    \
     859    if (yydebug)                          \
     860      yy_reduce_print (yyssp, yyvsp, Rule); \
     861  } while (0)
     862  
     863  /* Nonzero means print parse trace.  It is left uninitialized so that
     864     multiple parsers can coexist.  */
     865  int yydebug;
     866  #else /* !YYDEBUG */
     867  # define YYDPRINTF(Args) ((void) 0)
     868  # define YY_SYMBOL_PRINT(Title, Kind, Value, Location)
     869  # define YY_STACK_PRINT(Bottom, Top)
     870  # define YY_REDUCE_PRINT(Rule)
     871  #endif /* !YYDEBUG */
     872  
     873  
     874  /* YYINITDEPTH -- initial size of the parser's stacks.  */
     875  #ifndef YYINITDEPTH
     876  # define YYINITDEPTH 200
     877  #endif
     878  
     879  /* YYMAXDEPTH -- maximum size the stacks can grow to (effective only
     880     if the built-in stack extension method is used).
     881  
     882     Do not make this value too large; the results are undefined if
     883     YYSTACK_ALLOC_MAXIMUM < YYSTACK_BYTES (YYMAXDEPTH)
     884     evaluated with infinite-precision integer arithmetic.  */
     885  
     886  #ifndef YYMAXDEPTH
     887  # define YYMAXDEPTH 10000
     888  #endif
     889  
     890  
     891  
     892  
     893  
     894  
     895  /*-----------------------------------------------.
     896  | Release the memory associated to this symbol.  |
     897  `-----------------------------------------------*/
     898  
     899  static void
     900  yydestruct (const char *yymsg,
     901              yysymbol_kind_t yykind, YYSTYPE *yyvaluep)
     902  {
     903    YY_USE (yyvaluep);
     904    if (!yymsg)
     905      yymsg = "Deleting";
     906    YY_SYMBOL_PRINT (yymsg, yykind, yyvaluep, yylocationp);
     907  
     908    YY_IGNORE_MAYBE_UNINITIALIZED_BEGIN
     909    YY_USE (yykind);
     910    YY_IGNORE_MAYBE_UNINITIALIZED_END
     911  }
     912  
     913  
     914  /* Lookahead token kind.  */
     915  int yychar;
     916  
     917  /* The semantic value of the lookahead symbol.  */
     918  YYSTYPE yylval;
     919  /* Number of syntax errors so far.  */
     920  int yynerrs;
     921  
     922  
     923  
     924  
     925  /*----------.
     926  | yyparse.  |
     927  `----------*/
     928  
     929  int
     930  yyparse (void)
     931  {
     932      yy_state_fast_t yystate = 0;
     933      /* Number of tokens to shift before error messages enabled.  */
     934      int yyerrstatus = 0;
     935  
     936      /* Refer to the stacks through separate pointers, to allow yyoverflow
     937         to reallocate them elsewhere.  */
     938  
     939      /* Their size.  */
     940      YYPTRDIFF_T yystacksize = YYINITDEPTH;
     941  
     942      /* The state stack: array, bottom, top.  */
     943      yy_state_t yyssa[YYINITDEPTH];
     944      yy_state_t *yyss = yyssa;
     945      yy_state_t *yyssp = yyss;
     946  
     947      /* The semantic value stack: array, bottom, top.  */
     948      YYSTYPE yyvsa[YYINITDEPTH];
     949      YYSTYPE *yyvs = yyvsa;
     950      YYSTYPE *yyvsp = yyvs;
     951  
     952    int yyn;
     953    /* The return value of yyparse.  */
     954    int yyresult;
     955    /* Lookahead symbol kind.  */
     956    yysymbol_kind_t yytoken = YYSYMBOL_YYEMPTY;
     957    /* The variables used to return semantic value and location from the
     958       action routines.  */
     959    YYSTYPE yyval;
     960  
     961  
     962  
     963  #define YYPOPSTACK(N)   (yyvsp -= (N), yyssp -= (N))
     964  
     965    /* The number of symbols on the RHS of the reduced rule.
     966       Keep to zero when no symbol should be popped.  */
     967    int yylen = 0;
     968  
     969    YYDPRINTF ((stderr, "Starting parse\n"));
     970  
     971    yychar = YYEMPTY; /* Cause a token to be read.  */
     972    goto yysetstate;
     973  
     974  
     975  /*------------------------------------------------------------.
     976  | yynewstate -- push a new state, which is found in yystate.  |
     977  `------------------------------------------------------------*/
     978  yynewstate:
     979    /* In all cases, when you get here, the value and location stacks
     980       have just been pushed.  So pushing a state here evens the stacks.  */
     981    yyssp++;
     982  
     983  
     984  /*--------------------------------------------------------------------.
     985  | yysetstate -- set current state (the top of the stack) to yystate.  |
     986  `--------------------------------------------------------------------*/
     987  yysetstate:
     988    YYDPRINTF ((stderr, "Entering state %d\n", yystate));
     989    YY_ASSERT (0 <= yystate && yystate < YYNSTATES);
     990    YY_IGNORE_USELESS_CAST_BEGIN
     991    *yyssp = YY_CAST (yy_state_t, yystate);
     992    YY_IGNORE_USELESS_CAST_END
     993    YY_STACK_PRINT (yyss, yyssp);
     994  
     995    if (yyss + yystacksize - 1 <= yyssp)
     996  #if !defined yyoverflow && !defined YYSTACK_RELOCATE
     997      goto yyexhaustedlab;
     998  #else
     999      {
    1000        /* Get the current used size of the three stacks, in elements.  */
    1001        YYPTRDIFF_T yysize = yyssp - yyss + 1;
    1002  
    1003  # if defined yyoverflow
    1004        {
    1005          /* Give user a chance to reallocate the stack.  Use copies of
    1006             these so that the &'s don't force the real ones into
    1007             memory.  */
    1008          yy_state_t *yyss1 = yyss;
    1009          YYSTYPE *yyvs1 = yyvs;
    1010  
    1011          /* Each stack pointer address is followed by the size of the
    1012             data in use in that stack, in bytes.  This used to be a
    1013             conditional around just the two extra args, but that might
    1014             be undefined if yyoverflow is a macro.  */
    1015          yyoverflow (YY_("memory exhausted"),
    1016                      &yyss1, yysize * YYSIZEOF (*yyssp),
    1017                      &yyvs1, yysize * YYSIZEOF (*yyvsp),
    1018                      &yystacksize);
    1019          yyss = yyss1;
    1020          yyvs = yyvs1;
    1021        }
    1022  # else /* defined YYSTACK_RELOCATE */
    1023        /* Extend the stack our own way.  */
    1024        if (YYMAXDEPTH <= yystacksize)
    1025          goto yyexhaustedlab;
    1026        yystacksize *= 2;
    1027        if (YYMAXDEPTH < yystacksize)
    1028          yystacksize = YYMAXDEPTH;
    1029  
    1030        {
    1031          yy_state_t *yyss1 = yyss;
    1032          union yyalloc *yyptr =
    1033            YY_CAST (union yyalloc *,
    1034                     YYSTACK_ALLOC (YY_CAST (YYSIZE_T, YYSTACK_BYTES (yystacksize))));
    1035          if (! yyptr)
    1036            goto yyexhaustedlab;
    1037          YYSTACK_RELOCATE (yyss_alloc, yyss);
    1038          YYSTACK_RELOCATE (yyvs_alloc, yyvs);
    1039  #  undef YYSTACK_RELOCATE
    1040          if (yyss1 != yyssa)
    1041            YYSTACK_FREE (yyss1);
    1042        }
    1043  # endif
    1044  
    1045        yyssp = yyss + yysize - 1;
    1046        yyvsp = yyvs + yysize - 1;
    1047  
    1048        YY_IGNORE_USELESS_CAST_BEGIN
    1049        YYDPRINTF ((stderr, "Stack size increased to %ld\n",
    1050                    YY_CAST (long, yystacksize)));
    1051        YY_IGNORE_USELESS_CAST_END
    1052  
    1053        if (yyss + yystacksize - 1 <= yyssp)
    1054          YYABORT;
    1055      }
    1056  #endif /* !defined yyoverflow && !defined YYSTACK_RELOCATE */
    1057  
    1058    if (yystate == YYFINAL)
    1059      YYACCEPT;
    1060  
    1061    goto yybackup;
    1062  
    1063  
    1064  /*-----------.
    1065  | yybackup.  |
    1066  `-----------*/
    1067  yybackup:
    1068    /* Do appropriate processing given the current state.  Read a
    1069       lookahead token if we need one and don't already have one.  */
    1070  
    1071    /* First try to decide what to do without reference to lookahead token.  */
    1072    yyn = yypact[yystate];
    1073    if (yypact_value_is_default (yyn))
    1074      goto yydefault;
    1075  
    1076    /* Not known => get a lookahead token if don't already have one.  */
    1077  
    1078    /* YYCHAR is either empty, or end-of-input, or a valid lookahead.  */
    1079    if (yychar == YYEMPTY)
    1080      {
    1081        YYDPRINTF ((stderr, "Reading a token\n"));
    1082        yychar = yylex ();
    1083      }
    1084  
    1085    if (yychar <= YYEOF)
    1086      {
    1087        yychar = YYEOF;
    1088        yytoken = YYSYMBOL_YYEOF;
    1089        YYDPRINTF ((stderr, "Now at end of input.\n"));
    1090      }
    1091    else if (yychar == YYerror)
    1092      {
    1093        /* The scanner already issued an error message, process directly
    1094           to error recovery.  But do not keep the error token as
    1095           lookahead, it is too special and may lead us to an endless
    1096           loop in error recovery. */
    1097        yychar = YYUNDEF;
    1098        yytoken = YYSYMBOL_YYerror;
    1099        goto yyerrlab1;
    1100      }
    1101    else
    1102      {
    1103        yytoken = YYTRANSLATE (yychar);
    1104        YY_SYMBOL_PRINT ("Next token is", yytoken, &yylval, &yylloc);
    1105      }
    1106  
    1107    /* If the proper action on seeing token YYTOKEN is to reduce or to
    1108       detect an error, take that action.  */
    1109    yyn += yytoken;
    1110    if (yyn < 0 || YYLAST < yyn || yycheck[yyn] != yytoken)
    1111      goto yydefault;
    1112    yyn = yytable[yyn];
    1113    if (yyn <= 0)
    1114      {
    1115        if (yytable_value_is_error (yyn))
    1116          goto yyerrlab;
    1117        yyn = -yyn;
    1118        goto yyreduce;
    1119      }
    1120  
    1121    /* Count tokens shifted since error; after three, turn off error
    1122       status.  */
    1123    if (yyerrstatus)
    1124      yyerrstatus--;
    1125  
    1126    /* Shift the lookahead token.  */
    1127    YY_SYMBOL_PRINT ("Shifting", yytoken, &yylval, &yylloc);
    1128    yystate = yyn;
    1129    YY_IGNORE_MAYBE_UNINITIALIZED_BEGIN
    1130    *++yyvsp = yylval;
    1131    YY_IGNORE_MAYBE_UNINITIALIZED_END
    1132  
    1133    /* Discard the shifted token.  */
    1134    yychar = YYEMPTY;
    1135    goto yynewstate;
    1136  
    1137  
    1138  /*-----------------------------------------------------------.
    1139  | yydefault -- do the default action for the current state.  |
    1140  `-----------------------------------------------------------*/
    1141  yydefault:
    1142    yyn = yydefact[yystate];
    1143    if (yyn == 0)
    1144      goto yyerrlab;
    1145    goto yyreduce;
    1146  
    1147  
    1148  /*-----------------------------.
    1149  | yyreduce -- do a reduction.  |
    1150  `-----------------------------*/
    1151  yyreduce:
    1152    /* yyn is the number of a rule to reduce with.  */
    1153    yylen = yyr2[yyn];
    1154  
    1155    /* If YYLEN is nonzero, implement the default value of the action:
    1156       '$$ = $1'.
    1157  
    1158       Otherwise, the following line sets YYVAL to garbage.
    1159       This behavior is undocumented and Bison
    1160       users should not rely upon it.  Assigning to YYVAL
    1161       unconditionally makes the parser a bit smaller, and it avoids a
    1162       GCC warning that YYVAL may be used uninitialized.  */
    1163    yyval = yyvsp[1-yylen];
    1164  
    1165  
    1166    YY_REDUCE_PRINT (yyn);
    1167    switch (yyn)
    1168      {
    1169    case 5: /* complete: complete EOFILE  */
    1170  #line 62 "pam_conv_y.y"
    1171                    {
    1172      return 0;
    1173  }
    1174  #line 1175 "pam_conv_y.c"
    1175      break;
    1176  
    1177    case 6: /* line: tok tok tok path tokenls NL  */
    1178  #line 68 "pam_conv_y.y"
    1179                                {
    1180      char *filename;
    1181      FILE *conf;
    1182      int i;
    1183  
    1184      /* make sure we have lower case */
    1185      for (i=0; (yyvsp[-5].string)[i]; ++i) {
    1186  	(yyvsp[-5].string)[i] = tolower((yyvsp[-5].string)[i]);
    1187      }
    1188  
    1189      /* $1 = service-name */
    1190      yyerror("Appending to " PAM_D "/%s", (yyvsp[-5].string));
    1191  
    1192      filename = malloc(strlen((yyvsp[-5].string)) + sizeof(PAM_D) + 6);
    1193      sprintf(filename, PAM_D_FILE_FMT, (yyvsp[-5].string));
    1194      conf = fopen(filename, "r");
    1195      if (conf == NULL) {
    1196  	/* new file */
    1197  	conf = fopen(filename, "w");
    1198  	if (conf != NULL) {
    1199  	    fprintf(conf, PAM_D_MAGIC_HEADER);
    1200  	    fprintf(conf,
    1201  		    "#\n"
    1202  		    "# The PAM configuration file for the `%s' service\n"
    1203  		    "#\n", (yyvsp[-5].string));
    1204  	}
    1205      } else {
    1206  	fclose(conf);
    1207  	conf = fopen(filename, "a");
    1208      }
    1209      if (conf == NULL) {
    1210  	yyerror("trouble opening %s - aborting", filename);
    1211  	exit(1);
    1212      }
    1213      free(filename);
    1214  
    1215      /* $2 = module-type */
    1216      fprintf(conf, "%-10s", (yyvsp[-4].string));
    1217      free((yyvsp[-4].string));
    1218  
    1219      /* $3 = required etc. */
    1220      {
    1221  	const char *trans;
    1222  
    1223  	trans = old_to_new_ctrl_flag((yyvsp[-3].string));
    1224  	free((yyvsp[-3].string));
    1225  	fprintf(conf, " %-10s", trans);
    1226      }
    1227  
    1228      /* $4 = module-path */
    1229      fprintf(conf, " %s", (yyvsp[-2].string));
    1230      free((yyvsp[-2].string));
    1231  
    1232      /* $5 = arguments */
    1233      if ((yyvsp[-1].string) != NULL) {
    1234  	fprintf(conf, " \\\n\t\t%s", (yyvsp[-1].string));
    1235  	free((yyvsp[-1].string));
    1236      }
    1237  
    1238      /* end line */
    1239      fprintf(conf, "\n");
    1240  
    1241      fclose(conf);
    1242  }
    1243  #line 1244 "pam_conv_y.c"
    1244      break;
    1245  
    1246    case 7: /* line: error NL  */
    1247  #line 132 "pam_conv_y.y"
    1248             {
    1249      yyerror("malformed line");
    1250  }
    1251  #line 1252 "pam_conv_y.c"
    1252      break;
    1253  
    1254    case 8: /* tokenls: %empty  */
    1255  #line 138 "pam_conv_y.y"
    1256    {
    1257      (yyval.string)=NULL;
    1258  }
    1259  #line 1260 "pam_conv_y.c"
    1260      break;
    1261  
    1262    case 9: /* tokenls: tokenls tok  */
    1263  #line 141 "pam_conv_y.y"
    1264                {
    1265      int len;
    1266  
    1267      if ((yyvsp[-1].string)) {
    1268  	len = strlen((yyvsp[-1].string)) + strlen((yyvsp[0].string)) + 2;
    1269  	(yyval.string) = malloc(len);
    1270  	sprintf((yyval.string),"%s %s",(yyvsp[-1].string),(yyvsp[0].string));
    1271  	free((yyvsp[-1].string));
    1272  	free((yyvsp[0].string));
    1273      } else {
    1274  	(yyval.string) = (yyvsp[0].string);
    1275      }
    1276  }
    1277  #line 1278 "pam_conv_y.c"
    1278      break;
    1279  
    1280    case 10: /* path: TOK  */
    1281  #line 157 "pam_conv_y.y"
    1282        {
    1283      /* XXX - this could be used to check if file present */
    1284      (yyval.string) = strdup(yytext);
    1285  }
    1286  #line 1287 "pam_conv_y.c"
    1287      break;
    1288  
    1289    case 11: /* tok: TOK  */
    1290  #line 163 "pam_conv_y.y"
    1291        {
    1292      (yyval.string) = strdup(yytext);
    1293  }
    1294  #line 1295 "pam_conv_y.c"
    1295      break;
    1296  
    1297  
    1298  #line 1299 "pam_conv_y.c"
    1299  
    1300        default: break;
    1301      }
    1302    /* User semantic actions sometimes alter yychar, and that requires
    1303       that yytoken be updated with the new translation.  We take the
    1304       approach of translating immediately before every use of yytoken.
    1305       One alternative is translating here after every semantic action,
    1306       but that translation would be missed if the semantic action invokes
    1307       YYABORT, YYACCEPT, or YYERROR immediately after altering yychar or
    1308       if it invokes YYBACKUP.  In the case of YYABORT or YYACCEPT, an
    1309       incorrect destructor might then be invoked immediately.  In the
    1310       case of YYERROR or YYBACKUP, subsequent parser actions might lead
    1311       to an incorrect destructor call or verbose syntax error message
    1312       before the lookahead is translated.  */
    1313    YY_SYMBOL_PRINT ("-> $$ =", YY_CAST (yysymbol_kind_t, yyr1[yyn]), &yyval, &yyloc);
    1314  
    1315    YYPOPSTACK (yylen);
    1316    yylen = 0;
    1317  
    1318    *++yyvsp = yyval;
    1319  
    1320    /* Now 'shift' the result of the reduction.  Determine what state
    1321       that goes to, based on the state we popped back to and the rule
    1322       number reduced by.  */
    1323    {
    1324      const int yylhs = yyr1[yyn] - YYNTOKENS;
    1325      const int yyi = yypgoto[yylhs] + *yyssp;
    1326      yystate = (0 <= yyi && yyi <= YYLAST && yycheck[yyi] == *yyssp
    1327                 ? yytable[yyi]
    1328                 : yydefgoto[yylhs]);
    1329    }
    1330  
    1331    goto yynewstate;
    1332  
    1333  
    1334  /*--------------------------------------.
    1335  | yyerrlab -- here on detecting error.  |
    1336  `--------------------------------------*/
    1337  yyerrlab:
    1338    /* Make sure we have latest lookahead translation.  See comments at
    1339       user semantic actions for why this is necessary.  */
    1340    yytoken = yychar == YYEMPTY ? YYSYMBOL_YYEMPTY : YYTRANSLATE (yychar);
    1341    /* If not already recovering from an error, report this error.  */
    1342    if (!yyerrstatus)
    1343      {
    1344        ++yynerrs;
    1345        yyerror (YY_("syntax error"));
    1346      }
    1347  
    1348    if (yyerrstatus == 3)
    1349      {
    1350        /* If just tried and failed to reuse lookahead token after an
    1351           error, discard it.  */
    1352  
    1353        if (yychar <= YYEOF)
    1354          {
    1355            /* Return failure if at end of input.  */
    1356            if (yychar == YYEOF)
    1357              YYABORT;
    1358          }
    1359        else
    1360          {
    1361            yydestruct ("Error: discarding",
    1362                        yytoken, &yylval);
    1363            yychar = YYEMPTY;
    1364          }
    1365      }
    1366  
    1367    /* Else will try to reuse lookahead token after shifting the error
    1368       token.  */
    1369    goto yyerrlab1;
    1370  
    1371  
    1372  /*---------------------------------------------------.
    1373  | yyerrorlab -- error raised explicitly by YYERROR.  |
    1374  `---------------------------------------------------*/
    1375  yyerrorlab:
    1376    /* Pacify compilers when the user code never invokes YYERROR and the
    1377       label yyerrorlab therefore never appears in user code.  */
    1378    if (0)
    1379      YYERROR;
    1380  
    1381    /* Do not reclaim the symbols of the rule whose action triggered
    1382       this YYERROR.  */
    1383    YYPOPSTACK (yylen);
    1384    yylen = 0;
    1385    YY_STACK_PRINT (yyss, yyssp);
    1386    yystate = *yyssp;
    1387    goto yyerrlab1;
    1388  
    1389  
    1390  /*-------------------------------------------------------------.
    1391  | yyerrlab1 -- common code for both syntax error and YYERROR.  |
    1392  `-------------------------------------------------------------*/
    1393  yyerrlab1:
    1394    yyerrstatus = 3;      /* Each real token shifted decrements this.  */
    1395  
    1396    /* Pop stack until we find a state that shifts the error token.  */
    1397    for (;;)
    1398      {
    1399        yyn = yypact[yystate];
    1400        if (!yypact_value_is_default (yyn))
    1401          {
    1402            yyn += YYSYMBOL_YYerror;
    1403            if (0 <= yyn && yyn <= YYLAST && yycheck[yyn] == YYSYMBOL_YYerror)
    1404              {
    1405                yyn = yytable[yyn];
    1406                if (0 < yyn)
    1407                  break;
    1408              }
    1409          }
    1410  
    1411        /* Pop the current state because it cannot handle the error token.  */
    1412        if (yyssp == yyss)
    1413          YYABORT;
    1414  
    1415  
    1416        yydestruct ("Error: popping",
    1417                    YY_ACCESSING_SYMBOL (yystate), yyvsp);
    1418        YYPOPSTACK (1);
    1419        yystate = *yyssp;
    1420        YY_STACK_PRINT (yyss, yyssp);
    1421      }
    1422  
    1423    YY_IGNORE_MAYBE_UNINITIALIZED_BEGIN
    1424    *++yyvsp = yylval;
    1425    YY_IGNORE_MAYBE_UNINITIALIZED_END
    1426  
    1427  
    1428    /* Shift the error token.  */
    1429    YY_SYMBOL_PRINT ("Shifting", YY_ACCESSING_SYMBOL (yyn), yyvsp, yylsp);
    1430  
    1431    yystate = yyn;
    1432    goto yynewstate;
    1433  
    1434  
    1435  /*-------------------------------------.
    1436  | yyacceptlab -- YYACCEPT comes here.  |
    1437  `-------------------------------------*/
    1438  yyacceptlab:
    1439    yyresult = 0;
    1440    goto yyreturn;
    1441  
    1442  
    1443  /*-----------------------------------.
    1444  | yyabortlab -- YYABORT comes here.  |
    1445  `-----------------------------------*/
    1446  yyabortlab:
    1447    yyresult = 1;
    1448    goto yyreturn;
    1449  
    1450  
    1451  #if !defined yyoverflow
    1452  /*-------------------------------------------------.
    1453  | yyexhaustedlab -- memory exhaustion comes here.  |
    1454  `-------------------------------------------------*/
    1455  yyexhaustedlab:
    1456    yyerror (YY_("memory exhausted"));
    1457    yyresult = 2;
    1458    goto yyreturn;
    1459  #endif
    1460  
    1461  
    1462  /*-------------------------------------------------------.
    1463  | yyreturn -- parsing is finished, clean up and return.  |
    1464  `-------------------------------------------------------*/
    1465  yyreturn:
    1466    if (yychar != YYEMPTY)
    1467      {
    1468        /* Make sure we have latest lookahead translation.  See comments at
    1469           user semantic actions for why this is necessary.  */
    1470        yytoken = YYTRANSLATE (yychar);
    1471        yydestruct ("Cleanup: discarding lookahead",
    1472                    yytoken, &yylval);
    1473      }
    1474    /* Do not reclaim the symbols of the rule whose action triggered
    1475       this YYABORT or YYACCEPT.  */
    1476    YYPOPSTACK (yylen);
    1477    YY_STACK_PRINT (yyss, yyssp);
    1478    while (yyssp != yyss)
    1479      {
    1480        yydestruct ("Cleanup: popping",
    1481                    YY_ACCESSING_SYMBOL (+*yyssp), yyvsp);
    1482        YYPOPSTACK (1);
    1483      }
    1484  #ifndef yyoverflow
    1485    if (yyss != yyssa)
    1486      YYSTACK_FREE (yyss);
    1487  #endif
    1488  
    1489    return yyresult;
    1490  }
    1491  
    1492  #line 167 "pam_conv_y.y"
    1493  
    1494  
    1495  const char *old_to_new_ctrl_flag(const char *old)
    1496  {
    1497      static const char *clist[] = {
    1498  	"requisite",
    1499  	"required",
    1500  	"sufficient",
    1501  	"optional",
    1502  	NULL,
    1503      };
    1504      int i;
    1505  
    1506      for (i=0; clist[i]; ++i) {
    1507  	if (strcasecmp(clist[i], old) == 0) {
    1508  	    break;
    1509  	}
    1510      }
    1511  
    1512      return clist[i];
    1513  }
    1514  
    1515  PAM_FORMAT((printf, 1, 2))
    1516  void yyerror(const char *format, ...)
    1517  {
    1518      va_list args;
    1519  
    1520      fprintf(stderr, "line %d: ", current_line);
    1521      va_start(args, format);
    1522      vfprintf(stderr, format, args);
    1523      va_end(args);
    1524      fprintf(stderr, "\n");
    1525  }
    1526  
    1527  int main(void)
    1528  {
    1529      if (mkdir(PAM_D, PAM_D_MODE) != 0) {
    1530  	yyerror(PAM_D " already exists.. aborting");
    1531  	exit(1);
    1532      }
    1533      yyparse();
    1534      exit(0);
    1535  }