diff options
author | Joseph Hunkeler <jhunkeler@gmail.com> | 2015-07-08 20:46:52 -0400 |
---|---|---|
committer | Joseph Hunkeler <jhunkeler@gmail.com> | 2015-07-08 20:46:52 -0400 |
commit | fa080de7afc95aa1c19a6e6fc0e0708ced2eadc4 (patch) | |
tree | bdda434976bc09c864f2e4fa6f16ba1952b1e555 /sys/etc/envindir.x | |
download | iraf-linux-fa080de7afc95aa1c19a6e6fc0e0708ced2eadc4.tar.gz |
Initial commit
Diffstat (limited to 'sys/etc/envindir.x')
-rw-r--r-- | sys/etc/envindir.x | 31 |
1 files changed, 31 insertions, 0 deletions
diff --git a/sys/etc/envindir.x b/sys/etc/envindir.x new file mode 100644 index 00000000..48902eee --- /dev/null +++ b/sys/etc/envindir.x @@ -0,0 +1,31 @@ +# Copyright(c) 1986 Association of Universities for Research in Astronomy Inc. + +include <syserr.h> + +# ENVINDIR -- Return the name of an environment variable which may be given +# by the value of another environment variable as "@envvar". + +procedure envindir (envvar, outstr, maxch) + +char envvar[ARB] # possibly indirect env. variable name +char outstr[ARB] # receives value of variable +int maxch + +pointer sp, envname +int envfind() +errchk syserrs + +begin + call smark (sp) + call salloc (envname, SZ_FNAME, TY_CHAR) + + call strcpy (envvar, outstr, maxch) + + while (outstr[1] == '@') { + call strcpy (outstr[2], Memc[envname], SZ_FNAME) + if (envfind (Memc[envname], outstr, maxch) <= 0) + call syserrs (SYS_ENVNF, Memc[envname]) + } + + call sfree (sp) +end |