24 lines
380 B
C
24 lines
380 B
C
#include "env.h"
|
|
#include <pwd.h>
|
|
#include <stdbool.h>
|
|
#include <stdlib.h>
|
|
#include <unistd.h>
|
|
|
|
char *env_mc_root() {
|
|
char *env = getenv("MC_ROOT");
|
|
if (env == NULL) {
|
|
struct passwd *pw = getpwuid(getuid());
|
|
return pw->pw_dir;
|
|
}
|
|
|
|
return env;
|
|
}
|
|
|
|
bool env_mc_yes() {
|
|
return NULL != getenv("MC_YES");
|
|
}
|
|
|
|
bool env_mc_debug() {
|
|
return NULL != getenv("MC_DEBUG");
|
|
}
|