remove ghashfind (no longer required)

This commit is contained in:
Jan-Piet Mens
2015-09-15 16:14:15 +02:00
parent 92e1bf963a
commit d2447cf9c8
3 changed files with 3 additions and 102 deletions
+1 -2
View File
@@ -1,10 +1,9 @@
*.o
ot-recorder
ocat
ghashfind
*.dSYM
.DS_Store
store/
jpm-test/
config.mk
config.h
obsolete/
+2 -6
View File
@@ -49,7 +49,7 @@ CFLAGS += -DSTORAGEDEFAULT=\"$(STORAGEDEFAULT)\" -DDOCROOT=\"$(DOCROOT)\"
TARGETS += ot-recorder ocat ghashfind
TARGETS += ot-recorder ocat
all: $(TARGETS)
@@ -59,9 +59,6 @@ ot-recorder: ot-recorder.o $(OTR_OBJS)
ocat: ocat.o $(OTR_OBJS)
$(CC) $(CFLAGS) -o ocat ocat.o $(OTR_OBJS) $(LIBS)
ghashfind: ghashfind.o $(OTR_OBJS)
$(CC) $(CFLAGS) -o ghashfind ghashfind.o $(OTR_OBJS) $(LIBS)
ot-recorder.o: ot-recorder.c storage.h util.h Makefile geo.h udata.h json.h http.h gcache.h config.mk
geo.o: geo.h geo.c udata.h Makefile config.mk
@@ -71,7 +68,6 @@ gcache.o: gcache.c gcache.h json.h config.mk
misc.o: misc.c misc.h udata.h Makefile config.mk
http.o: http.c mongoose.h util.h http.h storage.h config.mk
util.o: util.c util.h Makefile config.mk
ghashfind.o: ghashfind.c util.h config.mk
mongoose.o: mongoose.c mongoose.h
ocat.o: ocat.c storage.h util.h config.mk version.h
storage.o: storage.c storage.h util.h gcache.h config.mk
@@ -80,7 +76,7 @@ storage.o: storage.c storage.h util.h gcache.h config.mk
clean:
rm -f *.o
clobber: clean
rm -f ot-recorder ocat ghashfind
rm -f ot-recorder ocat
mdb/liblmdb.a:
(cd mdb && make)
-94
View File
@@ -1,94 +0,0 @@
/*
* Copyright (C) 2015 Jan-Piet Mens <jpmens@gmail.com> and OwnTracks
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to
* deal in the Software without restriction, including without limitation the
* rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
* sell copies of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in
* all copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
* JAN-PIET MENS OR OWNTRACKS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
* FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
* IN THE SOFTWARE.
*/
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <ftw.h>
#include "util.h"
long counter = 0L;
int fn(const char *filename, const struct stat *sb, int flag)
{
JsonNode *obj, *node;
char ghash[64], *p, *bp, *gp, *js;
if (flag != FTW_F)
return (0);
if (strstr(filename, ".json") == NULL)
return (0);
/* Find ghash from filename */
if ((p = strrchr(filename, '/')) == NULL) {
return (0);
}
for (gp = ghash, bp = p + 1; bp && *bp && *bp != '.'; bp++) {
*gp++ = *bp;
}
*gp = 0;
if (!strcmp(ghash, "7zzzzzz"))
return (0);
obj = json_mkobject();
if (json_copy_from_file(obj, (char *)filename) != TRUE) {
json_delete(obj);
return (1);
}
json_foreach(node, obj) {
if (strcmp(node->key, "addr") == 0 || strcmp(node->key, "cc") == 0)
continue;
json_remove_from_parent(node);
}
if ((js = json_stringify(obj, NULL)) == NULL) {
json_delete(obj);
return (1);
}
++counter;
printf("%s %s\n", ghash, js);
free(js);
json_delete(obj);
return (0);
}
int main(int argc, char **argv)
{
char *ghash_dir;
if (argc != 2) {
fprintf(stderr, "Usage: %s ghashdirectory\n", *argv);
return (-1);
}
ghash_dir = argv[1];
if (ftw(ghash_dir, fn, 10) != 0) {
fprintf(stderr, "%s tree walk failed\n", *argv);
return (2);
}
fprintf(stderr, "%s: processed %ld files\n", *argv, counter);
return (0);
}