]> Pileus Git - ~andy/fetchmail/blob - rcfile_y.y
This is what I sent Harris.
[~andy/fetchmail] / rcfile_y.y
1 %{
2 /* Copyright 1993-95 by Carl Harris, Jr.
3  * All rights reserved
4  *
5  * Distribute freely, except: don't remove my name from the source or
6  * documentation (don't take credit for my work), mark your changes (don't
7  * get me blamed for your possible bugs), don't alter or remove this
8  * notice.  May be sold if buildable source is provided to buyer.  No
9  * warrantee of any kind, express or implied, is included with this
10  * software; use at your own risk, responsibility for damages (if any) to
11  * anyone resulting from the use of this software rests entirely with the
12  * user.
13  *
14  * Send bug reports, bug fixes, enhancements, requests, flames, etc., and
15  * I'll try to keep a version up to date.  I can be reached as follows:
16  * Carl Harris <ceharris@mal.com>
17  */
18
19
20 /***********************************************************************
21   module:       poprc_y.y
22   project:      popclient
23   programmer:   Carl Harris, ceharris@mal.com
24   description:  .poprc parser
25
26   $Log: rcfile_y.y,v $
27   Revision 1.2  1996/06/26 19:09:01  esr
28   This is what I sent Harris.
29
30   Revision 1.1  1996/06/24 18:17:24  esr
31   Initial revision
32
33   Revision 1.4  1995/08/10 00:32:45  ceharris
34   Preparation for 3.0b3 beta release:
35   -     added code for --kill/--keep, --limit, --protocol, --flush
36         options; --pop2 and --pop3 options now obsoleted by --protocol.
37   -     added support for APOP authentication, including --with-APOP
38         argument for configure.
39   -     provisional and broken support for RPOP
40   -     added buffering to SockGets and SockRead functions.
41   -     fixed problem of command-line options not being correctly
42         carried into the merged options record.
43
44   Revision 1.3  1995/08/09 01:33:02  ceharris
45   Version 3.0 beta 2 release.
46   Added
47   -     .poprc functionality
48   -     GNU long options
49   -     multiple servers on the command line.
50   Fixed
51   -     Passwords showing up in ps output.
52
53   Revision 1.2  1995/08/08 01:01:36  ceharris
54   Added GNU-style long options processing.
55   Fixed password in 'ps' output problem.
56   Fixed various RCS tag blunders.
57   Integrated .poprc parser, lexer, etc into Makefile processing.
58
59  ***********************************************************************/
60
61 #include <config.h>
62 #include <stdio.h>
63 extern char *prc_pathname;
64 extern int prc_lineno;
65 extern int prc_errflag;
66 extern char *yytext;
67
68 int yydebug;    /* in case we didn't generate with -- debug */
69 %}
70
71 %union {
72   int proto;
73   int flag;
74   char *sval;
75 }
76
77 %token KW_SERVER KW_PROTOCOL KW_USERNAME KW_PASSWORD
78 %token KW_REMOTEFOLDER KW_LOCALFOLDER KW_MDA KW_EOL KW_DEFAULTS
79 %token <proto> PROTO_POP2 PROTO_POP3 PROTO_IMAP PROTO_APOP PROTO_RPOP
80 %token <sval> PARAM_STRING
81 %token <flag> KW_KEEP KW_FLUSH KW_FETCHALL
82 %type <proto> proto;
83
84 %%
85
86 rcfile:         rcline
87         |       rcfile rcline
88   ;
89
90 rcline:         statement KW_EOL
91   ;
92
93 statement:
94         |       define_server                   {prc_register(); prc_reset();}
95   ;
96
97 define_server:  KW_SERVER PARAM_STRING server_options   {prc_setserver($2);}    
98         |       KW_SERVER PARAM_STRING                  {prc_setserver($2);}
99         |       KW_DEFAULTS server_options      {prc_setserver("defaults");}
100   ;
101
102 server_options: serv_option_clause
103         |       server_options serv_option_clause
104   ;
105
106 serv_option_clause: 
107                 KW_PROTOCOL proto               {prc_setproto($2);}
108         |       KW_USERNAME PARAM_STRING        {prc_setusername($2);}
109         |       KW_PASSWORD PARAM_STRING        {prc_setpassword($2);}
110         |       KW_REMOTEFOLDER PARAM_STRING    {prc_setremote($2);}
111         |       KW_LOCALFOLDER PARAM_STRING     {prc_setlocal($2);}
112         |       KW_MDA PARAM_STRING             {prc_setmda($2);}
113         |       KW_KEEP                         {prc_setkeep($1);}
114         |       KW_FLUSH                        {prc_setflush($1);}
115         |       KW_FETCHALL                     {prc_setfetchall($1);}
116   ;
117
118 proto:          PROTO_POP2
119         |       PROTO_POP3
120         |       PROTO_IMAP
121         |       PROTO_APOP
122         |       PROTO_RPOP
123   ;
124
125 %%
126
127
128 yyerror (s)
129 char *s;
130 {
131   fprintf(stderr,"%s line %d: %s at %s\n", prc_pathname, prc_lineno, s, yytext);
132   prc_errflag++;
133 }