aboutsummaryrefslogtreecommitdiffstats
path: root/service/src
diff options
context:
space:
mode:
authorLouis Burda <quent.burda@gmail.com>2021-05-20 02:49:09 +0200
committerLouis Burda <quent.burda@gmail.com>2021-05-20 02:49:09 +0200
commit1109a88447e1c5cefe6ed93eccc8dcf8cd595d0e (patch)
tree6c88ce49e14669527ff7da96ebef44416dc928ff /service/src
parentea33a19c447df8cc3748a8b6dc8e45121fdc3570 (diff)
downloadenowars5-service-stldoctor-1109a88447e1c5cefe6ed93eccc8dcf8cd595d0e.tar.gz
enowars5-service-stldoctor-1109a88447e1c5cefe6ed93eccc8dcf8cd595d0e.zip
implemented rest of checker functionality
Diffstat (limited to 'service/src')
-rw-r--r--service/src/main.c14
1 files changed, 10 insertions, 4 deletions
diff --git a/service/src/main.c b/service/src/main.c
index 959ef58..e79e04e 100644
--- a/service/src/main.c
+++ b/service/src/main.c
@@ -171,9 +171,9 @@ void
search_cmd(const char *arg)
{
char *end, *scandir = NULL, *infopath = NULL, *modelpath = NULL;
- const char *hash;
+ int i, which, dirstart, ishidden;
+ const char *hash, *name;
struct dirent *de;
- int i, which, dirstart;
DIR *d = NULL;
FILE *f = NULL;
size_t size;
@@ -190,9 +190,13 @@ search_cmd(const char *arg)
if (!(d = opendir(resultdir))) return;
+ printf("%s %s\n", resultdir, hash);
+
dirstart = telldir(d);
for (i = 0; (de = readdir(d));) {
- if (!strpfcmp(hash, de->d_name) && *de->d_name != '.') {
+ name = de->d_name;
+ if (loggedin && *name == '.' && !strpfcmp(hash, name + 1)
+ || !loggedin && *name != '.' && !strpfcmp(hash, name)) {
printf("%i : %s\n", i, de->d_name);
i++;
}
@@ -211,7 +215,9 @@ search_cmd(const char *arg)
seekdir(d, dirstart);
for (i = 0; (de = readdir(d));) {
- if (!strpfcmp(hash, de->d_name) && *de->d_name != '.') {
+ name = de->d_name;
+ if (loggedin && *name == '.' && !strpfcmp(hash, name + 1)
+ || !loggedin && *name != '.' && !strpfcmp(hash, name)) {
if (i == which) {
scandir = aprintf("%s/%s", resultdir, de->d_name);
break;