aboutsummaryrefslogtreecommitdiff
path: root/kernel/test/kshell/priv.h
diff options
context:
space:
mode:
authornthnluu <nate1299@me.com>2024-01-28 21:20:27 -0500
committernthnluu <nate1299@me.com>2024-01-28 21:20:27 -0500
commitc63f340d90800895f007de64b7d2d14624263331 (patch)
tree2c0849fa597dd6da831c8707b6f2603403778d7b /kernel/test/kshell/priv.h
Created student weenix repository
Diffstat (limited to 'kernel/test/kshell/priv.h')
-rw-r--r--kernel/test/kshell/priv.h43
1 files changed, 43 insertions, 0 deletions
diff --git a/kernel/test/kshell/priv.h b/kernel/test/kshell/priv.h
new file mode 100644
index 0000000..65c9493
--- /dev/null
+++ b/kernel/test/kshell/priv.h
@@ -0,0 +1,43 @@
+#pragma once
+
+#include "test/kshell/kshell.h"
+
+#include "util/list.h"
+
+#define dprintf(x, args...) dbg(DBG_TEST, x, ##args)
+
+#define KSH_BUF_SIZE \
+ 1024 /* This really just needs to be as large as \
+ * the line discipline buffer */
+#define KSH_CMD_NAME_LEN 16
+#define KSH_MAX_ARGS 128
+#define KSH_DESC_LEN 64
+
+struct chardev;
+struct kshell_command;
+
+struct kshell
+{
+ /* If we have a filesystem, we can write to the file
+ * descriptor. Otherwise, we need to write to a byte device */
+#ifdef __VFS__
+ int ksh_fd;
+
+ /* Used for redirection */
+ int ksh_out_fd;
+ int ksh_in_fd;
+#else
+ struct chardev *ksh_cd;
+#endif
+};
+
+extern list_t kshell_commands_list;
+
+/**
+ * Searches for a shell command with a specified name.
+ *
+ * @param name name of the command to search for
+ * @param namelen length of name
+ * @return the command, if it exists, or NULL
+ */
+struct kshell_command *kshell_lookup_command(const char *name, size_t namelen);