Files
MentOS/programs/tests/t_getenv.c
T
Enrico Fraccaroli (Galfurian) 1b2bc49d41 Update license and remove unused files.
2022-01-27 15:12:36 -05:00

20 lines
457 B
C

/// @file t_getenv.c
/// @brief
/// @copyright (c) 2014-2022 This file is distributed under the MIT License.
/// See LICENSE.md for details.
#include <stdio.h>
#include <stdlib.h>
#include <sys/unistd.h>
#include <sys/wait.h>
int main(int argc, char *argv[])
{
char *ENV_VAR = getenv("ENV_VAR");
if (ENV_VAR == NULL) {
printf("Failed to get env: `ENV_VAR`\n");
return 1;
}
printf("ENV_VAR = %s\n", ENV_VAR);
return 0;
}