aboutsummaryrefslogtreecommitdiff
path: root/src/shell.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/shell.c')
-rw-r--r--src/shell.c34
1 files changed, 34 insertions, 0 deletions
diff --git a/src/shell.c b/src/shell.c
index 6e67e0a..31dde0e 100644
--- a/src/shell.c
+++ b/src/shell.c
@@ -3,6 +3,27 @@
3static void cleanwhitespaces(char *line); 3static void cleanwhitespaces(char *line);
4static int parseline(char *line, char **v); 4static int parseline(char *line, char **v);
5 5
6bool
7checkfiles()
8{
9 /* TODO: add more checks (other files, use checksum...) */
10 FILE *f;
11 char fname[strlen(tabledir)+100];
12 int i;
13
14 for (i = 0; allpd[i] != NULL; i++) {
15 strcpy(fname, tabledir);
16 strcpy(fname, "/");
17 strcpy(fname, allpd[i]->filename);
18 if ((f = fopen(fname, "rb")) == NULL)
19 return false;
20 else
21 fclose(f);
22 }
23
24 return true;
25}
26
6static void 27static void
7cleanwhitespaces(char *line) 28cleanwhitespaces(char *line)
8{ 29{
@@ -119,6 +140,19 @@ launch(bool batchmode)
119int 140int
120main(int argc, char *argv[]) 141main(int argc, char *argv[])
121{ 142{
143 init_env();
144
145 if (!checkfiles()) {
146 fprintf(stderr,
147 "--- Warning ---\n"
148 "Some pruning tables are missing or unreadable."
149 "You can generate them with `nissy gen -t 4'\n"
150 "Here `4' is the number of threads. Use more if your"
151 "CPU has them, or expect it to take a while.\n"
152 "---------------\n\n"
153 );
154 }
155
122 if (argc > 1) { 156 if (argc > 1) {
123 if (!strcmp(argv[1], "-b")) { 157 if (!strcmp(argv[1], "-b")) {
124 launch(true); 158 launch(true);

Generated with cgit - Back to sebastiano.tronto.net