50 lines
901 B
C
50 lines
901 B
C
#include <stdio.h>
|
|
#include <unistd.h>
|
|
#include <fcntl.h>
|
|
|
|
/* Compiler version */
|
|
#define RIFLE_VERSION "0.0.1"
|
|
|
|
static void
|
|
help(void)
|
|
{
|
|
printf(
|
|
"The Rifle compiler - rack, bang bang\n"
|
|
"------------------------------------\n"
|
|
"[-h] Display this help menu\n"
|
|
"[-v] Display the version\n"
|
|
);
|
|
}
|
|
|
|
static void
|
|
version(void)
|
|
{
|
|
printf(
|
|
"The Rifle compiler - rack, bang bang\n"
|
|
"------------------------------------\n"
|
|
"Copyright (c) 2026, Ian Moffett\n"
|
|
"Version v%s\n",
|
|
RIFLE_VERSION
|
|
);
|
|
}
|
|
|
|
int
|
|
main(int argc, char **argv)
|
|
{
|
|
int opt;
|
|
|
|
/* Begin parsing command line options */
|
|
while ((opt = getopt(argc, argv, "hv")) != -1) {
|
|
switch (opt) {
|
|
case 'h':
|
|
help();
|
|
return -1;
|
|
case 'v':
|
|
version();
|
|
return -1;
|
|
}
|
|
}
|
|
|
|
return 0;
|
|
}
|