Hello Andreas,
I get this error using your patch:
>> decode-cgi "name=val1&name=val2"
** Script Error: either expected false-block argument of type: block
** Where: add-nv
** Near: either none? val-ptr: find list
Am I doing something wrong?
Thank you and have a nice day
Will Arp
[EMAIL PROTECTED]
On 1.6.2002 14:27, Andreas Bolka <[EMAIL PROTECTED]> wrote:
> so here is another patched decode-cgi :) [also submitted to feedback]
>
> ; --- snip ---
> decode-cgi: func [
> {Converts CGI argument string to a list of words and value strings.}
> args [any-string!] "Starts at first argument word"
> /local list equate value name name-chars val plus-to-space
> ][
> add-nv: func [ list name value /local val-ptr ] [
> name: to-set-word name
> value: either none? value
> [ copy "" ]
> [ form dehex (replace/all value "+" " ") ]
>
> either none? val-ptr: find list name [
> append list compose [ (name) (value) ]
> ] [
> idx: index? next val-ptr
> poke list idx compose [ (pick list idx) (value) ]
> ]
> ]
>
> list: make block! 8
> name-chars: complement charset "&="
> equate: [ copy name some name-chars value]
> value: [ "=" value
> | "&" (add-nv list name "")
> | [ copy val to "&" "&" | copy val to end ]
> (add-nv list name val)
> ]
>
> parse/all args [some equate | none]
> list
> ]
> ; --- snap ---
--
To unsubscribe from this list, please send an email to
[EMAIL PROTECTED] with "unsubscribe" in the
subject, without the quotes.