Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.sys.acorn.programmer > #714

Re: Parsing command-line arguments for module commands

From Martin Bazley <martin.bazley@blueyonder.co.uk>
Newsgroups comp.sys.acorn.programmer
Subject Re: Parsing command-line arguments for module commands
Message-ID <cf6f111152.martin@blueyonder.co.uk> (permalink)
References <e3d7d3e1-79aa-4e91-8b6b-6a1d0b273aca@s12g2000yqm.googlegroups.com> <91d5c21052.martin@blueyonder.co.uk> <d2558f02-edee-4af6-9912-0b309fbc8b53@j19g2000yqc.googlegroups.com>
Organization virginmedia.com
Date 2011-09-11 14:32 +0100

Show all headers | View raw


The following bytes were arranged on 11 Sep 2011 by Terje Slettebø :

> On Sep 11, 1:13 am, Martin Bazley <martin.baz...@blueyonder.co.uk>
> wrote:
>
> > SWI "OS_ReadArgs".
> >
> Thanks. I did look at OS_ReadArgs, but it seemed to only support
> parameters of the type "-<name>[ <value>]", so you couldn't use it
> e.g. to parse the parameters of a command like "*copy <from> <to>".

Yes, you can.  I do it all the time.  The <name> part in the syntax
string is entirely optional - all you need are the commas separating
each argument, and /A inserted between them if a parameter is
compulsory.

As the StrongHelp manual puts it, "," is a perfectly valid syntax
string.  Presumably the null string is also.  The last time I used this,
I was writing a utility to save memory starting from a certain address
to a file (determining the length of memory to save from the contents of
the address given being the purpose of the utility).  I used the string
"/A,/A/E".

One thing you do have to watch out for is that OS_ReadArgs generates a
rather unhelpful error if the parameters are junk, so standard practice
is to call it with the X flag set and, if V set, print a message of your
own along the lines of, "Syntax: <program> [-<arg1>] -<arg2>".

-- 
  __<^>__   "Your pet, our passion." - Purina
 / _   _ \  "Your potential, our passion." - Microsoft, a few months later
( ( |_| ) )
 \_>   <_/  ======================= Martin Bazley ==========================

Back to comp.sys.acorn.programmer | Previous | NextPrevious in thread | Next in thread | Find similar | Unroll thread


Thread

Parsing command-line arguments for module commands Terje Slettebø <tslettebo@gmail.com> - 2011-09-10 15:11 -0700
  Re: Parsing command-line arguments for module commands Martin Bazley <martin.bazley@blueyonder.co.uk> - 2011-09-11 00:13 +0100
    Re: Parsing command-line arguments for module commands Terje Slettebø <tslettebo@gmail.com> - 2011-09-11 01:31 -0700
      Re: Parsing command-line arguments for module commands Martin Bazley <martin.bazley@blueyonder.co.uk> - 2011-09-11 14:32 +0100
        Re: Parsing command-line arguments for module commands Terje Slettebø <tslettebo@gmail.com> - 2011-09-12 03:17 -0700

csiph-web