bbl

Read, search and index the Bible on the command line -- Greek, Latin, KJV, Knox, RSV, and more
git clone git://git.wilsonrgheen.com/bbl
Log | Files | Refs | README | LICENSE

input.awk (788B)


      1 function is_set(scalar,     oldlint, isset){
      2     oldlint = LINT
      3     LINT = 0 # For warning about accessing an unset variable
      4     isset = (scalar != "" || scalar != 0)
      5     LINT = oldlint
      6     return isset
      7 }
      8 function envbool(str){
      9     return str in ENVIRON && ENVIRON[str] != "" && ENVIRON[str] != "0"
     10 }
     11 function envint(str, default_value, min, max, regex,     i){
     12     if (!is_set(regex)) {
     13         regex = "^-?[0-9]+$"
     14     }
     15 	if (str in ENVIRON && ENVIRON[str] ~ regex) {
     16         i = int(ENVIRON[str])
     17         if (is_set(min) && i < min) {
     18             return min
     19         } else if (is_set(max) && i > max) {
     20             return max
     21         } else {
     22             return i
     23         }
     24 	} else {
     25         return default_value
     26     }
     27 }
     28 function num(str){
     29     return (lang == "he") ? str : int(str)
     30 }