sh: Fix duplicate prototypes for builtins.

Have mkbuiltins write the prototypes for the *cmd functions to builtins.h
instead of builtins.c and include builtins.h in more .c files instead of
duplicating prototypes for *cmd functions in other headers.
This commit is contained in:
Jilles Tjoelker 2011-06-13 21:03:27 +00:00
parent 8a8a3387fd
commit 454a02b372
Notes: svn2git 2020-12-20 02:59:44 +00:00
svn path=/head/; revision=223060
23 changed files with 14 additions and 41 deletions

View File

@ -46,6 +46,7 @@ __FBSDID("$FreeBSD$");
#include "mystring.h"
#include "alias.h"
#include "options.h" /* XXX for argptr (should remove?) */
#include "builtins.h"
#define ATABSIZE 39

View File

@ -43,5 +43,3 @@ struct alias {
};
struct alias *lookupalias(const char *, int);
int aliascmd(int, char **);
int unaliascmd(int, char **);

View File

@ -36,4 +36,3 @@
arith_t arith(const char *);
void arith_lex_reset(void);
int expcmd(int, char **);

View File

@ -43,6 +43,7 @@
#include "../mystring.h"
#ifdef SHELL
#include "../output.h"
#include "builtins.h"
#define FILE struct output
#undef stdout
#define stdout out1
@ -75,7 +76,4 @@ pointer stalloc(int);
void error(const char *, ...) __printf0like(1, 2);
pid_t getjobpgrp(char *);
int echocmd(int, char **);
int testcmd(int, char **);
extern char *commandname;

View File

@ -63,6 +63,7 @@ __FBSDID("$FreeBSD$");
#include "mystring.h"
#include "show.h"
#include "cd.h"
#include "builtins.h"
static int cdlogical(char *);
static int cdphysical(char *);

View File

@ -30,5 +30,3 @@
*/
void pwd_init(int);
int cdcmd (int, char **);
int pwdcmd(int, char **);

View File

