]> git.saurik.com Git - bison.git/blobdiff - doc/bison.texinfo
maint: avoid "magic number exit".
[bison.git] / doc / bison.texinfo
index f39f79ec0bb16718294d1d1d620c74cc40b23ae1..7fb051553684245f3a40256a2a661468c8e96e68 100644 (file)
@@ -2336,6 +2336,7 @@ Here are the C and Bison declarations for the multi-function calculator.
 @group
 %@{
   #include <stdio.h>  /* For printf, etc. */
+  #include <math.h>   /* For pow, used in the grammar.  */
   #include "calc.h"   /* Contains definition of `symrec'.  */
   int yylex (void);
   void yyerror (char const *);
@@ -2484,7 +2485,6 @@ struct init
 @end group
 
 @group
-#include <math.h>  /* Math functions, cos(), sin(), etc.  */
 struct init const arith_fncts[] =
 @{
   @{ "atan", atan @},
@@ -9969,7 +9969,7 @@ calcxx_driver::scan_begin ()
   else if (!(yyin = fopen (file.c_str (), "r")))
     @{
       error (std::string ("cannot open ") + file + ": " + strerror(errno));
-      exit (1);
+      exit (EXIT_FAILURE);
     @}
 @}
 
@@ -10703,11 +10703,17 @@ yyparse (char const *file)
 {
   yyin = fopen (file, "r");
   if (!yyin)
-    exit (2);
+  {
+    perror ("fopen");
+    exit (EXIT_FAILURE);
+  }
   /* One token only.  */
   yylex ();
   if (fclose (yyin) != 0)
-    exit (3);
+  {
+    perror ("fclose");
+    exit (EXIT_FAILURE);
+  }
   return 0;
 }