Category : Word Processors
Archive   : BESIDES.ZIP
Filename : CMDLNPRS.SEQ

 
Output of file : CMDLNPRS.SEQ contained in archive : BESIDES.ZIP
\ count number of command tail parameters, return nth para's addr & len.


0 value #params \ number of parameter on the command line
\ you should be able to reference
\ this value outside of the below words
\ once CNT#PARAMS has been executed to
\ get the number of parameter which
\ where on the command line (the command tail)

: cnt#params ( -- #P ) \ counts number of parameters (#P) on the command line
0 =: #params
dos-line count
begin
bl skip dup
if
incr> #params
bl scan
?dup
then 0=
until
drop #params ;

0 value lastloc \ temp working value c/b a local value


comment: getparm ( n - addr count | false )
Leaves the addr and length of the requested parameter
or a false value ( 0 ) on the stack.
Note that it is ones based, that is n = 1 leaves the
address and length of the first parameter. n = 0 will
return the false flag ( 0 ) as will the case n > #p.
comment;

: getparam ( n - addr count | false )
0 =: lastloc
?dup
if
dup
cnt#params
if
#params <=
if
dos-line count
rot 0
do
bl skip dup =: lastloc bl scan
loop
lastloc swap - tuck - swap
else
drop false \ no parameter
then
else
2drop false \ no parameter
then
else
false \ no parameter
then ;



  3 Responses to “Category : Word Processors
Archive   : BESIDES.ZIP
Filename : CMDLNPRS.SEQ

  1. Very nice! Thank you for this wonderful archive. I wonder why I found it only now. Long live the BBS file archives!

  2. This is so awesome! 😀 I’d be cool if you could download an entire archive of this at once, though.

  3. But one thing that puzzles me is the “mtswslnkmcjklsdlsbdmMICROSOFT” string. There is an article about it here. It is definitely worth a read: http://www.os2museum.com/wp/mtswslnk/