+proc epage {str} {
+ etxt $str
+}
+
+proc dospawn {} {
+ global pwd spawn_id
+
+ spawn -nottycopy \
+ w3m -config /dev/null -o cgi_bin=$pwd/tests file:///cgi-bin/wrap/Tsuffix
+
+ epage {You need to log in}
+}
+
+proc fillformfield {value} {
+ send "\t\r$value\r"
+}
+
+proc submitform-expect {wanttxt} {
+ send "\r"
+ etxt "loading file"
+ epage $wanttxt
+}
+
+proc loginas {user {password sesame} {wanttxt ACCESSGRANTED}} {
+ fillformfield $user
+ fillformfield $password
+ send "\t"
+ submitform-expect $wanttxt
+}