/* * pileraget.c, SJ */ #include #include #include #include #include #include #include #include #include #include #include #include int main(int argc, char **argv){ int 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])); retrieve_file_from_archive(filename, WRITE_TO_STDOUT, NULL, stdout, &cfg); return 0; }