* SUCH DAMAGE.
*
* @(#)alias.c 8.3 (Berkeley) 5/4/95
- * $FreeBSD: src/bin/sh/alias.c,v 1.31 2011/06/04 15:05:52 jilles Exp $
+ * $FreeBSD: src/bin/sh/alias.c,v 1.32 2011/06/13 21:03:27 jilles Exp $
*/
#include <stdlib.h>
#include "mystring.h"
#include "alias.h"
#include "options.h" /* XXX for argptr (should remove?) */
+#include "builtins.h"
#define ATABSIZE 39
* SUCH DAMAGE.
*
* @(#)alias.h 8.2 (Berkeley) 5/4/95
- * $FreeBSD: src/bin/sh/alias.h,v 1.10 2011/02/04 22:47:55 jilles Exp $
+ * $FreeBSD: src/bin/sh/alias.h,v 1.11 2011/06/13 21:03:27 jilles Exp $
*/
#define ALIASINUSE 1
};
struct alias *lookupalias(const char *, int);
-int aliascmd(int, char **);
-int unaliascmd(int, char **);
* SUCH DAMAGE.
*
* @(#)arith.h 1.1 (Berkeley) 5/4/95
- * $FreeBSD: src/bin/sh/arith.h,v 1.14 2011/02/08 23:18:06 jilles Exp $
+ * $FreeBSD: src/bin/sh/arith.h,v 1.15 2011/06/13 21:03:27 jilles Exp $
*/
#include "shell.h"
arith_t arith(const char *);
void arith_lex_reset(void);
-int letcmd(int, char **);
#include <stdio.h>
#include "arith.h"
#include "arith_yacc.h"
+#include "builtins.h"
#include "expand.h"
#include "shell.h"
#include "error.h"
* SUCH DAMAGE.
*
* @(#)bltin.h 8.2 (Berkeley) 5/4/95
- * $FreeBSD: src/bin/sh/bltin/bltin.h,v 1.18 2010/12/21 22:47:34 jilles Exp $
+ * $FreeBSD: src/bin/sh/bltin/bltin.h,v 1.19 2011/06/13 21:03:27 jilles Exp $
*/
/*
#include "../mystring.h"
#ifdef SHELL
#include "../output.h"
+#include "builtins.h"
#define FILE struct output
#undef stdout
#define stdout out1
#define warnx warning
#define warn(fmt, ...) warning(fmt ": %s", __VA_ARGS__, strerror(errno))
#define errx(exitstatus, ...) error(__VA_ARGS__)
-
-int main(int, char *[]);
-
#else
#undef NULL
#include <stdio.h>
pid_t getjobpgrp(char *);
-
extern char *commandname;
* SUCH DAMAGE.
*
* @(#)cd.c 8.2 (Berkeley) 5/4/95
- * $FreeBSD: src/bin/sh/cd.c,v 1.48 2011/05/27 20:01:46 jilles Exp $
+ * $FreeBSD: src/bin/sh/cd.c,v 1.49 2011/06/13 21:03:27 jilles Exp $
*/
#include <sys/types.h>
#include "mystring.h"
#include "show.h"
#include "cd.h"
+#include "builtins.h"
static int cdlogical(char *);
static int cdphysical(char *);
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*
- * $FreeBSD: src/bin/sh/cd.h,v 1.8 2010/04/17 14:35:46 jilles Exp $
+ * $FreeBSD: src/bin/sh/cd.h,v 1.9 2011/06/13 21:03:27 jilles Exp $
*/
void pwd_init(int);
-int cdcmd (int, char **);
-int pwdcmd(int, char **);
* SUCH DAMAGE.
*
* @(#)eval.h 8.2 (Berkeley) 5/4/95
- * $FreeBSD: src/bin/sh/eval.h,v 1.14 2009/12/27 18:04:05 jilles Exp $
+ * $FreeBSD: src/bin/sh/eval.h,v 1.15 2011/06/13 21:03:27 jilles Exp $
*/
extern const char *commandname; /* currently executing command */
#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
* SUCH DAMAGE.
*
* @(#)exec.h 8.3 (Berkeley) 6/8/95
- * $FreeBSD: src/bin/sh/exec.h,v 1.22 2011/02/05 14:08:51 jilles Exp $
+ * $FreeBSD: src/bin/sh/exec.h,v 1.23 2011/06/13 21:03:27 jilles Exp $
*/
/* values of cmdtype */
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);
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);
* SUCH DAMAGE.
*
* @(#)expand.c 8.5 (Berkeley) 5/15/95
- * $FreeBSD: src/bin/sh/expand.c,v 1.89 2011/06/12 23:06:04 jilles Exp $
+ * $FreeBSD: src/bin/sh/expand.c,v 1.90 2011/06/13 21:03:27 jilles Exp $
*/
#include <sys/types.h>
#include "mystring.h"
#include "arith.h"
#include "show.h"
+#include "builtins.h"
/*
* Structure specifying which parts of the string should be searched
* SUCH DAMAGE.
*
* @(#)expand.h 8.2 (Berkeley) 5/4/95
- * $FreeBSD: src/bin/sh/expand.h,v 1.16 2011/06/12 23:06:04 jilles Exp $
+ * $FreeBSD: src/bin/sh/expand.h,v 1.17 2011/06/13 21:03:27 jilles Exp $
*/
struct strlist {
int patmatch(const char *, const char *, int);
void rmescapes(char *);
int casematch(union node *, const char *);
-int wordexpcmd(int, char **);
* SUCH DAMAGE.
*
* @(#)histedit.c 8.2 (Berkeley) 5/4/95
- * $FreeBSD: src/bin/sh/histedit.c,v 1.42 2010/12/29 19:39:51 jilles Exp $
+ * $FreeBSD: src/bin/sh/histedit.c,v 1.43 2011/06/13 21:03:27 jilles Exp $
*/
#include <sys/param.h>
#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 */
* SUCH DAMAGE.
*
* @(#)jobs.c 8.5 (Berkeley) 5/4/95
- * $FreeBSD: src/bin/sh/jobs.c,v 1.94 2011/06/12 23:06:04 jilles Exp $
+ * $FreeBSD: src/bin/sh/jobs.c,v 1.95 2011/06/13 21:03:27 jilles Exp $
*/
#include <sys/ioctl.h>
#include "error.h"
#include "mystring.h"
#include "var.h"
+#include "builtins.h"
static struct job *jobtab; /* array of jobs */
* SUCH DAMAGE.
*
* @(#)jobs.h 8.2 (Berkeley) 5/4/95
- * $FreeBSD: src/bin/sh/jobs.h,v 1.20 2010/06/29 22:37:45 jilles Exp $
+ * $FreeBSD: src/bin/sh/jobs.h,v 1.21 2011/06/13 21:03:27 jilles Exp $
*/
/* Mode argument to forkshell. Don't change FORK_FG or FORK_BG. */
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 **);
pid_t getjobpgrp(char *);
struct job *makejob(union node *, int);
pid_t forkshell(struct job *, union node *, int);
*
* @(#) Copyright (c) 1991, 1993 The Regents of the University of California. All rights reserved.
* @(#)main.c 8.6 (Berkeley) 5/28/95
- * $FreeBSD: src/bin/sh/main.c,v 1.51 2011/06/12 10:13:48 jilles Exp $
+ * $FreeBSD: src/bin/sh/main.c,v 1.52 2011/06/13 21:03:27 jilles Exp $
*/
#include <stdio.h>
#include "mystring.h"
#include "exec.h"
#include "cd.h"
+#include "builtins.h"
int rootpid;
int rootshell;
* SUCH DAMAGE.
*
* @(#)main.h 8.2 (Berkeley) 5/4/95
- * $FreeBSD: src/bin/sh/main.h,v 1.10 2009/12/25 20:21:35 jilles Exp $
+ * $FreeBSD: src/bin/sh/main.h,v 1.11 2011/06/13 21:03:27 jilles Exp $
*/
extern int rootpid; /* pid of main shell */
void readcmdfile(const char *);
void cmdloop(int);
-int dotcmd(int, char **);
-int exitcmd(int, char **);
# SUCH DAMAGE.
#
# @(#)mkbuiltins 8.2 (Berkeley) 5/4/95
-# $FreeBSD: src/bin/sh/mkbuiltins,v 1.17 2009/12/27 18:04:05 jilles Exp $
+# $FreeBSD: src/bin/sh/mkbuiltins,v 1.18 2011/06/13 21:03:27 jilles Exp $
temp=`/usr/bin/mktemp -t ka`
havejobs=0
!
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 '};
};
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
* SUCH DAMAGE.
*
* @(#)myhistedit.h 8.2 (Berkeley) 5/4/95
- * $FreeBSD: src/bin/sh/myhistedit.h,v 1.12 2010/06/02 19:16:58 jilles Exp $
+ * $FreeBSD: src/bin/sh/myhistedit.h,v 1.13 2011/06/13 21:03:27 jilles Exp $
*/
#include <histedit.h>
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 **);
* SUCH DAMAGE.
*
* @(#)options.c 8.2 (Berkeley) 5/4/95
- * $FreeBSD: src/bin/sh/options.c,v 1.36 2011/06/04 22:19:00 jilles Exp $
+ * $FreeBSD: src/bin/sh/options.c,v 1.37 2011/06/13 21:03:27 jilles Exp $
*/
#include <signal.h>
#include "memalloc.h"
#include "error.h"
#include "mystring.h"
+#include "builtins.h"
#ifndef NO_HISTORY
#include "myhistedit.h"
#endif
* SUCH DAMAGE.
*
* @(#)options.h 8.2 (Berkeley) 5/4/95
- * $FreeBSD: src/bin/sh/options.h,v 1.15 2009/12/27 18:04:05 jilles Exp $
+ * $FreeBSD: src/bin/sh/options.h,v 1.16 2011/06/13 21:03:27 jilles Exp $
*/
struct shparam {
void optschanged(void);
void setparam(char **);
void freeparam(volatile struct shparam *);
-int shiftcmd(int, char **);
-int setcmd(int, char **);
-int getoptscmd(int, char **);
int nextopt(const char *);
void getoptsreset(const char *);
* SUCH DAMAGE.
*
* @(#)trap.c 8.5 (Berkeley) 6/5/95
- * $FreeBSD: src/bin/sh/trap.c,v 1.45 2011/02/04 22:47:55 jilles Exp $
+ * $FreeBSD: src/bin/sh/trap.c,v 1.46 2011/06/13 21:03:27 jilles Exp $
*/
#include <signal.h>
#include "error.h"
#include "trap.h"
#include "mystring.h"
+#include "builtins.h"
#include "myhistedit.h"
* SUCH DAMAGE.
*
* @(#)trap.h 8.3 (Berkeley) 6/5/95
- * $FreeBSD: src/bin/sh/trap.h,v 1.15 2011/01/08 23:08:13 jilles Exp $
+ * $FreeBSD: src/bin/sh/trap.h,v 1.16 2011/06/13 21:03:27 jilles Exp $
*/
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);
* SUCH DAMAGE.
*
* @(#)var.c 8.3 (Berkeley) 5/4/95
- * $FreeBSD: src/bin/sh/var.c,v 1.61 2011/06/12 23:06:04 jilles Exp $
+ * $FreeBSD: src/bin/sh/var.c,v 1.62 2011/06/13 21:03:27 jilles Exp $
*/
#include <unistd.h>
#include "error.h"
#include "mystring.h"
#include "parser.h"
+#include "builtins.h"
#ifndef NO_HISTORY
#include "myhistedit.h"
#endif
* SUCH DAMAGE.
*
* @(#)var.h 8.2 (Berkeley) 5/4/95
- * $FreeBSD: src/bin/sh/var.h,v 1.23 2011/06/12 23:06:04 jilles Exp $
+ * $FreeBSD: src/bin/sh/var.h,v 1.24 2011/06/13 21:03:27 jilles Exp $
*/
/*
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);