From 40e5a5811c6ffce9b0974e93cdd927cbcf60c157 Mon Sep 17 00:00:00 2001 From: Joe Hunkeler Date: Tue, 11 Aug 2015 16:51:37 -0400 Subject: Repatch (from linux) of OSX IRAF --- sys/etc/envnext.x | 53 +++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 53 insertions(+) create mode 100644 sys/etc/envnext.x (limited to 'sys/etc/envnext.x') diff --git a/sys/etc/envnext.x b/sys/etc/envnext.x new file mode 100644 index 00000000..80ddf226 --- /dev/null +++ b/sys/etc/envnext.x @@ -0,0 +1,53 @@ +# Copyright(c) 1986 Association of Universities for Research in Astronomy Inc. + +include "environ.h" + +# ENV_FIRST -- Return a pointer to the first (most recently entered) entry +# in the environment list. A pointer to the string definition of the entry +# is returned as the output argument. + +pointer procedure env_first (valp) + +pointer valp # pointer to environment string +pointer el +include "environ.com" + +begin + el = envbuf + last + if (el > envbuf) { + valp = E_SETP(el) + return (el) + } else + return (NULL) +end + + +# ENV_NEXT -- Return a pointer to the next element in the environment list. +# A pointer to the string value of the element is returned as the output +# argument. + +pointer procedure env_next (last_el, valp, show_redefines) + +pointer last_el # pointer to last element returned +pointer valp # receives charp of next element define string +int show_redefines # do not skip redefined elements + +pointer el +include "environ.com" + +begin + el = envbuf + E_LASTELEM(last_el) + + while (el > envbuf) { + if (E_REDEF(el) == NO || show_redefines == YES) + break + else + el = envbuf + E_LASTELEM(el) + } + + if (el > envbuf) { + valp = E_SETP(el) + return (el) + } else + return (NULL) +end -- cgit