talmage@lti.UUCP (David Talmage) (08/23/89)
Icon Trouble Report Name David W. Talmage Address P. O. Box 8848 Salem, MA 01971-8848 Telephone (617) 894-4939 (home) Electronic mail address talmage@lti.uucp, talmage@luvthang.uucp Icon version 7.5 Computer Amiga Operating system AmigaDOS 1.3 Date 22 August, 1989 Description of the problem: Icon doesn't use AmigaDOS 1.3-style environment variables. This is easy enough to fix. Enclosed is are getenv() and setenv(), two Icon procedures for manipulating environment variables. You may distribute them freely. Approximately: # Amiga-specific getenv that uses AmigaDOS 1.3-style environment variables. # # parameters: # environment_variable a string that names some environment # variable # # returns: # if environment_variable exists, getenv() returns the string value # of environment_variable. # # if environment_varable does not exist, getenv() fails. # procedure getenv( environment_variable ) local value # if environment_variable exists, this is its value local env_file # the file in ENV: that represents environment_variable # fail if environment_variable doesn't exist (env_file := open( "ENV:"||environment_variable, "r" ) ) | fail # fail if environment_variable doesn't exist (value := read( env_file ) ) | fail close( env_file ) return value # environment variable exists end # getenv # Amiga-specific setenv that uses AmigaDOS 1.3-style environment variables. # # parameters: # environment_variable a string that names some environment # variable # # value a string containing the new value of # environment_variable # # returns: # if setenv() can create or modify environment_variable, it returns # value. # # if setenv() cannot create or modify environment_variable, it fails. # # procedure setenv( environment_variable, value ) local env_file # the file in ENV: that represents environment_variable # fail if we cannot create or modify #environment_variable (env_file := open( "ENV:"||environment_variable, "w" ) ) | fail # fail if we cannot modify environment_variable (write( env_file, value ) ) | fail close( env_file ) return value # we can create or modify environment_variable end # setenv Attach additional information, listings, enclose source code, etc., as appropriate. Send to: Icon Project Department of Computer Science Gould-Simpson Building The University of Arizona Tucson, AZ 85721 U.S.A. (602) 621-2018 icon-project@arizona.edu (Internet) ... {uunet, allegra, noao}!arizona!icon-project (uucp) IPD46a June 2, 1989