You are looking at historical revision 35166 of this page. It may differ significantly from its current revision.
posix-utils
Documentation
Miscellaneous Posix related routines.
string-trim-eol
[procedure] (string-trim-eol STR) -> stringRemoves last instance of the platform dependent EOL character sequence from the string STR.
software-eol-string
[constant] software-eol-stringPlatform dependent EOL character sequence string.
environment-variables->environment-list
[procedure] (environment-variables->environment-list EVS) -> (list-of string)Returns a list of "VAR=VAL" from the environment variables association-list EVS.
environment-variable-bound?
[procedure] (environment-variable-bound? VARNAM) -> (or boolean string)Does the environment variable VARNAM exist with a non-null value?
VARNAM is a string.
FOO=1 BAR= csi -q -R posix-utils #;1> (environment-variable-bound? "FOO") #t #;2> (environment-variable-bound? "BAR") #f
environment-variable-true?
[procedure] (environment-variable-true? VARNAM [TRUE-LIST '("y" "yes" "1")]) -> booleanIs the environment variable VARNAM lowercase value in TRUE-LIST?
VARNAM is a string. TRUE-LIST is a (list-of string) recognized as true values.
FOO=1 BAR= csi -q -R posix-utils #;1> (environment-variable-true? "FOO") #t #;2> (environment-variable-true? "BAR") #f
register-environment-variable-feature!
[procedure] (register-environment-variable-feature! VARNAM) -> (or boolean symbol)Registers an existing VARNAM value as a feature. Returns #f or the registered feature symbol.
VARNAM is a string.
get-shell-variable
[procedure] (get-shell-variable VARNAM) -> (or boolean string)Returns the shell variable VARNAM value.
VARNAM is a string.
shell-variable-bound?
[procedure] (shell-variable-bound? VARNAM) -> (or boolean string)Does the shell variable VARNAM exist with a non-null value?
VARNAM is a string.
shell-variable-true?
[procedure] (shell-variable-true? VARNAM [TRUE-LIST '("y" "yes" "1")]) -> booleanIs the shell variable VARNAM lowercase value in TRUE-LIST?
VARNAM is a string. TRUE-LIST is a (list-of string) recognized as true values.
register-shell-variable-feature!
[procedure] (register-shell-variable-feature! VARNAM) -> (or boolean symbol)Registers an existing VARNAM value as a feature. Returns #f or the registered feature symbol.
VARNAM is a string.
#;1> (register-shell-variable-feature! "OSTYPE") darwin7 ;ymmv
Usage
(require-extension posix-utils)
Author
Version history
- 1.1.0
- Added string-trim-eol , software-eol-string, environment-variables->environment-list, register-environment-variable-feature!, get-shell-variable, shell-variable-bound?, shell-variable-true?, register-shell-variable-feature!
- 1.0.0
- Created.
License
Copyright (C) 2010-2018 Kon Lovett. All rights reserved.
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the Software), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED ASIS, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.