#ifndef _MY_H_
#define _MY_H_

/* PURPOSE:
 *    MY.H: Public interface to the my_ set of functions.
 * HISTORY:
 *    Ian D. Allen   idallen@freenet.carleton.ca
 */

#include <stdio.h>
#include "misc.h"
#include "buffer.h"

/* Modes for opening a file using my_open().
 * The MY__END__ mode isn't used; it's just there as a place holder
 * for silly compilers that don't want trailing commas inside enums.
 */
typedef enum MyOpenMode {
	MY_READONLY,	/* open for reading */
	MY_WRITE,	/* open for overwriting */
	MY_APPEND,	/* open for appending */
	MY__END__	/* compiler syntax: dummy entry without comma */
} MyOpenMode;

	FILE *
my_open(        /* RET: ptr to open file stream or NULL */
	Buffer *fbuf,        /* IN/OUT: file name to open (may be empty) */
	char *prompt,        /* IN: NULL or prompt to use if stdin is a tty */
	MyOpenMode mode,     /* IN: mode to open file: read/write/append */
	Boolean stripwhite   /* IN: TRUE: strip leading and trailing whtsp */
);

	void
my_close(
	FILE *fd,	/* IN: file descriptor to close */
	char *fbuf	/* IN: file name associated with fd */
);

	void
my_prompt(
	FILE *fd,	/* IN: from where to read input */
	char *prompt,	/* IN: prompt string to issue, if a tty */
	Buffer *lbuf	/* IN/OUT: where to put the input */
);

#endif /* _MY_H_ */
