summaryrefslogtreecommitdiff
path: root/snake.c
diff options
context:
space:
mode:
authorPreston Pan <preston@nullring.xyz>2023-02-06 02:04:44 -0800
committerPreston Pan <preston@nullring.xyz>2023-02-06 02:04:44 -0800
commit762bf741fd6db043f06448a19b554cc4946777e6 (patch)
tree17b2089bb7cb574db685fcc42caee5cf30553d13 /snake.c
parentfdedca4e02bfcafc1cac049c98c8fa202f8d4c24 (diff)
add version message; change binary name
Diffstat (limited to 'snake.c')
-rw-r--r--snake.c11
1 files changed, 11 insertions, 0 deletions
diff --git a/snake.c b/snake.c
index 6b4201f..9a88d26 100644
--- a/snake.c
+++ b/snake.c
@@ -4,6 +4,8 @@
#include <pthread.h>
#include <signal.h> //handling ctrl-c
#include <sys/ioctl.h> //terminal size
+#include <string.h> // argument parsing
+
#include "vector.h"
#include "snake.h"
#include "conio.h"
@@ -23,6 +25,15 @@ vector_t foodPos;
vector_t lastMoveDir;
int main(int argc, char **argv) {
+ for (int i = 0; i < argc; i ++) {
+ if (strcmp("--version", argv[i]) == 0) {
+ printf("snake3, version 1.0\n");
+ printf("Copyright 2023 Kai Stevenson\n");
+ printf("This software was licensed under the MIT license;\n");
+ printf("for more information, see the license file.\n");
+ return 0;
+ }
+ }
//get terminal size
struct winsize win;
ioctl(fileno(stdout), TIOCGWINSZ, &win);