3 * This source code is part of
7 * GROningen MAchine for Chemical Simulations
10 * Written by David van der Spoel, Erik Lindahl, Berk Hess, and others.
11 * Copyright (c) 1991-2000, University of Groningen, The Netherlands.
12 * Copyright (c) 2001-2004, The GROMACS development team,
13 * check out http://www.gromacs.org for more information.
15 * This program is free software; you can redistribute it and/or
16 * modify it under the terms of the GNU General Public License
17 * as published by the Free Software Foundation; either version 2
18 * of the License, or (at your option) any later version.
20 * If you want to redistribute modifications, please consider that
21 * scientific software is very special. Version control is crucial -
22 * bugs must be traceable. We will be happy to consider code for
23 * inclusion in the official distribution, but derived work must not
24 * be called official GROMACS. Details are found in the README & COPYING
25 * files - if they are missing, get the official version at www.gromacs.org.
27 * To help us fund GROMACS development, we humbly ask that you cite
28 * the papers on the package - you can find them in the top README file.
30 * For more info, check our website at http://www.gromacs.org
33 * Gromacs Runs On Most of All Computer Systems
50 /* Native windows uses backslash path separators.
51 * Cygwin and everybody else in the world use slash.
52 * When reading the PATH environment variable, Unix separates entries
53 * with colon, while windows uses semicolon.
55 #if ((defined WIN32 || defined _WIN32 || defined WIN64 || defined _WIN64) && !defined __CYGWIN__ && !defined __CYGWIN32__)
56 #define DIR_SEPARATOR '\\'
57 #define PATH_SEPARATOR ";"
59 #define DIR_SEPARATOR '/'
60 #define PATH_SEPARATOR ":"
64 /* Now get the maximum path size. */
66 #define GMX_PATH_MAX PATH_MAX
69 #define GMX_PATH_MAX MAX_PATH
71 #define GMX_PATH_MAX 4096
76 extern void no_buffers(void);
77 /* Turn off buffering of files (which is default) for debugging purposes */
79 extern bool gmx_fexist(const char *fname
);
80 /* Return TRUE when fname exists, FALSE otherwise */
82 bool gmx_fexist_master(const char *fname
, t_commrec
*cr
);
83 /* Return TRUE when fname exists, FALSE otherwise, bcast from master to others */
85 extern bool gmx_eof(FILE *fp
);
86 /* Return TRUE on end-of-file, FALSE otherwise */
88 extern bool is_pipe(FILE *fp
);
89 /* Check whether the file (opened by ffopen) is a pipe */
91 extern char *backup_fn(const char *file
);
92 /* Return a backup name for file (name with # before and after) */
94 /* Make a backup of file if necessary.
95 Return false if there was a problem.
97 extern bool make_backup(const char * file
);
99 extern FILE *ffopen(const char *file
, const char *mode
);
100 /* Return a valid file pointer when succesfull, exits otherwise
101 * If the file is in compressed format, open a pipe which uncompresses
102 * the file! Therefore, files must be closed with ffclose (see below)
105 extern int ffclose(FILE *fp
);
106 /* Close files or pipes */
109 extern void frewind(FILE *fp
);
110 /* Does not rewind pipes, but does so for normal files */
112 #define rewind frewind
114 bool is_pipe(FILE *fp
);
116 extern char *gmxlibfn(const char *file
);
117 /* allocates and returns a string with the full file name for a library file */
119 extern FILE *libopen(const char *file
);
120 /* Open a library file for reading. This looks in the current directory
121 * first, and then in the library directory. If the file is not found,
122 * it terminates with a fatal_error
125 extern bool get_libdir(char *libdir
);
127 extern char *low_gmxlibfn(const char *file
,bool bFatal
);
129 extern FILE *low_libopen(const char *file
,bool bFatal
);
130 /* The same as the above, but does not terminate if (!bFatal) */
132 /* Create unique name for temp file (wrapper around mkstemp).
133 * Buf should be at least 7 bytes long
135 extern void gmx_tmpnam(char *buf
);
138 gmx_truncatefile(char *path
, off_t length
);
144 #endif /* _futil_h */