gmx_fio_fclose(in);
}
+static gmx_bool gmx_one_before_eof(FILE *fp)
+{
+ char data[4];
+ gmx_bool beof;
+
+ if ((beof = fread(data, 1, 1, fp)) == 1)
+ {
+ gmx_fseek(fp, -1, SEEK_CUR);
+ }
+ return !beof;
+}
+
gmx_bool gro_next_x_or_v(FILE *status, t_trxframe *fr)
{
t_atoms atoms;
double tt;
int ndec = 0, i;
- if (gmx_eof(status))
+ if (gmx_one_before_eof(status))
{
return FALSE;
}
#endif
}
-
-//! Check whether the file (opened by gmx_ffopen()) is a pipe.
-static bool is_pipe(FILE *fp)
-{
- tMPI_Thread_mutex_lock(&pstack_mutex);
-
- t_pstack *ps = pstack;
- while (ps != NULL)
- {
- if (ps->fp == fp)
- {
- tMPI_Thread_mutex_unlock(&pstack_mutex);
- return true;
- }
- ps = ps->prev;
- }
- tMPI_Thread_mutex_unlock(&pstack_mutex);
- return false;
-}
-
-
static FILE *uncompress(const char *fn, const char *mode)
{
FILE *fp;
}
}
-gmx_bool gmx_eof(FILE *fp)
-{
- char data[4];
- gmx_bool beof;
-
- if (is_pipe(fp))
- {
- return feof(fp);
- }
- else
- {
- if ((beof = fread(data, 1, 1, fp)) == 1)
- {
- gmx_fseek(fp, -1, SEEK_CUR);
- }
- return !beof;
- }
-}
-
static char *backup_fn(const char *file, int count_max)
{
/* Use a reasonably low value for countmax; we might
*/
gmx_bool gmx_fexist(const char *fname);
-/*! \brief
- * Checks for end of file.
- *
- * \returns `TRUE` on end-of-file
- *
- * \todo
- * There are only two callers for this function, while there are ~20 direct
- * calls to feof(). Probably this is unnecessary.
- */
-gmx_bool gmx_eof(FILE *fp);
-
/*! \brief
* Makes a backup of file if the file exists.
*