/**************************************************************************/
/*                                                                        */
/*                                 Sources                                */
/*                                from  the                               */
/*                           XSC SOFTWARE PACKAGE                         */
/*                                                                        */
/*                Copyright (c) 1997 University of Karlsruhe              */
/*                     Institute for Appl. Mathematics                    */
/*                                                                        */
/* This program is free software for non-commercial use. For details, see */
/* the file LICENSE.XSC, distributed with this software package.          */
/*                                                                        */
/* This program is distributed WITHOUT ANY WARRANTY. For details, see the */
/* file LICENSE.XSC, distributed with this software package.              */
/*                                                                        */
/**************************************************************************/

/* RCS $Id: f_exst.c,v 1.2 1997/09/25 17:19:03 ae59 Exp $ */
/*
$Log: f_exst.c,v $
 * Revision 1.2  1997/09/25  17:19:03  ae59
 * Copyright-message
 *
 * Revision 1.1  1994/01/27  13:22:25  ae59
 * Put under RCS control
 *
 */
/****************************************************************/
/*                                                              */
/*      Filename        : f_exst.c                              */
/*                                                              */
/*      Entry           : a_bool f_exst(name)                   */
/*                        a_char name[];                        */
/*                                                              */
/*      Arguments       : name   - filename                     */
/*                                                              */
/*      Function value  : TRUE if file exists                   */
/*                                                              */
/*      Description     : Test for existing file                */
/*                                                              */
/*      Date            : 1991-12-03                            */
/*      1991-12-03 : TRUE returned on empty string              */
/****************************************************************/

#ifndef ALL_IN_ONE
#ifdef AIX
#include "/u/p88c/runtime/o_defs.h"
#else
#include "o_defs.h"
#endif
#define local
#endif

#ifdef LINT_ARGS
local a_bool f_exst(a_char name[])
#else
local a_bool f_exst(name)

a_char name[];
#endif

        {
        FILE *fp;

        E_TPUSH("f_exst")

        if (name==NULL)
           {
           e_trap(I_O_ERROR,2,E_TMSG,62);
           E_TPOPP("f_exst")
           return(FALSE);
           }

        if (name[0]=='\0')
           {
           E_TPOPP("f_exst")
           return(TRUE);
           }

        if ((fp=fopen((char *)name,"r"))==NULL)
           {
           E_TPOPP("f_exst")
           return(FALSE);
           }

        fclose(fp);

        E_TPOPP("f_exst")
        return(TRUE);
        }

