aboutsummaryrefslogtreecommitdiff
path: root/sys/etc/envindir.x
diff options
context:
space:
mode:
authorJoe Hunkeler <jhunkeler@gmail.com>2015-08-11 16:51:37 -0400
committerJoe Hunkeler <jhunkeler@gmail.com>2015-08-11 16:51:37 -0400
commit40e5a5811c6ffce9b0974e93cdd927cbcf60c157 (patch)
tree4464880c571602d54f6ae114729bf62a89518057 /sys/etc/envindir.x
downloadiraf-osx-40e5a5811c6ffce9b0974e93cdd927cbcf60c157.tar.gz
Repatch (from linux) of OSX IRAF
Diffstat (limited to 'sys/etc/envindir.x')
-rw-r--r--sys/etc/envindir.x31
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