/* bibtexe.ext -- BibTeX Support Routines			-*- C -*-
   Time-stamp: "97/08/12 20:43:41 mik"

   Copyright (C) 1996, 97
	Christian Schenk  <cschenk@berlin.snafu.de>

   This file is part of MiKTeX.

   MiKTeX is free software; you can redistribute it and/or modify it
   under the terms of the GNU General Public License as published by
   the Free Software Foundation; either version 2, or (at your option)
   any later version.
   
   MiKTeX is distributed in the hope that it will be useful, but
   WITHOUT ANY WARRANTY; without even the implied warranty of
   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
   General Public License for more details.
   
   You should have received a copy of the GNU General Public License
   along with MiKTeX; if not, write to the Free Software Foundation,
   59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.  */

#include <stdlib.h>
#include <stdarg.h>
#include <signal.h>

#include "miktex.h"

#line 28 "bibtex.ext"

boolean
mtopeninputf (alphafile *f)

{
  char filenamebuf[_MAX_PATH];
  FILE *fp;
  if (strchr(nameoffile, '/') || strchr(nameoffile, '\\'))
    strcpy (filenamebuf, nameoffile);
  else
    {
      char buf[MAX_PATH];
      const char *path_list = get_search_path ("BibTeX", "Input Dirs",
					       buf, sizeof (buf), 0);
      if (path_list == 0
	  || ! find_file(nameoffile, path_list, filenamebuf))
	return (false);
    }
  fp = open_file (filenamebuf, c4prmode);
  if (fp)
    {
      f->_c4p_fp = fp;
      get (*f);
      return (true);
    }
  else
    return (false);
}
