The Section Changing Command Options with edprofile gives an overview of this script. Here is the edprofile script (you might want to open it in a separate browser window). To install it, see the Section Programs in This Book's Archive.
The command line parsing happens in several steps. After checking for a leading -v option and being sure that there are more arguments, a for loop stores all arguments until it finds an argument with double dashes ( -- ). The rest of the arguments will be message pathnames that xmh adds to all the commands that are run with XmhShellCommand() -- edprofile doesn't need these pathnames, so the script ignores them.
After the script finds the profile entry to edit, it starts the ed editor to do the job. ed isn't very helpful about telling you when there have been errors. The command ed - cancels all ed output except error messages (which are often just a question mark, ?). The script saves ed output in the errs shell variable and saves ed exit status, too. If $errs isn't empty or the ed exit status is not 0, an error is printed and the script quits. Otherwise, verbose information is printed if the -v switch was used.
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