This commit is contained in:
2026-07-28 14:46:10 -06:00
parent acc1ad834e
commit 5a6cb93bab
5 changed files with 0 additions and 81 deletions
-1
View File
@@ -1 +0,0 @@
make-db
-13
View File
@@ -1,13 +0,0 @@
CFLAGS= \
-std=c99 \
-Wall \
-O3 \
-Wextra
LIBS=ncurses sqlite3
CFLAGS+=$(shell pkg-config --cflags $(LIBS))
LDFLAGS+=$(shell pkg-config --libs $(LIBS))
SOURCES=$(wildcard *.c)
EXECUTABLES=$(patsubst %.c,%,$(SOURCES))
all: $(EXECUTABLES)
-17
View File
@@ -1,17 +0,0 @@
{ stdenv
, sqlite
, ncurses
, pkg-config
, progressbar
}:
stdenv.mkDerivation {
pname = "make-db";
version = "0.0.0";
nativeBuildInputs = [
sqlite
ncurses
pkg-config
progressbar.dev
];
}
-45
View File
@@ -1,45 +0,0 @@
#include <stdio.h>
#include <string.h>
#include <sqlite3.h>
#include <unistd.h>
const char *word_db_path = "../words.db";
const char *word_plaintext_path = "../words.gz";
char buf[2048] = "";
char *word = buf;
char *read_entry () {
const char *s = fgets (buf, 2048, stdin);
if (s == NULL) {
return NULL;
} else {
char *r = strchr (buf, '\t');
if (r != NULL) {
*r = '\0';
return r + 1;
} else {
return NULL;
}
}
}
int main () {
if (access (word_db_path, F_OK)) {
remove (word_db_path);
}
sqlite3 *db = NULL;
if (! sqlite3_open (word_db_path, &db) == SQLITE_OK) {
fprintf (stderr, "couldn't open sqlite: %s\n", sqlite3_errmsg (db));
} else {
fprintf (stderr, "sqlite open }:3\n");
char *s = read_entry ();
if (s == NULL) {
printf ("%s: %s\n", word, s);
}
}
return 0;
}
-5
View File
@@ -1,5 +0,0 @@
{ stdenv
, ncurses
}:
stdenv.mkDerivation {}