#include <fstream>
#include <iostream>
#include <cstdlib>
#include <cstring>
enum
{
ERR_NONE = 0,
ERR_ARGS,
};
int main(int argc, char *argv[])
{
if (argc < 2)
return ERR_ARGS;
if (!strcmp(argv[1], "home"))
else if (!strcmp(argv[1], "env"))
{
if (argc < 3)
return ERR_ARGS;
std::cout <<getenv(argv[2]) <<'\n';
}
else if (!strcmp(argv[1], "in"))
{
if (argc < 3)
return ERR_ARGS;
std::ifstream in{argv[2]};
std::string line;
if (!getline(in, line))
return ERR_ARGS;
}
else
return ERR_ARGS;
return 0;
}
std::string expand_env(const char *s)