tag 643440 + patch
kthxbye

Hi,

You'll find attached two patches that fix the mailutils FTBFS with the
hardening build flags:

The first patch, fix_FTBFS_with_format-security.diff fixes the actual
-Werror=format-security issues. A lot of those are GCC pedantry, but I
think some may be real issues (the writeline hunks, for instance).

The second patch, refresh_mh_fmtgram.diff refreshes mh/mh_fmtgram.c from
the updated mh/mh_fmtgram.y (changed in the previous patch).
The diff is quite noisy as the file was generated by upstream with an
older version of bison than that currently in sid.

Cheers,
-- 
Nicolas Dandrimont
Description: Fix FTBFS with -Werror=format-security
Author: Nicolas Dandrimont <nicolas.dandrim...@crans.org
Bug-Debian: http://bugs.debian.org/643440
Last-Update: 2011-09-28

Index: mailutils-2.2+dfsg1/libproto/pop/pop3_sendline.c
===================================================================
--- mailutils-2.2+dfsg1.orig/libproto/pop/pop3_sendline.c	2011-09-28 12:03:00.000000000 +0200
+++ mailutils-2.2+dfsg1/libproto/pop/pop3_sendline.c	2011-09-28 12:04:41.000000000 +0200
@@ -112,7 +112,7 @@
 {
   if (line)
     {
-      int status = mu_pop3_writeline (pop3, line);
+      int status = mu_pop3_writeline (pop3, "%s", line);
       if (status)
 	return status;
     }
Index: mailutils-2.2+dfsg1/libproto/nntp/nntp_sendline.c
===================================================================
--- mailutils-2.2+dfsg1.orig/libproto/nntp/nntp_sendline.c	2011-09-28 12:03:00.000000000 +0200
+++ mailutils-2.2+dfsg1/libproto/nntp/nntp_sendline.c	2011-09-28 12:04:41.000000000 +0200
@@ -112,7 +112,7 @@
 {
   if (line)
     {
-      int status = mu_nntp_writeline (nntp, line);
+      int status = mu_nntp_writeline (nntp, "%s", line);
       if (status)
 	return status;
     }
Index: mailutils-2.2+dfsg1/mail/retain.c
===================================================================
--- mailutils-2.2+dfsg1.orig/mail/retain.c	2011-09-28 12:04:24.000000000 +0200
+++ mailutils-2.2+dfsg1/mail/retain.c	2011-09-28 12:04:41.000000000 +0200
@@ -33,7 +33,7 @@
   if (argc == 1)
     {
       if (mu_list_is_empty (*list))
-	fprintf (ofile, _(msg));
+	fprintf (ofile, "%s", _(msg));
       else
 	util_slist_print (*list, 1);
       return 0;
Index: mailutils-2.2+dfsg1/mail/unset.c
===================================================================
--- mailutils-2.2+dfsg1.orig/mail/unset.c	2011-09-28 12:04:24.000000000 +0200
+++ mailutils-2.2+dfsg1/mail/unset.c	2011-09-28 12:04:41.000000000 +0200
@@ -38,7 +38,7 @@
 	  char *buf = xmalloc ((7+strlen (argv[i])) * sizeof (char));
 	  strcpy (buf, "set no");
 	  strcat (buf, argv[i]);
-	  if (!util_do_command (buf))
+	  if (!util_do_command ("%s", buf))
 	    status = 1;
 	  free (buf);
 	}
Index: mailutils-2.2+dfsg1/mh/mh_fmtgram.y
===================================================================
--- mailutils-2.2+dfsg1.orig/mh/mh_fmtgram.y	2011-09-28 12:04:24.000000000 +0200
+++ mailutils-2.2+dfsg1/mh/mh_fmtgram.y	2011-09-28 12:04:41.000000000 +0200
@@ -207,7 +207,7 @@
 	      else
 		{
 		  yyerror (_("undefined function"));
-		  mu_error ($1);
+		  mu_error ("%s", $1);
 		  YYERROR;
 		}
 	    }
Index: mailutils-2.2+dfsg1/mh/mhn.c
===================================================================
--- mailutils-2.2+dfsg1.orig/mh/mhn.c	2011-09-28 12:04:24.000000000 +0200
+++ mailutils-2.2+dfsg1/mh/mhn.c	2011-09-28 12:04:41.000000000 +0200
@@ -1644,7 +1644,7 @@
       int rc;
 	
       asprintf (&p, _("File %s already exists. Rewrite"), name);
-      rc = mh_getyn (p);
+      rc = mh_getyn ("%s", p);
       free (p);
       if (!rc)
 	{
Index: mailutils-2.2+dfsg1/imap4d/append.c
===================================================================
--- mailutils-2.2+dfsg1.orig/imap4d/append.c	2011-09-28 12:04:24.000000000 +0200
+++ mailutils-2.2+dfsg1/imap4d/append.c	2011-09-28 12:04:41.000000000 +0200
@@ -204,7 +204,7 @@
   if (status == 0)
     return util_finish (command, RESP_OK, "Completed");
 
-  return util_finish (command, RESP_NO, err_text);
+  return util_finish (command, RESP_NO, "%s", err_text);
 }
 
 
Index: mailutils-2.2+dfsg1/imap4d/status.c
===================================================================
--- mailutils-2.2+dfsg1.orig/imap4d/status.c	2011-09-28 12:04:24.000000000 +0200
+++ mailutils-2.2+dfsg1/imap4d/status.c	2011-09-28 12:04:41.000000000 +0200
@@ -148,7 +148,7 @@
       if (count == 0)
 	return util_finish (command, RESP_BAD, "Too few args (empty list)");
       else if (err_msg)
-	return util_finish (command, RESP_BAD, err_msg);
+	return util_finish (command, RESP_BAD, "%s", err_msg);
       return util_finish (command, RESP_OK, "Completed");
     }
   
