diff options
Diffstat (limited to 'ipl/procs/argparse.icn')
-rw-r--r-- | ipl/procs/argparse.icn | 39 |
1 files changed, 39 insertions, 0 deletions
diff --git a/ipl/procs/argparse.icn b/ipl/procs/argparse.icn new file mode 100644 index 0000000..f6ae81a --- /dev/null +++ b/ipl/procs/argparse.icn @@ -0,0 +1,39 @@ +############################################################################ +# +# File: argparse.icn +# +# Subject: Procedure to parse pseudo-command-line +# +# Author: Ralph E. Griswold +# +# Date: November 14, 1991 +# +############################################################################ +# +# This file is in the public domain. +# +############################################################################ +# +# argparse(s) parses s as if it were a command line and puts the components in +# in a list, which is returned. +# +# At present, it does not accept any escape conventions. +# +############################################################################ + +procedure argparse(s) + local arglist + static nonblank + + initial nonblank := &cset -- ' \t\n' + + arglist := [] + + s ? { + while tab(upto(nonblank)) do + put(arglist, tab(many(nonblank))) + } + + return arglist + +end |