The execit program lets you make multiple versions of MH commands. For an introduction, see the Section Setup Before You Make First New Version. You can see the program and include files by clicking on the links in the text below (you might want to open them in a separate browser window).
The main program, execit.c, is written in the original (pre-ANSI) C programming language; you may need to do a little editing if you have an ANSI C compiler that doesn't understand "old C." The other files are:
As Chapter 10 explains, MH programs check the name they're invoked with (from their argv) and change the way they work. The easiest way to make this happen with system programs is to make a new link (symbolic or "hard") to the program's executable code, like this:
% ln /usr/local/bin/folder /usr/myhome/bin/folderzThen, you can run folder with the name folderz.
That method has some problems. You can only make hard links (ln) if you have access to a directory on the same filesystem as the system executables. And some systems don't have symbolic links (ln -s). That's when you need execit. execit lets you define a table of system commands and the names you want to run them with. Then, you make a link to execit with the name of the program you want to run. It invokes the system program with the name you use. This way, you get fast execution of a system program with your own name. And, if you make new hard links to execit to define new program names, the links take almost no more filesystem space.
Here's an example of how to set up execit so it will run the program /usr/local/mh/repl, but make repl think its name is replx:
"replx", "/usr/local/mh/repl",The second string should be where repl is located on your system. (the Chapter Key Parts of the UNIX Filesystem has more information.) Be sure to make the line look just like that: quotes (") and commas (,). The execit.include file is read into the xref structure when you compile execit.c; the execit.link script also reads it.
% cc -o execit execit.c
ln execit replxIf you run ls -li, you can be sure previous links to execit still exist:
% ls -li execit replx tscan 2379 -rwx------ 3 jdpeek 35982 Feb 10 22:14 execit 2379 -rwx------ 3 jdpeek 35982 Feb 10 22:14 replx 2379 -rwx------ 3 jdpeek 35982 Feb 10 22:14 tscan ^^^^ ^ ^^^^^^^^^^^^ SAME SAME TODAY'S i-NUMS LINK COUNT DATE AND TIMEDelete any old links (that you've removed from the execit.include file).
replx: -switches -go -hereNow, assuming the directory with the links is in your shell's search path, you can run replx and pass the switch -query to it this way:
% replx -query
The execit.link shell script reads the execit.include file and automatically builds the links to execit. When you first install execit.link, you'll need to edit this line for your system:
dest=/xxx/yyy/bin # WHERE YOUR LINKS SHOULD GO
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.
Copyright © 1996, 1997, 1999, 2000, 2002, 2004 Jerry Peek
Last modified: 2006-05-31 15:13:43 -0700