translit: now from koi8-u
[k8muffin.git] / src / tagsearch.c
blob7938979eab8dc02356f51eae720a4ddbe1d62e8a
1 #ifndef _BSD_SOURCE
2 # define _BSD_SOURCE
3 #endif
4 #ifndef _GNU_SOURCE
5 # define _GNU_SOURCE
6 #endif
7 #include <ctype.h>
8 #include <dirent.h>
9 #include <iconv.h>
10 #include <limits.h>
11 #include <stdint.h>
12 #include <stdio.h>
13 #include <stdlib.h>
14 #include <string.h>
15 #include <time.h>
16 #include <unistd.h>
18 #include <sys/stat.h>
19 #include <sys/types.h>
21 #include "libdbg/dbglog.h"
22 #include "translit.h"
24 #include "uthash.h"
27 ////////////////////////////////////////////////////////////////////////////////
28 #include "tagload.c"
29 #include "search.c"
32 ////////////////////////////////////////////////////////////////////////////////
34 ÎÁÞÁÌÏ: ×ÓÅ ÆÁÊÌÙ × ÓÐÉÓËÅ
36 /tag:
37 ÆÁÊÌÙ: ÕÂÉÒÁÅÍ ×ÓÅ, ÇÄÅ ÎÅ ×ÓÔÒÅÞÁÅÔÓÑ ÄÁÎÎÙÊ ÔÜÇ
39 /:artist/name
40 ÆÁÊÌÙ: ÕÂÉÒÁÅÍ ×ÓÅ, ÇÄÅ ÄÁÎÎÙÊ ÔÜÇ ÎÅ ×ÓÔÒÅÞÁÅÔÓÑ × artist
42 ÅÓÌÉ ÚÁËÁÎÞÉ×ÁÅÔÓÑ ÎÁ ÉÍÑ ÔÜÇÁ:
43 ÓÏÂÉÒÁÅÍ ×ÓÅ ÔÜÇÉ ÉÚ ÆÁÊÌÏ×, ÇÄÅ ÄÁÎÎÙÊ ÔÜÇ ×ÓÔÒÅÞÁÅÔÓÑ × ÓÏÏÔ×ÅÔÓÔ×ÕÀÝÅÍ ÐÏÌÅ
44 ÆÁÊÌÏ× ÎÅ ×ÏÚ×ÒÁÝÁÅÍ
45 ÉÎÁÞÅ:
46 ×ÏÚ×ÒÁÝÁÅÍ ×ÓÅ ÔÜÇÉ ÄÌÑ ×ÓÅÈ ÆÁÊÌÏ×
47 ×ÏÚ×ÒÁÝÁÅÍ ×ÓÅ ÆÁÊÌÙ
51 ////////////////////////////////////////////////////////////////////////////////
52 int main (int argc, char *argv[]) {
53 clock_t stt, ste;
54 dbglog_set_screenout(1);
55 dbglog_set_fileout(0);
57 stt = clock();
58 if (load_tagfile("tags.dat") != 0) { fprintf(stderr, "FATAL: can't open tagfile!\n"); return -1; }
59 ste = clock();
60 printf("database load time: %.15g seconds\n", (double)(ste-stt)/(double)CLOCKS_PER_SEC);
61 if (argc > 1) {
62 for (int f = 1; f < argc; ++f) {
63 dirinfo_t *di = list_dir(argv[f]);
64 // dump
65 dlogf("=====================\n");
66 for (int f = 0; f < di->fcount; ++f) dlogf(" [%s]\n", di->names[f]);
67 free(di->names);
68 free(di);
70 } else {
71 char s[128];
72 fgets(s, sizeof(s), stdin);
74 return 0;