Index: mailutils-2.2+dfsg1/imap4d/delete.c
===================================================================
--- mailutils-2.2+dfsg1.orig/imap4d/delete.c	2011-09-28 12:04:24.000000000 +0200
+++ mailutils-2.2+dfsg1/imap4d/delete.c	2011-09-28 12:04:41.000000000 +0200
@@ -59,5 +59,5 @@
       rc = RESP_NO;
       msg = "Cannot remove";
     }
-  return util_finish (command, rc, msg);
+  return util_finish (command, rc, "%s", msg);
 }
Index: mailutils-2.2+dfsg1/imap4d/rename.c
===================================================================
--- mailutils-2.2+dfsg1.orig/imap4d/rename.c	2011-09-28 12:04:24.000000000 +0200
+++ mailutils-2.2+dfsg1/imap4d/rename.c	2011-09-28 12:04:41.000000000 +0200
@@ -135,5 +135,5 @@
   if (oldname)
     free (oldname);
   free (newname);
-  return util_finish (command, rc, msg);
+  return util_finish (command, rc, "%s", msg);
 }
Index: mailutils-2.2+dfsg1/imap4d/close.c
===================================================================
--- mailutils-2.2+dfsg1.orig/imap4d/close.c	2011-09-28 12:04:24.000000000 +0200
+++ mailutils-2.2+dfsg1/imap4d/close.c	2011-09-28 12:04:41.000000000 +0200
@@ -51,7 +51,7 @@
   mu_mailbox_destroy (&mbox);
 
   if (msg)
-    return util_finish (command, RESP_NO, msg);
+    return util_finish (command, RESP_NO, "%s", msg);
   return util_finish (command, RESP_OK, "Completed");
 }
 
Index: mailutils-2.2+dfsg1/imap4d/util.c
===================================================================
--- mailutils-2.2+dfsg1.orig/imap4d/util.c	2011-09-28 12:04:24.000000000 +0200
+++ mailutils-2.2+dfsg1/imap4d/util.c	2011-09-28 12:04:41.000000000 +0200
@@ -649,7 +649,7 @@
 	  util_send (" ");
 	else
 	  space = 1;
-	util_send (_imap4d_attrlist[i].name);
+	util_send ("%s", _imap4d_attrlist[i].name);
       }
 
   if (MU_ATTRIBUTE_IS_UNSEEN (flags))
Index: mailutils-2.2+dfsg1/imap4d/create.c
===================================================================
--- mailutils-2.2+dfsg1.orig/imap4d/create.c	2011-09-28 12:04:24.000000000 +0200
+++ mailutils-2.2+dfsg1/imap4d/create.c	2011-09-28 12:04:41.000000000 +0200
@@ -165,5 +165,5 @@
       msg = "already exists";
     }
 
-  return util_finish (command, rc, msg);
+  return util_finish (command, rc, "%s", msg);
 }
Description: Refresh mh/mh_fmtgram.c for the new mh/mh_fmtgram.y
Author: Nicolas Dandrimont <nicolas.dandrim...@crans.org>
Bug-Debian: http://bugs.debian.org/643440
Last-Update: 2011-09-28

--- mailutils-2.2+dfsg1.orig/mh/mh_fmtgram.c
+++ mailutils-2.2+dfsg1/mh/mh_fmtgram.c
@@ -1,24 +1,23 @@
-/* A Bison parser, made by GNU Bison 2.3.  */
 
-/* Skeleton implementation for Bison's Yacc-like parsers in C
+/* A Bison parser, made by GNU Bison 2.4.1.  */
 
