Review startup and associated prototypes.

This commit is contained in:
Renaud 2015-01-16 21:12:27 +08:00
parent 5fda2735a5
commit f60e3fbc9f
4 changed files with 11 additions and 19 deletions

23
bind.c
View File

@ -459,24 +459,17 @@ unsigned int getckey(int mflag)
/*
* execute the startup file
*
* char *sfname; name of startup file (null if default)
* char *fname; name of startup file (null if default)
*/
int startup(char *sfname)
{
char *fname; /* resulting file name to execute */
int startup( const char *fname) {
if( !fname || *fname == 0) /* use default if empty parameter */
fname = rcfname ;
/* look up the startup file */
if (*sfname != 0)
fname = flook(sfname, TRUE);
else
fname = flook( rcfname, TRUE);
fname = flook( fname, TRUE) ; /* look up the startup file */
if( fname == NULL) /* if it isn't around, don't sweat it */
return TRUE ;
/* if it isn't around, don't sweat it */
if (fname == NULL)
return TRUE;
/* otherwise, execute the sucker */
return dofile(fname);
return dofile( fname) ; /* otherwise, execute the sucker */
}
/*

2
bind.h
View File

@ -19,7 +19,7 @@ int unbindchar( int c) ;
int desbind( int f, int n) ;
int buildlist( int type, char *mstring) ;
unsigned int getckey( int mflag) ;
int startup( char *sfname) ;
int startup( const char *fname) ;
void cmdstr( int c, char *seq) ;
fn_t getbind( int c) ;
fn_t fncmatch( char *) ;

3
exec.c
View File

@ -924,8 +924,7 @@ int execfile(int f, int n)
*
* char *fname; file name to execute
*/
int dofile(char *fname)
{
int dofile( const char *fname) {
struct buffer *bp; /* buffer to place file to exeute */
struct buffer *cb; /* temp to hold current buf while we read */
int status; /* results of various calls */

2
exec.h
View File

@ -25,7 +25,7 @@ int nextarg( const char *prompt, char *buffer, int size, int terminator) ;
int storemac( int f, int n) ;
int execbuf( int f, int n) ;
int execfile( int f, int n) ;
int dofile( char *fname) ;
int dofile( const char *fname) ;
int cbuf1( int f, int n) ;
int cbuf2( int f, int n) ;