1 /* @(#)btab.c	1.20 17/01/11 Copyright 1986-2017 J. Schilling */
2 #include <schily/mconfig.h>
3 #ifndef lint
4 static	UConst char sccsid[] =
5 	"@(#)btab.c	1.20 17/01/11 Copyright 1986-2017 J. Schilling";
6 #endif
7 /*
8  *	Copyright (c) 1986-2017 J. Schilling
9  */
10 /*
11  * The contents of this file are subject to the terms of the
12  * Common Development and Distribution License, Version 1.0 only
13  * (the "License").  You may not use this file except in compliance
14  * with the License.
15  *
16  * See the file CDDL.Schily.txt in this distribution for details.
17  * A copy of the CDDL is also available via the Internet at
18  * http://www.opensource.org/licenses/cddl1.txt
19  *
20  * When distributing Covered Code, include this CDDL HEADER in each
21  * file and include the License file CDDL.Schily.txt from this distribution.
22  */
23 
24 #include <schily/stdio.h>
25 #include "bsh.h"
26 #include "str.h"
27 #include "btab.h"
28 
29 						/* Musz sortiert sein !!! */
30 
31 	/*	name		argc	func to call	help text */
32 btab bitab[] = {
33 	{	"$",		1,	bfg,		ufg	},
34 	{	".",		0,	bsource,	udot	},
35 	{	":",		0,	bdummy,		NULL	},
36 	{	"@",		0,	bexpr,		uexpr	},
37 	{	"[",		0,	btest,		ubrack	},
38 	{	"alias",	0,	balias,		ualias	},
39 	{	"alloc",	0,	balloc,		NULL	},
40 	{	"bg",		0,	bfg,		ufg	},
41 	{	"break",	1,	bnallo,		NULL	},
42 	{	"case",		0,	bdummy,		NULL	},
43 	{	"cd",		0,	bcd,		ucd	},
44 	{	"chdir",	0,	bcd,		ucd	},
45 	{	"compute",	0,	bcompute,	utest	},
46 	{	"concat",	0,	bconcat,	uconcat	},
47 	{	"cwd",		0,	bcd,		ucd	},
48 	{	"dirs",		1,	bdirs,		nullstr	},
49 	{	"do",		0,	bdo,		udo	},
50 	{	"dosh",		0,	bdo,		udo	},
51 	{	"echo",		0,	becho,		uecho	},
52 	{	"else",		0,	bnallo,		NULL	},
53 	{	"end",		0,	bnallo,		NULL	},
54 	{	"env",		0,	benv,		uenv	},
55 	{	"err",		0,	becho,		uecho	},
56 	{	"errstr",	2,	berrstr,	uerrstr	},
57 	{	"eval",		0,	beval,		ueval	},
58 	{	"exec",		0,	bexec,		uexec	},
59 	{	"exit",		0,	bexit,		uexit	},
60 	{	"false",	0,	bfalse,		NULL	},
61 	{	"fg",		0,	bfg,		ufg	},
62 	{	"fi",		0,	bnallo,		NULL	},
63 #ifdef	DO_FIND
64 	{	"find",		0,	bfind,		(char *)-1 },
65 #endif
66 	{	"for",		0,	bfor,		NULL	},
67 	{	"function",	0,	bfunc,		ufunc	},
68 	{	"glob",		0,	becho,		uglob	},
69 	{	"history",	0,	bhistory,	uhist	},
70 	{	"if",		0,	bif,		NULL	},
71 	{	"kill",		0,	bkill,		ukill	},
72 	{	"killpg",	0,	bkill,		ukill	},
73 	{	"limit",	0,	blimit,		uulimit	},
74 	{	"login",	0,	blogin,		ulogin	},
75 	{	"logout",	1,	blogout,	nullstr	},
76 	{	"loop",		1,	bloop,		NULL	},
77 	{	"map",		0,	bmap,		umap	},
78 	{	"pgrp",		0,	bpgrp,		upgrp	},
79 	{	"popd",		0,	bcd,		upopd	},
80 	{	"pushd",	0,	bcd,		upushd	},
81 	{	"pwd",		1,	bpwd,		nullstr	},
82 	{	"read",		2,	bread,		uread	},
83 	{	"remap",	1,	bremap,		nullstr	},
84 	{	"repeat",	0,	brepeat,	urepeat	},
85 	{	"resume",	2,	bresume,	uresume	},
86 	{	"return",	0,	breturn,	ureturn	},
87 #ifdef	INTERACTIVE
88 	{	"savehistory",	1,	bsavehist,	nullstr	},
89 #endif
90 	{	"set",		0,	bsetcmd,	uset	},
91 	{	"setenv",	0,	bsetenv,	usetenv	},
92 	{	"setmask",	0,	bsetmask,	usetmask},
93 	{	"shift",	0,	bshift,		ushift	},
94 	{	"signal",	0,	bsignal,	usignal	},
95 	{	"source",	0,	bsource,	usource	},
96 	{	"stop",		0,	bsuspend,	ustop	},
97 #ifdef	DO_SUID
98 	{	"suid",		0,	bsuid,		usuid	},
99 #endif
100 	{	"suspend",	0,	bsuspend,	ususpend},
101 	{	"switch",	3,	bswitch,	NULL	},
102 	{	"sync",		1,	bsync,		nullstr	},
103 	{	"test",		0,	btest,		utest	},
104 	{	"then",		0,	bnallo,		NULL	},
105 	{	"time_",	0,	btime,		uutime	},
106 	{	"true",		0,	btrue,		NULL	},
107 	{	"type",		0,	btype,		utype	},
108 	{	"umask",	0,	bumask,		uumask	},
109 	{	"unalias",	0,	bunalias,	uunalias},
110 	{	"unmap",	2,	bunmap,		uunmap	},
111 	{	"unset",	2,	bunset,		uunset	},
112 	{	"unsetenv",	2,	bunsetenv,	uunsetenv},
113 	{	"wait",		0,	bwait,		uwait	},
114 };
115 
116 int	n_builtin	= sizeof (bitab) / sizeof (btab);
117