Remove last users of struct file_ext, and then get rid of struct
[pspp-builds.git] / src / data / filename.c
index 323a78c54ec32a67f9dac784ca5d25a18d212dad..d81dd0762e4e94e3882357359236383ec44a5393 100644 (file)
@@ -782,113 +782,6 @@ fn_close (const char *fn, FILE *f)
   else
     return fclose (f);
 }
-\f
-/* More extensive file handling. */
-
-/* File open routine that extends fn_open().  Opens or reopens a
-   file according to the contents of file_ext F.  Returns nonzero on
-   success.  If 0 is returned, errno is set to a sensible value. */
-int
-fn_open_ext (struct file_ext *f)
-{
-  char *p;
-
-  p = strstr (f->filename, "%d");
-  if (p)
-    {
-      char *s = local_alloc (strlen (f->filename)
-                             + INT_STRLEN_BOUND (int) - 1);
-      char *cp;
-
-      memcpy (s, f->filename, p - f->filename);
-      cp = spprintf (&s[p - f->filename], "%d", *f->sequence_no);
-      strcpy (cp, &p[2]);
-
-      if (f->file)
-       {
-         int error = 0;
-
-         if (f->preclose)
-           if (f->preclose (f) == 0)
-             error = errno;
-
-         if (EOF == fn_close (f->filename, f->file) || error)
-           {
-             f->file = NULL;
-             local_free (s);
-
-             if (error)
-               errno = error;
-
-             return 0;
-           }
-
-         f->file = NULL;
-       }
-
-      f->file = fn_open (s, f->mode);
-      local_free (s);
-
-      if (f->file && f->postopen)
-       if (f->postopen (f) == 0)
-         {
-           int error = errno;
-           fn_close (f->filename, f->file);
-           errno = error;
-
-           return 0;
-         }
-
-      return (f->file != NULL);
-    }
-  else if (f->file)
-    return 1;
-  else
-    {
-      f->file = fn_open (f->filename, f->mode);
-
-      if (f->file && f->postopen)
-       if (f->postopen (f) == 0)
-         {
-           int error = errno;
-           fn_close (f->filename, f->file);
-           errno = error;
-
-           return 0;
-         }
-
-      return (f->file != NULL);
-    }
-}
-
-/* Properly closes the file associated with file_ext F, if any.
-   Return nonzero on success.  If zero is returned, errno is set to a
-   sensible value. */
-int
-fn_close_ext (struct file_ext *f)
-{
-  if (f->file)
-    {
-      int error = 0;
-
-      if (f->preclose)
-       if (f->preclose (f) == 0)
-         error = errno;
-
-      if (EOF == fn_close (f->filename, f->file) || error)
-       {
-         f->file = NULL;
-
-         if (error)
-           errno = error;
-
-         return 0;
-       }
-
-      f->file = NULL;
-    }
-  return 1;
-}
 
 #ifdef unix
 /* A file's identity. */