/* $Id: c,v.dio-open 7.2 1998/09/01 19:51:53 stoklund Exp $ */
/* dio-open.c: Opening dio files.

   Copyright (C) 1998 Jakob Stoklund Olesen

   This library is free software; you can redistribute it and / or
   modify it under the terms of the GNU Library General Public
   License as published by the Free Software Foundation; either
   version 2 of the License, or (at your option) any later version.

   This library 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
   Library General Public License for more details.

   You should have received a copy of the GNU Library General Public
   License along with this library; if not ,write to the Free Software
   Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111 -
   1307, USA. */

#include "config.h"
#include "kpathsea:tex-file.h"
#include "kpathsea:riscos/direct-io.h"

/* File opening functions defined in texmfmp.c */
typedef void *(*openin_func) (const char *name);
boolean generic_open_input (void **, kpse_file_format_type, openin_func);

typedef void *(*openout_func) (const char *name, int filetype);
boolean generic_open_output (void **, int, openout_func);

/* Open a dio file for input */
boolean
open_input_dio (dio_handle * f_ptr, kpse_file_format_type filefmt)
{
  return generic_open_input ((void **) f_ptr, filefmt,
			     (openin_func) dio_openin);
}

/* Openout a dio file */
boolean
open_output_dio (dio_handle * f_ptr, int filetype)
{
  return generic_open_output ((void **) f_ptr, filetype,
			      (openout_func) dio_openout);
}

void
dioclose (dio_handle f)
{
  if (!f)
    return;

  if (dio_close (f) == EOF)
    perror ("dio_close");
}
