include "inc/cmdsys.plh" const cmdline = $01FF def argDelim(str) byte n // Strip leading spaces while ^str and ^(str + 1) == ' ' memcpy(str + 1, str + 2, ^str - 1) ^str-- loop // Scan to trailing spaces (if any) for n = 1 to ^str if ^(str + n) <= ' ' ^(str + n) = ^str - n ^str = n - 1 break fin next return str end export def argNext(str) str = str + ^str + 1 return argDelim(str) end export def argFirst // NULL terminate command line ^(cmdline + ^cmdline + 1) = 0 return argDelim(cmdline) end done