Commit ad66d8ac authored by Karl Wette's avatar Karl Wette

Remove deprecated function LALOpenDataFile()

- replace with either fopen() (in tests) or LALFopen() (everywhere else)
  with mode "rb" (for SFTs) or "r" (everywhere else)
- in XLALFindFiles(), remove prefixing of relative file names with './'
  to avoid LAL_DATA_PATH look-up; this is no longer necessary
- no longer set LAL_DATA_PATH in environment scripts and pkg-config files,
  but do set LAL..._DATADIR in environment scripts to $(pkgdatadir)
- refs #1676
Original: 933fe1e25ccbb8c8549ad939888d45d0552abaed
parent b669edcb
...@@ -32,7 +32,7 @@ SUBDIRS = \ ...@@ -32,7 +32,7 @@ SUBDIRS = \
user_environment = \ user_environment = \
set $(PACKAGE)_PREFIX $(prefix); \ set $(PACKAGE)_PREFIX $(prefix); \
prepend LAL_DATA_PATH $(pkgdatadir); \ set $(PACKAGE)_DATADIR $(pkgdatadir); \
prepend MANPATH $(mandir); \ prepend MANPATH $(mandir); \
prepend OCTAVE_PATH $(octexecdir); \ prepend OCTAVE_PATH $(octexecdir); \
prepend PATH $(bindir); \ prepend PATH $(bindir); \
......
...@@ -3,7 +3,6 @@ exec_prefix=@exec_prefix@ ...@@ -3,7 +3,6 @@ exec_prefix=@exec_prefix@
libdir=@libdir@ libdir=@libdir@
includedir=@includedir@ includedir=@includedir@
datarootdir=@datarootdir@ datarootdir=@datarootdir@
LAL_DATA_PATH=@datadir@/@PACKAGE@
LAL_OCTAVE_PATH=@octexecdir@ LAL_OCTAVE_PATH=@octexecdir@
LAL_PYTHON_PATH=@pyexecdir@ LAL_PYTHON_PATH=@pyexecdir@
......
...@@ -3,7 +3,6 @@ exec_prefix=@exec_prefix@ ...@@ -3,7 +3,6 @@ exec_prefix=@exec_prefix@
libdir=@libdir@ libdir=@libdir@
includedir=@includedir@ includedir=@includedir@
datarootdir=@datarootdir@ datarootdir=@datarootdir@
LALSUPPORT_DATA_PATH=@datadir@/@PACKAGE@
LALSUPPORT_OCTAVE_PATH=@octexecdir@ LALSUPPORT_OCTAVE_PATH=@octexecdir@
LALSUPPORT_PYTHON_PATH=@pyexecdir@ LALSUPPORT_PYTHON_PATH=@pyexecdir@
......
...@@ -44,8 +44,6 @@ extern "C" { ...@@ -44,8 +44,6 @@ extern "C" {
*/ */
/*@{*/ /*@{*/
FILE *LALOpenDataFile( const char* );
typedef struct tagLALFILE LALFILE; typedef struct tagLALFILE LALFILE;
LALFILE *lalstdin(void); LALFILE *lalstdin(void);
......
...@@ -17,51 +17,6 @@ ...@@ -17,51 +17,6 @@
* MA 02111-1307 USA * MA 02111-1307 USA
*/ */
/**
* \addtogroup FileIO_h
*
* ### Obsolete LAL Prototypes ###
*
* \code
* FILE *LALFopen( const char *path, const char *mode );
* int LALFclose( FILE *stream );
* \endcode
*
* ### Description ###
*
* The routines <tt>LALFopen()</tt> and <tt>LALFclose()</tt> are macro defined to be
* the same as the standard C routines <tt>LALFopen()</tt> and <tt>fclose()</tt>. These
* should only be used in test programs.
*
* The routine <tt>LALOpenDataFile()</tt> is used to open a data file for reading.
* This routine is also to be used in test programs only. Unless the data file
* is specified with an absolute path (beginning with a <tt>/</tt>), or a specific
* path (beginning with a <tt>./</tt> or a <tt>../</tt>), the directory
* that the file is in is obtained from the environment variable
* \c LAL_DATA_PATH, which must be set at run-time. (If the environment
* variable is not set, the default path is <tt>.</tt> --- i.e., the current
* directory.)
*
* \c LAL_DATA_PATH should typically be set to
* <tt>/usr/local/share/lal</tt>, or wherever LAL data is installed in your system
* (which may be different if you used a <tt>--prefix</tt> argument when
* configuring LAL), but when the test suite is run with <tt>make check</tt>, the
* variable \c LAL_DATA_PATH is set to the current source directory. If the
* filename (including the directory path) is too long (more than 256
* characters), <tt>LALOpenDataFile()</tt> returns \c NULL and sets
* \c errno to \c ENAMETOOLONG.
*
* \c LAL_DATA_PATH can be any colon-delimeted list of directories, which
* are searched in order (just like the \c PATH environment variable).
* An extra colon inserts the default data directory
* (\f$\langle\f$prefix\f$\rangle\f$<tt>/share/lal</tt>) into the search path at that
* point. E.g., a leading/trailing colon will look for the default data
* directory at the start/end of the list of directories.
*
* It is strongly recommended that <tt>LALOpenDataFile()</tt> be used when writing test code.
*
*/
#include <config.h> #include <config.h>
#include <stdarg.h> #include <stdarg.h>
...@@ -109,120 +64,12 @@ LALFILE *lalstderr( void ) ...@@ -109,120 +64,12 @@ LALFILE *lalstderr( void )
return &_lalstderr; return &_lalstderr;
} }
#define STR( x ) #x
#define XSTR( x ) STR( x )
#define INFOMSG( msg, file ) ( ( lalDebugLevel & LALINFO ) ? \
LALPrintError( "Info: function LALOpenDataFile, file " __FILE__ ", line " \
XSTR( __LINE__ ) ", $Id$\n\t%s %s\n", msg, file ) : 0 )
#define ERRORMSG( file ) ( ( lalDebugLevel & LALERROR ) ? \
LALPrintError( "Info: function LALOpenDataFile, file " __FILE__ ", line " \
XSTR( __LINE__ ) ", $Id$\n\tCould not open data file %s\n", file ) : 0 )
#ifndef LAL_PREFIX
#define LAL_PREFIX "/usr/local"
#endif
FILE *
LALOpenDataFile( const char *fname )
{
FILE *fp;
const char *path;
char *datapath; /* locally allocated copy of env-var LAL_DATA_PATH */
const char *p0; /* pointer to current sub-path of datapath*/
char *p1; /* pointer to next sub-path */
char fdata[32768];
int n;
XLAL_PRINT_DEPRECATION_WARNING("XLALFileResolvePathLong");
if ( (fname==NULL) || ( strlen(fname)==0) ) {
return NULL;
}
if ( *fname == '/' ) /* absolute path is given */
{
fp = LALFopen( fname, "r" );
if ( ! fp )
ERRORMSG( fname );
else
INFOMSG( "Opening data file", fname );
return fp;
}
n = strlen( fname );
if ( *fname == '.' && n > 0 && ( fname[1] == '/' || ( n > 1 && fname[1] == '.'
&& fname[2] == '/' ) ) ) /* specific path is given */
{
fp = LALFopen( fname, "r" );
if ( ! fp )
ERRORMSG( fname );
else
INFOMSG( "Opening data file", fname );
return fp;
}
path = getenv( "LAL_DATA_PATH" );
if ( ! path || ! strlen( path ) ) /* path is NULL or empty */
{
fp = LALFopen( fname, "r" );
if ( ! fp )
ERRORMSG( fname );
else
INFOMSG( "Opening data file", fname );
return fp;
}
/* scan through all directories in colon-delmited list of directories */
if ( (datapath = LALCalloc (strlen(path)+1, 1)) == NULL) /* we need local copy */
{
ERRORMSG( fname );
return NULL;
}
strcpy (datapath, path);
p0 = datapath;
do {
p1 = strchr( p0, ':' ); /* look for additional directories */
if ( p1 ) /* there are more things in the list */
*p1++ = 0; /* NUL-terminate current directory */
if ( ! strlen( p0 ) ) /* this directory is empty */
p0 = LAL_PREFIX "/share/lal"; /* default data directory */
n = snprintf( fdata, sizeof(fdata), "%s/%s", p0 ? p0 : ".", fname );
if ( n > (int) sizeof( fdata ) ) /* data file name too long */
{
errno = ENAMETOOLONG;
LALFree (datapath);
return NULL;
}
INFOMSG( "Looking for file", fdata );
fp = LALFopen( fdata, "r" );
if ( fp ) /* we've found it! */
{
INFOMSG( "Opening data file", fdata );
LALFree (datapath);
return fp;
}
p0 = p1;
}
while ( p0 );
LALFree (datapath);
ERRORMSG( fname );
return NULL;
}
/** 'Resolve' a given filename 'fname', returning a file path where the /** 'Resolve' a given filename 'fname', returning a file path where the
* file can successfully be opened by fopen() using mode='rb'. * file can successfully be opened by fopen() using mode='rb'.
* *
* Return: successful file-path or NULL if failed. * Return: successful file-path or NULL if failed.
* *
* Resolving follows an algorithm similar to what LALOpenDataFile() did, * Resolving uses the following algorithm: if 'fname' contains a
* namely if 'fname' contains a
* i) (relative or absolute) path: only tries to open that path directly * i) (relative or absolute) path: only tries to open that path directly
* ii) pure filename: try 1) local dir, then 2) search LAL_DATA_PATH, then 3) try fallbackdir * ii) pure filename: try 1) local dir, then 2) search LAL_DATA_PATH, then 3) try fallbackdir
* return first successful hit * return first successful hit
......
...@@ -42,7 +42,7 @@ void FUNC ( LALStatus* status, ...@@ -42,7 +42,7 @@ void FUNC ( LALStatus* status,
/* if (filename == NULL) return; */ /* if (filename == NULL) return; */
fp = LALOpenDataFile( filename ); fp = LALFopen( filename, "r" );
if (fp == NULL) if (fp == NULL)
{ {
ABORT( status, READFTSERIESH_EFILENOTFOUND, ABORT( status, READFTSERIESH_EFILENOTFOUND,
......
...@@ -103,7 +103,7 @@ LALReadNoiseSpectrum(LALStatus *stat, REAL4FrequencySeries *spectrum, CHAR *fnam ...@@ -103,7 +103,7 @@ LALReadNoiseSpectrum(LALStatus *stat, REAL4FrequencySeries *spectrum, CHAR *fnam
ATTATCHSTATUSPTR(stat); ATTATCHSTATUSPTR(stat);
/* this is the file containing the spectrum data */ /* this is the file containing the spectrum data */
if ( !(fp = LALOpenDataFile( fname )) ) if ( !(fp = LALFopen( fname, "r" )) )
{ {
ABORT(stat, LALREADNOISESPECTRUMH_EOPEN, LALREADNOISESPECTRUMH_MSGEOPEN); ABORT(stat, LALREADNOISESPECTRUMH_EOPEN, LALREADNOISESPECTRUMH_MSGEOPEN);
} }
......
...@@ -44,7 +44,7 @@ FUNC ( LALStatus* status, ...@@ -44,7 +44,7 @@ FUNC ( LALStatus* status,
/* if (filename == NULL) return; */ /* if (filename == NULL) return; */
fp = LALOpenDataFile( filename ); fp = LALFopen( filename, "r" );
if (fp == NULL) if (fp == NULL)
{ {
ABORT( status, READFTSERIESH_EFILENOTFOUND, ABORT( status, READFTSERIESH_EFILENOTFOUND,
......
...@@ -382,7 +382,7 @@ main(int argc, char **argv) ...@@ -382,7 +382,7 @@ main(int argc, char **argv)
/* Open input and output files. */ /* Open input and output files. */
if ( strcmp( infile, "stdin" ) ) { if ( strcmp( infile, "stdin" ) ) {
if ( !( fpIn = LALOpenDataFile( infile ) ) ) { if ( !( fpIn = fopen( infile, "r" ) ) ) {
ERROR( STREAMINPUTTESTC_EFILE, "- " STREAMINPUTTESTC_MSGEFILE, ERROR( STREAMINPUTTESTC_EFILE, "- " STREAMINPUTTESTC_MSGEFILE,
infile ); infile );
return STREAMINPUTTESTC_EFILE; return STREAMINPUTTESTC_EFILE;
......
...@@ -192,7 +192,7 @@ main(int argc, char **argv) ...@@ -192,7 +192,7 @@ main(int argc, char **argv)
/* Open input and output files. */ /* Open input and output files. */
if ( strcmp( infile, "stdin" ) ) { if ( strcmp( infile, "stdin" ) ) {
if ( !( fpIn = LALOpenDataFile( infile ) ) ) { if ( !( fpIn = fopen( infile, "r" ) ) ) {
ERROR( STREAMSERIESINPUTTESTC_EFILE, "- " ERROR( STREAMSERIESINPUTTESTC_EFILE, "- "
STREAMSERIESINPUTTESTC_MSGEFILE, infile ); STREAMSERIESINPUTTESTC_MSGEFILE, infile );
return STREAMSERIESINPUTTESTC_EFILE; return STREAMSERIESINPUTTESTC_EFILE;
......
...@@ -29,7 +29,7 @@ SUBDIRS = \ ...@@ -29,7 +29,7 @@ SUBDIRS = \
user_environment = \ user_environment = \
set $(PACKAGE)_PREFIX $(prefix); \ set $(PACKAGE)_PREFIX $(prefix); \
prepend LAL_DATA_PATH $(pkgdatadir); \ set $(PACKAGE)_DATADIR $(pkgdatadir); \
prepend MANPATH $(mandir); \ prepend MANPATH $(mandir); \
prepend PATH $(bindir); \ prepend PATH $(bindir); \
prepend PYTHONPATH $(pyexecdir) $(pythondir); \ prepend PYTHONPATH $(pyexecdir) $(pythondir); \
......
...@@ -30,7 +30,7 @@ SUBDIRS = \ ...@@ -30,7 +30,7 @@ SUBDIRS = \
user_environment = \ user_environment = \
set $(PACKAGE)_PREFIX $(prefix); \ set $(PACKAGE)_PREFIX $(prefix); \
prepend LAL_DATA_PATH $(pkgdatadir); \ set $(PACKAGE)_DATADIR $(pkgdatadir); \
prepend MANPATH $(mandir); \ prepend MANPATH $(mandir); \
prepend OCTAVE_PATH $(octexecdir); \ prepend OCTAVE_PATH $(octexecdir); \
prepend PATH $(bindir); \ prepend PATH $(bindir); \
......
...@@ -3,7 +3,6 @@ exec_prefix=@exec_prefix@ ...@@ -3,7 +3,6 @@ exec_prefix=@exec_prefix@
libdir=@libdir@ libdir=@libdir@
includedir=@includedir@ includedir=@includedir@
datarootdir=@datarootdir@ datarootdir=@datarootdir@
LALBURST_DATA_PATH=@datadir@/@PACKAGE@
LALBURST_OCTAVE_PATH=@octexecdir@ LALBURST_OCTAVE_PATH=@octexecdir@
LALBURST_PYTHON_PATH=@pyexecdir@ LALBURST_PYTHON_PATH=@pyexecdir@
......
...@@ -29,7 +29,7 @@ SUBDIRS = \ ...@@ -29,7 +29,7 @@ SUBDIRS = \
user_environment = \ user_environment = \
set $(PACKAGE)_PREFIX $(prefix); \ set $(PACKAGE)_PREFIX $(prefix); \
prepend LAL_DATA_PATH $(pkgdatadir); \ set $(PACKAGE)_DATADIR $(pkgdatadir); \
prepend MANPATH $(mandir); \ prepend MANPATH $(mandir); \
prepend OCTAVE_PATH $(octexecdir); \ prepend OCTAVE_PATH $(octexecdir); \
prepend PATH $(bindir); \ prepend PATH $(bindir); \
......
...@@ -3,7 +3,6 @@ exec_prefix=@exec_prefix@ ...@@ -3,7 +3,6 @@ exec_prefix=@exec_prefix@
libdir=@libdir@ libdir=@libdir@
includedir=@includedir@ includedir=@includedir@
datarootdir=@datarootdir@ datarootdir=@datarootdir@
LALDETCHAR_DATA_PATH=@datadir@/@PACKAGE@
LALDETCHAR_OCTAVE_PATH=@octexecdir@ LALDETCHAR_OCTAVE_PATH=@octexecdir@
LADETCHARL_PYTHON_PATH=@pyexecdir@ LADETCHARL_PYTHON_PATH=@pyexecdir@
......
...@@ -29,7 +29,7 @@ SUBDIRS = \ ...@@ -29,7 +29,7 @@ SUBDIRS = \
user_environment = \ user_environment = \
set $(PACKAGE)_PREFIX $(prefix); \ set $(PACKAGE)_PREFIX $(prefix); \
prepend LAL_DATA_PATH $(pkgdatadir); \ set $(PACKAGE)_DATADIR $(pkgdatadir); \
prepend MANPATH $(mandir); \ prepend MANPATH $(mandir); \
prepend OCTAVE_PATH $(octexecdir); \ prepend OCTAVE_PATH $(octexecdir); \
prepend PATH $(bindir); \ prepend PATH $(bindir); \
......
...@@ -3,7 +3,6 @@ exec_prefix=@exec_prefix@ ...@@ -3,7 +3,6 @@ exec_prefix=@exec_prefix@
libdir=@libdir@ libdir=@libdir@
includedir=@includedir@ includedir=@includedir@
datarootdir=@datarootdir@ datarootdir=@datarootdir@
LALFRAME_DATA_PATH=@datadir@/@PACKAGE@
LALFRAME_OCTAVE_PATH=@octexecdir@ LALFRAME_OCTAVE_PATH=@octexecdir@
LALFRAME_PYTHON_PATH=@pyexecdir@ LALFRAME_PYTHON_PATH=@pyexecdir@
......
...@@ -29,7 +29,7 @@ SUBDIRS = \ ...@@ -29,7 +29,7 @@ SUBDIRS = \
user_environment = \ user_environment = \
set $(PACKAGE)_PREFIX $(prefix); \ set $(PACKAGE)_PREFIX $(prefix); \
prepend LAL_DATA_PATH $(pkgdatadir); \ set $(PACKAGE)_DATADIR $(pkgdatadir); \
prepend MANPATH $(mandir); \ prepend MANPATH $(mandir); \
prepend OCTAVE_PATH $(octexecdir); \ prepend OCTAVE_PATH $(octexecdir); \
prepend PATH $(bindir); \ prepend PATH $(bindir); \
......
...@@ -3,7 +3,6 @@ exec_prefix=@exec_prefix@ ...@@ -3,7 +3,6 @@ exec_prefix=@exec_prefix@
libdir=@libdir@ libdir=@libdir@
includedir=@includedir@ includedir=@includedir@
datarootdir=@datarootdir@ datarootdir=@datarootdir@
LALINFERENCE_DATA_PATH=@datadir@/@PACKAGE@
LALINFERENCE_OCTAVE_PATH=@octexecdir@ LALINFERENCE_OCTAVE_PATH=@octexecdir@
LALINFERENCE_PYTHON_PATH=@pyexecdir@ LALINFERENCE_PYTHON_PATH=@pyexecdir@
......
...@@ -30,7 +30,7 @@ SUBDIRS = \ ...@@ -30,7 +30,7 @@ SUBDIRS = \
user_environment = \ user_environment = \
set $(PACKAGE)_PREFIX $(prefix); \ set $(PACKAGE)_PREFIX $(prefix); \
prepend LAL_DATA_PATH $(pkgdatadir); \ set $(PACKAGE)_DATADIR $(pkgdatadir); \
prepend MANPATH $(mandir); \ prepend MANPATH $(mandir); \
prepend OCTAVE_PATH $(octexecdir); \ prepend OCTAVE_PATH $(octexecdir); \
prepend PATH $(bindir); \ prepend PATH $(bindir); \
......
...@@ -3,7 +3,6 @@ exec_prefix=@exec_prefix@ ...@@ -3,7 +3,6 @@ exec_prefix=@exec_prefix@
libdir=@libdir@ libdir=@libdir@
includedir=@includedir@ includedir=@includedir@
datarootdir=@datarootdir@ datarootdir=@datarootdir@
LALINSPIRAL_DATA_PATH=@datadir@/@PACKAGE@
LALINSPIRAL_OCTAVE_PATH=@octexecdir@ LALINSPIRAL_OCTAVE_PATH=@octexecdir@
LALINSPIRAL_PYTHON_PATH=@pyexecdir@ LALINSPIRAL_PYTHON_PATH=@pyexecdir@
......
...@@ -29,7 +29,7 @@ SUBDIRS = \ ...@@ -29,7 +29,7 @@ SUBDIRS = \
user_environment = \ user_environment = \
set $(PACKAGE)_PREFIX $(prefix); \ set $(PACKAGE)_PREFIX $(prefix); \
prepend LAL_DATA_PATH $(pkgdatadir); \ set $(PACKAGE)_DATADIR $(pkgdatadir); \
prepend MANPATH $(mandir); \ prepend MANPATH $(mandir); \
prepend OCTAVE_PATH $(octexecdir); \ prepend OCTAVE_PATH $(octexecdir); \
prepend PATH $(bindir); \ prepend PATH $(bindir); \
......
...@@ -3,7 +3,6 @@ exec_prefix=@exec_prefix@ ...@@ -3,7 +3,6 @@ exec_prefix=@exec_prefix@
libdir=@libdir@ libdir=@libdir@
includedir=@includedir@ includedir=@includedir@
datarootdir=@datarootdir@ datarootdir=@datarootdir@
LALMETAIO_DATA_PATH=@datadir@/@PACKAGE@
LALMETAIO_OCTAVE_PATH=@octexecdir@ LALMETAIO_OCTAVE_PATH=@octexecdir@
LALMETAIO_PYTHON_PATH=@pyexecdir@ LALMETAIO_PYTHON_PATH=@pyexecdir@
......
...@@ -30,7 +30,7 @@ SUBDIRS = \ ...@@ -30,7 +30,7 @@ SUBDIRS = \
user_environment = \ user_environment = \
set $(PACKAGE)_PREFIX $(prefix); \ set $(PACKAGE)_PREFIX $(prefix); \
prepend LAL_DATA_PATH $(pkgdatadir); \ set $(PACKAGE)_DATADIR $(pkgdatadir); \
prepend MANPATH $(mandir); \ prepend MANPATH $(mandir); \
prepend OCTAVE_PATH $(octexecdir); \ prepend OCTAVE_PATH $(octexecdir); \
prepend PATH $(bindir); \ prepend PATH $(bindir); \
......
...@@ -3,7 +3,6 @@ exec_prefix=@exec_prefix@ ...@@ -3,7 +3,6 @@ exec_prefix=@exec_prefix@
libdir=@libdir@ libdir=@libdir@
includedir=@includedir@ includedir=@includedir@
datarootdir=@datarootdir@ datarootdir=@datarootdir@
LALPULSAR_DATA_PATH=@datadir@/@PACKAGE@
LALPULSAR_OCTAVE_PATH=@octexecdir@ LALPULSAR_OCTAVE_PATH=@octexecdir@
LALPULSAR_PYTHON_PATH=@pyexecdir@ LALPULSAR_PYTHON_PATH=@pyexecdir@
......
...@@ -820,7 +820,7 @@ loadFullGridFile ( LALStatus *status, ...@@ -820,7 +820,7 @@ loadFullGridFile ( LALStatus *status,
} /* for s < max_spins */ } /* for s < max_spins */
/* open input data file */ /* open input data file */
if ( (fp = LALOpenDataFile (init->gridFile)) == NULL) { if ( (fp = LALFopen (init->gridFile, "r")) == NULL) {
XLALPrintError ("Could not open data-file: `%s`\n\n", init->gridFile); XLALPrintError ("Could not open data-file: `%s`\n\n", init->gridFile);
ABORT (status, CONFIGFILEH_EFILE, CONFIGFILEH_MSGEFILE); ABORT (status, CONFIGFILEH_EFILE, CONFIGFILEH_MSGEFILE);
} }
......
...@@ -922,7 +922,7 @@ LALReadSFTheader (LALStatus *status, /**< pointer to LALStatus structure */ ...@@ -922,7 +922,7 @@ LALReadSFTheader (LALStatus *status, /**< pointer to LALStatus structure */
ASSERT (fname, status, SFTFILEIO_ENULL, SFTFILEIO_MSGENULL); ASSERT (fname, status, SFTFILEIO_ENULL, SFTFILEIO_MSGENULL);
/* opening the SFT binary file */ /* opening the SFT binary file */
fp = LALOpenDataFile( fname ); fp = LALFopen( fname, "rb" );
if (fp == NULL) { if (fp == NULL) {
ABORT (status, SFTFILEIO_EFILE, SFTFILEIO_MSGEFILE); ABORT (status, SFTFILEIO_EFILE, SFTFILEIO_MSGEFILE);
} }
...@@ -1072,7 +1072,7 @@ LALReadSFTdata(LALStatus *status, /**< pointer to LALStatus structure */ ...@@ -1072,7 +1072,7 @@ LALReadSFTdata(LALStatus *status, /**< pointer to LALStatus structure */
offset = fminBinIndex - header.fminBinIndex; offset = fminBinIndex - header.fminBinIndex;
/* open file for reading */ /* open file for reading */
if ( (fp = LALOpenDataFile( fname )) == NULL) { if ( (fp = LALFopen( fname, "rb" )) == NULL) {
ABORT (status, SFTFILEIO_EFILE, SFTFILEIO_MSGEFILE); ABORT (status, SFTFILEIO_EFILE, SFTFILEIO_MSGEFILE);
} }
......
...@@ -48,6 +48,7 @@ ...@@ -48,6 +48,7 @@
#endif #endif
#include <lal/LALStdio.h> #include <lal/LALStdio.h>
#include <lal/LALString.h>
#include <lal/FileIO.h> #include <lal/FileIO.h>
#include <lal/SFTfileIO.h> #include <lal/SFTfileIO.h>
#include <lal/StringVector.h> #include <lal/StringVector.h>
...@@ -2482,17 +2483,10 @@ XLALFindFiles (const CHAR *globstring) ...@@ -2482,17 +2483,10 @@ XLALFindFiles (const CHAR *globstring)
LALParsedDataFile *list = NULL; LALParsedDataFile *list = NULL;
CHAR* listfname = NULL; CHAR* listfname = NULL;
/* create list file name /* extract list file name */
prefix with "./" if not an absolute file name (see LALOpenDataFile()) */ if ((listfname = XLALStringDuplicate(globstring + strlen(LIST_PREFIX))) == NULL) {
if ((listfname = LALCalloc(1, strlen(globstring) + 3)) == NULL) {
XLAL_ERROR_NULL ( XLAL_ENOMEM ) ; XLAL_ERROR_NULL ( XLAL_ENOMEM ) ;
} }
ptr1 = globstring + strlen(LIST_PREFIX);
if (*ptr1 == '/')
*listfname = '\0';
else
strcpy(listfname, "./");
strcat(listfname, ptr1);
#undef LIST_PREFIX #undef LIST_PREFIX
/* read list of file names from file */ /* read list of file names from file */
......