From 232660167bb035294da36a63af9fe245fd5389a2 Mon Sep 17 00:00:00 2001 From: Juan RP Date: Sun, 24 Jan 2010 17:25:17 +0100 Subject: [PATCH] xbps-uhelper: make 'fetch' target accept an arbitrary number of arguments. Also set default libfetch's cache connection limits. --HG-- extra : convert_revision : xtraeme%40gmail.com-20100124162517-iorbhh21je4c65xo --- bin/xbps-uhelper/main.c | 27 +++++++++++++++++---------- 1 file changed, 17 insertions(+), 10 deletions(-) diff --git a/bin/xbps-uhelper/main.c b/bin/xbps-uhelper/main.c index 6dc2f835..233dbcd1 100644 --- a/bin/xbps-uhelper/main.c +++ b/bin/xbps-uhelper/main.c @@ -1,5 +1,5 @@ /*- - * Copyright (c) 2008-2009 Juan Romero Pardines. + * Copyright (c) 2008-2010 Juan Romero Pardines. * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -67,7 +67,7 @@ usage(void) " Action arguments:\n" " cmpver\t\t \n" " digest\t\t \n" - " fetch\t\t\n" + " fetch\t\t \n" " getpkgdepname\t\n" " getpkgname\t\t\n" " getpkgrevision\t\n" @@ -84,8 +84,8 @@ usage(void) "\n" " Examples:\n" " $ xbps-uhelper cmpver 'foo-1.0' 'foo-2.1'\n" - " $ xbps-uhelper digest /foo/blah.txt\n" - " $ xbps-uhelper fetch http://www.foo.org/file.blob\n" + " $ xbps-uhelper digest /foo/blah.txt ...\n" + " $ xbps-uhelper fetch http://www.foo.org/file.blob ...\n" " $ xbps-uhelper getpkgname foo-2.0\n" " $ xbps-uhelper getpkgrevision foo-2.0_1\n" " $ xbps-uhelper getpkgversion foo-2.0\n" @@ -319,12 +319,19 @@ main(int argc, char **argv) if (argc != 2) usage(); - rv = xbps_fetch_file(argv[1], ".", false, "v"); - if (rv == -1) { - printf("%s: %s\n", argv[1], xbps_fetch_error_string()); - exit(EXIT_FAILURE); - } else if (rv == 0) { - printf("%s: file is identical than remote.\n", argv[1]); + xbps_fetch_set_cache_connection(0, 0); + int i; + + for (i = 1; i < argc; i++) { + rv = xbps_fetch_file(argv[i], ".", false, "v"); + if (rv == -1) { + printf("%s: %s\n", argv[1], + xbps_fetch_error_string()); + exit(EXIT_FAILURE); + } else if (rv == 0) { + printf("%s: file is identical than remote.\n", + argv[1]); + } } } else {