(main): Exit with EXIT_FAILURE if BROWSE file doesn't exist, is not seekable, not...
[bpt/emacs.git] / lib-src / ebrowse.c
index 94fa911..398dd10 100644 (file)
@@ -3909,17 +3909,31 @@ main (argc, argv)
 
          fp = fopen (out_filename, "r");
          if (fp == NULL)
-           yyerror ("file `%s' must exist for --append", out_filename);
+           {
+             yyerror ("file `%s' must exist for --append", out_filename);
+             exit (EXIT_FAILURE);
+           }
 
          rc = fseek (fp, 0, SEEK_END);
          if (rc == -1)
-           yyerror ("error seeking in file `%s'", out_filename);
+           {
+             yyerror ("error seeking in file `%s'", out_filename);
+             exit (EXIT_FAILURE);
+           }
 
          rc = ftell (fp);
          if (rc == -1)
-           yyerror ("error getting size of file `%s'", out_filename);
+           {
+             yyerror ("error getting size of file `%s'", out_filename);
+             exit (EXIT_FAILURE);
+           }
+         
          else if (rc == 0)
-           yyerror ("file `%s' is empty", out_filename);
+           {
+             yyerror ("file `%s' is empty", out_filename);
+             /* It may be ok to use an empty file for appending.
+                exit (EXIT_FAILURE); */
+           }
 
          fclose (fp);
        }