mailgo — shell script for using mgt to automate email go games


mailgo [-r] [-n] [-c] [-e] [filename]


mailgo helps manage email games by processing Smart-Go game records received by mail, invoking mgt, and automatically sending your next move back.

Invoking mailgo with no flags instructs the program to search the specified file for a go game, ignoring mail headers or other such garbage. mailgo will invoke the game processor specified in the environment variable MAILGO or of this variable is undefined, will attempt to run mgt from the inherited path. If you give the filename -- then mailgo will read its input from stdin, allowing you to redirect messages into mailgo directly from your mailer. Your mail program may not support redirecting messages into external programs. Check it's man page to find out. This option to use stdin as the input is only valid if you give mailgo no other arguments. (Technical note: mgt is instructed to read its input from /dev/tty if you use this feature.)

If your opponent loses your move, you can resend the game with the -r switch.

To start a new game, use the -n switch. Without a file, you will be prompted for your address, your opponent's address, and the filename for both your and your opponent's local game record. The game processor will then be invoked for you to make the first move. If a filename is specified, the address and filename data is taken from that file.

The -c switch causes the program to delete any extraneous files it might have created during a previous run which was abnormally terminated. These files have the form: MailGo*

To edit the mailgo headers (including mail addresses, file names and game record format) or the game record, use the -e switch with the file name of the mailgo file you wish to edit. The file may be a saved mailgo mail message or a processed mailgo game file. The -e option will not mail changes because of the possibility of confusing addresses. To mail edited files, use 'mailgo <file>' for edited mail messages and 'mailgo -r <file>' for edited files which have been previously processed by mailgo.

mailgo also supports go board sizes of 9x9, 13x13 and 19x19. Handicaps maybe set to values of 2-4 for 9x9 games, 2-5 for 13x13 games and 2-9 for 19x19 games. Any other board size or handicap must be set behind mailgo's back.

File format

 TO: opponent@hissite
 TOFILE: his_game_record
 FROM: me@mysite
 FROMFILE: my_game_record
 FORMAT: format_code
 Smart-Go game data

 Trailing garbage ignored

The game data file contains a leading tag to indicate the start of the data. It contains both addresses, as should be used to mail the game files, and it contains the files to store the games in. In the example above, you are playing opponent@hissite, and the game is being stored in my_game_record.

The file format used can be either long, short, or extrashort indicated by L, S, and E respectively. The long format uses the full size Smart-Go file saved with no options from mgt. The extrashort format uses mgt with the -s option to save short format files. This format may cause problems for some mailers, however, because the lines will grow longer than 512 bytes. In any game record format, if very long comments are created, there is a danger of causing mailer problems. The short format is similar to the extrashort format but has extra newlines inserted. The short format is the default when selecting format from the prompt, but the long format is the default if a file contains no FORMAT line. When mailgo is used normally, the file specified on the command line is removed at successful completion, and the new game is saved to the file specified in the received game record. If the destination file does not look like a mailgo file, mailgo will query for confirmation.

When a new game is started, the first mailgo message contains the line NEWGAME inserted before the FORMAT line. This is used to check for the overwriting of old game records.



Smart-Go.def, the Smart-Go format definition.


mailgo tries to handle the case where you start a new game but do not make the first move. If after the first move you have a reason to convince mgt that you have changed the game record without really changing anything, you should enter and exit the comment editor.


Adrian Mariano (