From fa080de7afc95aa1c19a6e6fc0e0708ced2eadc4 Mon Sep 17 00:00:00 2001 From: Joseph Hunkeler Date: Wed, 8 Jul 2015 20:46:52 -0400 Subject: Initial commit --- sys/etc/envindir.x | 31 +++++++++++++++++++++++++++++++ 1 file changed, 31 insertions(+) create mode 100644 sys/etc/envindir.x (limited to 'sys/etc/envindir.x') 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 + +# 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 -- cgit