-
Notifications
You must be signed in to change notification settings - Fork 2
/
commands.h
31 lines (22 loc) · 947 Bytes
/
commands.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
#ifndef _COMMANDS_H_
#define _COMMANDS_H_
#include "filesystem.h"
#define CMD_SUCCESS 1
#define CMD_ERROR 0
typedef struct {
// have to be both directories
fs_file *root;
fs_file *working;
} cmd_filesystem;
uint8_t tree(fs_file *file);
uint8_t ls(fs_file *file);
uint8_t mkdir(mem_allocator *allocator, cmd_filesystem *filesystem, char *dirpath);
uint8_t touch(mem_allocator *allocator, cmd_filesystem *filesystem, char *filepath);
uint8_t wtxt(mem_allocator *allocator, cmd_filesystem *filesystem, char *filepath, const char *data_txt);
uint8_t whex(mem_allocator *allocator, cmd_filesystem *filesystem, char *filepath, const char *data_hex);
uint8_t cat(fs_file *file);
uint8_t rm(mem_allocator *allocator, cmd_filesystem *filesystem, char *path);
uint8_t pwd(mem_allocator *allocator, cmd_filesystem *filesystem);
uint8_t cd(cmd_filesystem *filesystem, char *filepath);
uint8_t exec(mem_allocator *allocator, fs_file *file);
#endif