mwh / dlcall

Call standard library functions from the command line

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

dlcall lets you call C library functions from the command line.

    dlcall sin 2.5
    dlcall strlen "hello world"
    dlcall strstr "hello world" " " -r s
    dlcall strcasecmp hello HELLO
    dlcall strchr world -c r -r s
    dlcall getenv HOME -r s
    dlcall write 1 hello 5


Arguments that parse as ints are assumed to be ints, as doubles assumed
to be doubles, and otherwise treated as strings. The default can be
overridden with

    -s 1    string "1"
    -i 1    int 1
    -c 1    char '1'
    -d 1    double 1.0

Return types are assumed to be double for functions taking a double and
int otherwise. The return type can be specified with -r X, for X one of
the characters sicd above.

For functions from arbitrary libraries, give the path to the dynamic
library before the function name.

dlcall only understands certain function prototypes currently, including
most string and math functions. Pull requests are welcome to add more
functions.

Build with `make` and put the executable somewhere convenient.

About

Call standard library functions from the command line

License:GNU General Public License v3.0


Languages

Language:C 99.5%Language:Makefile 0.5%