Path: utzoo!attcan!utgpu!jarvis.csri.toronto.edu!cs.utexas.edu!usc!samsung!munnari.oz.au!murtoa.cs.mu.oz.au!ditmela!diemen!tasis!jmw From: jmw@tasis.utas.oz.au@munnari.oz (John Williams) Newsgroups: comp.sys.atari.st Subject: Did I come from the desktop? Keywords: Shell desktop Message-ID: <1147@diemen.cc.utas.oz> Date: 26 Nov 89 12:29:30 GMT Sender: root@diemen.cc.utas.oz Lines: 25 A recent article suggested three possible methods by which a process could determine whether it was being run from the desktop or from a shell. I'd like to suggest another method which works for me. I don't suggest that it is foolproof however. It simply requires moving the basepage ptr up to its parent until it becomes null. If this requires three iterations then the program is running from the desktop. Any more and it is running from a shell. The following piece of code works with MWC: int fromdesk() { BASEPAGE *bp; int i = 0; bp = (BASEPAGE **) BP->p_parent; while (bp != 0) { i++; bp = (BASEPAGE **) bp->p_parent; } return (i == 3); } John M Williams ACSnet: jmw@tasis.utas.oz ARPA: jmw%tasis.utas.oz@uunet.uu.net UUCP: {enea,hplabs,mcvax,uunet,ukc}!munnari!tasis.utas.oz!jmw