diff options
Diffstat (limited to 'src/main.c')
-rw-r--r-- | src/main.c | 28 |
1 files changed, 28 insertions, 0 deletions
diff --git a/src/main.c b/src/main.c new file mode 100644 index 0000000..a40d841 --- /dev/null +++ b/src/main.c @@ -0,0 +1,28 @@ +#include <stdio.h> +#include <posthaste/core.h> + +static void usage(FILE *f, const char *pname) +{ + fprintf(f, "Usage:\n %s <filename>\n", pname); +} + +/** + * Main entry to posthaste. + * Checks command line and drives the rest of the language. + * + * Feels kind of weird documenting main, but doxygen warns about not + * doing it so whatever. + * + * @param argc Number of command line arguments. + * @param argv Array of command line arguments. + * @return \c 0 when succesful, non-zero otherwise. + */ +int main(int argc, char *argv[]) +{ + if (argc != 2) { + usage(stderr, argv[0]); + return -1; + } + + return run(argv[1]); +} |