mirror of
https://github.com/RGBCube/serenity
synced 2025-07-26 20:37:36 +00:00
Shell: Add a "noop" builtin aliased to ":"
POSIX comes up with such silly names sometimes... This builtin does nothing. at all.
This commit is contained in:
parent
6a245de911
commit
5c0c126122
2 changed files with 15 additions and 1 deletions
|
@ -25,6 +25,11 @@ extern char** environ;
|
|||
|
||||
namespace Shell {
|
||||
|
||||
int Shell::builtin_noop(int, const char**)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
int Shell::builtin_dump(int argc, const char** argv)
|
||||
{
|
||||
if (argc != 2)
|
||||
|
@ -1142,6 +1147,9 @@ bool Shell::run_builtin(const AST::Command& command, const NonnullRefPtrVector<A
|
|||
Core::EventLoop loop;
|
||||
setup_signals();
|
||||
|
||||
if (name == ":"sv)
|
||||
name = "noop"sv;
|
||||
|
||||
#define __ENUMERATE_SHELL_BUILTIN(builtin) \
|
||||
if (name == #builtin) { \
|
||||
retval = builtin_##builtin(argv.size() - 1, argv.data()); \
|
||||
|
@ -1160,6 +1168,9 @@ bool Shell::run_builtin(const AST::Command& command, const NonnullRefPtrVector<A
|
|||
|
||||
bool Shell::has_builtin(StringView name) const
|
||||
{
|
||||
if (name == ":"sv)
|
||||
return true;
|
||||
|
||||
#define __ENUMERATE_SHELL_BUILTIN(builtin) \
|
||||
if (name == #builtin) { \
|
||||
return true; \
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue