* Parse environment variable 'k' as a boolean (in various * possible spellings); if missing, use the default value 'def'. */
| 195 | * possible spellings); if missing, use the default value 'def'. |
| 196 | */ |
| 197 | int git_env_bool(const char *k, int def) |
| 198 | { |
| 199 | const char *v = getenv(k); |
| 200 | int val; |
| 201 | if (!v) |
| 202 | return def; |
| 203 | val = git_parse_maybe_bool(v); |
| 204 | if (val < 0) |
| 205 | die(_("bad boolean environment value '%s' for '%s'"), |
| 206 | v, k); |
| 207 | return val; |
| 208 | } |
| 209 | |
| 210 | /* |
| 211 | * Parse environment variable 'k' as ulong with possibly a unit |