summary |
shortlog |
log |
commit | commitdiff |
tree
raw |
patch |
inline | side by side (from parent 1:
a7a18bd)
documentation. It's nice for our code to follow the convention too.
30 files changed:
+Sun Apr 16 18:53:12 2006 Ben Pfaff <blp@gnu.org>
+
+ GNU standards require "file name" instead of "filename" in
+ documentation. It's nice for our code to follow the convention
+ too.
+
+ Basically did search and replace in the whole source tree. Major
+ changes in function names or struct member names have their own
+ change log entries.
+
Sun Apr 16 15:58:56 2006 Ben Pfaff <blp@gnu.org>
Continue reforming error message support. In this phase, we get
Sun Apr 16 15:58:56 2006 Ben Pfaff <blp@gnu.org>
Continue reforming error message support. In this phase, we get
FILE *file;
bool is_type;
FILE *file;
bool is_type;
- file = fn_open (fh_get_filename (handle), "rb");
+ file = fn_open (fh_get_file_name (handle), "rb");
if (file == NULL)
{
msg (ME, _("An error occurred while opening \"%s\": %s."),
if (file == NULL)
{
msg (ME, _("An error occurred while opening \"%s\": %s."),
- fh_get_filename (handle), strerror (errno));
+ fh_get_file_name (handle), strerror (errno));
return IO_ERROR;
}
is_type = detect (file);
return IO_ERROR;
}
is_type = detect (file);
- fn_close (fh_get_filename (handle), file);
+ fn_close (fh_get_file_name (handle), file);
return is_type ? YES : NO;
}
return is_type ? YES : NO;
}
pfm_open_reader (handle, dict, NULL));
msg (SE, _("\"%s\" is not a system or portable file."),
pfm_open_reader (handle, dict, NULL));
msg (SE, _("\"%s\" is not a system or portable file."),
- fh_get_filename (handle));
+ fh_get_file_name (handle));
struct any_writer *writer;
char *extension;
struct any_writer *writer;
char *extension;
- extension = fn_extension (fh_get_filename (handle));
+ extension = fn_extension (fh_get_file_name (handle));
str_lowercase (extension);
if (!strcmp (extension, ".por"))
str_lowercase (extension);
if (!strcmp (extension, ".por"))
/* Disk storage. */
int fd; /* File descriptor, -1 if none. */
/* Disk storage. */
int fd; /* File descriptor, -1 if none. */
- char *filename; /* Filename. */
+ char *file_name; /* File name. */
union value *buffer; /* I/O buffer, NULL if none. */
size_t buffer_used; /* Number of values used in buffer. */
size_t buffer_size; /* Buffer size in values. */
union value *buffer; /* I/O buffer, NULL if none. */
size_t buffer_used; /* Number of values used in buffer. */
size_t buffer_size; /* Buffer size in values. */
static void io_error (struct casefile *, const char *, ...)
PRINTF_FORMAT (2, 3);
static void io_error (struct casefile *, const char *, ...)
PRINTF_FORMAT (2, 3);
-static int safe_open (const char *filename, int flags);
+static int safe_open (const char *file_name, int flags);
static int safe_close (int fd);
/* Creates and returns a casefile to store cases of VALUE_CNT
static int safe_close (int fd);
/* Creates and returns a casefile to store cases of VALUE_CNT
cf->ok = true;
cf->cases = NULL;
cf->fd = -1;
cf->ok = true;
cf->cases = NULL;
cf->fd = -1;
cf->buffer = NULL;
cf->buffer_size = ROUND_UP (cf->value_cnt, IO_BUF_SIZE);
if (cf->value_cnt > 0 && cf->buffer_size % cf->value_cnt > 64)
cf->buffer = NULL;
cf->buffer_size = ROUND_UP (cf->value_cnt, IO_BUF_SIZE);
if (cf->value_cnt > 0 && cf->buffer_size % cf->value_cnt > 64)
if (cf->fd != -1)
safe_close (cf->fd);
if (cf->fd != -1)
safe_close (cf->fd);
- if (cf->filename != NULL && remove (cf->filename) == -1)
+ if (cf->file_name != NULL && remove (cf->file_name) == -1)
io_error (cf, _("%s: Removing temporary file: %s."),
io_error (cf, _("%s: Removing temporary file: %s."),
- cf->filename, strerror (errno));
- free (cf->filename);
+ cf->file_name, strerror (errno));
+ free (cf->file_name);
- assert (cf->filename == NULL);
+ assert (cf->file_name == NULL);
assert (cf->fd == -1);
assert (cf->buffer_used == 0);
assert (cf->fd == -1);
assert (cf->buffer_used == 0);
- if (!make_temp_file (&cf->fd, &cf->filename))
+ if (!make_temp_file (&cf->fd, &cf->file_name))
{
cf->ok = false;
return false;
{
cf->ok = false;
return false;
- reader->fd = safe_open (cf->filename, O_RDONLY);
+ reader->fd = safe_open (cf->file_name, O_RDONLY);
if (reader->fd < 0)
io_error (cf, _("%s: Opening temporary file: %s."),
if (reader->fd < 0)
io_error (cf, _("%s: Opening temporary file: %s."),
- cf->filename, strerror (errno));
+ cf->file_name, strerror (errno));
}
if (cf->buffer != NULL)
}
if (cf->buffer != NULL)
file_ofs = 0;
if (lseek (reader->fd, file_ofs, SEEK_SET) != file_ofs)
io_error (cf, _("%s: Seeking temporary file: %s."),
file_ofs = 0;
if (lseek (reader->fd, file_ofs, SEEK_SET) != file_ofs)
io_error (cf, _("%s: Seeking temporary file: %s."),
- cf->filename, strerror (errno));
+ cf->file_name, strerror (errno));
if (cf->case_cnt > 0 && cf->value_cnt > 0)
fill_buffer (reader);
if (cf->case_cnt > 0 && cf->value_cnt > 0)
fill_buffer (reader);
reader->cf->buffer_size * sizeof *reader->buffer);
if (bytes < 0)
io_error (reader->cf, _("%s: Reading temporary file: %s."),
reader->cf->buffer_size * sizeof *reader->buffer);
if (bytes < 0)
io_error (reader->cf, _("%s: Reading temporary file: %s."),
- reader->cf->filename, strerror (errno));
+ reader->cf->file_name, strerror (errno));
else if (bytes != reader->cf->buffer_size * sizeof *reader->buffer)
io_error (reader->cf, _("%s: Temporary file ended unexpectedly."),
else if (bytes != reader->cf->buffer_size * sizeof *reader->buffer)
io_error (reader->cf, _("%s: Temporary file ended unexpectedly."),
+ reader->cf->file_name);
}
return reader->cf->ok;
}
}
return reader->cf->ok;
}
va_list args;
e.class = ME;
va_list args;
e.class = ME;
- e.where.filename = NULL;
+ e.where.file_name = NULL;
e.where.line_number = -1;
e.title = NULL;
e.where.line_number = -1;
e.title = NULL;
-/* Calls open(), passing FILENAME and FLAGS, repeating as necessary
+/* Calls open(), passing FILE_NAME and FLAGS, repeating as necessary
to deal with interrupted calls. */
static int
to deal with interrupted calls. */
static int
-safe_open (const char *filename, int flags)
+safe_open (const char *file_name, int flags)
- fd = open (filename, flags);
+ fd = open (file_name, flags);
}
while (fd == -1 && errno == EINTR);
}
while (fd == -1 && errno == EINTR);
enum fh_referent referent; /* What the file handle refers to. */
/* FH_REF_FILE only. */
enum fh_referent referent; /* What the file handle refers to. */
/* FH_REF_FILE only. */
- char *filename; /* Filename as provided by user. */
+ char *file_name; /* File name as provided by user. */
struct file_identity *identity; /* For checking file identity. */
enum fh_mode mode; /* File mode. */
struct file_identity *identity; /* For checking file identity. */
enum fh_mode mode; /* File mode. */
/* Free data. */
free (handle->name);
/* Free data. */
free (handle->name);
- free (handle->filename);
+ free (handle->file_name);
fn_free_identity (handle->identity);
scratch_handle_destroy (handle->sh);
free (handle);
fn_free_identity (handle->identity);
scratch_handle_destroy (handle->sh);
free (handle);
-/* Returns the handle for the file named FILENAME,
+/* Returns the handle for the file named FILE_NAME,
or a null pointer if none exists.
Different names for the same file (e.g. "x" and "./x") are
considered equivalent. */
struct file_handle *
or a null pointer if none exists.
Different names for the same file (e.g. "x" and "./x") are
considered equivalent. */
struct file_handle *
-fh_from_filename (const char *filename)
+fh_from_file_name (const char *file_name)
{
struct file_identity *identity;
struct file_handle *iter;
/* First check for a file with the same identity. */
{
struct file_identity *identity;
struct file_handle *iter;
/* First check for a file with the same identity. */
- identity = fn_get_identity (filename);
+ identity = fn_get_identity (file_name);
if (identity != NULL)
{
for (iter = file_handles; iter != NULL; iter = iter->next)
if (identity != NULL)
{
for (iter = file_handles; iter != NULL; iter = iter->next)
/* Then check for a file with the same name. */
for (iter = file_handles; iter != NULL; iter = iter->next)
if (!iter->deleted
/* Then check for a file with the same name. */
for (iter = file_handles; iter != NULL; iter = iter->next)
if (!iter->deleted
- && iter->referent == FH_REF_FILE && !strcmp (filename, iter->filename))
+ && iter->referent == FH_REF_FILE && !strcmp (file_name, iter->file_name))
return iter;
return NULL;
return iter;
return NULL;
/* Creates a new file handle named HANDLE_NAME, which must not be
the name of an existing file handle. The new handle is
/* Creates a new file handle named HANDLE_NAME, which must not be
the name of an existing file handle. The new handle is
- associated with file FILENAME and the given PROPERTIES. */
+ associated with file FILE_NAME and the given PROPERTIES. */
-fh_create_file (const char *handle_name, const char *filename,
+fh_create_file (const char *handle_name, const char *file_name,
const struct fh_properties *properties)
{
struct file_handle *handle;
assert (fh_from_name (handle_name) == NULL);
handle = create_handle (handle_name, FH_REF_FILE);
const struct fh_properties *properties)
{
struct file_handle *handle;
assert (fh_from_name (handle_name) == NULL);
handle = create_handle (handle_name, FH_REF_FILE);
- handle->filename = xstrdup (filename);
- handle->identity = fn_get_identity (filename);
+ handle->file_name = xstrdup (file_name);
+ handle->identity = fn_get_identity (file_name);
handle->mode = properties->mode;
handle->record_width = properties->record_width;
handle->tab_width = properties->tab_width;
handle->mode = properties->mode;
handle->record_width = properties->record_width;
handle->tab_width = properties->tab_width;
}
/* Returns the identifier of file HANDLE. If HANDLE was created
}
/* Returns the identifier of file HANDLE. If HANDLE was created
- by referring to a filename instead of a handle name, returns
- the filename, enclosed in double quotes. Return value is
+ by referring to a file name instead of a handle name, returns
+ the file name, enclosed in double quotes. Return value is
owned by the file handle.
Useful for printing error messages about use of file handles. */
owned by the file handle.
Useful for printing error messages about use of file handles. */
/* Returns the name of the file associated with HANDLE. */
const char *
/* Returns the name of the file associated with HANDLE. */
const char *
-fh_get_filename (const struct file_handle *handle)
+fh_get_file_name (const struct file_handle *handle)
{
assert (handle->referent == FH_REF_FILE);
{
assert (handle->referent == FH_REF_FILE);
- return handle->filename;
+ return handle->file_name;
}
/* Returns the mode of HANDLE. */
}
/* Returns the mode of HANDLE. */
/* Creating file handles. */
struct file_handle *fh_create_file (const char *handle_name,
/* Creating file handles. */
struct file_handle *fh_create_file (const char *handle_name,
const struct fh_properties *);
struct file_handle *fh_create_scratch (const char *handle_name);
const struct fh_properties *fh_default_properties (void);
const struct fh_properties *);
struct file_handle *fh_create_scratch (const char *handle_name);
const struct fh_properties *fh_default_properties (void);
/* Finding file handles. */
struct file_handle *fh_from_name (const char *handle_name);
/* Finding file handles. */
struct file_handle *fh_from_name (const char *handle_name);
-struct file_handle *fh_from_filename (const char *filename);
+struct file_handle *fh_from_file_name (const char *file_name);
struct file_handle *fh_inline_file (void);
/* Generic properties of file handles. */
struct file_handle *fh_inline_file (void);
/* Generic properties of file handles. */
enum fh_referent fh_get_referent (const struct file_handle *);
/* Properties of FH_REF_FILE file handles. */
enum fh_referent fh_get_referent (const struct file_handle *);
/* Properties of FH_REF_FILE file handles. */
-const char *fh_get_filename (const struct file_handle *);
+const char *fh_get_file_name (const struct file_handle *);
enum fh_mode fh_get_mode (const struct file_handle *) ;
/* Properties of FH_REF_FILE and FH_REF_INLINE file handles. */
enum fh_mode fh_get_mode (const struct file_handle *) ;
/* Properties of FH_REF_FILE and FH_REF_INLINE file handles. */
config_path = fn_getenv_default ("STAT_CONFIG_PATH", default_config_path);
}
\f
config_path = fn_getenv_default ("STAT_CONFIG_PATH", default_config_path);
}
\f
-/* Functions for performing operations on filenames. */
+/* Functions for performing operations on file names. */
/* Substitutes $variables as defined by GETENV into TARGET.
/* Substitutes $variables as defined by GETENV into TARGET.
malloc'd full name of the first file found, or NULL if none is
found.
malloc'd full name of the first file found, or NULL if none is
found.
- If PREFIX is non-NULL, then it is prefixed to each filename;
- i.e., it looks like PREFIX/PATH_COMPONENT/NAME. This is not done
- with absolute directories in the path. */
+ If PREFIX is non-NULL, then it is prefixed to each file name;
+ i.e., it looks like PREFIX/PATH_COMPONENT/NAME. This is not
+ done with absolute directories in the path. */
char *
fn_search_path (const char *base_name, const char *path_, const char *prefix)
{
char *
fn_search_path (const char *base_name, const char *path_, const char *prefix)
{
}
/* fn_normalize(): This very OS-dependent routine canonicalizes
}
/* fn_normalize(): This very OS-dependent routine canonicalizes
- filename FN1. The filename should not need to be the name of an
+ file name FN1. The file name should not need to be the name of an
existing file. Returns a malloc()'d copy of the canonical name.
This function must always succeed; if it needs to bail out then it
should return xstrdup(FN1). */
#ifdef unix
char *
existing file. Returns a malloc()'d copy of the canonical name.
This function must always succeed; if it needs to bail out then it
should return xstrdup(FN1). */
#ifdef unix
char *
-fn_normalize (const char *filename)
+fn_normalize (const char *file_name)
{
const char *src;
char *fn1, *fn2, *dest;
int maxlen;
{
const char *src;
char *fn1, *fn2, *dest;
int maxlen;
- if (fn_is_special (filename))
- return xstrdup (filename);
+ if (fn_is_special (file_name))
+ return xstrdup (file_name);
- fn1 = fn_tilde_expand (filename);
+ fn1 = fn_tilde_expand (file_name);
/* Follow symbolic links. */
for (;;)
/* Follow symbolic links. */
for (;;)
DWORD success;
char *fn2;
DWORD success;
char *fn2;
- /* Don't change special filenames. */
- if (is_special_filename (filename))
- return xstrdup (filename);
+ /* Don't change special file names. */
+ if (is_special_file_name (file_name))
+ return xstrdup (file_name);
/* First find the required buffer length. */
len = GetFullPathName (fn1, 0, NULL, NULL);
/* First find the required buffer length. */
len = GetFullPathName (fn1, 0, NULL, NULL);
}
#endif /* not Lose32, Unix, or DJGPP */
}
#endif /* not Lose32, Unix, or DJGPP */
-/* Returns the directory part of FILENAME, as a malloc()'d
+/* Returns the directory part of FILE_NAME, as a malloc()'d
-fn_dir_name (const char *filename)
+fn_dir_name (const char *file_name)
{
const char *p;
char *s;
size_t len;
{
const char *p;
char *s;
size_t len;
- len = strlen (filename);
- if (len == 1 && filename[0] == '/')
- p = filename + 1;
- else if (len && filename[len - 1] == '/')
- p = buf_find_reverse (filename, len - 1, filename + len - 1, 1);
+ len = strlen (file_name);
+ if (len == 1 && file_name[0] == '/')
+ p = file_name + 1;
+ else if (len && file_name[len - 1] == '/')
+ p = buf_find_reverse (file_name, len - 1, file_name + len - 1, 1);
- p = strrchr (filename, '/');
+ p = strrchr (file_name, '/');
- s = xmalloc (p - filename + 1);
- memcpy (s, filename, p - filename);
- s[p - filename] = 0;
+ s = xmalloc (p - file_name + 1);
+ memcpy (s, file_name, p - file_name);
+ s[p - file_name] = 0;
-/* Returns the extension part of FILENAME as a malloc()'d string.
- If FILENAME does not have an extension, returns an empty
+/* Returns the extension part of FILE_NAME as a malloc()'d string.
+ If FILE_NAME does not have an extension, returns an empty
-fn_extension (const char *filename)
+fn_extension (const char *file_name)
- const char *extension = strrchr (filename, '.');
+ const char *extension = strrchr (file_name, '.');
if (extension == NULL)
extension = "";
return xstrdup (extension);
if (extension == NULL)
extension = "";
return xstrdup (extension);
\f
/* Find out information about files. */
\f
/* Find out information about files. */
-/* Returns nonzero iff NAME specifies an absolute filename. */
+/* Returns nonzero iff NAME specifies an absolute file name. */
int
fn_is_absolute (const char *name)
{
int
fn_is_absolute (const char *name)
{
-/* Returns 1 if the filename specified is a virtual file that doesn't
- really exist on disk, 0 if it's a real filename. */
+/* Returns 1 if FILE_NAME is a virtual file that doesn't
+ really exist on disk, 0 if it's a real file name. */
-fn_is_special (const char *filename)
+fn_is_special (const char *file_name)
- if (!strcmp (filename, "-") || !strcmp (filename, "stdin")
- || !strcmp (filename, "stdout") || !strcmp (filename, "stderr")
+ if (!strcmp (file_name, "-") || !strcmp (file_name, "stdin")
+ || !strcmp (file_name, "stdout") || !strcmp (file_name, "stderr")
- || filename[0] == '|'
- || (*filename && filename[strlen (filename) - 1] == '|')
+ || file_name[0] == '|'
+ || (*file_name && file_name[strlen (file_name) - 1] == '|')
-/* Returns the symbolic link value for FILENAME as a dynamically
+/* Returns the symbolic link value for FILE_NAME as a dynamically
allocated buffer, or a null pointer on failure. */
char *
allocated buffer, or a null pointer on failure. */
char *
-fn_readlink (const char *filename)
+fn_readlink (const char *file_name)
- return xreadlink (filename, 32);
+ return xreadlink (file_name, 32);
}
\f
/* Environment variables. */
}
\f
/* Environment variables. */
caller is responsible for freeing the structure with
fn_free_identity() when finished. */
struct file_identity *
caller is responsible for freeing the structure with
fn_free_identity() when finished. */
struct file_identity *
-fn_get_identity (const char *filename)
+fn_get_identity (const char *file_name)
- if (stat (filename, &s) == 0)
+ if (stat (file_name, &s) == 0)
{
struct file_identity *identity = xmalloc (sizeof *identity);
identity->device = s.st_dev;
{
struct file_identity *identity = xmalloc (sizeof *identity);
identity->device = s.st_dev;
/* A file's identity. */
struct file_identity
{
/* A file's identity. */
struct file_identity
{
- char *normalized_filename; /* File's normalized name. */
+ char *normalized_file_name; /* File's normalized name. */
};
/* Returns a pointer to a dynamically allocated structure whose
};
/* Returns a pointer to a dynamically allocated structure whose
caller is responsible for freeing the structure with
fn_free_identity() when finished. */
struct file_identity *
caller is responsible for freeing the structure with
fn_free_identity() when finished. */
struct file_identity *
-fn_get_identity (const char *filename)
+fn_get_identity (const char *file_name)
{
struct file_identity *identity = xmalloc (sizeof *identity);
{
struct file_identity *identity = xmalloc (sizeof *identity);
- identity->normalized_filename = fn_normalize (filename);
+ identity->normalized_file_name = fn_normalize (file_name);
{
if (identity != NULL)
{
{
if (identity != NULL)
{
- free (identity->normalized_filename);
+ free (identity->normalized_file_name);
fn_compare_file_identities (const struct file_identity *a,
const struct file_identity *b)
{
fn_compare_file_identities (const struct file_identity *a,
const struct file_identity *b)
{
- return strcmp (a->normalized_filename, b->normalized_filename);
+ return strcmp (a->normalized_file_name, b->normalized_file_name);
FILE *fn_open (const char *fn, const char *mode);
int fn_close (const char *fn, FILE *file);
FILE *fn_open (const char *fn, const char *mode);
int fn_close (const char *fn, FILE *file);
-struct file_identity *fn_get_identity (const char *filename);
+struct file_identity *fn_get_identity (const char *file_name);
void fn_free_identity (struct file_identity *);
int fn_compare_file_identities (const struct file_identity *,
const struct file_identity *);
void fn_free_identity (struct file_identity *);
int fn_compare_file_identities (const struct file_identity *,
const struct file_identity *);
#define P_tmpdir "/tmp"
#endif
#define P_tmpdir "/tmp"
#endif
-/* Creates a temporary file and stores its name in *FILENAME and
+/* Creates a temporary file and stores its name in *FILE_NAME and
a file descriptor for it in *FD. Returns success. Caller is
a file descriptor for it in *FD. Returns success. Caller is
- responsible for freeing *FILENAME. */
+ responsible for freeing *FILE_NAME. */
-make_temp_file (int *fd, char **filename)
+make_temp_file (int *fd, char **file_name)
{
const char *parent_dir;
{
const char *parent_dir;
- assert (filename != NULL);
+ assert (file_name != NULL);
assert (fd != NULL);
if (getenv ("TMPDIR") != NULL)
assert (fd != NULL);
if (getenv ("TMPDIR") != NULL)
else
parent_dir = P_tmpdir;
else
parent_dir = P_tmpdir;
- *filename = xmalloc (strlen (parent_dir) + 32);
- sprintf (*filename, "%s/psppXXXXXX", parent_dir);
- *fd = mkstemp (*filename);
+ *file_name = xmalloc (strlen (parent_dir) + 32);
+ sprintf (*file_name, "%s/psppXXXXXX", parent_dir);
+ *fd = mkstemp (*file_name);
if (*fd < 0)
{
msg (ME, _("%s: Creating temporary file: %s."),
if (*fd < 0)
{
msg (ME, _("%s: Creating temporary file: %s."),
- *filename, strerror (errno));
- free (*filename);
- *filename = NULL;
+ *file_name, strerror (errno));
+ free (*file_name);
+ *file_name = NULL;
-/* Creates a temporary file and stores its name in *FILENAME and
+/* Creates a temporary file and stores its name in *FILE_NAME and
a file stream for it in *FP. Returns success. Caller is
a file stream for it in *FP. Returns success. Caller is
- responsible for freeing *FILENAME and for closing *FP */
+ responsible for freeing *FILE_NAME and for closing *FP */
-make_unique_file_stream (FILE **fp, char **filename)
+make_unique_file_stream (FILE **fp, char **file_name)
{
static int serial = 0;
const char *parent_dir;
{
static int serial = 0;
const char *parent_dir;
Need also to pass in the directory instead of using /tmp
*/
Need also to pass in the directory instead of using /tmp
*/
- assert (filename != NULL);
+ assert (file_name != NULL);
assert (fp != NULL);
if (getenv ("TMPDIR") != NULL)
assert (fp != NULL);
if (getenv ("TMPDIR") != NULL)
else
parent_dir = P_tmpdir;
else
parent_dir = P_tmpdir;
- *filename = xmalloc (strlen (parent_dir) + 32);
+ *file_name = xmalloc (strlen (parent_dir) + 32);
- sprintf (*filename, "%s/pspp%d.png", parent_dir, serial++);
+ sprintf (*file_name, "%s/pspp%d.png", parent_dir, serial++);
- *fp = fopen(*filename, "w");
+ *fp = fopen(*file_name, "w");
- msg (ME, _("%s: Creating file: %s."), *filename, strerror (errno));
- free (*filename);
- *filename = NULL;
+ msg (ME, _("%s: Creating file: %s."), *file_name, strerror (errno));
+ free (*file_name);
+ *file_name = NULL;
-/* Creates a temporary file and stores its name in *FILENAME and
+/* Creates a temporary file and stores its name in *FILE_NAME and
a file descriptor for it in *FD. Returns success. Caller is
a file descriptor for it in *FD. Returns success. Caller is
- responsible for freeing *FILENAME. */
-int make_temp_file (int *fd, char **filename);
+ responsible for freeing *FILE_NAME. */
+int make_temp_file (int *fd, char **file_name);
-/* Creates a temporary file and stores its name in *FILENAME and
+/* Creates a temporary file and stores its name in *FILE_NAME and
a file stream for it in *FP. Returns success. Caller is
a file stream for it in *FP. Returns success. Caller is
- responsible for freeing *FILENAME. */
-int make_unique_file_stream (FILE **fp, char **filename) ;
+ responsible for freeing *FILE_NAME. */
+int make_unique_file_stream (FILE **fp, char **file_name) ;
error (struct pfm_reader *r, const char *msg, ...)
{
struct error e;
error (struct pfm_reader *r, const char *msg, ...)
{
struct error e;
char *title;
va_list args;
e.class = ME;
char *title;
va_list args;
e.class = ME;
- e.where.filename = NULL;
+ e.where.file_name = NULL;
- filename = fh_get_filename (r->fh);
- e.title = title = pool_alloc (r->pool, strlen (filename) + 80);
+ file_name = fh_get_file_name (r->fh);
+ e.title = title = pool_alloc (r->pool, strlen (file_name) + 80);
sprintf (title, _("portable file %s corrupt at offset %ld: "),
sprintf (title, _("portable file %s corrupt at offset %ld: "),
- filename, ftell (r->file));
+ file_name, ftell (r->file));
va_start (args, msg);
err_vmsg (&e, msg, args);
va_start (args, msg);
err_vmsg (&e, msg, args);
if (setjmp (r->bail_out))
goto error;
r->fh = fh;
if (setjmp (r->bail_out))
goto error;
r->fh = fh;
- r->file = pool_fopen (r->pool, fh_get_filename (r->fh), "rb");
+ r->file = pool_fopen (r->pool, fh_get_file_name (r->fh), "rb");
r->weight_index = -1;
r->trans = NULL;
r->var_cnt = 0;
r->weight_index = -1;
r->trans = NULL;
r->var_cnt = 0;
{
msg (ME, _("An error occurred while opening \"%s\" for reading "
"as a portable file: %s."),
{
msg (ME, _("An error occurred while opening \"%s\" for reading "
"as a portable file: %s."),
- fh_get_filename (r->fh), strerror (errno));
+ fh_get_file_name (r->fh), strerror (errno));
for (i = 0; i < 8; i++)
if (!match (r, "SPSSPORT"[i]))
{
for (i = 0; i < 8; i++)
if (!match (r, "SPSSPORT"[i]))
{
- msg (SE, _("%s: Not a portable file."), fh_get_filename (r->fh));
+ msg (SE, _("%s: Not a portable file."), fh_get_file_name (r->fh));
longjmp (r->bail_out, 1);
}
}
longjmp (r->bail_out, 1);
}
}
mode = S_IRUSR | S_IRGRP | S_IROTH;
if (opts.create_writeable)
mode |= S_IWUSR | S_IWGRP | S_IWOTH;
mode = S_IRUSR | S_IRGRP | S_IROTH;
if (opts.create_writeable)
mode |= S_IWUSR | S_IWGRP | S_IWOTH;
- fd = open (fh_get_filename (fh), O_WRONLY | O_CREAT | O_TRUNC, mode);
+ fd = open (fh_get_file_name (fh), O_WRONLY | O_CREAT | O_TRUNC, mode);
if (fd < 0)
goto open_error;
if (fd < 0)
goto open_error;
open_error:
msg (ME, _("An error occurred while opening \"%s\" for writing "
"as a portable file: %s."),
open_error:
msg (ME, _("An error occurred while opening \"%s\" for writing "
"as a portable file: %s."),
- fh_get_filename (fh), strerror (errno));
+ fh_get_file_name (fh), strerror (errno));
if (!ok)
msg (ME, _("An I/O error occurred writing portable file \"%s\"."),
if (!ok)
msg (ME, _("An I/O error occurred writing portable file \"%s\"."),
- fh_get_filename (w->fh));
+ fh_get_file_name (w->fh));
}
fh_close (w->fh, "portable file", "we");
}
fh_close (w->fh, "portable file", "we");
va_list args;
e.class = class;
va_list args;
e.class = class;
- e.where.filename = NULL;
+ e.where.file_name = NULL;
e.where.line_number = 0;
e.title = _("corrupt system file: ");
e.where.line_number = 0;
e.title = _("corrupt system file: ");
- if (fn_close (fh_get_filename (r->fh), r->file) == EOF)
+ if (fn_close (fh_get_file_name (r->fh), r->file) == EOF)
msg (ME, _("%s: Closing system file: %s."),
msg (ME, _("%s: Closing system file: %s."),
- fh_get_filename (r->fh), strerror (errno));
+ fh_get_file_name (r->fh), strerror (errno));
/* Create and initialize reader. */
r = xmalloc (sizeof *r);
r->fh = fh;
/* Create and initialize reader. */
r = xmalloc (sizeof *r);
r->fh = fh;
- r->file = fn_open (fh_get_filename (fh), "rb");
+ r->file = fn_open (fh_get_file_name (fh), "rb");
r->reverse_endian = 0;
r->fix_specials = 0;
r->reverse_endian = 0;
r->fix_specials = 0;
{
msg (ME, _("An error occurred while opening \"%s\" for reading "
"as a system file: %s."),
{
msg (ME, _("An error occurred while opening \"%s\" for reading "
"as a system file: %s."),
- fh_get_filename (r->fh), strerror (errno));
+ fh_get_file_name (r->fh), strerror (errno));
if (r->weight_idx < 0 || r->weight_idx >= r->value_cnt)
lose ((ME, _("%s: Index of weighting variable (%d) is not between 0 "
"and number of elements per case (%d)."),
if (r->weight_idx < 0 || r->weight_idx >= r->value_cnt)
lose ((ME, _("%s: Index of weighting variable (%d) is not between 0 "
"and number of elements per case (%d)."),
- fh_get_filename (r->fh), r->weight_idx, r->value_cnt));
+ fh_get_file_name (r->fh), r->weight_idx, r->value_cnt));
weight_var = var_by_idx[r->weight_idx];
weight_var = var_by_idx[r->weight_idx];
if (weight_var == NULL)
lose ((ME,
_("%s: Weighting variable may not be a continuation of "
if (weight_var == NULL)
lose ((ME,
_("%s: Weighting variable may not be a continuation of "
- "a long string variable."), fh_get_filename (fh)));
+ "a long string variable."), fh_get_file_name (fh)));
else if (weight_var->type == ALPHA)
lose ((ME, _("%s: Weighting variable may not be a string variable."),
else if (weight_var->type == ALPHA)
lose ((ME, _("%s: Weighting variable may not be a string variable."),
- fh_get_filename (fh)));
+ fh_get_file_name (fh)));
dict_set_weight (*dict, weight_var);
}
dict_set_weight (*dict, weight_var);
}
lose ((ME, _("%s: Orphaned variable index record (type 4). Type 4 "
"records must always immediately follow type 3 "
"records."),
lose ((ME, _("%s: Orphaned variable index record (type 4). Type 4 "
"records must always immediately follow type 3 "
"records."),
- fh_get_filename (r->fh)));
+ fh_get_file_name (r->fh)));
case 6:
if (!read_documents (r, *dict))
case 6:
if (!read_documents (r, *dict))
bytes = data.size * data.count;
if (bytes < data.size || bytes < data.count)
lose ((ME, "%s: Record type %d subtype %d too large.",
bytes = data.size * data.count;
if (bytes < data.size || bytes < data.count)
lose ((ME, "%s: Record type %d subtype %d too large.",
- fh_get_filename (r->fh), rec_type, data.subtype));
+ fh_get_file_name (r->fh), rec_type, data.subtype));
{
msg (MW, _("%s: Invalid subrecord length. "
"Record: 7; Subrecord: 11"),
{
msg (MW, _("%s: Invalid subrecord length. "
"Record: 7; Subrecord: 11"),
- fh_get_filename (r->fh));
+ fh_get_file_name (r->fh));
{
msg (MW, _("%s: Trailing garbage in long variable "
"name map."),
{
msg (MW, _("%s: Trailing garbage in long variable "
"name map."),
- fh_get_filename (r->fh));
+ fh_get_file_name (r->fh));
break;
}
if (!var_is_valid_name (long_name, false))
{
msg (MW, _("%s: Long variable mapping to invalid "
"variable name `%s'."),
break;
}
if (!var_is_valid_name (long_name, false))
{
msg (MW, _("%s: Long variable mapping to invalid "
"variable name `%s'."),
- fh_get_filename (r->fh), long_name);
+ fh_get_file_name (r->fh), long_name);
{
msg (MW, _("%s: Long variable mapping for "
"nonexistent variable %s."),
{
msg (MW, _("%s: Long variable mapping for "
"nonexistent variable %s."),
- fh_get_filename (r->fh), short_name);
+ fh_get_file_name (r->fh), short_name);
NULL != dict_lookup_var (*dict, long_name))
lose ((ME, _("%s: Duplicate long variable name `%s' "
"within system file."),
NULL != dict_lookup_var (*dict, long_name))
lose ((ME, _("%s: Duplicate long variable name `%s' "
"within system file."),
- fh_get_filename (r->fh), long_name));
+ fh_get_file_name (r->fh), long_name));
default:
msg (MW, _("%s: Unrecognized record type 7, subtype %d "
"encountered in system file."),
default:
msg (MW, _("%s: Unrecognized record type 7, subtype %d "
"encountered in system file."),
- fh_get_filename (r->fh), data.subtype);
+ fh_get_file_name (r->fh), data.subtype);
default:
corrupt_msg(MW, _("%s: Unrecognized record type %d."),
default:
corrupt_msg(MW, _("%s: Unrecognized record type %d."),
- fh_get_filename (r->fh), rec_type);
+ fh_get_file_name (r->fh), rec_type);
if (size != sizeof (int32_t) || count != 8)
lose ((ME, _("%s: Bad size (%d) or count (%d) field on record type 7, "
"subtype 3. Expected size %d, count 8."),
if (size != sizeof (int32_t) || count != 8)
lose ((ME, _("%s: Bad size (%d) or count (%d) field on record type 7, "
"subtype 3. Expected size %d, count 8."),
- fh_get_filename (r->fh), size, count, sizeof (int32_t)));
+ fh_get_file_name (r->fh), size, count, sizeof (int32_t)));
assertive_buf_read (r, data, sizeof data, 0);
if (r->reverse_endian)
assertive_buf_read (r, data, sizeof data, 0);
if (r->reverse_endian)
lose ((ME, _("%s: Floating-point representation in system file is not "
"IEEE-754. PSPP cannot convert between floating-point "
"formats."),
lose ((ME, _("%s: Floating-point representation in system file is not "
"IEEE-754. PSPP cannot convert between floating-point "
"formats."),
- fh_get_filename (r->fh)));
+ fh_get_file_name (r->fh)));
#else
#error Add support for your floating-point format.
#endif
#else
#error Add support for your floating-point format.
#endif
if (file_bigendian ^ (data[6] == 1))
lose ((ME, _("%s: File-indicated endianness (%s) does not match "
"endianness intuited from file header (%s)."),
if (file_bigendian ^ (data[6] == 1))
lose ((ME, _("%s: File-indicated endianness (%s) does not match "
"endianness intuited from file header (%s)."),
- fh_get_filename (r->fh),
+ fh_get_file_name (r->fh),
file_bigendian ? _("big-endian") : _("little-endian"),
data[6] == 1 ? _("big-endian") : (data[6] == 2 ? _("little-endian")
: _("unknown"))));
file_bigendian ? _("big-endian") : _("little-endian"),
data[6] == 1 ? _("big-endian") : (data[6] == 2 ? _("little-endian")
: _("unknown"))));
if (data[7] != 2 && data[7] != 3)
lose ((ME, _("%s: File-indicated character representation code (%s) is "
"not ASCII."),
if (data[7] != 2 && data[7] != 3)
lose ((ME, _("%s: File-indicated character representation code (%s) is "
"not ASCII."),
- fh_get_filename (r->fh),
+ fh_get_file_name (r->fh),
(data[7] == 1 ? "EBCDIC"
: (data[7] == 4 ? _("DEC Kanji") : _("Unknown")))));
(data[7] == 1 ? "EBCDIC"
: (data[7] == 4 ? _("DEC Kanji") : _("Unknown")))));
if (size != sizeof (flt64) || count != 3)
lose ((ME, _("%s: Bad size (%d) or count (%d) field on record type 7, "
"subtype 4. Expected size %d, count 8."),
if (size != sizeof (flt64) || count != 3)
lose ((ME, _("%s: Bad size (%d) or count (%d) field on record type 7, "
"subtype 4. Expected size %d, count 8."),
- fh_get_filename (r->fh), size, count, sizeof (flt64)));
+ fh_get_file_name (r->fh), size, count, sizeof (flt64)));
assertive_buf_read (r, data, sizeof data, 0);
if (r->reverse_endian)
assertive_buf_read (r, data, sizeof data, 0);
if (r->reverse_endian)
"for at least one of the three system values. SYSMIS: "
"indicated %g, expected %g; HIGHEST: %g, %g; LOWEST: "
"%g, %g."),
"for at least one of the three system values. SYSMIS: "
"indicated %g, expected %g; HIGHEST: %g, %g; LOWEST: "
"%g, %g."),
- fh_get_filename (r->fh), (double) data[0], (double) SYSMIS,
+ fh_get_file_name (r->fh), (double) data[0], (double) SYSMIS,
(double) data[1], (double) FLT64_MAX,
(double) data[2], (double) second_lowest_flt64);
}
(double) data[1], (double) FLT64_MAX,
(double) data[2], (double) second_lowest_flt64);
}
if (strncmp ("$FL2", hdr.rec_type, 4) != 0)
lose ((ME, _("%s: Bad magic. Proper system files begin with "
"the four characters `$FL2'. This file will not be read."),
if (strncmp ("$FL2", hdr.rec_type, 4) != 0)
lose ((ME, _("%s: Bad magic. Proper system files begin with "
"the four characters `$FL2'. This file will not be read."),
- fh_get_filename (r->fh)));
+ fh_get_file_name (r->fh)));
/* Check eye-category.her string. */
memcpy (prod_name, hdr.prod_name, sizeof hdr.prod_name);
/* Check eye-category.her string. */
memcpy (prod_name, hdr.prod_name, sizeof hdr.prod_name);
if (hdr.layout_code != 2)
lose ((ME, _("%s: File layout code has unexpected value %d. Value "
"should be 2, in big-endian or little-endian format."),
if (hdr.layout_code != 2)
lose ((ME, _("%s: File layout code has unexpected value %d. Value "
"should be 2, in big-endian or little-endian format."),
- fh_get_filename (r->fh), hdr.layout_code));
+ fh_get_file_name (r->fh), hdr.layout_code));
r->reverse_endian = 1;
bswap_int32 (&hdr.case_size);
r->reverse_endian = 1;
bswap_int32 (&hdr.case_size);
if (r->case_cnt < -1 || r->case_cnt > INT_MAX / 2)
lose ((ME,
_("%s: Number of cases in file (%ld) is not between -1 and %d."),
if (r->case_cnt < -1 || r->case_cnt > INT_MAX / 2)
lose ((ME,
_("%s: Number of cases in file (%ld) is not between -1 and %d."),
- fh_get_filename (r->fh), (long) r->case_cnt, INT_MAX / 2));
+ fh_get_file_name (r->fh), (long) r->case_cnt, INT_MAX / 2));
r->bias = hdr.bias;
if (r->bias != 100.0)
corrupt_msg (MW, _("%s: Compression bias (%g) is not the usual "
"value of 100."),
r->bias = hdr.bias;
if (r->bias != 100.0)
corrupt_msg (MW, _("%s: Compression bias (%g) is not the usual "
"value of 100."),
- fh_get_filename (r->fh), r->bias);
+ fh_get_file_name (r->fh), r->bias);
/* Make a file label only on the condition that the given label is
not all spaces or nulls. */
/* Make a file label only on the condition that the given label is
not all spaces or nulls. */
if (sv.type != -1)
lose ((ME, _("%s: position %d: String variable does not have "
"proper number of continuation records."),
if (sv.type != -1)
lose ((ME, _("%s: position %d: String variable does not have "
"proper number of continuation records."),
- fh_get_filename (r->fh), i));
+ fh_get_file_name (r->fh), i));
else if (sv.type == -1)
lose ((ME, _("%s: position %d: Superfluous long string continuation "
"record."),
else if (sv.type == -1)
lose ((ME, _("%s: position %d: Superfluous long string continuation "
"record."),
- fh_get_filename (r->fh), i));
+ fh_get_file_name (r->fh), i));
/* Check fields for validity. */
if (sv.type < 0 || sv.type > 255)
lose ((ME, _("%s: position %d: Bad variable type code %d."),
/* Check fields for validity. */
if (sv.type < 0 || sv.type > 255)
lose ((ME, _("%s: position %d: Bad variable type code %d."),
- fh_get_filename (r->fh), i, sv.type));
+ fh_get_file_name (r->fh), i, sv.type));
if (sv.has_var_label != 0 && sv.has_var_label != 1)
lose ((ME, _("%s: position %d: Variable label indicator field is not "
if (sv.has_var_label != 0 && sv.has_var_label != 1)
lose ((ME, _("%s: position %d: Variable label indicator field is not "
- "0 or 1."), fh_get_filename (r->fh), i));
+ "0 or 1."), fh_get_file_name (r->fh), i));
if (sv.n_missing_values < -3 || sv.n_missing_values > 3
|| sv.n_missing_values == -1)
lose ((ME, _("%s: position %d: Missing value indicator field is not "
if (sv.n_missing_values < -3 || sv.n_missing_values > 3
|| sv.n_missing_values == -1)
lose ((ME, _("%s: position %d: Missing value indicator field is not "
- "-3, -2, 0, 1, 2, or 3."), fh_get_filename (r->fh), i));
+ "-3, -2, 0, 1, 2, or 3."), fh_get_file_name (r->fh), i));
/* Copy first character of variable name. */
if (sv.name[0] == '@' || sv.name[0] == '#')
lose ((ME, _("%s: position %d: Variable name begins with invalid "
"character."),
/* Copy first character of variable name. */
if (sv.name[0] == '@' || sv.name[0] == '#')
lose ((ME, _("%s: position %d: Variable name begins with invalid "
"character."),
- fh_get_filename (r->fh), i));
+ fh_get_file_name (r->fh), i));
if ( ! var_is_plausible_name(name, false) )
lose ((ME, _("%s: Invalid variable name `%s' within system file."),
if ( ! var_is_plausible_name(name, false) )
lose ((ME, _("%s: Invalid variable name `%s' within system file."),
- fh_get_filename (r->fh), name));
+ fh_get_file_name (r->fh), name));
/* Create variable. */
vv = (*var_by_idx)[i] = dict_create_var (dict, name, sv.type);
if (vv == NULL)
lose ((ME, _("%s: Duplicate variable name `%s' within system file."),
/* Create variable. */
vv = (*var_by_idx)[i] = dict_create_var (dict, name, sv.type);
if (vv == NULL)
lose ((ME, _("%s: Duplicate variable name `%s' within system file."),
- fh_get_filename (r->fh), name));
+ fh_get_file_name (r->fh), name));
var_set_short_name (vv, vv->name);
var_set_short_name (vv, vv->name);
if (len < 0 || len > 255)
lose ((ME, _("%s: Variable %s indicates variable label of invalid "
"length %d."),
if (len < 0 || len > 255)
lose ((ME, _("%s: Variable %s indicates variable label of invalid "
"length %d."),
- fh_get_filename (r->fh), vv->name, len));
+ fh_get_file_name (r->fh), vv->name, len));
if (vv->width > MAX_SHORT_STRING)
lose ((ME, _("%s: Long string variable %s may not have missing "
"values."),
if (vv->width > MAX_SHORT_STRING)
lose ((ME, _("%s: Long string variable %s may not have missing "
"values."),
- fh_get_filename (r->fh), vv->name));
+ fh_get_file_name (r->fh), vv->name));
assertive_buf_read (r, mv, sizeof *mv * mv_cnt, 0);
assertive_buf_read (r, mv, sizeof *mv * mv_cnt, 0);
if (vv->type == ALPHA)
lose ((ME, _("%s: String variable %s may not have missing "
"values specified as a range."),
if (vv->type == ALPHA)
lose ((ME, _("%s: String variable %s may not have missing "
"values specified as a range."),
- fh_get_filename (r->fh), vv->name));
+ fh_get_file_name (r->fh), vv->name));
if (mv[0] == r->lowest)
mv_add_num_range (&vv->miss, LOWEST, mv[1]);
if (mv[0] == r->lowest)
mv_add_num_range (&vv->miss, LOWEST, mv[1]);
if (long_string_count != 0)
lose ((ME, _("%s: Long string continuation records omitted at end of "
"dictionary."),
if (long_string_count != 0)
lose ((ME, _("%s: Long string continuation records omitted at end of "
"dictionary."),
- fh_get_filename (r->fh)));
+ fh_get_file_name (r->fh)));
if (next_value != r->value_cnt)
corrupt_msg(MW, _("%s: System file header indicates %d variable positions but "
"%d were read from file."),
if (next_value != r->value_cnt)
corrupt_msg(MW, _("%s: System file header indicates %d variable positions but "
"%d were read from file."),
- fh_get_filename (r->fh), r->value_cnt, next_value);
+ fh_get_file_name (r->fh), r->value_cnt, next_value);
f->type = translate_fmt ((s >> 16) & 0xff);
if (f->type == -1)
lose ((ME, _("%s: Bad format specifier byte (%d)."),
f->type = translate_fmt ((s >> 16) & 0xff);
if (f->type == -1)
lose ((ME, _("%s: Bad format specifier byte (%d)."),
- fh_get_filename (r->fh), (s >> 16) & 0xff));
+ fh_get_file_name (r->fh), (s >> 16) & 0xff));
f->w = (s >> 8) & 0xff;
f->d = s & 0xff;
if ((v->type == ALPHA) ^ ((formats[f->type].cat & FCAT_STRING) != 0))
lose ((ME, _("%s: %s variable %s has %s format specifier %s."),
f->w = (s >> 8) & 0xff;
f->d = s & 0xff;
if ((v->type == ALPHA) ^ ((formats[f->type].cat & FCAT_STRING) != 0))
lose ((ME, _("%s: %s variable %s has %s format specifier %s."),
- fh_get_filename (r->fh),
+ fh_get_file_name (r->fh),
v->type == ALPHA ? _("String") : _("Numeric"),
v->name,
formats[f->type].cat & FCAT_STRING ? _("string") : _("numeric"),
v->type == ALPHA ? _("String") : _("Numeric"),
v->name,
formats[f->type].cat & FCAT_STRING ? _("string") : _("numeric"),
if ( n_labels >= ((int32_t) ~0) / sizeof *labels)
{
corrupt_msg(MW, _("%s: Invalid number of labels: %d. Ignoring labels."),
if ( n_labels >= ((int32_t) ~0) / sizeof *labels)
{
corrupt_msg(MW, _("%s: Invalid number of labels: %d. Ignoring labels."),
- fh_get_filename (r->fh), n_labels);
+ fh_get_file_name (r->fh), n_labels);
if (rec_type != 4)
lose ((ME, _("%s: Variable index record (type 4) does not immediately "
"follow value label record (type 3) as it should."),
if (rec_type != 4)
lose ((ME, _("%s: Variable index record (type 4) does not immediately "
"follow value label record (type 3) as it should."),
- fh_get_filename (r->fh)));
+ fh_get_file_name (r->fh)));
}
/* Read number of variables associated with value label from type 4
}
/* Read number of variables associated with value label from type 4
if (n_vars < 1 || n_vars > dict_get_var_cnt (dict))
lose ((ME, _("%s: Number of variables associated with a value label (%d) "
"is not between 1 and the number of variables (%d)."),
if (n_vars < 1 || n_vars > dict_get_var_cnt (dict))
lose ((ME, _("%s: Number of variables associated with a value label (%d) "
"is not between 1 and the number of variables (%d)."),
- fh_get_filename (r->fh), n_vars, dict_get_var_cnt (dict)));
+ fh_get_file_name (r->fh), n_vars, dict_get_var_cnt (dict)));
/* Read the list of variables. */
var = xnmalloc (n_vars, sizeof *var);
/* Read the list of variables. */
var = xnmalloc (n_vars, sizeof *var);
if (var_idx < 1 || var_idx > r->value_cnt)
lose ((ME, _("%s: Variable index associated with value label (%d) is "
"not between 1 and the number of values (%d)."),
if (var_idx < 1 || var_idx > r->value_cnt)
lose ((ME, _("%s: Variable index associated with value label (%d) is "
"not between 1 and the number of values (%d)."),
- fh_get_filename (r->fh), var_idx, r->value_cnt));
+ fh_get_file_name (r->fh), var_idx, r->value_cnt));
/* Make sure it's a real variable. */
v = var_by_idx[var_idx - 1];
/* Make sure it's a real variable. */
v = var_by_idx[var_idx - 1];
lose ((ME, _("%s: Variable index associated with value label (%d) "
"refers to a continuation of a string variable, not to "
"an actual variable."),
lose ((ME, _("%s: Variable index associated with value label (%d) "
"refers to a continuation of a string variable, not to "
"an actual variable."),
- fh_get_filename (r->fh), var_idx));
+ fh_get_file_name (r->fh), var_idx));
if (v->type == ALPHA && v->width > MAX_SHORT_STRING)
lose ((ME, _("%s: Value labels are not allowed on long string "
"variables (%s)."),
if (v->type == ALPHA && v->width > MAX_SHORT_STRING)
lose ((ME, _("%s: Value labels are not allowed on long string "
"variables (%s)."),
- fh_get_filename (r->fh), v->name));
+ fh_get_file_name (r->fh), v->name));
/* Add it to the list of variables. */
var[i] = v;
/* Add it to the list of variables. */
var[i] = v;
lose ((ME, _("%s: Variables associated with value label are not all of "
"identical type. Variable %s has %s type, but variable "
"%s has %s type."),
lose ((ME, _("%s: Variables associated with value label are not all of "
"identical type. Variable %s has %s type, but variable "
"%s has %s type."),
- fh_get_filename (r->fh),
+ fh_get_file_name (r->fh),
var[0]->name, var[0]->type == ALPHA ? _("string") : _("numeric"),
var[i]->name, var[i]->type == ALPHA ? _("string") : _("numeric")));
var[0]->name, var[0]->type == ALPHA ? _("string") : _("numeric"),
var[i]->name, var[i]->type == ALPHA ? _("string") : _("numeric")));
if (var[0]->type == NUMERIC)
msg (MW, _("%s: File contains duplicate label for value %g for "
"variable %s."),
if (var[0]->type == NUMERIC)
msg (MW, _("%s: File contains duplicate label for value %g for "
"variable %s."),
- fh_get_filename (r->fh), label->value.f, v->name);
+ fh_get_file_name (r->fh), label->value.f, v->name);
else
msg (MW, _("%s: File contains duplicate label for value `%.*s' "
"for variable %s."),
else
msg (MW, _("%s: File contains duplicate label for value `%.*s' "
"for variable %s."),
- fh_get_filename (r->fh), v->width, label->value.s, v->name);
+ fh_get_file_name (r->fh), v->width, label->value.s, v->name);
{
if (ferror (r->file))
msg (ME, _("%s: Reading system file: %s."),
{
if (ferror (r->file))
msg (ME, _("%s: Reading system file: %s."),
- fh_get_filename (r->fh), strerror (errno));
+ fh_get_file_name (r->fh), strerror (errno));
else
corrupt_msg (ME, _("%s: Unexpected end of file."),
else
corrupt_msg (ME, _("%s: Unexpected end of file."),
- fh_get_filename (r->fh));
+ fh_get_file_name (r->fh));
r->ok = false;
return NULL;
}
r->ok = false;
return NULL;
}
if ( 0 != fseek(r->file, -byte_cnt, SEEK_CUR))
{
msg (ME, _("%s: Seeking system file: %s."),
if ( 0 != fseek(r->file, -byte_cnt, SEEK_CUR))
{
msg (ME, _("%s: Seeking system file: %s."),
- fh_get_filename (r->fh), strerror (errno));
+ fh_get_file_name (r->fh), strerror (errno));
if (dict_get_documents (dict) != NULL)
lose ((ME, _("%s: System file contains multiple "
"type 6 (document) records."),
if (dict_get_documents (dict) != NULL)
lose ((ME, _("%s: System file contains multiple "
"type 6 (document) records."),
- fh_get_filename (r->fh)));
+ fh_get_file_name (r->fh)));
assertive_buf_read (r, &line_cnt, sizeof line_cnt, 0);
if (line_cnt <= 0)
lose ((ME, _("%s: Number of document lines (%ld) "
"must be greater than 0."),
assertive_buf_read (r, &line_cnt, sizeof line_cnt, 0);
if (line_cnt <= 0)
lose ((ME, _("%s: Number of document lines (%ld) "
"must be greater than 0."),
- fh_get_filename (r->fh), (long) line_cnt));
+ fh_get_file_name (r->fh), (long) line_cnt));
documents = buf_read (r, NULL, 80 * line_cnt, line_cnt * 80 + 1);
/* FIXME? Run through asciify. */
documents = buf_read (r, NULL, 80 * line_cnt, line_cnt * 80 + 1);
/* FIXME? Run through asciify. */
if (ferror (r->file))
{
msg (ME, _("%s: Error reading file: %s."),
if (ferror (r->file))
{
msg (ME, _("%s: Error reading file: %s."),
- fh_get_filename (r->fh), strerror (errno));
+ fh_get_file_name (r->fh), strerror (errno));
r->ok = false;
return 0;
}
r->ok = false;
return 0;
}
return 0;
lose ((ME, _("%s: Compressed data is corrupted. Data ends "
"in partial case."),
return 0;
lose ((ME, _("%s: Compressed data is corrupted. Data ends "
"in partial case."),
- fh_get_filename (r->fh)));
+ fh_get_file_name (r->fh)));
case 253:
/* Code 253 indicates that the value is stored explicitly
following the instruction bytes. */
if (r->ptr == NULL || r->ptr >= r->end)
if (!buffer_input (r))
lose ((ME, _("%s: Unexpected end of file."),
case 253:
/* Code 253 indicates that the value is stored explicitly
following the instruction bytes. */
if (r->ptr == NULL || r->ptr >= r->end)
if (!buffer_input (r))
lose ((ME, _("%s: Unexpected end of file."),
- fh_get_filename (r->fh)));
+ fh_get_file_name (r->fh)));
memcpy (buf++, r->ptr++, sizeof *buf);
if (buf >= buf_end)
goto success;
memcpy (buf++, r->ptr++, sizeof *buf);
if (buf >= buf_end)
goto success;
{
if (buf_beg != buf)
lose ((ME, _("%s: Unexpected end of file."),
{
if (buf_beg != buf)
lose ((ME, _("%s: Unexpected end of file."),
- fh_get_filename (r->fh)));
+ fh_get_file_name (r->fh)));
if (ferror (r->file))
{
msg (ME, _("%s: Reading system file: %s."),
if (ferror (r->file))
{
msg (ME, _("%s: Reading system file: %s."),
- fh_get_filename (r->fh), strerror (errno));
+ fh_get_file_name (r->fh), strerror (errno));
r->ok = false;
}
else if (read_bytes != 0)
{
msg (ME, _("%s: Partial record at end of system file."),
r->ok = false;
}
else if (read_bytes != 0)
{
msg (ME, _("%s: Partial record at end of system file."),
- fh_get_filename (r->fh));
+ fh_get_file_name (r->fh));
r->ok = false;
}
return 0;
r->ok = false;
}
return 0;
mode = S_IRUSR | S_IRGRP | S_IROTH;
if (opts.create_writeable)
mode |= S_IWUSR | S_IWGRP | S_IWOTH;
mode = S_IRUSR | S_IRGRP | S_IROTH;
if (opts.create_writeable)
mode |= S_IWUSR | S_IWGRP | S_IWOTH;
- fd = open (fh_get_filename (fh), O_WRONLY | O_CREAT | O_TRUNC, mode);
+ fd = open (fh_get_file_name (fh), O_WRONLY | O_CREAT | O_TRUNC, mode);
if (fd < 0)
goto open_error;
if (fd < 0)
goto open_error;
open_error:
msg (ME, _("Error opening \"%s\" for writing as a system file: %s."),
open_error:
msg (ME, _("Error opening \"%s\" for writing as a system file: %s."),
- fh_get_filename (fh), strerror (errno));
+ fh_get_file_name (fh), strerror (errno));
if (!ok)
msg (ME, _("An I/O error occurred writing system file \"%s\"."),
if (!ok)
msg (ME, _("An I/O error occurred writing system file \"%s\"."),
- fh_get_filename (w->fh));
+ fh_get_file_name (w->fh));
}
fh_close (w->fh, "system file", "we");
}
fh_close (w->fh, "system file", "we");
return;
is_inline = r->fh == fh_inline_file ();
return;
is_inline = r->fh == fh_inline_file ();
- file_name = is_inline ? NULL : xstrdup (fh_get_filename (r->fh));
+ file_name = is_inline ? NULL : xstrdup (fh_get_file_name (r->fh));
still_open = fh_close (r->fh, "data file", "rs");
if (still_open)
{
still_open = fh_close (r->fh, "data file", "rs");
if (still_open)
{
r->eof_cnt = 0;
if (fh != fh_inline_file ())
{
r->eof_cnt = 0;
if (fh != fh_inline_file ())
{
- r->where.filename = fh_get_filename (fh);
+ r->where.file_name = fh_get_file_name (fh);
r->where.line_number = 0;
r->where.line_number = 0;
- r->file = fn_open (fh_get_filename (fh), "rb");
+ r->file = fn_open (fh_get_file_name (fh), "rb");
if (r->file == NULL)
{
msg (ME, _("Could not open \"%s\" for reading as a data file: %s."),
if (r->file == NULL)
{
msg (ME, _("Could not open \"%s\" for reading as a data file: %s."),
- fh_get_filename (r->fh), strerror (errno));
+ fh_get_file_name (r->fh), strerror (errno));
fh_close (fh,"data file", "rs");
free (r);
return NULL;
fh_close (fh,"data file", "rs");
free (r);
return NULL;
-/* Pushes the filename and line number on the fn/ln stack. */
+/* Pushes the file name and line number on the fn/ln stack. */
void
dfm_push (struct dfm_reader *r)
{
void
dfm_push (struct dfm_reader *r)
{
err_push_file_locator (&r->where);
}
err_push_file_locator (&r->where);
}
-/* Pops the filename and line number from the fn/ln stack. */
+/* Pops the file name and line number from the fn/ln stack. */
void
dfm_pop (struct dfm_reader *r)
{
void
dfm_pop (struct dfm_reader *r)
{
w = *aux = xmalloc (sizeof *w);
w->fh = fh;
w = *aux = xmalloc (sizeof *w);
w->fh = fh;
- w->file = fn_open (fh_get_filename (w->fh), "wb");
+ w->file = fn_open (fh_get_file_name (w->fh), "wb");
w->bounce = NULL;
if (w->file == NULL)
{
msg (ME, _("An error occurred while opening \"%s\" for writing "
"as a data file: %s."),
w->bounce = NULL;
if (w->file == NULL)
{
msg (ME, _("An error occurred while opening \"%s\" for writing "
"as a data file: %s."),
- fh_get_filename (w->fh), strerror (errno));
+ fh_get_file_name (w->fh), strerror (errno));
-/* Parses a file handle name, which may be a filename as a string
+/* Parses a file handle name, which may be a file name as a string
or a file handle name as an identifier. The allowed types of
file handle are restricted to those in REFERENT_MASK. Returns
the file handle when successful, a null pointer on failure. */
or a file handle name as an identifier. The allowed types of
file handle are restricted to those in REFERENT_MASK. Returns
the file handle when successful, a null pointer on failure. */
if (token == T_ID)
handle = fh_from_name (tokid);
if (handle == NULL)
if (token == T_ID)
handle = fh_from_name (tokid);
if (handle == NULL)
- handle = fh_from_filename (ds_c_str (&tokstr));
+ handle = fh_from_file_name (ds_c_str (&tokstr));
if (handle == NULL)
{
if (token != T_ID || tokid[0] != '#' || get_syntax () != ENHANCED)
{
if (handle == NULL)
{
if (token != T_ID || tokid[0] != '#' || get_syntax () != ENHANCED)
{
- char *filename = ds_c_str (&tokstr);
- char *handle_name = xasprintf ("\"%s\"", filename);
- handle = fh_create_file (handle_name, filename,
+ char *file_name = ds_c_str (&tokstr);
+ char *handle_name = xasprintf ("\"%s\"", file_name);
+ handle = fh_create_file (handle_name, file_name,
fh_default_properties ());
free (handle_name);
}
fh_default_properties ());
free (handle_name);
}
t = tab_create (2, 9, 0);
tab_vline (t, TAL_GAP, 1, 0, 8);
tab_text (t, 0, 0, TAB_LEFT, _("File:"));
t = tab_create (2, 9, 0);
tab_vline (t, TAL_GAP, 1, 0, 8);
tab_text (t, 0, 0, TAB_LEFT, _("File:"));
- tab_text (t, 1, 0, TAB_LEFT, fh_get_filename (h));
+ tab_text (t, 1, 0, TAB_LEFT, fh_get_file_name (h));
tab_text (t, 0, 1, TAB_LEFT, _("Label:"));
{
const char *label = dict_get_label (d);
tab_text (t, 0, 1, TAB_LEFT, _("Label:"));
{
const char *label = dict_get_label (d);
struct getl_source *next; /* Next file in list. */
/* Current location. */
struct getl_source *next; /* Next file in list. */
/* Current location. */
- char *fn; /* Filename. */
+ char *fn; /* File name. */
int ln; /* Line number. */
enum getl_source_type
int ln; /* Line number. */
enum getl_source_type
append_source (create_syntax_file_source (fn));
}
append_source (create_syntax_file_source (fn));
}
-/* Inserts the given file with filename FN into the current file after
- the current line. */
+/* Inserts the given file with name FN into the current file
+ after the current line. */
void
getl_include_syntax_file (const char *fn)
{
void
getl_include_syntax_file (const char *fn)
{
if (nfile_loc)
*f = *file_loc[nfile_loc - 1];
else
if (nfile_loc)
*f = *file_loc[nfile_loc - 1];
else
- getl_location (&f->filename, &f->line_number);
+ getl_location (&f->file_name, &f->line_number);
}
/* Reads a line from syntax file source S into LINE.
}
/* Reads a line from syntax file source S into LINE.
{
assert (c != NULL);
assert (model_file != NULL);
{
assert (c != NULL);
assert (model_file != NULL);
- fp = fopen (fh_get_filename (model_file), "w");
+ fp = fopen (fh_get_file_name (model_file), "w");
assert (fp != NULL);
fprintf (fp, "%s", reg_preamble);
reg_print_getvar (fp, c);
assert (fp != NULL);
fprintf (fp, "%s", reg_preamble);
reg_print_getvar (fp, c);
if (lex_match_id ("FILE"))
lex_match ('=');
if (lex_match_id ("FILE"))
lex_match ('=');
- /* Filename can be identifier or string. */
+ /* File name can be identifier or string. */
if (token != T_ID && token != T_STRING)
{
if (token != T_ID && token != T_STRING)
{
- lex_error (_("expecting filename"));
+ lex_error (_("expecting file name"));
return CMD_CASCADING_FAILURE;
}
getl_include_syntax_file (ds_c_str (&tokstr));
return CMD_CASCADING_FAILURE;
}
getl_include_syntax_file (ds_c_str (&tokstr));
enum PER {PER_RO, PER_RW};
enum PER {PER_RO, PER_RW};
-int change_permissions(const char *filename, enum PER per);
+int change_permissions(const char *file_name, enum PER per);
/* Parses the PERMISSIONS command. */
/* Parses the PERMISSIONS command. */
-change_permissions(const char *filename, enum PER per)
+change_permissions(const char *file_name, enum PER per)
{
struct stat buf;
mode_t mode;
{
struct stat buf;
mode_t mode;
- if ( -1 == stat(filename, &buf) )
+ if ( -1 == stat(file_name, &buf) )
{
const int errnum = errno;
{
const int errnum = errno;
- msg(ME,_("Cannot stat %s: %s"), filename, strerror(errnum));
+ msg(ME,_("Cannot stat %s: %s"), file_name, strerror(errnum));
else
mode = buf.st_mode & ~( S_IWOTH | S_IWUSR | S_IWGRP );
else
mode = buf.st_mode & ~( S_IWOTH | S_IWUSR | S_IWGRP );
- if ( -1 == chmod(filename, mode))
+ if ( -1 == chmod(file_name, mode))
{
const int errnum = errno;
{
const int errnum = errno;
- msg(ME,_("Cannot change mode of %s: %s"), filename, strerror(errnum));
+ msg(ME,_("Cannot change mode of %s: %s"), file_name, strerror(errnum));
/* A file location. */
struct file_locator
{
/* A file location. */
struct file_locator
{
- const char *filename; /* Filename. */
+ const char *file_name; /* File name. */
int line_number; /* Line number. */
};
int line_number; /* Line number. */
};
subpool->parent = pool;
}
subpool->parent = pool;
}
-/* Opens file FILENAME with mode MODE and returns a handle to it
+/* Opens file FILE_NAME with mode MODE and returns a handle to it
if successful or a null pointer if not.
The file will be closed automatically when POOL is destroyed, or it
may be closed explicitly in advance using pool_fclose(), or
detached from the pool with pool_detach_file(). */
FILE *
if successful or a null pointer if not.
The file will be closed automatically when POOL is destroyed, or it
may be closed explicitly in advance using pool_fclose(), or
detached from the pool with pool_detach_file(). */
FILE *
-pool_fopen (struct pool *pool, const char *filename, const char *mode)
+pool_fopen (struct pool *pool, const char *file_name, const char *mode)
- assert (pool && filename && mode);
- f = fopen (filename, mode);
+ assert (pool && file_name && mode);
+ f = fopen (file_name, mode);
if (f == NULL)
return NULL;
if (f == NULL)
return NULL;
enum
{
ERR_IN_PROCEDURE = 01, /* 1=Display name of current procedure. */
enum
{
ERR_IN_PROCEDURE = 01, /* 1=Display name of current procedure. */
- ERR_WITH_FILE = 02, /* 1=Display filename and line number. */
+ ERR_WITH_FILE = 02, /* 1=Display file name and line number. */
};
/* Describes one class of error. */
};
/* Describes one class of error. */
assert (format != NULL);
ds_init (&msg, 64);
assert (format != NULL);
ds_init (&msg, 64);
- if (e->where.filename && (error_classes[e->class].flags & ERR_WITH_FILE))
+ if (e->where.file_name && (error_classes[e->class].flags & ERR_WITH_FILE))
- ds_printf (&msg, "%s:", e->where.filename);
+ ds_printf (&msg, "%s:", e->where.file_name);
if (e->where.line_number != -1)
ds_printf (&msg, "%d:", e->where.line_number);
ds_putc (&msg, ' ');
if (e->where.line_number != -1)
ds_printf (&msg, "%d:", e->where.line_number);
ds_putc (&msg, ' ');
FILE *file;
/* The geometry of the chart
FILE *file;
/* The geometry of the chart
output_tab_table ( this, (struct tab_table *) s->ext);
break;
case SOM_CHART:
output_tab_table ( this, (struct tab_table *) s->ext);
break;
case SOM_CHART:
- link_image (x->file, ((struct chart *)s->ext)->filename);
+ link_image (x->file, ((struct chart *)s->ext)->file_name);
break;
default:
abort ();
break;
default:
abort ();
- make_unique_file_stream(&fp, &ch->filename);
+ make_unique_file_stream(&fp, &ch->file_name);
#ifdef NO_CHARTS
ch->lp = 0;
#ifdef NO_CHARTS
ch->lp = 0;
static void
html_finalise_chart(struct outp_driver *d UNUSED, struct chart *ch)
{
static void
html_finalise_chart(struct outp_driver *d UNUSED, struct chart *ch)
{
}
/* Looks for a PostScript font file or config file in all the
}
/* Looks for a PostScript font file or config file in all the
- appropriate places. Returns the filename on success, NULL on
+ appropriate places. Returns the file name on success, NULL on
failure. */
static char *
find_ps_file (const char *name)
failure. */
static char *
find_ps_file (const char *name)
GtkWidget *data_sheet = get_widget_assert(xml, "data_sheet");
GtkWidget *var_sheet = get_widget_assert(xml, "variable_sheet");
GtkWidget *data_sheet = get_widget_assert(xml, "data_sheet");
GtkWidget *var_sheet = get_widget_assert(xml, "variable_sheet");
g_assert(data_sheet);
g_assert(var_sheet);
g_assert(data_sheet);
g_assert(var_sheet);
- filename = gtk_file_chooser_get_filename
+ file_name = gtk_file_chooser_get_filename
(GTK_FILE_CHOOSER (dialog));
if ( psppire_handle )
fh_free(psppire_handle);
psppire_handle =
(GTK_FILE_CHOOSER (dialog));
if ( psppire_handle )
fh_free(psppire_handle);
psppire_handle =
- fh_create_file (handle_name, filename, fh_default_properties());
+ fh_create_file (handle_name, file_name, fh_default_properties());
if ( !psppire_handle )
{
g_warning("Cannot read handle for reading system file \"%s\"\n",
if ( !psppire_handle )
{
g_warning("Cannot read handle for reading system file \"%s\"\n",
psppire_case_array_clear(data_store->cases);
psppire_case_array_clear(data_store->cases);
- psppire_set_window_title(basename(filename));
+ psppire_set_window_title(basename(file_name));
{
const int ni = dict_get_next_value_idx(the_dictionary->dict);
{
const int ni = dict_get_next_value_idx(the_dictionary->dict);
if (gtk_dialog_run (GTK_DIALOG (dialog)) == GTK_RESPONSE_ACCEPT)
{
if (gtk_dialog_run (GTK_DIALOG (dialog)) == GTK_RESPONSE_ACCEPT)
{
- char *filename = gtk_file_chooser_get_filename
+ char *file_name = gtk_file_chooser_get_filename
(GTK_FILE_CHOOSER (dialog));
#if 0
if ( *handle )
destroy_file_handle(*handle, 0);
#endif
(GTK_FILE_CHOOSER (dialog));
#if 0
if ( *handle )
destroy_file_handle(*handle, 0);
#endif
- *handle = fh_create_file (handle_name, filename, fh_default_properties());
+ *handle = fh_create_file (handle_name, file_name, fh_default_properties());
- psppire_set_window_title(basename(filename));
+ psppire_set_window_title(basename(file_name));
}
gtk_widget_destroy (dialog);
}
gtk_widget_destroy (dialog);
void
err_location (struct file_locator *f)
{
void
err_location (struct file_locator *f)
{