Commit: 4d637ac454e7b35a51d2bd93fcba8dcdea8a9ce0
Parent: a783739a0eb5b7451b0c725db61747c9b253b14f
Author: Randy Palamar
Date: Mon, 23 Aug 2021 19:06:13 -0600
oboeru: make DELIM configurable via config.h
note this only effects the ledger format. oboeru{data,http} still expect
tab seperated fields
Diffstat:
2 files changed, 5 insertions(+), 2 deletions(-)
diff --git a/config.def.h b/config.def.h
@@ -20,5 +20,9 @@
/* card id formatting. needs to use ld */
#define CARDID "%05ld"
+/* string used as a field delimiter */
+/* don't set this to a string that could appear in fields */
+#define DELIM "\t"
+
/* format for times in the output deck file */
const char *timefmt = "%Y年%m月%d日%H時%M分";
diff --git a/oboeru.c b/oboeru.c
@@ -15,7 +15,6 @@
#include "config.h"
#define BUF_SIZE BUFSIZ
-#define DELIM "\t" /* fixed unless a better parser gets implemented */
enum {
CARD_PASS,
@@ -36,7 +35,7 @@ typedef struct node {
struct node *next;
} Node;
-static const char *scanfmt = "%ld" DELIM "%s" DELIM "%s" DELIM "%d" DELIM "%[^\n]";
+static const char *scanfmt = "%ld" DELIM "%[^"DELIM"]" DELIM "%[^"DELIM"]" DELIM "%d" DELIM "%[^\n]";
static const char *logfmt = CARDID DELIM "%s" DELIM "%s" DELIM "%d" DELIM "%s\n";
static Node *head;