The following example uses the login name/password stored in the ATE configuration for the ftp name/password. The function to temporarily set a new name/password has not yet been implemented.
GET ZTERM/ATE ID:
?CHR(27);"?";
xcall GET,BUFFER,0,2,RCVD,1000
IF RCVD<2 goto NOT'ATE'ZTERM
xcall TINKEY,A$ ! extra char?
?CHR(27);"?";
xcall GET,BUFFER,0,3,RCVD,1000
IF RCVD<2 goto NOT'ATE'ZTERM
xcall TINKEY,A$ ! extra char?
?CHR(27);"?";
xcall GET,BUFFER,0,2,RCVD,1000
IF RCVD<2 or BUFFER#"ZT" goto NOT'ATE'ZTERM
?CHR(27);"?";
xcall GET,BUFFER,0,14,RCVD,200
? "VERSION=";BUFFER
Most AMxxx and WYxxx terminals will respond to ESC ? with 2 bytes indicating the (row and col each offset by 32). However, to be more robust, you should allow for the possibility that the terminal will not respond at all to ESC ?, or that it will give you an extra byte (possibly a trailing CR or a leading ^Y for columns > 96). The above code uses GETxs with the timeout option to input up to 2 chars, aborting after 1000 ms. It then uses TINKEY to grab any extra character without waiting. This sequence is repeated 4 times. After the 3rd time, ATE will respond with "ZT" (like ZTERM does). After the 4th time, it will return you "AV" following by the version string. (This is where you can distinguish ATE from ZTERM.)