#!/bin/sh # usage: dred [switches] files exec java -jar $HOME/bin/Dred.jar "$@" &
#!/bin/sh # usage: ted [switches] files exec java -jar $HOME/bin/Dred.jar --wait "$@"
java -jar Dred.jar --serve[=####] files
If the port number (=####) appears, and the given port is not currently in use, then the program starts serving the current user on that port. If the port number appears, and the given port responds to an inquiry that indicates that a Dred server is operating at that port, then editing sessions are started on that server for the files; otherwise it finds an unused port, starts serving on that, and starts editing sessions on that server for the files.
To discover what port the most-recently activated Dred server is active on use the command
java -jar Dred.jar --servingwhich succeeds (Unix exit 0) and outputs the port number if there is an active server, and fails (Unix exit 1) and outputs 0 otherwise.
An editing request takes the form
GET /edit?CWD=workingdirectory&FILE=absolutefilename&WAIT=true or false&ENCODING=encoding name
The WAIT and ENCODING parameters can be omitted, in which case they are taken, respectively, to be false, and UTF8.
The server responds by starting an editing session for the given file using the given working directory as the session's effective working directory.
If WAIT is true, then when the session is terminated an HTTP response is generated; otherwise the HTTP response is generated immediately.
The given ENCODING is taken to be the encoding of the file.
The server also honours requests for Dred's documentation files. The Help/Browse Help with Mozilla (etc) menu actions are implemented by aiming the browser at Dred's built-in server port (####), using the command:
It's possible, though not much use, to run Dred in server mode on Windows. By preventing the opening of local ports without administrator permission XP Service pack 2 makes it slightly tedious to do this. The best thing to do (if you are sure you want a proper server and not a pseudo-server) is to allocate a fixed port for Dred and make appropriate arrangements with the administrator to unblock that port. If your administrator wants to know why this is secure, explain that Dred only accepts connections from the host on which it's running.
Bernard Sufrin $Revision: 113 $ $Date: 2005-06-30 12:29:14 +0100 (Thu, 30 Jun 2005) $