blob: 014233fbb93307f67c09df3d2222b67d746e253a [file] [log] [blame]
// Copyright 2018 The Fuchsia Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
#include "env.h"
#include <stdlib.h>
#include <string.h>
bool getenv_bool(const char* key, bool default_value) {
const char* value = getenv(key);
if (value == nullptr) {
return default_value;
}
if ((strcmp(value, "0") == 0) || (strcmp(value, "false") == 0) || (strcmp(value, "off") == 0)) {
return false;
}
return true;
}