|
|
|
|
|
by laurenth
692 days ago
|
|
One of the example we include is a base64 encoder/decoder: https://github.com/udem-dlteam/pnut/blob/main/examples/compiled/base64.sh
It doesn't support NULs as you pointed out, but it's interesting to see similarities between your implementation and the one generated by Pnut.Because we use `read -r`, we haven't tested reading binary files. Fortunately, the shell's `printf` function can emit all 256 characters so Pnut can at least
output binary files. This makes it possible for Pnut to have a x86 backend for the use of reproducible builds. Regarding the use of `read`, one constraint we set ourselves when writing Pnut
is to not use any external utilities, including those that are specified by the
POSIX standard (other than `read` and `printf`). This maximizes portability of the code generated by Pnut and is enough for the reproducible build use case. We're still looking for ways to integrate existing shell code with C. One way
this can be done is through the use of the `#include_shell` directive which
includes existing shell code in the generated shell script. This makes it possible to call the necessary utilities to read raw bytes without having Pnut itself depends on less portable utilities. |
|
I'd choose a different example to showcase pnut.