mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2024-12-30 14:43:38 +03: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
Notes:
sideshowbarker
2024-07-17 21:20:39 +09:00
Author: https://github.com/alimpfard Commit: https://github.com/SerenityOS/serenity/commit/5c0c1261228 Pull-request: https://github.com/SerenityOS/serenity/pull/11634
@ -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; \
|
||||
|
@ -48,7 +48,8 @@
|
||||
__ENUMERATE_SHELL_BUILTIN(bg) \
|
||||
__ENUMERATE_SHELL_BUILTIN(wait) \
|
||||
__ENUMERATE_SHELL_BUILTIN(dump) \
|
||||
__ENUMERATE_SHELL_BUILTIN(kill)
|
||||
__ENUMERATE_SHELL_BUILTIN(kill) \
|
||||
__ENUMERATE_SHELL_BUILTIN(noop)
|
||||
|
||||
#define ENUMERATE_SHELL_OPTIONS() \
|
||||
__ENUMERATE_SHELL_OPTION(inline_exec_keep_empty_segments, false, "Keep empty segments in inline execute $(...)") \
|
||||
@ -333,6 +334,8 @@ private:
|
||||
ENUMERATE_SHELL_BUILTINS()
|
||||
|
||||
#undef __ENUMERATE_SHELL_BUILTIN
|
||||
|
||||
":", // POSIX-y name for "noop".
|
||||
};
|
||||
|
||||
bool m_should_ignore_jobs_on_next_exit { false };
|
||||
|
Loading…
Reference in New Issue
Block a user