summary refs log tree commit diff
path: root/unscoop.c
diff options
context:
space:
mode:
authorJune McEnroe <june@causal.agency>2019-12-23 21:08:32 -0500
committerJune McEnroe <june@causal.agency>2019-12-23 21:08:32 -0500
commitde5f00d71614a5018a6468d5fd7e3cc039c41ec6 (patch)
tree4d4bf449f922b8e1e6031afca650adf91a03744b /unscoop.c
parentHandle NICK (diff)
downloadlitterbox-de5f00d71614a5018a6468d5fd7e3cc039c41ec6.tar.gz
litterbox-de5f00d71614a5018a6468d5fd7e3cc039c41ec6.zip
Factour out verbose, dbStep+reset
Diffstat (limited to '')
-rw-r--r--unscoop.c12
1 files changed, 5 insertions, 7 deletions
diff --git a/unscoop.c b/unscoop.c
index d9015a6..996b929 100644
--- a/unscoop.c
+++ b/unscoop.c
@@ -272,10 +272,8 @@ matchLine(const struct Format *format, const regex_t *regex, const char *line) {
 			bindMatch(insertEvent, param, line, match[1 + i]);
 		}
 
-		dbStep(insertName);
-		dbStep(insertEvent);
-		sqlite3_reset(insertName);
-		sqlite3_reset(insertEvent);
+		dbRun(insertName);
+		dbRun(insertEvent);
 		break;
 	}
 }
@@ -307,13 +305,14 @@ int main(int argc, char *argv[]) {
 	const struct Format *format = &Formats[0];
 
 	int opt;
-	while (0 < (opt = getopt(argc, argv, "C:DN:d:f:"))) {
+	while (0 < (opt = getopt(argc, argv, "C:DN:d:f:v"))) {
 		switch (opt) {
 			break; case 'C': context = optarg;
 			break; case 'D': dedup = true;
 			break; case 'N': network = optarg;
 			break; case 'd': path = optarg;
 			break; case 'f': format = formatParse(optarg);
+			break; case 'v': verbose = true;
 			break; default:  return EX_USAGE;
 		}
 	}
@@ -391,8 +390,7 @@ int main(int argc, char *argv[]) {
 			bindMatch(insertContext, ":context", argv[i], pathContext);
 			bindMatch(insertEvent, ":context", argv[i], pathContext);
 		}
-		dbStep(insertContext);
-		sqlite3_reset(insertContext);
+		dbRun(insertContext);
 
 		ssize_t len;
 		while (0 < (len = getline(&line, &cap, file))) {