Matozinho / fat16_interpreter

A interpreter for Fat 16 images.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Fat 16 Interpreter

A interpreter for Fat 16 images.

Usage

You can run it with xmake or with docker.

To run with xmake:

xmake && xmake r interpreter <path-to-img>

To run with docker:

  • Build the image and create the container with the script (this will open container after create)
./scripts/create_container
  • To run the app, you can use the script:
./scripts/run <path-to-img>
  • To delete the image and the container after usage, you can run:
./scripts/delete_container
  • To use another image, you have 3 options:
    1. Move the image to the assets folder before create the docker image;
    2. Copy the object from the local machine to the assets folder and re-build the project with the following command:
    # in the local machine
    docker cp <path-to-img-in-local-machine> matozinho_fat16:/home/cppdev/assets
    # in the container
    xmake build -a
    1. Copy the image directly to the folder with the executable
    # in the local machine
    docker cp <path-to-img-in-local-machine> matozinho_fat16:/home/cppdev/build/linux/x86_64/release/assets

Useful commands for docker

# if the container is stopped, start and connect to it
docker start matozinho_fat16 && docker attach matozinho_fat16
# list all running containers
docker ps

Interpreter

The interpreter starts on the root dir of the image, and you can use the command help to see all available commands.

[cppdev@12283e978376 ~]$ ./scripts/run assets/fat16_4sectorpercluster.img
|> help
Available commands:
+---------+----------------------------------------+----------------+
| Command | Description                            | Arguments      |
+---------+----------------------------------------+----------------+
| clear   | Clear the console                      | ()>            |
+---------+----------------------------------------+----------------+
| pwd     | Show the path to the current directory | ()>            |
+---------+----------------------------------------+----------------+
| cd      | Change to the specified directory      | (std::string)> |
+---------+----------------------------------------+----------------+
| cat     | Show the content of the specified file | (std::string)> |
+---------+----------------------------------------+----------------+
| ls      | List all the entries of the directory  | ()>            |
+---------+----------------------------------------+----------------+
|>

Examples

./scripts/create_container
[cppdev@9c4cc4d9c605 ~]$ ./scripts/run assets/fat16_4sectorpercluster.img
|> help
Available commands:
+---------+----------------------------------------+----------------+
| Command | Description                            | Arguments      |
+---------+----------------------------------------+----------------+
| clear   | Clear the console                      | ()>            |
+---------+----------------------------------------+----------------+
| pwd     | Show the path to the current directory | ()>            |
+---------+----------------------------------------+----------------+
| cd      | Change to the specified directory      | (std::string)> |
+---------+----------------------------------------+----------------+
| cat     | Show the content of the specified file | (std::string)> |
+---------+----------------------------------------+----------------+
| ls      | List all the entries of the directory  | ()>            |
+---------+----------------------------------------+----------------+
|>

About

A interpreter for Fat 16 images.


Languages

Language:C++ 92.6%Language:Lua 2.9%Language:Shell 2.4%Language:Dockerfile 2.2%