minecraft-pi-reborn/mods/src/feature/feature.c
TheBrokenRail d0c2b98ca6
Some checks failed
minecraft-pi-reborn/pipeline/head There was a failure building this commit
2.0
2021-06-17 17:32:24 -04:00

27 lines
597 B
C

#include <stdlib.h>
#include <string.h>
#include <libreborn/libreborn.h>
#include "feature.h"
// Check For Feature
int feature_has(const char *name) {
char *env = getenv("MCPI_FEATURE_FLAGS");
char *features = strdup(env != NULL ? env : "");
char *tok = strtok(features, "|");
int ret = 0;
while (tok != NULL) {
if (strcmp(tok, name) == 0) {
ret = 1;
break;
}
tok = strtok(NULL, "|");
}
free(features);
#ifndef MCPI_SERVER_MODE
INFO("Feature: %s: %s", name, ret ? "Enabled" : "Disabled");
#endif
return ret;
}