The Gforth documentation say to access arguments by calling next-arg
, but this omits the program name, which would be printed in a C-like language.
Since argv[0]
seems to be automatically removed from the argument vector in Forth, is there a special function I can call that does return it?
sourcefilename
gives the program's name, andn arg
gets the arguments that were sent to gforth, including the gforth binary name.