+2010-03-20 Jerry DeLisle <jvdelisle@gcc.gnu.org>
+
+ PR fortran/43409
+ * ioparm.def: Change inquire size variable to type pointer to
+ GFC_IO_INT type.
+
2010-03-18 Paul Thomas <pault@gcc.gnu.org>
PR fortran/43039
IOPARM (inquire, round, 1 << 3, char2)
IOPARM (inquire, sign, 1 << 4, char1)
IOPARM (inquire, pending, 1 << 5, pint4)
-IOPARM (inquire, size, 1 << 6, pint4)
+IOPARM (inquire, size, 1 << 6, pintio)
IOPARM (inquire, id, 1 << 7, pint4)
IOPARM (wait, common, 0, common)
IOPARM (wait, id, 1 << 7, pint4)
+2010-03-20 Jerry DeLisle <jvdelisle@gcc.gnu.org>
+
+ PR fortran/43409
+ * io/unix.h: Add prototype for new function to return file size.
+ * io/unix.c (file_size): New function.
+ * io/inquire.c (inquire_via_unit): Use new function.
+ (inquire_via_filename): Use new function.
+
2010-03-17 Jerry DeLisle <jvdelisle@gcc.gnu.org>
* io/transfer.c (read_sf_internal): Remove stray function declaration
- used during debigging.
+ used during debugging.
2010-03-17 Jerry DeLisle <jvdelisle@gcc.gnu.org>
cf_strcpy (iqp->round, iqp->round_len, p);
}
+
+ if ((cf2 & IOPARM_INQUIRE_HAS_SIZE) != 0)
+ {
+ if (u == NULL)
+ *iqp->size = -1;
+ else
+ *iqp->size = file_size (u->file, (gfc_charlen_type) u->file_len);
+ }
}
if ((cf & IOPARM_INQUIRE_HAS_POSITION) != 0)
if ((cf2 & IOPARM_INQUIRE_HAS_ENCODING) != 0)
cf_strcpy (iqp->encoding, iqp->encoding_len, undefined);
+
+ if ((cf2 & IOPARM_INQUIRE_HAS_SIZE) != 0)
+ *iqp->size = file_size (iqp->file, iqp->file_len);
}
if ((cf & IOPARM_INQUIRE_HAS_POSITION) != 0)
}
+/* file_size()-- Returns the size of the file. */
+
+GFC_IO_INT
+file_size (const char *file, gfc_charlen_type file_len)
+{
+ char path[PATH_MAX + 1];
+ gfstat_t statbuf;
+
+ if (unpack_filename (path, file, file_len))
+ return -1;
+
+ if (stat (path, &statbuf) < 0)
+ return -1;
+
+ return (GFC_IO_INT) statbuf.st_size;
+}
static const char yes[] = "YES", no[] = "NO", unknown[] = "UNKNOWN";
extern int file_exists (const char *file, gfc_charlen_type file_len);
internal_proto(file_exists);
+extern GFC_IO_INT file_size (const char *file, gfc_charlen_type file_len);
+internal_proto(file_size);
+
extern const char *inquire_sequential (const char *, int);
internal_proto(inquire_sequential);