|
Basic Solution File System - BSFS
|
Public interface for the interactive BSFS browser (shell). More...
Macros | |
| #define | PATH_MAX 4096 |
Functions | |
| char * | browser_read_line () |
| Read a single line from standard input. | |
| char ** | browser_split_line (char *line) |
| Split a command line into whitespace-delimited tokens. | |
| int | browser_execute (FILE *file, superblock_t *sb, char **args) |
| Dispatch a parsed command to its implementation. | |
| void | browser_loop (FILE *file, superblock_t *sb) |
| Interactive read-eval-print loop (REPL) for the BSFS browser. | |
Public interface for the interactive BSFS browser (shell).
Declares the main entry points used by the CLI program that allows users to interact with a BSFS-formatted image. The browser reads commands from standard input, tokenizes them and dispatches to the command table.
Key responsibilities:
| int browser_execute | ( | FILE * | file, |
| superblock_t * | sb, | ||
| char ** | args ) |
Dispatch a parsed command to its implementation.
Looks up the command name in the built-in command table and invokes the matching function. Unknown commands print a short error message.
| file | Open filesystem image. |
| sb | Loaded superblock. |
| args | Tokenized argv-like vector (args[0] is the command name). |
| void browser_loop | ( | FILE * | file, |
| superblock_t * | sb ) |
Interactive read-eval-print loop (REPL) for the BSFS browser.
Prints a prompt, reads input, tokenizes and executes commands until exit.
| file | Open filesystem image. |
| sb | Loaded superblock. |
| char * browser_read_line | ( | ) |
Read a single line from standard input.
Allocates a buffer and returns a NUL-terminated line suitable for tokenizing. The caller is responsible for freeing the returned pointer.
| char ** browser_split_line | ( | char * | line | ) |
Split a command line into whitespace-delimited tokens.
Tokenizes the given mutable buffer in-place and returns a NULL-terminated array of pointers to the tokens. The array itself must be freed by the caller; the token strings live inside the original buffer.
| line | Writable buffer containing the input line to split. |