1. List CLI Argument Information
# FA ( -- ) list CLI argument information
# this version uses the new print iterator to list
# all the arguments
#BUFFER
{A
24K "\n#d arguments were on the command line:\n"
"ndx argument\n"
"--- --------\n"
25K "!A" __ preload the print iterator address
loop __ look at each of the arguments
38K 25K - 2>> dup 24K < while
dup 26K@ = if
"=>" __ indicates the first script argument
else
" "
endif "#d" __ print the argument index
" \"@s\"\n" __ then print the argument string
endloop __ end the loop
__ if optind (26K@) is out of range (>= 24K) tell us all about it
26K@ 24K >= if
26K@ "=>#d"
__ the string pointer is *supposed* to be NULL in this case ...
26K@ 4* 25K+@ dup 0= if
drop " NULL\n" __ normal (NULL) case
else
" \"#s\"\n" __ abnormal (non-NULL) case
endif
endif
26K@ "optind=#d\n"
"\nNOTE: \"=>\" indicates the first script argument.\n\n"
}
#EXECUTE
#define argtest=FA