getenv?

Bert Freudenberg bert at isgnw.CS.Uni-Magdeburg.De
Thu Feb 10 12:22:48 UTC 2000


On Wed, 9 Feb 2000, David T. Lewis wrote:

> On Wed, Feb 09, 2000 at 11:13:52AM -0800, Jesse Schell wrote:
> > 
> > Is there any support for getenv (or something like it) in Squeak?
> >
> 
> No, there is no direct support for getenv() in Squeak.
> [..but you can use OSProcess...]

With the FFI you can call getenv directly:

(ExternalLibraryFunction
        name: 'getenv' module: nil callType: 0
        returnType: ExternalType string
        argumentTypes: {ExternalType string})
                invokeWith: 'HOME'

Or make that a method:

------------------
Object subclass: #Unix
	instanceVariableNames: ''
	classVariableNames: ''
	poolDictionaries: ''
	category: 'System-Support'!

!Unix class methodsFor: 'stdlib' stamp: 'bf 2/10/2000 12:58'!
getenv: aString
	<cdecl: char* 'getenv' (char*)>
	^self externalCallFailed! !
------------------

and call it with "Unix getenv: 'HOME'" 

  -Bert-





More information about the Squeak-dev mailing list