#define SWITCH '@'. there are 4 kinds of commands defined. SWITCH, SWITCH This just sends the SWITCH character through. Used to escape the switch character. SWITCH, SWITCH+n Switch to the stream n. Streams are numbered from 1. SWITCH, SWITCH-1, "%s" , 0 Do the control sequence "%s" on the local end. SWITCH, SWITCH-2, "%s" , 0 Do the control sequence on the remote end. SWITCH, SWITCH-3, "%s", 0 Pass the control sequence through to the remote client. This is how the results of commands are passed back to the client. A switch, switch-3 sequence is generated in the term server, and passed to the client. "%s" is simply a string of non-zero bytes. Brackets indicate optional items. Legal control sequences are. Option Returns status? C_NAME "%s" No "" Sets the name of this client to be '%s'. Returned by C_STATS Does not return success of failure. C_PUTENV "%s=%s" No "=" Puts a variable into the environment. This will be inherited by any C_EXEC commands. C_CLOSE "[%d]" No "[]" Close the current client's file, or the client number specified file. C_CLCLOSE "[%d]" No "[]" Close the current client, or the client number specified. C_DUMB No Downgrade clients status to dumb. All control message are now ignored, and all switch characters become escaped. Only makes sense as a local command. C_DUMP "%d" No "" Effectively makes term go dump for the next %d bytes. All command bytes are ignored in the data stream until %d bytes have passed. Measured from the first byte to be send after the C_DUMP command. Sending 0 means to go dumb permanently. C_CHMOD "%s\n%o [%ld [%ld]]" No "\n [ []]" Changes the mode of a file, and optionally the access time and modification time. Times are specified relative to the current time. C_SETPEERNAME "%d,%d,%d,%d,%d,%d" No ** cf. RFC 959 Changes the socket address that will be returned by C_GETPEERNAME. This is usefull, if the connection has been redirected. C_OPEN "%s [%ld [%o]]" Yes " [ []]>" To attach a O_RDWR|O_CREAT file to the file descriptor. (only makes sense as a remote command). C_UPLOAD "%s [%ld [%o]]" Yes " [ []]>" To attach a O_TRUNC|O_CREAT|O_TRUNC file to the file descriptor. (only makes sense as a remote command). C_DOWNLOAD "%s [%ld [%o]]" Yes " [ []]>" To attach a O_RDONLY file to the file descriptor. (only makes sense as a remote command). C_STAT "%s" "%ld %d %d %ld %ld %o" "" " " Returns the given stats for the specified file. is 0 for a file, 1 for a directory, and 2 for anything else. are 4+2+1 for (rwx). and is relative to the current time. C_UNLINK "%s" Yes "" Unlinks the specified file. C_EXEC "%s\254%s\%s\254%s\254 ...\254\254" Yes "\254\254\254...\254\254" Forks and exec's the above command. C_PTYEXEC "%s\254%s...\254\254" Yes "\254\254\254...\254\254" Same as C_EXEC, but opens a pty to execute it in first. This is how remote shells are spawned. C_BIND "%u [%d]" "%u" " []" "" Binds the remote port %d. If is greater than 0, will listen for connections. Otherwise you will need to use C_LISTEN. defaults to 5. See C_LISTEN. C_ACCEPT "%d" "%d,%d,%d,%d,%d,%d" "" ** cf. RFC 959 Tries to do an accept() on the socket indicated by the client number. The number is the result of a C_BIND command. C_X_SERVER Yes Tries to connect the display. C_SOCKET "%s" Yes Tries to open the unix domain socket with name "%s". C_PORT "[%s:]%d [%d]" Yes "[:] []" Tries to open a connection to on the host specified. defaults to "remotehost". If is 0, the socket will be closed and recreated, otherwise the existing socket will be used. defaults to 0. C_LISTEN "%d %d" No " " Listens to for connections on a bound socket. When a socket is ready accept()'ing, a client number is written to the stream. This number should be passed as a parameter to C_ACCEPT. It is acceptable to select() on the server socket until it is ready for reading. If it is ready for reading, then the socket must be ready for accepting. C_PRIORITY "%d" No "" Changes the client to the specified value. Normally priorities range from 20 to -20, with 20 allowed the most outgoing term traffic and -20 allowed the least. The local priority is separate from the remote priority. C_COMPRESS "%c" No "" Turns on and off compression respectively. The any of 'y','c','Y','C', '1' or '\01' means compress, and 'n', 'u', 'r', 'N', 'U', 'R', '0', or '\0' means don't compress. C_STATS "%d" Yes --> Varies "