+package require cmdline
+
+#GLOBAL VALUES
+set VERSION "0.2"
+set USERAGENT "mtinyurl.tcl version $VERSION by http://sven.stormbind.net/misc"
+
+
+proc use_t {args_t} {
+ set uri http://tinyurl.com/create.php?
+ append uri [http::formatQuery url $args_t]
+ set curlopts [http::formatQuery url $args_t]
+ set shortname "http://tinyurl.com"
+ maketiny $uri $curlopts $shortname
+}
+
+proc use_j {args_j} {
+ set uri http://jbot.de/create.php
+ set curlopts [http::formatQuery url $args_j]
+ set shortname "http://jbot.de"
+ maketiny $uri $curlopts $shortname
+}
+
+proc maketiny {uri curlopts shortname} {
+ global USERAGENT
+ set chandle [curl::init]
+ $chandle configure -url $uri \
+ -useragent $USERAGENT \
+ -autoreferer 1 \
+ -followlocation 1 \
+ -postfields $curlopts \
+ -bodyvar rpage
+ $chandle perform
+ $chandle cleanup