lane@dalcs.UUCP (John Wright/Dr. Pat Lane) (02/20/88)
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
ralf@B.GP.CS.CMU.EDU (Ralf Brown) (02/21/88)
In article <2781@dalcs.UUCP> lane@dalcs.UUCP (John Wright/Dr. Pat Lane) writes: [all about the full pathname of the program following the environment] }Why don't all programs use the sensible approach [of finding their directory]? }is because this is an undocumented (an therefore unguarenteed) feature? May- }be it was not around in DOS 1 (who cares?). Curious. It is also not around in DOS 2.x, and a lot of people still run 2.x. The sensible thing to do (like Turbo C does) is to use this feature if running 3.x, and require some other way of finding the support files otherwise. }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 -- {harvard,uunet,ucbvax}!b.gp.cs.cmu.edu!ralf -=-=- AT&T: (412)268-3053 (school) ARPA: RALF@B.GP.CS.CMU.EDU |"Tolerance means excusing the mistakes others make. FIDO: Ralf Brown at 129/31 | Tact means not noticing them." --Arthur Schnitzler BITnet: RALF%B.GP.CS.CMU.EDU@CMUCCVMA -=-=- DISCLAIMER? I claimed something?
rde@eagle.ukc.ac.uk (R.D.Eager) (02/23/88)
Expires: Sender: Followup-To: This is documented in the Technical Reference for DOS 3.x. Not in an obvious place, but it's with all the stuff that says what's in the registers on entry to a program (I think). -- Bob Eager rde@ukc.UUCP ...!mcvax!ukc!rde Phone: +44 227 764000 ext 7589
madd@bu-cs.BU.EDU (Jim Frost) (02/26/88)
In article <4489@eagle.ukc.ac.uk> rde@ukc.ac.uk (R.D.Eager) writes: >This is documented in the Technical Reference for DOS 3.x. Not in an obvious >place, but it's with all the stuff that says what's in the registers on entry >to a program (I think). In the IBM Disk Operating System Technical Reference for PC-DOS 3.20, under "4BH - Load or Execute a Program (EXEC)", p. 6-173, is says: "Also inherited (or copied from the parent) is an "environment." This is a block of text strings (less than 32K bytes total) that convey various configuration parameters. The following is the format of the environment (always on a paragraph boundary): [table deleted] Typically the environment strings have the form: parameter=value Following the byte of zero in the environment, is a WORD that indicates the number of other strings following. Following this is a copy of the DS:DX filename passed to the child process. For example, the string VERIFY=ON could be passed. [...]" This is word-for-word. I have no clue why they put the description in the middle of the discussion of the environment, but that's where it is. I could not locate it in any other location, including the discussion of the PSP and the PSP map. This is for MS/PC-DOS 3.0 and greater only. This has all be said before, but it's sufficiently confusing that it comes up every few months. jim frost madd@bu-it.bu.edu