/* File I/O functions
   Rick Smereka, Copyright (C) 1995-2002.

   This program 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 of the License, or
   (at your option) any later version.

   This program 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 this program; if not, get a copy via the Internet at
   http://gnu.org/copyleft/gpl.html or write to the Free Software
   Foundation, Inc., 59 Temple Place, Suite 330, Boston,
   MA 02111-1307 USA

   You can contact the author via email at rsmereka@future-lab.com

   Original DOS version Jan/95, Rick Smereka

   Added extra parameter to the 'unique' function to accomidate
   a directory. Dec/97, Rick Smereka

   Port to QNX V4.23a Mar/98, Rick Smereka

   Added detection of C++ compiler with instructions not to
   mangle the function names. Nov/98, Rick Smereka

   Ported to 32bit Windows under CodeWarrior.
   Dec/98, Rick Smereka

   Ported to HP-UX under GNU C 2.8.1.
   Jan/99, Rick Smereka

   Ported to Red Hat Linux 5.2, Jul/99, Rick Smereka

   Enabled the 'isdirectory' function prototype for all
   platforms. Feb/2001, Rick Smereka

   Ported to Debian Linux. Nov/2002, Rick Smereka

   Added function prototypes 'write_dos_line' and 'write_unix_line'.
   Dec/2002, Rick Smereka */

#define BUFSIZE 1024                /* line buffer size */

#ifdef __cplusplus
extern "C"
{
#endif

int unique(char *, char *);         /* create a unique file name */
int exist(char *);                  /* check for file existence */
int numrecs(FILE *);                /* count record in a file */
void get_nrec(int,FILE *,char *);   /* read nth record from file */
void get_rec(FILE *,char *);        /* read a record */
int zcreate(char *);                /* create a zero-byte file */
int filecopy(char *, char *);       /* copy a file */
int qrename(char *, char *);        /* rename a file anywhere */
int isdirectory(char *);            /* check for directory name */
int write_dos_line(FILE *, char *); /* write text line with cr/lf */
int write_unix_line(FILE *, char *); /* write text line with lf */


/* the 'getdirentry' function is specific to Unix
   but does not seem to be part of Red Hat Linux */

#ifdef OS_UNIX
#ifndef OS_UNIX_REDHAT_LINUX
   int getdirentry(DIR *, char *, struct stat *);  /* get next dir entry */
#endif
#endif

/* the 'pexist' function is specific to DOS */

#ifdef OS_DOS
int pexist(char *);
#endif

#ifdef __cplusplus
}
#endif

