FrostWing
A lightweight raw-control operating system.
Loading...
Searching...
No Matches
sh_util.h
Go to the documentation of this file.
1
11
12#ifndef SH_UTIL_H
13#define SH_UTIL_H
14
15#include <basics.h>
16#include <memory.h>
17#include <graphics.h>
18#include <memory.h>
19#include <keyboard.h>
20#include <heap.h>
21#include <stddef.h>
22#include <strings.h>
23#include <stdint.h>
24#include <flanterm/flanterm.h>
25#include <filesystems/fwrfs.h>
26#include <fdlfcn.h>
27#include <commands/commands.h>
28#include <stream.h>
29
30#define BUFFER_SIZE 128
31#define MAX_COMMAND_LINE 1024
32#define MAX_SUBCOMMANDS 64
33#define MAX_ARGV 64
34
35typedef struct command_list_entry
36{
37 struct command_list_entry* prev;
38 char* command;
39 size_t length;
40 struct command_list_entry* next;
42
43typedef struct
44{
45 command_list_entry* start;
47 size_t count;
49
50typedef struct {
51 int redirect_stdout;
52 int redirect_stderr;
53 int append;
54 const char* filename;
55} redir_t;
56
57
62typedef int (*cmd_func_t)(int argc, char** argv);
63
68typedef struct {
69 const char* name;
70 cmd_func_t func;
71} command_t;
72
77typedef enum {
78 OP_NONE = 0,
79 OP_AND, /* && */
80 OP_OR /* || */
81} op_t;
82
83typedef struct {
84 char* cmd;
85 op_t op_after;
86} subcmd_t;
87
93
100
107
115void push_command_to_list(command_list* lst, const char* value, size_t length);
116
124void execute(const char* buffer, int argc, char** argv);
125
132void user_main(char* buffer);
133
134#endif
This is a basic header files with FrostWing specific short forms and basically a good for life header...
Contains all the print functions.
Header files for heap.
The PS/2 Keyboard interface code.
Custom memory manipulation functions.
void dispose_command_list(command_list *lst)
Dispose the command list.
int(* cmd_func_t)(int argc, char **argv)
Wrapper to store properly the function commands list.
Definition sh_util.h:62
string current_user
Name of the current user.
Definition sh_util.h:92
void init_command_list(command_list *lst)
Initialize the command list.
op_t
operator types between commands
Definition sh_util.h:77
void push_command_to_list(command_list *lst, const char *value, size_t length)
Push a value to the command list.
void execute(const char *buffer, int argc, char **argv)
Executes the command passed to it.
void user_main(char *buffer)
Function for adding or removing users.
Unix like standard streams.
The header file for strings.c.
Definition sh_util.h:36
Wrapper to store the command and its respective function.
Definition sh_util.h:68