OurOS 0.1
Operating System built by McGill Students
 
Loading...
Searching...
No Matches
kshell_cmds.h
Go to the documentation of this file.
1#ifndef _KSHELL_CMDS_H
2#define _KSHELL_CMDS_H
3
4#include "io.h"
5
6/**
7 * @brief A pointer to a function for a shell command.
8 *
9 * @param argc Number of arguments.
10 * @param argv The arguments.
11 * @param put The putchar function.
12 * @return Return status.
13 */
14typedef int (*cmd_t)(int argc, const char *argv[], putchar put);
15
16/**
17 * @struct cmd_tbl_entry
18 * @brief An entry for a shell command.
19 */
21 /** Name of the command. */
22 const char *name;
23 /** Function associated to the command. */
25 /** Description of the command. */
26 const char *description;
27};
28
29/**
30 * @brief Gets the cmd_t of a shell command, or NULL if not found.
31 *
32 * @param name Name the command.
33 */
34cmd_t find_cmd(const char *name);
35
36#endif // _KSHELL_CMDS_H
void(* putchar)(char)
Function type for printing a character.
Definition io.h:7
cmd_t find_cmd(const char *name)
Gets the cmd_t of a shell command, or NULL if not found.
Definition kshell_cmds.c:42
int(* cmd_t)(int argc, const char *argv[], putchar put)
A pointer to a function for a shell command.
Definition kshell_cmds.h:14
An entry for a shell command.
Definition kshell_cmds.h:20
const char * description
Definition kshell_cmds.h:26
cmd_t command
Definition kshell_cmds.h:24
const char * name
Definition kshell_cmds.h:22