~emersion/mrsh

819e0495ca9e0db1a5459892aefdb2608b397d0a — Issam Maghni 6 months ago 657ea07
Nitpick details about buit-ins

* exec and trap are special built-ins
* Add remaining utilities as comments
* type now recognizes special built-ins
2 files changed, 10 insertions(+), 2 deletions(-)

M builtin/builtin.c
M builtin/type.c
M builtin/builtin.c => builtin/builtin.c +5 -2
@@ 24,14 24,17 @@ static const struct builtin builtins[] = {
	{ "command", builtin_command, false },
	{ "continue", builtin_break, true },
	{ "eval", builtin_eval, true },
	{ "exec", builtin_exec, false },
	{ "exec", builtin_exec, true },
	{ "exit", builtin_exit, true },
	{ "export", builtin_export, true },
	{ "false", builtin_false, false },
//	{ "fc", builtin_fc, false },
	{ "fg", builtin_fg, false },
	{ "getopts", builtin_getopts, false },
	{ "hash", builtin_hash, false },
	{ "jobs", builtin_jobs, false },
//	{ "kill", builtin_kill, false },
//	{ "newgrp", builtin_newgrp, false },
	{ "pwd", builtin_pwd, false },
	{ "read", builtin_read, false },
	{ "readonly", builtin_export, true },


@@ 39,7 42,7 @@ static const struct builtin builtins[] = {
	{ "set", builtin_set, true },
	{ "shift", builtin_shift, true },
	{ "times", builtin_times, true },
	{ "trap", builtin_trap, false },
	{ "trap", builtin_trap, true },
	{ "true", builtin_true, false },
	{ "type", builtin_type, false },
	{ "ulimit", builtin_ulimit, false },

M builtin/type.c => builtin/type.c +5 -0
@@ 32,6 32,11 @@ int builtin_type(struct mrsh_state *state, int argc, char *argv[]) {
			continue;
		}

		if (mrsh_has_special_builtin(name)) {
			fprintf(stdout, "%s is a special shell builtin\n", name);
			continue;
		}

		if (mrsh_has_builtin(name)) {
			fprintf(stdout, "%s is a shell builtin\n", name);
			continue;