Xref: utzoo comp.lang.forth:5646 alt.sources.amiga:198 Path: utzoo!utgpu!news-server.csri.toronto.edu!rpi!zaphod.mps.ohio-state.edu!swrinde!elroy.jpl.nasa.gov!decwrl!apple!well!jax From: jax@well.sf.ca.us (Jack J. Woehr) Newsgroups: comp.lang.forth,alt.sources.amiga Subject: Access Amiga ENV: Variables in JForth (Short) Keywords: source,code,example Message-ID: <23895@well.sf.ca.us> Date: 28 Mar 91 04:58:20 GMT Lines: 42 \ getenv.f ... environment variable fetching in jforth 2.0 \ (C) 1991 jack j. woehr jax@well.UUCP JAX on GEnie \ Permission to use freely is hereby granted. ANEW TASK-GETENV $ 100 constant env$bufln " ENV:" create env$buf \ -- $addr count dup allot \ -- addr ct env$buf swap move \ -- here env$bufln allot \ -- here constant (env$buf) \ -- : env$buf.init (env$buf) env$bufln 0 fill ; \ get an environment variable up to ENV$BUFLN long from a counted string : getenv ( $adr -- addr ct) env$buf.init count (env$buf) swap move env$buf 0fopen dup if dup (env$buf) env$bufln fread swap fclose then (env$buf) swap ; \ Typical usage \ \ " EDITOR" GETENV \ \ ... would yield addr and (possibly zero) count of EDITOR environment string. \ *** End of GETENV.F -- < Member, > /// ///\\\ \\\ /// < X3J14 TC > /// /// \\\ \\\/// < for ANS > \\\ /// ///====\\\ ///\\\ < Forth > \\\/// /// \\\ /// \\\