1
0
mirror of https://github.com/rfivet/uemacs.git synced 2024-12-18 15:26:23 -05:00

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 * char *fname; base file name to search for
* int hflag; Look in the HOME environment variable first? * 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 *home; /* path to home directory */
char *path; /* environmental PATH variable */ char *path; /* environmental PATH variable */
@ -502,9 +502,10 @@ char *flook(char *fname, int hflag)
#endif #endif
/* always try the current directory first */ /* always try the current directory first */
if (ffropen(fname) == FIOSUC) { strcpy( fspec, fname) ;
ffclose(); if( ffropen( fspec) == FIOSUC) {
return fname; ffclose() ;
return fspec ;
} }
#if ENVFUNC #if ENVFUNC
/* get the PATH variable */ /* 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 int strinc(char *source, char *sub);
extern unsigned int getckey(int mflag); extern unsigned int getckey(int mflag);
extern int startup(char *sfname); 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 void cmdstr(int c, char *seq);
extern fn_t getbind(int c); extern fn_t getbind(int c);
extern char *getfname(fn_t); extern char *getfname(fn_t);
@ -221,7 +221,7 @@ extern int filename(int f, int n);
extern int ifile(char *fname); extern int ifile(char *fname);
/* fileio.c */ /* fileio.c */
extern int ffropen(char *fn); int ffropen( const char *fn) ;
extern int ffwopen(char *fn); extern int ffwopen(char *fn);
extern int ffclose(void); extern int ffclose(void);
extern int ffputline(char *buf, int nbuf); extern int ffputline(char *buf, int nbuf);

View File

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

View File

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

View File

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