uaa1006@dircon.co.uk (Peter Miles) (05/24/91)
I've got Informix 4GL (and RDS) version 2.10.03F. Can anyone tell me whether it's possible to read (and write) an environment variable from within a 4GL program? Please reply by mail and I'll summarise. -- Pete -- Pete Miles uaa1006@dircon.co.uk ...ukc!dircon!uaa1006
das@trac2000.ueci.com (David Snyder) (05/25/91)
In article <1991May23.220608.14498@dircon.co.uk>, uaa1006@dircon.co.uk (Peter Miles) writes: > > I've got Informix 4GL (and RDS) version 2.10.03F. > > Can anyone tell me whether it's possible to read (and write) > an environment variable from within a 4GL program? > You sure can! Here are the functions that we use... Here --------- Snip Here --------- Snip Here --------- Snip Here --------- Snip /* usr_funcs.c * This module contains 'C' functions that are used by Informix-4GL * at run-time. They should work with both RAPID and COMPILED 4GL. */ /******************************************************************************* * This function allows the getting of an environment variable from 4GL. * *******************************************************************************/ dbgetenv(arg) int arg; { char s[513], *getenv(); popquote(s, sizeof(s)); rtrim(s); retquote(getenv(s)); return(1); } /******************************************************************************* * This function allows the setting of an environment variable from 4GL. * *******************************************************************************/ dbputenv(arg) int arg; { static char s[513]; popquote(s, sizeof(s)); rtrim(s); retint(putenv(s)); return(1); } #include <ctype.h> #include <string.h> /******************************************************************************* * This function trims non-printing characters (including space) from the right * * side of a character pointer. * *******************************************************************************/ rtrim(s) char *s; { int i; for (i = strlen(s) - 1; i >= 0; i--) if (!isgraph(s[i]) || !isascii(s[i])) s[i] = '\0'; else break; } Here --------- Snip Here --------- Snip Here --------- Snip Here --------- Snip DAS -- David A. Snyder @ UE&C - Catalytic in Philadelphia, PA UUCP: ..!uunet!trac2000!das INTERNET: das@trac2000.ueci.com