|
Basic Solution File System - BSFS
|
Browser shell-like for the BSFS file system. More...
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. | |
| int | main (int argc, char *argv[]) |
| Program entry point for the BSFS browser. | |
Variables | |
| char | current_path [PATH_MAX] = "/" |
| Current working directory text (provided by the browser prompt) | |
Browser shell-like for the BSFS file system.
This program allows interaction with a BSFS-formatted file through a shell-like interface. Usage: ./browser <formatted_file> It validates the file, reads the superblock, and enters a command loop.
| 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. |
| int main | ( | int | argc, |
| char * | argv[] ) |
Program entry point for the BSFS browser.
Validates usage, opens the formatted image file, checks the magic number, reads the superblock and starts the interactive loop.
| argc | Argument count (expects 2). |
| argv | Argument vector: argv[1] must be the path to the image file. |
| char current_path[PATH_MAX] = "/" |
Current working directory text (provided by the browser prompt)
Current browser prompt path (defined in browser_bsfs.c)