use constant strings for pathnames.

This commit is contained in:
Renaud 2013-05-17 16:54:02 +08:00
parent 13f4a7cefd
commit 4958b7d2af
5 changed files with 11 additions and 10 deletions

9
bind.c
View File

@ -474,7 +474,7 @@ int startup(char *sfname)
* char *fname; base file name to search for
* int hflag; Look in the HOME environment variable first?
*/
char *flook(char *fname, int hflag)
char *flook( const char *fname, int hflag)
{
char *home; /* path to home directory */
char *path; /* environmental PATH variable */
@ -502,9 +502,10 @@ char *flook(char *fname, int hflag)
#endif
/* always try the current directory first */
if (ffropen(fname) == FIOSUC) {
ffclose();
return fname;
strcpy( fspec, fname) ;
if( ffropen( fspec) == FIOSUC) {
ffclose() ;
return fspec ;
}
#if ENVFUNC
/* get the PATH variable */

View File

@ -180,7 +180,7 @@ extern int buildlist(int type, char *mstring);
extern int strinc(char *source, char *sub);
extern unsigned int getckey(int mflag);
extern int startup(char *sfname);
extern char *flook(char *fname, int hflag);
char *flook( const char *fname, int hflag) ;
extern void cmdstr(int c, char *seq);
extern fn_t getbind(int c);
extern char *getfname(fn_t);
@ -221,7 +221,7 @@ extern int filename(int f, int n);
extern int ifile(char *fname);
/* fileio.c */
extern int ffropen(char *fn);
int ffropen( const char *fn) ;
extern int ffwopen(char *fn);
extern int ffclose(void);
extern int ffputline(char *buf, int nbuf);

View File

@ -9,7 +9,7 @@
#define EPATH_H_
/* possible names and paths of help files under different OSs */
static char *pathname[] =
static const char *pathname[] =
#if MSDOS
{
"emacs.rc",

View File

@ -17,7 +17,7 @@ static int eofflag; /* end-of-file flag */
/*
* Open a file for reading.
*/
int ffropen(char *fn)
int ffropen( const char *fn)
{
if ((ffp = fopen(fn, "r")) == NULL)
return FIOFNF;

View File

@ -1,4 +1,4 @@
/* spaw.c
/* spawn.c
*
* Various operating system access commands.
*
@ -571,7 +571,7 @@ int execprog(char *cmd)
char *fcb1; /* 4 byte pointer to FCB at PSP+5Ch */
char *fcb2; /* 4 byte pointer to FCB at PSP+6Ch */
} pblock;
char *flook();
char *flook( const char *fname, int hflag) ;
/* parse the command name from the command line */
sp = prog;