diff --git a/Makefile b/Makefile index 4939168..7524ad2 100644 --- a/Makefile +++ b/Makefile @@ -28,7 +28,7 @@ OBJ=basic.o bind.o buffer.o crypt.o display.o eval.o exec.o \ termio.o window.o word.o names.o globals.o \ wrapper.o utf8.o -HDR=ebind.h edef.h efunc.h estruct.h version.h +HDR=ebind.h edef.h efunc.h estruct.h fileio.h version.h # DO NOT ADD OR MODIFY ANY LINES ABOVE THIS -- make source creates them @@ -139,7 +139,7 @@ display.o: display.c estruct.h edef.h utf8.h version.h eval.o: eval.c estruct.h edef.h version.h exec.o: exec.c estruct.h edef.h file.o: file.c estruct.h edef.h -fileio.o: fileio.c estruct.h edef.h +fileio.o: fileio.c fileio.h estruct.h edef.h ibmpc.o: ibmpc.c estruct.h edef.h input.o: input.c estruct.h edef.h isearch.o: isearch.c estruct.h edef.h diff --git a/efunc.h b/efunc.h index e24bbba..e5cdace 100644 --- a/efunc.h +++ b/efunc.h @@ -221,12 +221,7 @@ extern int filename(int f, int n); extern int ifile(char *fname); /* fileio.c */ -int ffropen( const char *fn) ; -extern int ffwopen(char *fn); -extern int ffclose(void); -extern int ffputline(char *buf, int nbuf); -extern int ffgetline(void); -extern int fexist(char *fname); +#include "fileio.h" /* exec.c */ extern int namedcmd(int f, int n); diff --git a/fileio.c b/fileio.c index eeadc05..0211c5f 100644 --- a/fileio.c +++ b/fileio.c @@ -1,3 +1,7 @@ +/* fileio.c -- implements fileio.h */ + +#include "fileio.h" + /* FILEIO.C * * The routines in this file read and write ASCII files from the disk. All of @@ -6,9 +10,9 @@ * modified by Petri Kutvonen */ -#include +#include #include "estruct.h" -#include "edef.h" +#include "edef.h" #include "efunc.h" static FILE *ffp; /* File pointer, all functions. */ @@ -19,7 +23,7 @@ static int eofflag; /* end-of-file flag */ */ int ffropen( const char *fn) { - if ((ffp = fopen(fn, "r")) == NULL) + if ((ffp = fopen(fn, "rt")) == NULL) return FIOFNF; eofflag = FALSE; return FIOSUC; @@ -29,7 +33,7 @@ int ffropen( const char *fn) * Open a file for writing. Return TRUE if all is well, and FALSE on error * (cannot create). */ -int ffwopen(char *fn) +int ffwopen( const char *fn) { #if VMS int fd; @@ -205,7 +209,7 @@ int ffgetline(void) * * char *fname; file to check for existance */ -int fexist(char *fname) +int fexist( const char *fname) { FILE *fp; diff --git a/fileio.h b/fileio.h new file mode 100644 index 0000000..d27008e --- /dev/null +++ b/fileio.h @@ -0,0 +1,11 @@ +#ifndef _FILEIO_H_ +#define _FILEIO_H_ + +int fexist( const char *fname) ; +int ffclose( void) ; +int ffgetline( void) ; +int ffputline( char *buf, int nbuf) ; +int ffropen( const char *fn) ; +int ffwopen( const char *fn) ; + +#endif