Interestingly, the next day or so, the discussion about the C
interface used execve() as an example, which is an essential system
call in a Unix shell. I use the slightly more refined wrapper
function execvp() (which does path searching, so dumbsh is not totally
dumb).
So you may want to study it as an example of the libcc C interface in
action.
Dumbsh uses only NUL as meta-character (for separating arguments of a
command); since execve/execvp require NUL-terminated strings, this
poses no additional restrictions. The way I used this is
(simplified):
find <dir> -name \*.ogg -printf 'cp\0-p\0%p\000/sansa/MUSIC/\0\0'|gforth dumbsh.fs
The only restriction of the current implementation of dumbsh is that
it cannot pass empty arguments (because it interprets empty arguments
as indicating the end of the command).
- anton
--
M. Anton Ertl http://www.complang.tuwien.ac.at/anton/home.html
comp.lang.forth FAQs: http://www.complang.tuwien.ac.at/forth/faq/toc.html
New standard: http://www.forth200x.org/forth200x.html