[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [RP] Generic argument parsing & stuff
From: |
Gergely Nagy |
Subject: |
Re: [RP] Generic argument parsing & stuff |
Date: |
Fri Sep 14 13:39:02 2001 |
User-agent: |
Mutt/1.3.20i |
Hello there!
> This all sounds really nice.
>
> How will parse_cmdline behave when 'extra' arguments are specified ?
At the moment, you tell it how many arguments you want to accept, it
splits up the command into max_args - 1 pieces, and copies the rest to
the last element of a string vector (think argv).
So, extra arguments are part of the last argument.
This is mostly for the sake of colon and exec.
> Can it distinguish between commands like bind in which the last arg
> should be 'gobbled up' and commands such as msgwait which should only
> accept a specific number of args ?
>
No it can't. But there is an easy workaround: if foo takes 4
arguments, then specify 5 as max_args, so the extra cruft will end up
in argv[5], which won't be used, thus ignored.
At the moment, I don't see any problem with it. Feel free to point out
some obvious mistake I made in my design.
(btw, I can post my current patch to you privately. I'd rather not
make it public in its current state :)
Cheers,
--
Gergely Nagy \ mhp/|8]
pgpwuo5oPQ_U_.pgp
Description: PGP signature