83e926b3090278ebbbd801e0a7e0ef2f98ef0775 galt Tue Mar 29 01:55:50 2011 -0700 updating paraFetch and paraSync to support -newer option which only downloads newer files, very useful now that the dates are being preserved diff --git src/utils/paraFetch/paraFetch.c src/utils/paraFetch/paraFetch.c index 9a94b73..ec534b1 100644 --- src/utils/paraFetch/paraFetch.c +++ src/utils/paraFetch/paraFetch.c @@ -1,40 +1,43 @@ /* paraFetch - fetch URL with multiple parallel connections. */ #include "common.h" #include "options.h" #include "dystring.h" #include "obscure.h" #include "net.h" void usage() /* Explain usage and exit */ { errAbort( "paraFetch - try to fetch url with multiple connections\n" "usage:\n" " paraFetch N R URL outPath\n" " where N is the number of connections to use\n" " R is the number of retries\n" + "options:\n" + " -newer only download a file if it is newer than the version we already have.\n" ); } static struct optionSpec options[] = { + {"newer", OPTION_BOOLEAN}, {NULL, 0}, }; -boolean paraFetch(int numConnections, int numRetries, char *url, char *outPath) +boolean paraFetch(int numConnections, int numRetries, char *url, char *outPath, boolean newer) /* Fetch given URL, send to stdout. */ { -return parallelFetch(url, outPath, numConnections, numRetries); +return parallelFetch(url, outPath, numConnections, numRetries, newer); } int main(int argc, char *argv[]) /* Process command line. */ { optionInit(&argc, argv, options); if (argc != 5) usage(); -if (!paraFetch(atoi(argv[1]), atoi(argv[2]), argv[3], argv[4])) +if (!paraFetch(atoi(argv[1]), atoi(argv[2]), argv[3], argv[4], optionExists("newer"))) exit(1); return 0; }