]> Pileus Git - ~andy/fetchmail/blobdiff - rcfile_y.y
RC file syntax change, folder->mailbox, remote->remotename.
[~andy/fetchmail] / rcfile_y.y
index ab8834194a5a6401f778cda0805479915e86e603..94b81d8b15a0e632e65b5432310a840d6afa3aa6 100644 (file)
@@ -5,17 +5,17 @@
  */
 
 /***********************************************************************
-  module:       poprc_y.y
-  project:      popclient
+  module:       rcfile_y.y
+  project:      fetchmail
   programmer:   Carl Harris, ceharris@mal.com
                Extensively hacked and fixed by esr.
-  description:  .poprc parser
+  description:  configuration file parser
 
  ***********************************************************************/
 
 #include <config.h>
 #include <stdio.h>
-extern char *prc_pathname;
+extern char *rcfile;
 extern int prc_lineno;
 extern int prc_errflag;
 extern char *yytext;
@@ -29,12 +29,15 @@ int yydebug;        /* in case we didn't generate with -- debug */
   char *sval;
 }
 
-%token KW_SERVER KW_PROTOCOL KW_USERNAME KW_PASSWORD
-%token KW_REMOTEFOLDER KW_LOCALFOLDER KW_MDA KW_EOL KW_DEFAULTS
-%token <proto> PROTO_POP2 PROTO_POP3 PROTO_IMAP PROTO_APOP PROTO_RPOP
-%token <sval> PARAM_STRING
-%token <flag> KW_KEEP KW_FLUSH KW_FETCHALL
-%type <proto> proto;
+%token KW_SERVER KW_PROTOCOL KW_LOCALNAME KW_REMOTENAME KW_PASSWORD
+%token KW_MAILBOX KW_SMTPHOST KW_MDA KW_DEFAULTS
+%token <proto> KW_PROTO
+%token <sval>  PARAM_STRING
+%token <flag>  KW_KEEP KW_FLUSH KW_FETCHALL KW_REWRITE KW_PORT KW_SKIP
+
+/* these are actually used by the lexer */
+%token FLAG_TRUE       2
+%token FLAG_FALSE      1
 
 %%
 
@@ -42,14 +45,14 @@ rcfile:             rcline
        |       rcfile rcline
   ;
 
-rcline:                statement KW_EOL
+rcline:                statement
   ;
 
 statement:
        |       define_server                   {prc_register(); prc_reset();}
   ;
 
-define_server: KW_SERVER PARAM_STRING server_options   {prc_setserver($2);}    
+define_server: KW_SERVER PARAM_STRING server_options   {prc_setserver($2);}
        |       KW_SERVER PARAM_STRING                  {prc_setserver($2);}
        |       KW_DEFAULTS server_options      {prc_setserver("defaults");}
   ;
@@ -59,30 +62,26 @@ server_options:     serv_option_clause
   ;
 
 serv_option_clause: 
-               KW_PROTOCOL proto               {prc_setproto($2);}
-       |       KW_USERNAME PARAM_STRING        {prc_remotename($2);}
-       |       KW_PASSWORD PARAM_STRING        {prc_setpassword($2);}
-       |       KW_REMOTEFOLDER PARAM_STRING    {prc_setremote($2);}
-       |       KW_LOCALFOLDER PARAM_STRING     {prc_setlocal($2);}
-       |       KW_MDA PARAM_STRING             {prc_setmda($2);}
-       |       KW_KEEP                         {prc_setkeep($1);}
-       |       KW_FLUSH                        {prc_setflush($1);}
-       |       KW_FETCHALL                     {prc_setfetchall($1);}
-  ;
-
-proto:         PROTO_POP2
-       |       PROTO_POP3
-       |       PROTO_IMAP
-       |       PROTO_APOP
-       |       PROTO_RPOP
+               KW_PROTOCOL KW_PROTO         {prc_setproto($2);}
+       |       KW_LOCALNAME PARAM_STRING    {prc_localname($2);}
+       |       KW_REMOTENAME PARAM_STRING   {prc_remotename($2);}
+       |       KW_PASSWORD PARAM_STRING     {prc_setpassword($2);}
+       |       KW_MAILBOX PARAM_STRING      {prc_setmailbox($2);}
+       |       KW_SMTPHOST PARAM_STRING     {prc_setsmtphost($2);}
+       |       KW_MDA PARAM_STRING          {prc_setmda($2);}
+       |       KW_KEEP                      {prc_setkeep($1==FLAG_TRUE);}
+       |       KW_FLUSH                     {prc_setflush($1==FLAG_TRUE);}
+       |       KW_FETCHALL                  {prc_setfetchall($1==FLAG_TRUE);}
+       |       KW_REWRITE                   {prc_setrewrite($1==FLAG_TRUE);}
+       |       KW_SKIP                      {prc_setskip($1==FLAG_TRUE);}
+       |       KW_PORT PARAM_STRING         {prc_setport($2);}
   ;
 
 %%
 
-
 yyerror (s)
 char *s;
 {
-  fprintf(stderr,"%s line %d: %s at %s\n", prc_pathname, prc_lineno, s, yytext);
+  fprintf(stderr,"%s line %d: %s at %s\n", rcfile, prc_lineno, s, yytext);
   prc_errflag++;
 }