Path: utzoo!mnetor!uunet!dalcs!lane From: lane@dalcs.UUCP (John Wright/Dr. Pat Lane) Newsgroups: comp.sys.ibm.pc Subject: Program pathname in the environment. Message-ID: <2781@dalcs.UUCP> Date: 20 Feb 88 08:45:06 GMT Organization: Math, Stats & CS, Dalhousie University, Halifax, NS, Canada Lines: 55 Keywords: DOS, environment, pathname, undocumented Hi. Here's a question for you folks who have debugged the heck out of DOS. I have noticed that in the enviroment of a running program there are the environment strings each terminated by a zero byte and the last one terminated by a second zero bytes. Everybody knows that and it's documented but then there's a byte which always contains '01' (and Iv'e debugged into COMMAND.COM to determine that it should always be '01'), followed by another zero byte, floowed by the path and filename of the program which is running, followed by a zero byte, followed by garbage (and I've debugged COMMAND.COM to find out that is unpredictable what goes here) up to the next paragraph boundary (I think). I've never seen any of that documented and I'd be curious to know if anybody out there has more detailed knowledge of this phenomenon or knows if/where it is documented. This is an interesting feature of DOS because it allows programs to determin in what directory thier executable file is and provides a sensible way to determin the "home" directory, ie. where the program can find overlays, help files, etc. Two major application programs I am aware of, WordPerfect (4.1) and Ashton-Tate's Rapidfile have no problem finding their overlay and help files when run by using a pathname other than the default in the command and I assume that is how they do it. Other programs, including programs from the above two firms, insists that you specify the home dircetory by some clumsy, arcane procedure such as including it on the PATH variable, setting a specific environment variable, or using a command line parameter. yeuchh. Why don't all programs use the sensible approach (dumb question I know)? Is is because this is an undocumented (an therefore unguarenteed) feature? May- be it was not around in DOS 1 (who cares?). Curious. PS to the above: As an alternative solution to the home directory problem for programs that do not support any means of specifying it, I am fond of using the APPEND program supplied with DOS 3.20. It's a nice way to set a temporary PATH without messing with enviroment variables and potentially running out of environment size. (BTW, I discovered how to set my default enviroment size with a patch to COMMAND.COM so this doesn't happen to me much anymore, but anyway...). Why, oh why, didn't Microsoft(-in-the-head :-) have APPEND hook the functions for EXEC, FIND FIRST and FIND NEXT. The omission of FIND FIRST is particularly galling as this is how most Fortrans (and C's i expect), *including Microsoft's*, open files. Oh well, I guess we all have our little crosses to bear. I'll be bearing mine away now. Anybody with comments to the above, please E-mail them as I had to give up reading the net regularly (:-() due to the fact that I have a job and a life (:-) no time anymore, you know). Cheers. JW. John Wright ////////////////// Phone: 902-424-3805 or 902-424-6527 Post: c/o Dr Pat Lane, Biology Dept, Dalhousie U, Halifax N.S., CANADA B3H-4H8 Cdn/Bitnet: lane@cs.dal.cdn Arpa: lane%dalcs.uucp@uunet.uu.net Uucp: lane@dalcs.uucp or {uunet,watmath,utai,garfield}!dalcs!lane -- John Wright ////////////////// Phone: 902-424-3805 or 902-424-6527 Post: c/o Dr Pat Lane, Biology Dept, Dalhousie U, Halifax N.S., CANADA B3H-4H8 Cdn/Bitnet: lane@cs.dal.cdn Arpa: lane%dalcs.uucp@uunet.uu.net Uucp: lane@dalcs.uucp or {uunet,watmath,utai,garfield}!dalcs!lane