4 * This source code is part of
8 * GROningen MAchine for Chemical Simulations
11 * Written by David van der Spoel, Erik Lindahl, Berk Hess, and others.
12 * Copyright (c) 1991-2000, University of Groningen, The Netherlands.
13 * Copyright (c) 2001-2004, The GROMACS development team,
14 * check out http://www.gromacs.org for more information.
16 * This program is free software; you can redistribute it and/or
17 * modify it under the terms of the GNU General Public License
18 * as published by the Free Software Foundation; either version 2
19 * of the License, or (at your option) any later version.
21 * If you want to redistribute modifications, please consider that
22 * scientific software is very special. Version control is crucial -
23 * bugs must be traceable. We will be happy to consider code for
24 * inclusion in the official distribution, but derived work must not
25 * be called official GROMACS. Details are found in the README & COPYING
26 * files - if they are missing, get the official version at www.gromacs.org.
28 * To help us fund GROMACS development, we humbly ask that you cite
29 * the papers on the package - you can find them in the top README file.
31 * For more info, check our website at http://www.gromacs.org
34 * Gromacs Runs On Most of All Computer Systems
51 extern void no_buffers(void);
52 /* Turn off buffering of files (which is default) for debugging purposes */
54 extern bool fexist(const char *fname
);
55 /* Return TRUE when fname exists, FALSE otherwise */
57 extern bool eof(FILE *fp
);
58 /* Return TRUE on end-of-file, FALSE otherwise */
60 extern bool is_pipe(FILE *fp
);
61 /* Check whether the file (opened by ffopen) is a pipe */
63 extern char *backup_fn(const char *file
);
64 /* Return a backup name for file (name with # before and after) */
66 /* Make a backup of file if necessary.
67 Return false if there was a problem.
69 extern bool make_backup(const char * file
);
71 extern FILE *ffopen(const char *file
,char *mode
);
72 /* Return a valid file pointer when succesfull, exits otherwise
73 * If the file is in compressed format, open a pipe which uncompresses
74 * the file! Therefore, files must be closed with ffclose (see below)
77 extern void ffclose(FILE *fp
);
78 /* Close files or pipes */
80 #define fclose ffclose
82 extern void frewind(FILE *fp
);
83 /* Does not rewind pipes, but does so for normal files */
85 #define rewind frewind
87 bool is_pipe(FILE *fp
);
89 extern FILE *uncompress(char *fn
,char *mode
);
90 extern FILE *gunzip(char *fn
,char *mode
);
91 /* Open a pipe to uncompress or unzip files. Must be closed with pclose */
93 extern const char *libfn(const char *file
);
95 extern FILE *libopen(const char *file
);
96 /* Open a library file for reading. This looks in the current directory
97 * first, and then in the library directory. If the file is not found,
98 * it terminates with a fatal_error
101 extern bool get_libdir(char *libdir
);
103 extern const char *low_libfn(const char *file
,bool bFatal
);
105 extern FILE *low_libopen(const char *file
,bool bFatal
);
106 /* The same as the above, but does not terminate if (!bFatal) */
108 /* Create unique name for temp file (wrapper around mkstemp).
109 * Buf should be at least 7 bytes long
111 extern void gmx_tmpnam(char *buf
);
117 #endif /* _futil_h */