-   Copyright (C) 1984, 1989, 1990, 2000, 2001, 2002, 2003, 2004, 2005, 2006
+/* Skeleton implementation for Bison's Yacc-like parsers in C
+   
+      Copyright (C) 1984, 1989, 1990, 2000, 2001, 2002, 2003, 2004, 2005, 2006
    Free Software Foundation, Inc.
-
-   This program is free software; you can redistribute it and/or modify
+   
+   This program is free software: you can redistribute it and/or modify
    it under the terms of the GNU General Public License as published by
-   the Free Software Foundation; either version 2, or (at your option)
-   any later version.
-
+   the Free Software Foundation, either version 3 of the License, or
+   (at your option) any later version.
+   
    This program is distributed in the hope that it will be useful,
    but WITHOUT ANY WARRANTY; without even the implied warranty of
    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    GNU General Public License for more details.
-
+   
    You should have received a copy of the GNU General Public License
-   along with this program; if not, write to the Free Software
-   Foundation, Inc., 51 Franklin Street, Fifth Floor,
-   Boston, MA 02110-1301, USA.  */
+   along with this program.  If not, see <http://www.gnu.org/licenses/>.  */
 
 /* As a special exception, you may create a larger work that contains
    part or all of the Bison parser skeleton and distribute that work
@@ -29,7 +28,7 @@
    special exception, which will cause the skeleton and the resulting
    Bison output files to be licensed under the GNU General Public
    License without this special exception.
-
+   
    This special exception was added by the Free Software Foundation in
    version 2.2 of Bison.  */
 
@@ -47,7 +46,7 @@
 #define YYBISON 1
 
 /* Bison version.  */
-#define YYBISON_VERSION "2.3"
+#define YYBISON_VERSION "2.4.1"
 
 /* Skeleton name.  */
 #define YYSKELETON_NAME "yacc.c"
@@ -55,51 +54,20 @@
 /* Pure parsers.  */
 #define YYPURE 0
 
-/* Using locations.  */
-#define YYLSP_NEEDED 0
+/* Push parsers.  */
+#define YYPUSH 0
 
+/* Pull parsers.  */
+#define YYPULL 1
 
-
-/* Tokens.  */
-#ifndef YYTOKENTYPE
-# define YYTOKENTYPE
-   /* Put the tokens into the symbol table, so that GDB and other debuggers
-      know about them.  */
-   enum fmt_yytokentype {
-     NUMBER = 258,
-     STRING = 259,
-     FUNCTION = 260,
-     IF = 261,
-     ELIF = 262,
-     ELSE = 263,
-     FI = 264,
-     OBRACE = 265,
-     CBRACE = 266,
-     OCURLY = 267,
-     CCURLY = 268,
-     FMTSPEC = 269,
-     BOGUS = 270
-   };
-#endif
-/* Tokens.  */
-#define NUMBER 258
-#define STRING 259
-#define FUNCTION 260
-#define IF 261
-#define ELIF 262
-#define ELSE 263
-#define FI 264
-#define OBRACE 265
-#define CBRACE 266
-#define OCURLY 267
-#define CCURLY 268
-#define FMTSPEC 269
-#define BOGUS 270
-
+/* Using locations.  */
+#define YYLSP_NEEDED 0
 
 
 
 /* Copy the first part of user declarations.  */
+
+/* Line 189 of yacc.c  */
 #line 1 "mh_fmtgram.y"
 
 /* GNU Mailutils -- a suite of utilities for electronic mail
@@ -150,6 +118,9 @@ static int want_function;   /* Set when
 static int want_arg;        /* Expecting function argument */
 
 
+/* Line 189 of yacc.c  */
+#line 123 "mh_fmtgram.c"
+
 /* Enabling traces.  */
 #ifndef YYDEBUG
 # define YYDEBUG 1
@@ -168,10 +139,53 @@ static int want_arg;        /* Expecting
 # define YYTOKEN_TABLE 0
 #endif
 
+
+/* Tokens.  */
+#ifndef YYTOKENTYPE
+# define YYTOKENTYPE
+   /* Put the tokens into the symbol table, so that GDB and other debuggers
+      know about them.  */
+   enum fmt_yytokentype {
+     NUMBER = 258,
+     STRING = 259,
+     FUNCTION = 260,
+     IF = 261,
+     ELIF = 262,
+     ELSE = 263,
+     FI = 264,
+     OBRACE = 265,
+     CBRACE = 266,
+     OCURLY = 267,
+     CCURLY = 268,
+     FMTSPEC = 269,
+     BOGUS = 270
+   };
+#endif
+/* Tokens.  */
+#define NUMBER 258
+#define STRING 259
+#define FUNCTION 260
+#define IF 261
+#define ELIF 262
+#define ELSE 263
+#define FI 264
+#define OBRACE 265
+#define CBRACE 266
+#define OCURLY 267
+#define CCURLY 268
+#define FMTSPEC 269
+#define BOGUS 270
+
+
+
+
 #if ! defined YYSTYPE && ! defined YYSTYPE_IS_DECLARED
 typedef union YYSTYPE
-#line 50 "mh_fmtgram.y"
 {
+
+/* Line 214 of yacc.c  */
+#line 50 "mh_fmtgram.y"
+
   char *str;
   int num;
   int type;
@@ -181,22 +195,23 @@ typedef union YYSTYPE
   } elif_list;
   size_t pc;
   mh_builtin_t *builtin;
-}
-/* Line 187 of yacc.c.  */
-#line 187 "mh_fmtgram.c"
-	YYSTYPE;
+
+
+
+/* Line 214 of yacc.c  */
+#line 203 "mh_fmtgram.c"
+} YYSTYPE;
+# define YYSTYPE_IS_TRIVIAL 1
 # define fmt_yystype YYSTYPE /* obsolescent; will be withdrawn */
 # define YYSTYPE_IS_DECLARED 1
