blob: 076b0765f13b4b89e7aea32edf5b8ce17b4e5cdc [file] [log] [blame]
# -- url_query
#
# Build a URL query starting from a list of parameter-value
# pairs. If the list size is odd the last element in the list
# is discarded. Values in the list are escaped using
# ::rivet::escape_string
namespace eval ::rivet {
proc url_query {args} {
set args_list $args
set urlarg ""
while {[llength $args_list] > 1} {
set args_list [lassign $args_list par val]
lappend urlarg "$par=[::rivet::escape_string $val]"
}
return [join $urlarg "&"]
}
}