[comp.sys.atari.st] _shell_p standardization: a suggest

braner@batcomputer.UUCP (05/27/87)

[]

Another solution to the shell-existance checking is to keep the _shell_p
vector pointing to executable code (as described here recently) but
put some ID info just before that code.  (That is of course impossible
if you write your shell in C with a compiler that does not allow in-line
assembly.  End of plug :-)

This is similar to my protocol for RAM-resident utilities.  I suggest that
the long word starting at offset -8 from [the address _shell_p points to]
hold an ID string, and the next long word hold a magic number.   So a
calling program can do: (loose syntax here)

struct shellid {
	long	id
	long	magic
};
struct shellid *sp;
long addr;
typedef int fri();	/* function returning an int */
...
addr = *(long *) SHELL_P;
sp = (struct shellid *) (addr-8);
if (sp->magic != MAGIC) CrashAndBurn();
if (sp->id == JOHN) say("hi, john!");
return ((fri *)addr(command));

Now how do we choose the value of MAGIC?  (How about ASCII of "!SH!"?)

- Moshe Braner