This section explains the steps you'll use to make a new MH command version. Some of the steps need to be done only once before making the first new command version.
For example, you can make a new version of the scan command called tscan. After this, if you type the command scan, it will work the way it always has. But if you use tscan, it will automatically use the -form scan.timely switch to show the date in a different style, as shown in the following example:
% scan 3-5 3 02/04*To:firstname.lastname@example.org Problems with maxa<<Vicki, I thi 4 12/14 To:uunet!xyz!pamb Holiday Greetings<<Pam, I just w 5 04/06 email@example.com rcvtty -- how do I use it?<<I've % tscan 3-5 3 Sun *To:firstname.lastname@example.org Problems with maxa<<Vicki, I thi 4 14Dec To:uunet!xyz!pamb Holiday Greetings<<Pam, I just w 5 Apr92 email@example.com rcvtty -- how do I use it?<<I'veLet's start with a summary of the steps. Do these steps only once before making the first version (the Section Setup Before You Make First New Version explains how to do that):
This section has overall setup that you'll only need to do once.
Making a bin Directory, Setting Search Path
You need a place to put your new MH programs. This can be a directory on your account. Or, if several people want to use these programs, you could pick any other directory -- as long as you have write access to it. Usually, the directory's name is something like bin. Here are the steps:
% cd % mkdir bin
% echo $PATH ...:/u/walt/bin:...If the directory isn't in your PATH, add it. Do that by editing the PATH=... line in your .profile file or the set path=(...) line in your .cshrc or .login file. Add the full pathname of the directory to the end of the PATH. Then, for the Bourne and Korn shells, type the command:
$ . .profileFor the C shell, type one of these commands, depending on which file you changed:
% source .cshrc % source .loginFinally, if other people are sharing the directory, use a command like chmod go+rx bin to give them access.
Finding the Best Way to Make New Versions
The first time you make a new command version, you'll need to figure out how to do it on your particular account and computer. There are a few different ways. Here's how to decide which one is best for you:
For example, to make the version of scan called tscan, you first find where the scan program is stored. (There are instructions for doing that below.) Then, you cd to your bin directory and type commands like:
% ln -s /usr/local/mh/scan tscan % ls -l tscan lrwxrwxrwx 1 eds 16 Jul 1 14:32 tscan -> /usr/local/mh/scan % ls -lL tscan -rwxr-xr-x 1 root 81920 May 26 19:04 tscanThe ls -l command shows the link itself and the ls -lL command shows the file that the link "points to."
There's one thing to watch out for: each symbolic link takes a block of disk space. If you're short on disk space and you plan to make a lot of symbolic links, you may want to use one of the three other methods below.
Hard links are good because they take virtually no filesystem space. But they won't work if the programs you want to link to are on a different filesystem. (If you're not sure whether the program is on a different filesystem, try to make the link and see if it works, or ask a local expert.)
Another problem with hard links can happen when the system administrator installs a new version of the program you're linked to. Unless the administrator is careful, you could end up with a link to the old version of the program, instead of the new one! (There's one workaround here: the system administrator could make a system directory and put the hard links there for everyone on the system to use.) The bottom line: if you want to make hard links, talk to your system administrator.
Here's how to make a hard link. For example, to make the version of scan called tscan, you'd first find where the scan program is stored. Then, you'd cd to your bin directory and type commands like:
% ln /usr/local/mh/scan tscan % ls -li /usr/local/mh/scan tscan 13256 -rwxr-xr-x 2 root 81920 May 26 19:04 /usr/local/mh/scan 13256 -rwxr-xr-x 2 root 81920 May 26 19:04 tscanIf you make hard links, it's a good idea to use ls -li every so often, to compare the original program with your link. If the two listings are different (except for the names), your link to the system version was broken.
To set up execit, edit a simple table of renamed commands in a file called execit.include. Then compile the execit.c file with one command. Finally, run a shell script named execit.link to make the links for you:
% vi execit.include ...Add a line for tscan to the table... % cc -o execit execit.c % execit.linkThe execit.link script makes as many hard links to the execit program as you need, one link per version. If you're making many command versions, this can save disk space as compared to symbolic links.
After you've done the first-time setup in the Section Setup Before You Make First New Version (which you only need to do once), you're ready for this section. Here are the overall steps to do each time you make a new version of an MH command:
% man 1 tscan No manual entry for tscan in section 1. % which tscan no tscan in . /xxx/ehuser/bin /usr/bin/X11 /usr/local/bin ... % whereis tscan tscan: $ whence tscan
tscan: -form scan.timelyBe sure not to leave any blank lines in the file.
% which scan % whereis scan $ whence scanThe answer should be a pathname, something like /usr/local/mh/scan.
If you still can't find it, type ls in the MH binary directory or ask an expert for help.
tscan: command not foundthere's a problem with your shell's search path, your link, or your execit.include file. Reread these instructions carefully -- if that doesn't help, it's time to get your guru. Once you get the hang of these steps, it only takes a minute to add a new command version.
This file is from the third edition of the book MH & xmh: Email for Users & Programmers, ISBN 1-56592-093-7, by Jerry Peek. It is freely available; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation. For more information, see COPYING.
Copyright © 1991, 1992, 1995 O'Reilly Media, Inc.
Last modified: 2006-05-31 15:13:43 -0700