2017-11-22 05:24:51 +00:00
|
|
|
#include <stdio.h>
|
|
|
|
#include <stdlib.h>
|
|
|
|
|
|
|
|
#include "log.h"
|
|
|
|
|
2017-12-06 22:43:30 +00:00
|
|
|
/*
|
|
|
|
* This function will establish the base environment that we want to use
|
|
|
|
* while we execute.
|
|
|
|
*/
|
2017-11-22 05:24:51 +00:00
|
|
|
static void
|
|
|
|
init()
|
|
|
|
{
|
2017-12-06 22:43:30 +00:00
|
|
|
// We're literally using stdout in this heavy phase of development.
|
|
|
|
log_open(stdout);
|
2017-11-22 05:24:51 +00:00
|
|
|
}
|
|
|
|
|
2017-12-06 22:43:30 +00:00
|
|
|
/*
|
|
|
|
* And this is the teardown function.
|
|
|
|
*/
|
2017-11-22 05:24:51 +00:00
|
|
|
static void
|
|
|
|
finish()
|
|
|
|
{
|
|
|
|
log_close();
|
|
|
|
}
|
|
|
|
|
2017-12-06 22:43:30 +00:00
|
|
|
/*
|
|
|
|
* This is what will run when the program begins, if you were new to how
|
|
|
|
* C works.
|
|
|
|
*/
|
2017-11-22 05:24:51 +00:00
|
|
|
int
|
|
|
|
main(int argc, char **argv)
|
|
|
|
{
|
|
|
|
init();
|
|
|
|
|
2017-12-06 22:43:30 +00:00
|
|
|
// When we exit, we want to wrap up a few loose ends. This syscall
|
|
|
|
// will ensure that `finish()` runs whether we return from main
|
|
|
|
// successfully or if we run `exit()` from elsewhere in the program.
|
2017-11-22 05:24:51 +00:00
|
|
|
atexit(finish);
|
|
|
|
|
2017-12-06 22:43:30 +00:00
|
|
|
// ha ha ha ha #nervous #laughter
|
2017-11-22 05:24:51 +00:00
|
|
|
printf("Hello, world\n");
|
|
|
|
}
|