deslop
This commit is contained in:
@@ -1 +0,0 @@
|
|||||||
make-db
|
|
||||||
@@ -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)
|
|
||||||
@@ -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
|
|
||||||
];
|
|
||||||
}
|
|
||||||
@@ -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;
|
|
||||||
}
|
|
||||||
@@ -1,5 +0,0 @@
|
|||||||
{ stdenv
|
|
||||||
, ncurses
|
|
||||||
}:
|
|
||||||
|
|
||||||
stdenv.mkDerivation {}
|
|
||||||
Reference in New Issue
Block a user