telodendria/Cytoplasm/examples/PrintArgsAndEnv.c

29 lines
512 B
C
Raw Permalink Normal View History

#include <Array.h>
#include <HashMap.h>
#include <Log.h>
2023-06-18 02:53:52 +00:00
int
2023-05-27 18:22:38 +00:00
Main(Array * args, HashMap * env)
{
2023-05-27 18:22:38 +00:00
size_t i;
char *key;
char *val;
2023-05-27 18:22:38 +00:00
Log(LOG_INFO, "Hello World!");
Log(LOG_INFO, "Arguments: %lu", ArraySize(args));
2023-05-27 18:22:38 +00:00
for (i = 0; i < ArraySize(args); i++)
{
Log(LOG_INFO, " [%ld] %s", i, ArrayGet(args, i));
}
2023-05-27 18:22:38 +00:00
Log(LOG_INFO, "Environment:");
while (HashMapIterate(env, &key, (void **) &val))
{
Log(LOG_INFO, " %s = %s", key, val);
}
2023-05-27 18:22:38 +00:00
return 0;
}