Relay-Version: version B 2.10 5/3/83; site utzoo.UUCP Path: utzoo!utgpu!water!watmath!clyde!rutgers!sri-unix!sri-spam!ames!oliveb!pyramid!batcomputer!braner From: braner@batcomputer.UUCP Newsgroups: comp.sys.atari.st Subject: Re: _shell_p standardization: a suggestion Message-ID: <1150@batcomputer.tn.cornell.edu> Date: Tue, 26-May-87 19:26:47 EDT Article-I.D.: batcompu.1150 Posted: Tue May 26 19:26:47 1987 Date-Received: Thu, 28-May-87 06:35:25 EDT References: <2124@cwruecmp.UUCP> <1042@viper.Lynx.MN.ORG> Reply-To: braner@tcgould.tn.cornell.edu.UUCP (braner) Organization: Cornell Theory Center, Cornell University, Ithaca NY Lines: 30 Keywords: Gulam, _shell_p, system() Summary: yet another approach [] 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