From b4955284142f2f4767e75d36b73345087feee564 Mon Sep 17 00:00:00 2001 From: thing1 Date: Wed, 12 Feb 2025 19:07:51 +0000 Subject: init commit --- .gitignore | 1 + Makefile | 9 +++++++++ cards.h | 6 ++++++ flash.c | 19 +++++++++++++++++++ util.h | 8 ++++++++ 5 files changed, 43 insertions(+) create mode 100644 .gitignore create mode 100644 Makefile create mode 100644 cards.h create mode 100644 flash.c create mode 100644 util.h diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..980a7fc --- /dev/null +++ b/.gitignore @@ -0,0 +1 @@ +flash diff --git a/Makefile b/Makefile new file mode 100644 index 0000000..e3e36a2 --- /dev/null +++ b/Makefile @@ -0,0 +1,9 @@ +flash: flash.c cards.h + cc flash.c -o flash + +install: flash + cp flash /usr/local/bin/flash + +uninstall: + rm /usr/local/bin/flash + diff --git a/cards.h b/cards.h new file mode 100644 index 0000000..f86e8dd --- /dev/null +++ b/cards.h @@ -0,0 +1,6 @@ +#include "util.h" + +card cards[] = { + {"what is 2 + 2", "4"}, + {"what is 2 + 5", "7"}, +}; diff --git a/flash.c b/flash.c new file mode 100644 index 0000000..d8590d4 --- /dev/null +++ b/flash.c @@ -0,0 +1,19 @@ +#include +#include +#include + +#include "cards.h" + +int main() { +loop: + srand(time(NULL)); + int n = rand() % len(cards); + + printf("%s\n", cards[n].front); + getchar(); + printf("%s\n", cards[n].back); + + goto loop; + + return 0; +} diff --git a/util.h b/util.h new file mode 100644 index 0000000..9d27ab9 --- /dev/null +++ b/util.h @@ -0,0 +1,8 @@ +#define len(c) sizeof(c) / sizeof(c[0]) + +#define CARDMAX 512 + +typedef struct card { + char front[CARDMAX]; + char back[CARDMAX]; +} card; -- cgit v1.2.3