[comp.sys.mac.programmer] SysEnvirons inconsistency

lsr@Apple.COM (Larry Rosenstein) (03/01/88)

[This is a follow up to an article in comp.sys.mac, but it really belongs
here.] 

In article <46100075@uxe.cso.uiuc.edu> leonardr@uxe.cso.uiuc.edu writes:
>
>P.PRIAPUS@HAMLET.STANFORD.EDU(Bill ??) writes in comp.sys.mac
>
>>There is an inconsistency in Inside Macintosh V regarding the definition of
>>SysEnvirons. In the text it says that SysEnvirons expects to be passed a
>>pointer to a record which it will fill out with environment information. In
>>the end-chapter summary it says that SysEnvirons expects the actual record.

The Pascal version of the interface passes the record as a VAR parameter,
which is the same as passing a pointer.

>	As I understand the SysEnvirons call (don't have my IM in front of
>me so I am doing this from memory).  It takes the record itself and then
>fills it in based on the version number that you pass it.  I believe that
>if you ask for version 2 and there is only a version 1 that you will get
>version 1, but if you ask for version 1 and there is a version 2 it does
>not give you version 2.

If you ask for a smaller version than the call knows about, it will only
fill in the fields you ask for.  This prevents SysEnvirons from stomping on
memory.  If you ask for a larger version than the trap knows about, it will
fill in as much as possible and return an error.  Your program can check to
see how much information it got back.

Tech Note #129 (as well as Inside Mac vol 5) explains SysEnvirons.

-- 
		 Larry Rosenstein,  Object Specialist
 Apple Computer, Inc.  20525 Mariani Ave, MS 32E  Cupertino, CA 95014
	    AppleLink:Rosenstein1    domain:lsr@Apple.COM
		UUCP:{sun,voder,nsc,decwrl}!apple!lsr