mirror of
https://github.com/sheumann/hush.git
synced 2025-01-14 12:30:40 +00:00
Added some smallish comments to help folks understand why we have two tables
of builtins and the reasoning behind it.
This commit is contained in:
parent
c41e8c840f
commit
37653aaf9c
7
lash.c
7
lash.c
@ -112,7 +112,9 @@ static int runCommand(struct job newJob, struct jobSet *jobList, int inBg);
|
|||||||
static int busy_loop(FILE * input);
|
static int busy_loop(FILE * input);
|
||||||
|
|
||||||
|
|
||||||
/* Table of built-in functions */
|
/* Table of built-in functions (these are non-forking builtins, meaning they
|
||||||
|
* can change global variables in the parent shell process but they will not
|
||||||
|
* work with pipes and redirects; 'unset foo | whatever' will not work) */
|
||||||
static struct builtInCommand bltins[] = {
|
static struct builtInCommand bltins[] = {
|
||||||
{"bg", "Resume a job in the background", "bg [%%job]", builtin_fg_bg},
|
{"bg", "Resume a job in the background", "bg [%%job]", builtin_fg_bg},
|
||||||
{"cd", "Change working directory", "cd [dir]", builtin_cd},
|
{"cd", "Change working directory", "cd [dir]", builtin_cd},
|
||||||
@ -125,7 +127,8 @@ static struct builtInCommand bltins[] = {
|
|||||||
{NULL, NULL, NULL, NULL}
|
{NULL, NULL, NULL, NULL}
|
||||||
};
|
};
|
||||||
|
|
||||||
/* Table of built-in functions */
|
/* Table of forking built-in functions (things that fork cannot change global
|
||||||
|
* variables in the parent process, such as the current working directory) */
|
||||||
static struct builtInCommand bltins_forking[] = {
|
static struct builtInCommand bltins_forking[] = {
|
||||||
{"env", "Print all environment variables", "env", builtin_env},
|
{"env", "Print all environment variables", "env", builtin_env},
|
||||||
{"pwd", "Print current directory", "pwd", builtin_pwd},
|
{"pwd", "Print current directory", "pwd", builtin_pwd},
|
||||||
|
7
sh.c
7
sh.c
@ -112,7 +112,9 @@ static int runCommand(struct job newJob, struct jobSet *jobList, int inBg);
|
|||||||
static int busy_loop(FILE * input);
|
static int busy_loop(FILE * input);
|
||||||
|
|
||||||
|
|
||||||
/* Table of built-in functions */
|
/* Table of built-in functions (these are non-forking builtins, meaning they
|
||||||
|
* can change global variables in the parent shell process but they will not
|
||||||
|
* work with pipes and redirects; 'unset foo | whatever' will not work) */
|
||||||
static struct builtInCommand bltins[] = {
|
static struct builtInCommand bltins[] = {
|
||||||
{"bg", "Resume a job in the background", "bg [%%job]", builtin_fg_bg},
|
{"bg", "Resume a job in the background", "bg [%%job]", builtin_fg_bg},
|
||||||
{"cd", "Change working directory", "cd [dir]", builtin_cd},
|
{"cd", "Change working directory", "cd [dir]", builtin_cd},
|
||||||
@ -125,7 +127,8 @@ static struct builtInCommand bltins[] = {
|
|||||||
{NULL, NULL, NULL, NULL}
|
{NULL, NULL, NULL, NULL}
|
||||||
};
|
};
|
||||||
|
|
||||||
/* Table of built-in functions */
|
/* Table of forking built-in functions (things that fork cannot change global
|
||||||
|
* variables in the parent process, such as the current working directory) */
|
||||||
static struct builtInCommand bltins_forking[] = {
|
static struct builtInCommand bltins_forking[] = {
|
||||||
{"env", "Print all environment variables", "env", builtin_env},
|
{"env", "Print all environment variables", "env", builtin_env},
|
||||||
{"pwd", "Print current directory", "pwd", builtin_pwd},
|
{"pwd", "Print current directory", "pwd", builtin_pwd},
|
||||||
|
@ -112,7 +112,9 @@ static int runCommand(struct job newJob, struct jobSet *jobList, int inBg);
|
|||||||
static int busy_loop(FILE * input);
|
static int busy_loop(FILE * input);
|
||||||
|
|
||||||
|
|
||||||
/* Table of built-in functions */
|
/* Table of built-in functions (these are non-forking builtins, meaning they
|
||||||
|
* can change global variables in the parent shell process but they will not
|
||||||
|
* work with pipes and redirects; 'unset foo | whatever' will not work) */
|
||||||
static struct builtInCommand bltins[] = {
|
static struct builtInCommand bltins[] = {
|
||||||
{"bg", "Resume a job in the background", "bg [%%job]", builtin_fg_bg},
|
{"bg", "Resume a job in the background", "bg [%%job]", builtin_fg_bg},
|
||||||
{"cd", "Change working directory", "cd [dir]", builtin_cd},
|
{"cd", "Change working directory", "cd [dir]", builtin_cd},
|
||||||
@ -125,7 +127,8 @@ static struct builtInCommand bltins[] = {
|
|||||||
{NULL, NULL, NULL, NULL}
|
{NULL, NULL, NULL, NULL}
|
||||||
};
|
};
|
||||||
|
|
||||||
/* Table of built-in functions */
|
/* Table of forking built-in functions (things that fork cannot change global
|
||||||
|
* variables in the parent process, such as the current working directory) */
|
||||||
static struct builtInCommand bltins_forking[] = {
|
static struct builtInCommand bltins_forking[] = {
|
||||||
{"env", "Print all environment variables", "env", builtin_env},
|
{"env", "Print all environment variables", "env", builtin_env},
|
||||||
{"pwd", "Print current directory", "pwd", builtin_pwd},
|
{"pwd", "Print current directory", "pwd", builtin_pwd},
|
||||||
|
Loading…
x
Reference in New Issue
Block a user