diff --git a/src/Makefile.in b/src/Makefile.in index 4446cdac..91e47ef4 100644 --- a/src/Makefile.in +++ b/src/Makefile.in @@ -33,7 +33,7 @@ MAKE = `which make` INSTALL = @INSTALL@ -all: libpiler.a piler pilerconf pilerget pilerimport pilerexport pilerpurge reindex test +all: libpiler.a piler pilerconf pilerget pileraget pilerimport pilerexport pilerpurge reindex test install: install-piler @@ -51,6 +51,9 @@ libpiler.a: $(OBJS) $(MYSQL_OBJS) pilerget: pilerget.c libpiler.a $(CC) $(CFLAGS) $(INCDIR) $(DEFS) -o $@ $< -lpiler $(LIBS) $(LIBDIR) +pileraget: pileraget.c libpiler.a + $(CC) $(CFLAGS) $(INCDIR) $(DEFS) -o $@ $< -lpiler $(LIBS) $(LIBDIR) + pilerimport: pilerimport.c libpiler.a $(CC) $(CFLAGS) $(INCDIR) $(DEFS) -o $@ $< -lpiler $(LIBS) $(LIBDIR) @@ -82,13 +85,14 @@ install-piler: $(INSTALL) -m 0755 piler $(DESTDIR)$(sbindir) $(INSTALL) -m 0755 pilerconf $(DESTDIR)$(sbindir) $(INSTALL) -m 6755 -o $(RUNNING_USER) -g $(RUNNING_GROUP) pilerget $(DESTDIR)$(bindir) + $(INSTALL) -m 6755 -o $(RUNNING_USER) -g $(RUNNING_GROUP) pileraget $(DESTDIR)$(bindir) $(INSTALL) -m 6755 -o $(RUNNING_USER) -g $(RUNNING_GROUP) pilerimport $(DESTDIR)$(bindir) $(INSTALL) -m 6755 -o $(RUNNING_USER) -g $(RUNNING_GROUP) pilerexport $(DESTDIR)$(bindir) $(INSTALL) -m 6755 -o $(RUNNING_USER) -g $(RUNNING_GROUP) pilerpurge $(DESTDIR)$(bindir) $(INSTALL) -m 6755 -o $(RUNNING_USER) -g $(RUNNING_GROUP) reindex $(DESTDIR)$(bindir) clean: - rm -f *.o *.a libpiler.so* piler pilerconf pilerget pilerimport pilerexport pilerpurge pilertest reindex + rm -f *.o *.a libpiler.so* piler pilerconf pilerget pileraget pilerimport pilerexport pilerpurge pilertest reindex distclean: clean rm -f Makefile diff --git a/src/config.h b/src/config.h index b480ee33..b02c8df0 100644 --- a/src/config.h +++ b/src/config.h @@ -13,7 +13,7 @@ #define VERSION "0.1.21" -#define BUILD 712 +#define BUILD 713 #define HOSTID "mailarchiver" diff --git a/src/pileraget.c b/src/pileraget.c new file mode 100644 index 00000000..a17eb278 --- /dev/null +++ b/src/pileraget.c @@ -0,0 +1,53 @@ +/* + * pileraget.c, SJ + */ + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + + +int main(int argc, char **argv){ + int rc, readkey=1; + char filename[SMALLBUFSIZE]; + struct __config cfg; + + + if(argc < 3){ + printf("usage: %s \n", argv[0]); + exit(1); + } + + + cfg = read_config(CONFIG_FILE); + + if(argc >= 4) readkey = 0; + + if(readkey == 1 && read_key(&cfg)){ + printf("%s\n", ERR_READING_KEY); + return 1; + } + + + if(strlen(argv[1]) != RND_STR_LEN){ + printf("invalid piler id: '%s'\n", argv[1]); + return 1; + } + + snprintf(filename, sizeof(filename)-1, "%s/%c%c/%c%c/%c%c/%s.a%d", cfg.queuedir, argv[1][RND_STR_LEN-6], argv[1][RND_STR_LEN-5], argv[1][RND_STR_LEN-4], argv[1][RND_STR_LEN-3], argv[1][RND_STR_LEN-2], argv[1][RND_STR_LEN-1], argv[1], atoi(argv[2])); + + rc = retrieve_file_from_archive(filename, WRITE_TO_STDOUT, NULL, stdout, &cfg); + + return 0; +} + +