-# define YYSTYPE_IS_TRIVIAL 1
 #endif
 
 
-
 /* Copy the second part of user declarations.  */
 
 
-/* Line 216 of yacc.c.  */
-#line 200 "mh_fmtgram.c"
+/* Line 264 of yacc.c  */
+#line 215 "mh_fmtgram.c"
 
 #ifdef short
 # undef short
@@ -271,14 +286,14 @@ typedef short int fmt_yytype_int16;
 #if (defined __STDC__ || defined __C99__FUNC__ \
      || defined __cplusplus || defined _MSC_VER)
 static int
-YYID (int i)
+YYID (int fmt_yyi)
 #else
 static int
-YYID (i)
-    int i;
+YYID (fmt_yyi)
+    int fmt_yyi;
 #endif
 {
-  return i;
+  return fmt_yyi;
 }
 #endif
 
@@ -359,9 +374,9 @@ void free (void *); /* INFRINGES ON USER
 /* A type that is properly aligned for any stack member.  */
 union fmt_yyalloc
 {
-  fmt_yytype_int16 fmt_yyss;
-  YYSTYPE fmt_yyvs;
-  };
+  fmt_yytype_int16 fmt_yyss_alloc;
+  YYSTYPE fmt_yyvs_alloc;
+};
 
 /* The size of the maximum gap between one aligned stack and the next.  */
 # define YYSTACK_GAP_MAXIMUM (sizeof (union fmt_yyalloc) - 1)
@@ -395,12 +410,12 @@ union fmt_yyalloc
    elements in the stack, and YYPTR gives the new location of the
    stack.  Advance YYPTR to a properly aligned location for the next
    stack.  */
-# define YYSTACK_RELOCATE(Stack)					\
+# define YYSTACK_RELOCATE(Stack_alloc, Stack)				\
     do									\
       {									\
 	YYSIZE_T fmt_yynewbytes;						\
-	YYCOPY (&fmt_yyptr->Stack, Stack, fmt_yysize);				\
-	Stack = &fmt_yyptr->Stack;						\
+	YYCOPY (&fmt_yyptr->Stack_alloc, Stack, fmt_yysize);			\
+	Stack = &fmt_yyptr->Stack_alloc;					\
 	fmt_yynewbytes = fmt_yystacksize * sizeof (*Stack) + YYSTACK_GAP_MAXIMUM; \
 	fmt_yyptr += fmt_yynewbytes / sizeof (*fmt_yyptr);				\
       }									\
@@ -509,7 +524,7 @@ static const char *const fmt_yytname[] =
   "$end", "error", "$undefined", "NUMBER", "STRING", "FUNCTION", "IF",
   "ELIF", "ELSE", "FI", "OBRACE", "CBRACE", "OCURLY", "CCURLY", "FMTSPEC",
   "BOGUS", "$accept", "input", "list", "pitem", "item", "literal",
-  "escape", "component", "obrace", "cbrace", "funcall", "@1", "@2",
+  "escape", "component", "obrace", "cbrace", "funcall", "$@1", "$@2",
   "fmtspec", "function", "argument", "cntl", "zlist", "if", "fi", "elif",
   "end", "cond", "cond_expr", "elif_part", "elif_list", "else_part",
   "else", 0
@@ -809,17 +824,20 @@ fmt_yy_symbol_print (fmt_yyoutput, fmt_y
 #if (defined __STDC__ || defined __C99__FUNC__ \
      || defined __cplusplus || defined _MSC_VER)
 static void
-fmt_yy_stack_print (fmt_yytype_int16 *bottom, fmt_yytype_int16 *top)
+fmt_yy_stack_print (fmt_yytype_int16 *fmt_yybottom, fmt_yytype_int16 *fmt_yytop)
 #else
 static void
-fmt_yy_stack_print (bottom, top)
-    fmt_yytype_int16 *bottom;
-    fmt_yytype_int16 *top;
+fmt_yy_stack_print (fmt_yybottom, fmt_yytop)
+    fmt_yytype_int16 *fmt_yybottom;
+    fmt_yytype_int16 *fmt_yytop;
 #endif
 {
   YYFPRINTF (stderr, "Stack now");
-  for (; bottom <= top; ++bottom)
-    YYFPRINTF (stderr, " %d", *bottom);
+  for (; fmt_yybottom <= fmt_yytop; fmt_yybottom++)
+    {
+      int fmt_yybot = *fmt_yybottom;
+      YYFPRINTF (stderr, " %d", fmt_yybot);
+    }
   YYFPRINTF (stderr, "\n");
 }
 
@@ -853,11 +871,11 @@ fmt_yy_reduce_print (fmt_yyvsp, fmt_yyru
   /* The symbols being reduced.  */
   for (fmt_yyi = 0; fmt_yyi < fmt_yynrhs; fmt_yyi++)
     {
-      fprintf (stderr, "   $%d = ", fmt_yyi + 1);
+      YYFPRINTF (stderr, "   $%d = ", fmt_yyi + 1);
       fmt_yy_symbol_print (stderr, fmt_yyrhs[fmt_yyprhs[fmt_yyrule] + fmt_yyi],
 		       &(fmt_yyvsp[(fmt_yyi + 1) - (fmt_yynrhs)])
 		       		       );
-      fprintf (stderr, "\n");
+      YYFPRINTF (stderr, "\n");
     }
 }
 
