use a file as memory for a stack (LIFO) of strings (implementation in rust and c++)
  • Rust 61.1%
  • C++ 27.4%
  • Nix 11.5%
Find a file
2023-12-29 22:09:13 +01:00
src corrections 2023-12-29 22:08:57 +01:00
.gitignore initial commit 2023-12-29 15:24:28 +01:00
Cargo.lock initial commit 2023-12-29 15:24:28 +01:00
Cargo.toml initial commit 2023-12-29 15:24:28 +01:00
flake.lock initial commit 2023-12-29 15:24:28 +01:00
flake.nix initial commit 2023-12-29 15:24:28 +01:00
LICENSE add license 2023-12-29 15:26:07 +01:00
README.md added README 2023-12-29 22:09:13 +01:00

Stackfile

This small program uses a plain file as persistent memory for a stack (LIFO (Last In First Out)) of Strings.

Currently the classic push pop empty operations are supported.

Additional to the main rust implementation there exists a horribly unsafe C++ implementation, which will not be worked on anymore. Still doesn't hurt to keep it around.

Plans

  • implement some interfaces to make it interoperable with other rust code
  • improve the code

Command Line Usage

USAGE:
    stackfile <filename> <command> [<args>]

COMMANDS:
    stackfile <filename> empty
        -> exits with exit code 0 if the file is empty or nonexistent and 1 otherwise

    stackfile <filename> empty2
        -> prints 'true' if the file is empty or nonexistent and 'false' otherwise

    stackfile <filename> pop
        -> pops a line from the filestack and prints it

    stackfile <filename> push <text>
        -> pushes <text> to the stack (appends it to the file)

EXAMPLE:
    $ stackfile ./example.txt push "hello world"
    $ stackfile ./example.txt empty2
    false
    $ stackfile ./example.txt pop
    hello world