Commit: 02d2d8351c9a7f1e8f17f106effb3583ee5e08b9
Parent: 4676a851f8adb80513b1ac5bb081e26829034db1
Author: Randy Palamar
Date: Mon, 16 Aug 2021 16:54:02 -0600
oboeru: make the cardid printing fmt configurable
this is so that the printing width can be changed
Diffstat:
2 files changed, 5 insertions(+), 2 deletions(-)
diff --git a/config.def.h b/config.def.h
@@ -17,5 +17,8 @@
/* should be < 1. this leads to exponential decay */
#define SHRINK_RATE (0.66)
+/* card id formatting. needs to use ld */
+#define CARDID "%05ld"
+
/* format for times in the output deck file */
const char *timefmt = "%Y年%m月%d日%H時%M分";
diff --git a/oboeru.c b/oboeru.c
@@ -37,7 +37,7 @@ typedef struct node {
} Node;
static const char *scanfmt = "%ld" DELIM "%s" DELIM "%s" DELIM "%d" DELIM "%[^\n]";
-static const char *logfmt = "%05ld" DELIM "%s" DELIM "%s" DELIM "%d" DELIM "%s\n";
+static const char *logfmt = CARDID DELIM "%s" DELIM "%s" DELIM "%d" DELIM "%s\n";
static Node *head;
static size_t n_reviews;
@@ -223,7 +223,7 @@ review_loop(Card *r[], const char *decks[], const char *fifo)
};
for (i = 0; i < n_reviews; i++) {
- fprintf(stdout, "%s\t%ld\n", decks[r[i]->deck], r[i]->id);
+ fprintf(stdout, "%s\t"CARDID"\n", decks[r[i]->deck], r[i]->id);
reply[0] = 0;
fd = open(fifo, O_RDONLY);