@@ -1137,10 +1155,8 @@ fmt_yydestruct (fmt_yymsg, fmt_yytype, f
 	break;
     }
 }
-
 
 /* Prevent warnings from -Wmissing-prototypes.  */
-
 #ifdef YYPARSE_PARAM
 #if defined __STDC__ || defined __cplusplus
 int fmt_yyparse (void *YYPARSE_PARAM);
@@ -1156,11 +1172,10 @@ int fmt_yyparse ();
 #endif /* ! YYPARSE_PARAM */
 
 
-
-/* The look-ahead symbol.  */
+/* The lookahead symbol.  */
 int fmt_yychar;
 
-/* The semantic value of the look-ahead symbol.  */
+/* The semantic value of the lookahead symbol.  */
 YYSTYPE fmt_yylval;
 
 /* Number of syntax errors so far.  */
@@ -1168,9 +1183,9 @@ int fmt_yynerrs;
 
 
 
-/*----------.
-| fmt_yyparse.  |
-`----------*/
+/*-------------------------.
+| fmt_yyparse or fmt_yypush_parse.  |
+`-------------------------*/
 
 #ifdef YYPARSE_PARAM
 #if (defined __STDC__ || defined __C99__FUNC__ \
@@ -1194,14 +1209,39 @@ fmt_yyparse ()
 #endif
 #endif
 {
-  
-  int fmt_yystate;
+
+
+    int fmt_yystate;
+    /* Number of tokens to shift before error messages enabled.  */
+    int fmt_yyerrstatus;
+
+    /* The stacks and their tools:
+       `fmt_yyss': related to states.
+       `fmt_yyvs': related to semantic values.
+
+       Refer to the stacks thru separate pointers, to allow fmt_yyoverflow
+       to reallocate them elsewhere.  */
+
+    /* The state stack.  */
+    fmt_yytype_int16 fmt_yyssa[YYINITDEPTH];
+    fmt_yytype_int16 *fmt_yyss;
+    fmt_yytype_int16 *fmt_yyssp;
+
+    /* The semantic value stack.  */
+    YYSTYPE fmt_yyvsa[YYINITDEPTH];
+    YYSTYPE *fmt_yyvs;
+    YYSTYPE *fmt_yyvsp;
+
+    YYSIZE_T fmt_yystacksize;
+
   int fmt_yyn;
   int fmt_yyresult;
-  /* Number of tokens to shift before error messages enabled.  */
-  int fmt_yyerrstatus;
-  /* Look-ahead token as an internal (translated) token number.  */
-  int fmt_yytoken = 0;
+  /* Lookahead token as an internal (translated) token number.  */
+  int fmt_yytoken;
+  /* The variables used to return semantic value and location from the
+     action routines.  */
+  YYSTYPE fmt_yyval;
+
 #if YYERROR_VERBOSE
   /* Buffer for error messages, and its allocated size.  */
   char fmt_yymsgbuf[128];
@@ -1209,51 +1249,28 @@ fmt_yyparse ()
   YYSIZE_T fmt_yymsg_alloc = sizeof fmt_yymsgbuf;
 #endif
 
-  /* Three stacks and their tools:
-     `fmt_yyss': related to states,
-     `fmt_yyvs': related to semantic values,
-     `fmt_yyls': related to locations.
-
-     Refer to the stacks thru separate pointers, to allow fmt_yyoverflow
-     to reallocate them elsewhere.  */
-
-  /* The state stack.  */
-  fmt_yytype_int16 fmt_yyssa[YYINITDEPTH];
-  fmt_yytype_int16 *fmt_yyss = fmt_yyssa;
-  fmt_yytype_int16 *fmt_yyssp;
-
-  /* The semantic value stack.  */
-  YYSTYPE fmt_yyvsa[YYINITDEPTH];
-  YYSTYPE *fmt_yyvs = fmt_yyvsa;
-  YYSTYPE *fmt_yyvsp;
-
-
-
 #define YYPOPSTACK(N)   (fmt_yyvsp -= (N), fmt_yyssp -= (N))
 
-  YYSIZE_T fmt_yystacksize = YYINITDEPTH;
-
-  /* The variables used to return semantic value and location from the
-     action routines.  */
-  YYSTYPE fmt_yyval;
-
-
   /* The number of symbols on the RHS of the reduced rule.
      Keep to zero when no symbol should be popped.  */
   int fmt_yylen = 0;
 
+  fmt_yytoken = 0;
+  fmt_yyss = fmt_yyssa;
+  fmt_yyvs = fmt_yyvsa;
+  fmt_yystacksize = YYINITDEPTH;
+
   YYDPRINTF ((stderr, "Starting parse\n"));
 
   fmt_yystate = 0;
   fmt_yyerrstatus = 0;
   fmt_yynerrs = 0;
-  fmt_yychar = YYEMPTY;		/* Cause a token to be read.  */
+  fmt_yychar = YYEMPTY; /* Cause a token to be read.  */
 
   /* Initialize stack pointers.
      Waste one element of value and location stack
      so that they stay on the same level as the state stack.
      The wasted elements are never initialized.  */
-
   fmt_yyssp = fmt_yyss;
   fmt_yyvsp = fmt_yyvs;
 
@@ -1283,7 +1300,6 @@ fmt_yyparse ()
 	YYSTYPE *fmt_yyvs1 = fmt_yyvs;
 	fmt_yytype_int16 *fmt_yyss1 = fmt_yyss;
 
-
 	/* Each stack pointer address is followed by the size of the
 	   data in use in that stack, in bytes.  This used to be a
 	   conditional around just the two extra args, but that might
@@ -1291,7 +1307,6 @@ fmt_yyparse ()
 	fmt_yyoverflow (YY_("memory exhausted"),
 		    &fmt_yyss1, fmt_yysize * sizeof (*fmt_yyssp),
 		    &fmt_yyvs1, fmt_yysize * sizeof (*fmt_yyvsp),
-
 		    &fmt_yystacksize);
 
 	fmt_yyss = fmt_yyss1;
@@ -1314,9 +1329,8 @@ fmt_yyparse ()
 	  (union fmt_yyalloc *) YYSTACK_ALLOC (YYSTACK_BYTES (fmt_yystacksize));
 	if (! fmt_yyptr)
 	  goto fmt_yyexhaustedlab;
-	YYSTACK_RELOCATE (fmt_yyss);
-	YYSTACK_RELOCATE (fmt_yyvs);
-
+	YYSTACK_RELOCATE (fmt_yyss_alloc, fmt_yyss);
+	YYSTACK_RELOCATE (fmt_yyvs_alloc, fmt_yyvs);
 #  undef YYSTACK_RELOCATE
 	if (fmt_yyss1 != fmt_yyssa)
 	  YYSTACK_FREE (fmt_yyss1);
@@ -1327,7 +1341,6 @@ fmt_yyparse ()
       fmt_yyssp = fmt_yyss + fmt_yysize - 1;
       fmt_yyvsp = fmt_yyvs + fmt_yysize - 1;
 
-
       YYDPRINTF ((stderr, "Stack size increased to %lu\n",
 		  (unsigned long int) fmt_yystacksize));
 
@@ -1337,6 +1350,9 @@ fmt_yyparse ()
 
   YYDPRINTF ((stderr, "Entering state %d\n", fmt_yystate));
 
+  if (fmt_yystate == YYFINAL)
+    YYACCEPT;
+
   goto fmt_yybackup;
 
 /*-----------.
@@ -1345,16 +1361,16 @@ fmt_yyparse ()
 fmt_yybackup:
 
   /* Do appropriate processing given the current state.  Read a
-     look-ahead token if we need one and don't already have one.  */
+     lookahead token if we need one and don't already have one.  */
 
-  /* First try to decide what to do without reference to look-ahead token.  */
+  /* First try to decide what to do without reference to lookahead token.  */
   fmt_yyn = fmt_yypact[fmt_yystate];
   if (fmt_yyn == YYPACT_NINF)
     goto fmt_yydefault;
 
-  /* Not known => get a look-ahead token if don't already have one.  */
+  /* Not known => get a lookahead token if don't already have one.  */
 
-  /* YYCHAR is either YYEMPTY or YYEOF or a valid look-ahead symbol.  */
+  /* YYCHAR is either YYEMPTY or YYEOF or a valid lookahead symbol.  */
   if (fmt_yychar == YYEMPTY)
     {
       YYDPRINTF ((stderr, "Reading a token: "));
@@ -1386,20 +1402,16 @@ fmt_yybackup:
       goto fmt_yyreduce;
     }
 
-  if (fmt_yyn == YYFINAL)
-    YYACCEPT;
-
   /* Count tokens shifted since error; after three, turn off error
      status.  */
   if (fmt_yyerrstatus)
     fmt_yyerrstatus--;
 
-  /* Shift the look-ahead token.  */
+  /* Shift the lookahead token.  */
   YY_SYMBOL_PRINT ("Shifting", fmt_yytoken, &fmt_yylval, &fmt_yylloc);
 
-  /* Discard the shifted token unless it is eof.  */
-  if (fmt_yychar != YYEOF)
-    fmt_yychar = YYEMPTY;
+  /* Discard the shifted token.  */
+  fmt_yychar = YYEMPTY;
 
   fmt_yystate = fmt_yyn;
   *++fmt_yyvsp = fmt_yylval;
@@ -1439,6 +1451,8 @@ fmt_yyreduce:
   switch (fmt_yyn)
     {
         case 2:
+
+/* Line 1455 of yacc.c  */
 #line 76 "mh_fmtgram.y"
     {
 	      /* nothing: to shut bison up */
@@ -1446,6 +1460,8 @@ fmt_yyreduce:
     break;
 
   case 5:
+
+/* Line 1455 of yacc.c  */
 #line 86 "mh_fmtgram.y"
     {
 	      switch ((fmt_yyvsp[(1) - (1)].type))
@@ -1472,6 +1488,8 @@ fmt_yyreduce:
     break;
 
   case 7:
+
+/* Line 1455 of yacc.c  */
 #line 112 "mh_fmtgram.y"
     {
 	      in_escape = 0;
@@ -1479,6 +1497,8 @@ fmt_yyreduce:
     break;
 
   case 8:
+
+/* Line 1455 of yacc.c  */
 #line 118 "mh_fmtgram.y"
     {
 	      mh_code_string ((fmt_yyvsp[(1) - (1)].str));
@@ -1487,6 +1507,8 @@ fmt_yyreduce:
     break;
 
   case 9:
+
+/* Line 1455 of yacc.c  */
 #line 123 "mh_fmtgram.y"
     {
 	      mh_code_number ((fmt_yyvsp[(1) - (1)].num));
@@ -1495,6 +1517,8 @@ fmt_yyreduce:
     break;
 
   case 12:
+
+/* Line 1455 of yacc.c  */
 #line 132 "mh_fmtgram.y"
     {
 	      (fmt_yyval.type) = mhtype_none;
@@ -1502,6 +1526,8 @@ fmt_yyreduce:
     break;
 
   case 13:
+
+/* Line 1455 of yacc.c  */
 #line 138 "mh_fmtgram.y"
     {
 	      if (mu_c_strcasecmp ((fmt_yyvsp[(3) - (4)].str), "body") == 0)
@@ -1518,6 +1544,8 @@ fmt_yyreduce:
     break;
 
   case 14:
+
+/* Line 1455 of yacc.c  */
 #line 153 "mh_fmtgram.y"
     {
 	      in_escape++;
@@ -1525,6 +1553,8 @@ fmt_yyreduce:
     break;
 
   case 15:
+
+/* Line 1455 of yacc.c  */
 #line 159 "mh_fmtgram.y"
     {
 	      in_escape--;
@@ -1532,16 +1562,22 @@ fmt_yyreduce:
     break;
 
   case 16:
+
+/* Line 1455 of yacc.c  */
 #line 164 "mh_fmtgram.y"
     { want_function = 1;}
     break;
 
   case 17:
+
+/* Line 1455 of yacc.c  */
 #line 164 "mh_fmtgram.y"
     { want_function = 0; want_arg = 1;}
     break;
 
   case 18:
+
+/* Line 1455 of yacc.c  */
 #line 165 "mh_fmtgram.y"
     {
 	      if ((fmt_yyvsp[(4) - (7)].builtin))
@@ -1571,6 +1607,8 @@ fmt_yyreduce:
     break;
 
   case 20:
+
+/* Line 1455 of yacc.c  */
 #line 194 "mh_fmtgram.y"
     {
 	      mh_code_op (mhop_fmtspec);
@@ -1579,6 +1617,8 @@ fmt_yyreduce:
     break;
 
   case 22:
+
+/* Line 1455 of yacc.c  */
 #line 202 "mh_fmtgram.y"
     {
 	      if (strcmp ((fmt_yyvsp[(1) - (1)].str), "void") == 0)
@@ -1588,13 +1628,15 @@ fmt_yyreduce:
 	      else
 		{
 		  fmt_yyerror (_("undefined function"));
-		  mu_error ((fmt_yyvsp[(1) - (1)].str));
+		  mu_error ("%s", (fmt_yyvsp[(1) - (1)].str));
 		  YYERROR;
 		}
 	    }
     break;
 
   case 23:
+
+/* Line 1455 of yacc.c  */
 #line 217 "mh_fmtgram.y"
     {
 	      (fmt_yyval.type) = mhtype_none;
@@ -1602,6 +1644,8 @@ fmt_yyreduce:
     break;
 
   case 26:
+
+/* Line 1455 of yacc.c  */
 #line 226 "mh_fmtgram.y"
     {
 	      size_t start_pc = 0, end_pc = 0;
@@ -1635,6 +1679,8 @@ fmt_yyreduce:
     break;
 
   case 27:
+
+/* Line 1455 of yacc.c  */
 #line 258 "mh_fmtgram.y"
     {
 	      (fmt_yyval.pc) = pc;
@@ -1642,6 +1688,8 @@ fmt_yyreduce:
     break;
 
   case 29:
+
+/* Line 1455 of yacc.c  */
 #line 265 "mh_fmtgram.y"
     {
 	      in_escape++;
@@ -1649,6 +1697,8 @@ fmt_yyreduce:
     break;
 
   case 30:
+
+/* Line 1455 of yacc.c  */
 #line 271 "mh_fmtgram.y"
     {
 	      /* False branch of an if-block */
@@ -1662,6 +1712,8 @@ fmt_yyreduce:
     break;
 
   case 31:
+
+/* Line 1455 of yacc.c  */
 #line 283 "mh_fmtgram.y"
     {
 	      in_escape++;
@@ -1670,6 +1722,8 @@ fmt_yyreduce:
     break;
 
   case 32:
+
+/* Line 1455 of yacc.c  */
 #line 290 "mh_fmtgram.y"
     {
 	      mh_code_op (mhop_branch);
@@ -1678,6 +1732,8 @@ fmt_yyreduce:
     break;
 
   case 33:
+
+/* Line 1455 of yacc.c  */
 #line 297 "mh_fmtgram.y"
     {
 	      in_escape--;
@@ -1690,6 +1746,8 @@ fmt_yyreduce:
     break;
 
   case 36:
+
+/* Line 1455 of yacc.c  */
 #line 312 "mh_fmtgram.y"
     {
 	      (fmt_yyval.elif_list).cond = 0;
@@ -1698,6 +1756,8 @@ fmt_yyreduce:
     break;
 
   case 37:
+
+/* Line 1455 of yacc.c  */
 #line 317 "mh_fmtgram.y"
     {
 	      (fmt_yyval.elif_list).cond = (fmt_yyvsp[(1) - (2)].elif_list).cond;
@@ -1707,6 +1767,8 @@ fmt_yyreduce:
     break;
 
   case 38:
+
+/* Line 1455 of yacc.c  */
 #line 325 "mh_fmtgram.y"
     {
 	      (fmt_yyval.elif_list).cond = (fmt_yyvsp[(1) - (3)].pc);
@@ -1716,6 +1778,8 @@ fmt_yyreduce:
     break;
 
   case 39:
+
+/* Line 1455 of yacc.c  */
 #line 331 "mh_fmtgram.y"
     {
 	      MHI_NUM(format.prog[(fmt_yyvsp[(4) - (5)].pc)]) = pc - (fmt_yyvsp[(4) - (5)].pc) + 2;
@@ -1726,6 +1790,8 @@ fmt_yyreduce:
     break;
 
   case 40:
+
+/* Line 1455 of yacc.c  */
 #line 340 "mh_fmtgram.y"
     {
 	      (fmt_yyval.pc) = 0;
@@ -1733,6 +1799,8 @@ fmt_yyreduce:
     break;
 
   case 42:
+
+/* Line 1455 of yacc.c  */
 #line 347 "mh_fmtgram.y"
     {
 	      (fmt_yyval.pc) = pc;
@@ -1740,8 +1808,9 @@ fmt_yyreduce:
     break;
 
 
-/* Line 1267 of yacc.c.  */
-#line 1745 "mh_fmtgram.c"
+
+/* Line 1455 of yacc.c  */
+#line 1814 "mh_fmtgram.c"
       default: break;
     }
   YY_SYMBOL_PRINT ("-> $$ =", fmt_yyr1[fmt_yyn], &fmt_yyval, &fmt_yyloc);
@@ -1752,7 +1821,6 @@ fmt_yyreduce:
 
   *++fmt_yyvsp = fmt_yyval;
 
-
   /* Now `shift' the result of the reduction.  Determine what state
      that goes to, based on the state we popped back to and the rule
      number reduced by.  */
@@ -1817,7 +1885,7 @@ fmt_yyerrlab:
 
   if (fmt_yyerrstatus == 3)
     {
-      /* If just tried and failed to reuse look-ahead token after an
+      /* If just tried and failed to reuse lookahead token after an
 	 error, discard it.  */
 
       if (fmt_yychar <= YYEOF)
@@ -1834,7 +1902,7 @@ fmt_yyerrlab:
 	}
     }
 
-  /* Else will try to reuse look-ahead token after shifting the error
+  /* Else will try to reuse lookahead token after shifting the error
      token.  */
   goto fmt_yyerrlab1;
 
@@ -1891,9 +1959,6 @@ fmt_yyerrlab1:
       YY_STACK_PRINT (fmt_yyss, fmt_yyssp);
     }
 
-  if (fmt_yyn == YYFINAL)
-    YYACCEPT;
-
   *++fmt_yyvsp = fmt_yylval;
 
 
@@ -1918,7 +1983,7 @@ fmt_yyabortlab:
   fmt_yyresult = 1;
   goto fmt_yyreturn;
 
-#ifndef fmt_yyoverflow
+#if !defined(fmt_yyoverflow) || YYERROR_VERBOSE
 /*-------------------------------------------------.
 | fmt_yyexhaustedlab -- memory exhaustion comes here.  |
 `-------------------------------------------------*/
@@ -1929,7 +1994,7 @@ fmt_yyexhaustedlab:
 #endif
 
 fmt_yyreturn:
-  if (fmt_yychar != YYEOF && fmt_yychar != YYEMPTY)
+  if (fmt_yychar != YYEMPTY)
      fmt_yydestruct ("Cleanup: discarding lookahead",
 		 fmt_yytoken, &fmt_yylval);
   /* Do not reclaim the symbols of the rule which action triggered
@@ -1955,6 +2020,8 @@ fmt_yyreturn:
 }
 
 
+
+/* Line 1675 of yacc.c  */
 #line 352 "mh_fmtgram.y"
 
 

Reply via email to