* src/files.c (tryopen, tryclose): Move to the top.
authorAkim Demaille <akim@epita.fr>
Fri, 31 Mar 2000 14:56:00 +0000 (14:56 +0000)
committerAkim Demaille <akim@epita.fr>
Fri, 31 Mar 2000 14:56:00 +0000 (14:56 +0000)
Be static.

ChangeLog
src/files.c

index 78a94bf..5298e84 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,10 @@
 2000-03-31  Akim Demaille  <akim@epita.fr>
 
+       * src/files.c (tryopen, tryclose): Move to the top.
+       Be static.
+
+2000-03-31  Akim Demaille  <akim@epita.fr>
+
        * src/main.c (main): Don't call `done', exit does it.
 
 2000-03-31  Akim Demaille  <akim@epita.fr>
index f77df45..e032d65 100644 (file)
@@ -83,8 +83,6 @@ extern char   *getenv();
 char *stringappend PARAMS((char *, int, char *));
 void openfiles PARAMS((void));
 void open_extra_files PARAMS((void));
-FILE *tryopen PARAMS((char *, char *));        /* This might be a good idea */
-int tryclose PARAMS((FILE *));
 
 extern char *program_name;
 extern int verboseflag;
@@ -116,7 +114,42 @@ stringappend (char *string1, int end1, char *string2)
   return ostring;
 }
 
+/*-----------------------------------------------------------------.
+| Try to open file NAME with mode MODE, and print an error message |
+| if fails.                                                        |
+`-----------------------------------------------------------------*/
 
+static FILE *
+tryopen (char *name, char *mode)
+{
+  FILE *ptr;
+
+  ptr = fopen (name, mode);
+  if (!ptr)
+    error (2, errno, _("cannot open file `%s'"), name);
+
+  return ptr;
+}
+
+/*-------------------------------------------------------------.
+| Try to close file PTR, and print an error message if fails.  |
+`-------------------------------------------------------------*/
+
+static int
+tryclose (FILE *ptr)
+{
+  int result;
+
+  if (ptr == NULL)
+    return 0;
+
+  result = fclose (ptr);
+  if (result == EOF)
+    error (2, errno, _("cannot close file"));
+
+  return result;
+}
+\f
 /* JF this has been hacked to death.  Nowaday it sets up the file names for
    the output files, and opens the tmp files and the parser */
 void
@@ -367,35 +400,6 @@ open_extra_files (void)
 
 }
 
-/* JF to make file opening easier.  This func tries to open file
-   NAME with mode MODE, and prints an error message if it fails. */
-FILE *
-tryopen (char *name, char *mode)
-{
-  FILE *ptr;
-
-  ptr = fopen (name, mode);
-  if (!ptr)
-    error (2, errno, _("cannot open file `%s'"), name);
-
-  return ptr;
-}
-
-int
-tryclose (FILE *ptr)
-{
-  int result;
-
-  if (ptr == NULL)
-    return 0;
-
-  result = fclose (ptr);
-  if (result == EOF)
-    error (2, errno, _("cannot close file"));
-
-  return result;
-}
-
 void
 done (void)
 {