• Top
    • Documentation
    • Books
    • Boolean-reasoning
    • Projects
    • Debugging
    • Std
    • Proof-automation
    • Macro-libraries
    • ACL2
      • Theories
      • Rule-classes
      • Proof-builder
      • Recursion-and-induction
      • Hons-and-memoization
      • Events
      • Parallelism
      • History
      • Programming
        • Defun
        • Declare
        • System-utilities
        • Stobj
        • State
          • World
          • Io
          • Wormhole
          • Programming-with-state
            • Error-triple
            • Cbd
            • State-global-let*
            • Last-prover-steps
            • @
            • Assign
            • Read-run-time
            • Canonical-pathname
            • F-put-global
            • Unsound-eval
            • Setenv$
            • Er-progn
            • Read-ACL2-oracle
            • With-live-state
            • F-get-global
            • Getenv$
              • Pprogn
              • Get-real-time
              • Makunbound-global
              • Get-cpu-time
              • F-boundp-global
              • Probe-file
            • W
            • Set-state-ok
            • Random$
          • Mutual-recursion
          • Memoize
          • Mbe
          • Io
          • Defpkg
          • Apply$
          • Loop$
          • Programming-with-state
            • Error-triple
            • Cbd
            • State-global-let*
            • Last-prover-steps
            • @
            • Assign
            • Read-run-time
            • Canonical-pathname
            • F-put-global
            • Unsound-eval
            • Setenv$
            • Er-progn
            • Read-ACL2-oracle
            • With-live-state
            • F-get-global
            • Getenv$
              • Pprogn
              • Get-real-time
              • Makunbound-global
              • Get-cpu-time
              • F-boundp-global
              • Probe-file
            • Arrays
            • Characters
            • Time$
            • Defmacro
            • Loop$-primer
            • Fast-alists
            • Defconst
            • Evaluation
            • Guard
            • Equality-variants
            • Compilation
            • Hons
            • ACL2-built-ins
            • Developers-guide
            • System-attachments
            • Advanced-features
            • Set-check-invariant-risk
            • Numbers
            • Efficiency
            • Irrelevant-formals
            • Introduction-to-programming-in-ACL2-for-those-who-know-lisp
            • Redefining-programs
            • Lists
            • Invariant-risk
            • Errors
            • Defabbrev
            • Conses
            • Alists
            • Set-register-invariant-risk
            • Strings
            • Program-wrapper
            • Get-internal-time
            • Basics
            • Packages
            • Oracle-eval
            • Defmacro-untouchable
            • <<
            • Primitive
            • Revert-world
            • Unmemoize
            • Set-duplicate-keys-action
            • Symbols
            • Def-list-constructor
            • Easy-simplify-term
            • Defiteration
            • Fake-oracle-eval
            • Defopen
            • Sleep
          • Operational-semantics
          • Real
          • Start-here
          • Debugging
          • Miscellaneous
          • Output-controls
          • Macros
          • Interfacing-tools
        • Interfacing-tools
        • Hardware-verification
        • Software-verification
        • Math
        • Testing-utilities
      • Programming-with-state
      • ACL2-built-ins

      Getenv$

      Read an environment variable

      (Getenv$ str state), where str is a string, reads the value of environment variable str, returning a value of nil if none is found or if the read fails. (Exception: if the value is not a legal ACL2 string, say because it contains a character with char-code exceeding 255, then an error is signaled.) The logical story is that getenv$ reads its value from the oracle field of the ACL2 state. The return value is thus a triple of the form (mv erp val state), where erp will always be nil in practice, and logically, val is the top of the acl2-oracle field of the state (see read-ACL2-oracle) and the returned state has the updated (popped) acl2-oracle.

      Example:
      (getenv$ "PWD" state) ==> (mv nil "/u/joe/work" state)

      Also see setenv$.

      Function: getenv$

      (defun getenv$ (str state)
        (declare (xargs :stobjs state
                        :guard (stringp str)))
        (declare (ignore str))
        (read-acl2-oracle state))