@ -51,19 +51,10 @@ struct backcmd { /* result of evalbackcmd */
#define EV_TESTED 02 /* exit status is checked; ignore -e flag */
#define EV_BACKCMD 04 /* command executing within back quotes */
int evalcmd(int, char **);
void evalstring(char *, int);
union node; /* BLETCH for ansi C */
void evaltree(union node *, int);
void evalbackcmd(union node *, struct backcmd *);
int bltincmd(int, char **);
int breakcmd(int, char **);
int returncmd(int, char **);
int falsecmd(int, char **);
int truecmd(int, char **);
int execcmd(int, char **);
int timescmd(int, char **);
int commandcmd(int, char **);
/* in_function returns nonzero if we are currently evaluating a function */
#define in_function() funcnest

View File

@ -66,7 +66,6 @@ extern int exerrno; /* last exec error */
void shellexec(char **, char **, const char *, int) __dead2;
char *padvance(const char **, const char *);
int hashcmd(int, char **);
void find_command(const char *, struct cmdentry *, int, const char *);
int find_builtin(const char *, int *);
void hashcd(void);
@ -75,5 +74,4 @@ void addcmdentry(const char *, struct cmdentry *);
void defun(const char *, union node *);
int unsetfunc(const char *);
int typecmd_impl(int, char **, int, const char *);
int typecmd(int, char **);
void clearcmdentry(void);

View File

@ -76,6 +76,7 @@ __FBSDID("$FreeBSD$");
#include "mystring.h"
#include "arith.h"
#include "show.h"
#include "builtins.h"
/*
* Structure specifying which parts of the string should be searched

View File

@ -63,4 +63,3 @@ void expari(int);
int patmatch(const char *, const char *, int);
void rmescapes(char *);
int casematch(union node *, const char *);
int wordexpcmd(int, char **);

View File

@ -59,6 +59,7 @@ __FBSDID("$FreeBSD$");
#include "error.h"
#include "eval.h"
#include "memalloc.h"
#include "builtins.h"
#define MAXHISTLOOPS 4 /* max recursions through fc */
#define DEFEDITOR "ed" /* default editor *should* be $EDITOR */

View File

@ -71,6 +71,7 @@ __FBSDID("$FreeBSD$");
#include "error.h"
#include "mystring.h"
#include "var.h"
#include "builtins.h"
static struct job *jobtab; /* array of jobs */

View File

@ -88,12 +88,7 @@ extern int in_dowait; /* are we in dowait()? */
extern volatile sig_atomic_t breakwaitcmd; /* break wait to process traps? */
void setjobctl(int);
int fgcmd(int, char **);
int bgcmd(int, char **);
int jobscmd(int, char **);
void showjobs(int, int);
int waitcmd(int, char **);
int jobidcmd(int, char **);
struct job *makejob(union node *, int);
pid_t forkshell(struct job *, union node *, int);
int waitforjob(struct job *, int *);

View File

@ -72,6 +72,7 @@ __FBSDID("$FreeBSD$");
#include "mystring.h"
#include "exec.h"
#include "cd.h"
#include "builtins.h"
int rootpid;
int rootshell;

View File

@ -39,5 +39,3 @@ extern struct jmploc main_handler; /* top level exception handler */
void readcmdfile(const char *);
void cmdloop(int);
int dotcmd(int, char **);
int exitcmd(int, char **);

View File

@ -58,9 +58,7 @@ cat <<\!
!
awk '/^[^#]/ {if(('$havejobs' || $2 != "-j") && ('$havehist' || $2 != "-h")) \
print $0}' builtins.def | sed 's/-[hj]//' > $temp
awk '{ printf "int %s(int, char **);\n", $1}' $temp
echo '
int (*const builtinfunc[])(int, char **) = {'
echo 'int (*const builtinfunc[])(int, char **) = {'
awk '/^[^#]/ { printf "\t%s,\n", $1}' $temp
echo '};
@ -94,5 +92,7 @@ struct builtincmd {
};
extern int (*const builtinfunc[])(int, char **);
extern const struct builtincmd builtincmd[];'
extern const struct builtincmd builtincmd[];
'
awk '{ printf "int %s(int, char **);\n", $1}' $temp
rm -f $temp

View File

@ -39,8 +39,6 @@ extern int displayhist;
void histedit(void);
void sethistsize(const char *);
void setterm(const char *);
int histcmd(int, char **);
int not_fcnumber(const char *);
int str_to_event(const char *, int);
int bindcmd(int, char **);

View File

@ -56,6 +56,7 @@ __FBSDID("$FreeBSD$");
#include "memalloc.h"
#include "error.h"
#include "mystring.h"
#include "builtins.h"
#ifndef NO_HISTORY
#include "myhistedit.h"
#endif

View File

@ -108,8 +108,5 @@ void procargs(int, char **);
void optschanged(void);
void setparam(char **);
void freeparam(struct shparam *);
int shiftcmd(int, char **);
int setcmd(int, char **);
int getoptscmd(int, char **);
int nextopt(const char *);
void getoptsreset(const char *);

View File

@ -55,6 +55,7 @@ __FBSDID("$FreeBSD$");
#include "error.h"
#include "trap.h"
#include "mystring.h"
#include "builtins.h"
#include "myhistedit.h"

View File

@ -37,7 +37,6 @@ extern int pendingsigs;
extern int in_dotrap;
extern volatile sig_atomic_t gotwinch;
int trapcmd(int, char **);
void clear_traps(void);
int have_traps(void);
void setsignal(int);

View File

@ -63,6 +63,7 @@ __FBSDID("$FreeBSD$");
#include "error.h"
#include "mystring.h"
#include "parser.h"
#include "builtins.h"
#ifndef NO_HISTORY
#include "myhistedit.h"
#endif

View File

@ -123,11 +123,7 @@ void updatecharset(void);
void initcharset(void);
char **environment(void);
int showvarscmd(int, char **);
int exportcmd(int, char **);
int localcmd(int, char **);
void mklocal(char *);
void poplocalvars(void);
int setvarcmd(int, char **);
int unsetcmd(int, char **);
int unsetvar(const char *);
int setvarsafe(const char *, const char *, int);