[comp.sys.mac] MPW2.0 bug/feature

ranson@crcge1.UUCP (D. Ranson CNET) (09/24/87)

I have stumbled on an annoying bug or feature of MPW2.0 . When you create a
menu item containing a multi-line command (eg. If), the Suspend/Resume
scripts do not work properly. Suspend saves the user menu items by calling
AddMenu without parameters. AddMenu writes the menu rebuilding commands with
hard quotes (') around everything for security. With an If command, this gives
something like:
AddMenu 'MenuName' 'MenuItem' 'If condition
    commands
    end'
with no deltas at ends of lines (actually deltas wouldn't help). Of course,
this command with a hard-quoted string spread on several lines is not syntac-
tically correct.
In fact, the only way I have found to write such commands is to use "-quotes
and to put deltas in front of all special characters. AddMenu is not smart
enough to recreate that.
   Daniel Ranson
   ...!seismo!mcvax!inria!{crcge1 or cnetlu}!ranson

florman@randvax.UUCP (Bruce Florman) (10/01/87)

> I have stumbled on an annoying bug or feature of MPW2.0 . When you create a
> menu item containing a multi-line command (eg. If), the Suspend/Resume
> scripts do not work properly. Suspend saves the user menu items by calling
> AddMenu without parameters. AddMenu writes the menu rebuilding commands with
> hard quotes (') around everything for security. With an If command, this gives
> something like:
> AddMenu 'MenuName' 'MenuItem' 'If condition
>     commands
>     end'
> with no deltas at ends of lines (actually deltas wouldn't help). Of course,
> this command with a hard-quoted string spread on several lines is not syntac-
> tically correct.
> In fact, the only way I have found to write such commands is to use "-quotes
> and to put deltas in front of all special characters. AddMenu is not smart
> enough to recreate that.

Try creating the menu item like this:

Addmenu MenuName ItemName 'If condition ; <delta>
	command ; <delta>
    end'

The semicolons are equivalent to EOLs.  When AddMenu writes the item out
to the SuspendState file, it will look like:

Addmenu MenuName ItemName 'If condition ; 	command ;    end'

This is syntactically correct.
-- 
========================================================================
florman@rand-unix.ARPA
{decvax,sdcrdcf,trwrb,trwspf,vortex}!rand-unix!gnu!florman

"There is no limit to the amount of good that people can accomplish,
 if they don't care who gets the credit."
							- Anonymous