/************************************************************************/
/* Copyright 2003-2013 MBARI						*/
/************************************************************************/
/* Summary  : Definitions for File I/O Utilities for BEDS		*/
/* Filename : fileUtils.h                                               */
/* Author   : Robert Herlien (rah)					*/
/* Project  : Benthic Event Detection System (BEDS)			*/
/* Revision : 1.0							*/
/* Created  : 02/25/2013 from Oasis4 file.h				*/
/*									*/
/* MBARI provides this documentation and code "as is", with no warranty,    */
/* express or implied, of its quality or consistency. It is provided without*/
/* support and without obligation on the part of the Monterey Bay Aquarium  */
/* Research Institute to assist in its use, correction, modification, or    */
/* enhancement. This information should not be published or distributed to  */
/* third parties without specific written permission from MBARI.            */
/*									*/
/************************************************************************/
/* Modification History:						*/
/* 25feb2013 rah - created from Oasis4 file.h				*/
/************************************************************************/

#ifndef INCfileUtilsh
#define INCfileUtilsh	1

#include <file.h>

typedef short	dsdfunc(short, ulong, void *, short);
typedef dsdfunc	*dsdfp;

#define FILEPATH	"C:\\"

#define BACKUP_FILES		5

typedef struct
{
    Nat32	entries;
    IdxRcd	index[0];
} IndexStruct;


/****************************************/
/* Function Declarations		*/
/****************************************/

MBool	dirScan(char *matchStr, MBool (*func)(struct dirent *, void *), void *parm);
MBool	getNextRec(FILE *fp, FileRcdType rtype, RcdUnion *recp);
MBool	getAnyRec(FILE *fp, RcdUnion *recp);
void	more(int numLines, MBool (*displayFunc)(), void *parm);
char	*MoreCmd(CmdInfoPtr cip);
char	*TailCmd(CmdInfoPtr cip);
void	backupFile(const char *fileName, const char *backupName);
MBool	trueFunc(void);
MBool	magnitudeFunc(IdxRcd *idx1, IdxRcd *idx2);
IndexStruct *createSortedIndex(char *fname, MBool (*compareFunc)());
char	*deleteLine(CmdInfoPtr cip);
char	*deleteChars(CmdInfoPtr cip);
char	*insertLine(CmdInfoPtr cip);
char	*insertChars(CmdInfoPtr cip);

#endif /* INCfileUtilsh */
