xbps-uhelper: new bin that combines xbps-cmpver, xbps-digest,
xbps-fetch and xbps-pkgdb in one utility. Bump XBPS_RELVER to 20091124-1. --HG-- extra : convert_revision : xtraeme%40gmail.com-20091124115947-hb9cp7vp3tyhq64o
This commit is contained in:
@ -1,43 +0,0 @@
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
#include <xbps_api.h>
|
||||
#include "fetch.h"
|
||||
|
||||
static void
|
||||
usage(void)
|
||||
{
|
||||
printf("usage: xbps-fetch [-v] URL\n");
|
||||
exit(EXIT_FAILURE);
|
||||
}
|
||||
|
||||
int
|
||||
main(int argc, char **argv)
|
||||
{
|
||||
char flags[8];
|
||||
int c, rv = 0;
|
||||
|
||||
while ((c = getopt(argc, argv, "v")) != -1) {
|
||||
switch (c) {
|
||||
case 'v':
|
||||
strcat(flags, "v");
|
||||
break;
|
||||
default:
|
||||
usage();
|
||||
}
|
||||
}
|
||||
argc -= optind;
|
||||
argv += optind;
|
||||
|
||||
if (argc != 1)
|
||||
usage();
|
||||
|
||||
rv = xbps_fetch_file(argv[0], ".", false, flags);
|
||||
if (rv == -1) {
|
||||
printf("%s: %s\n", argv[0], xbps_fetch_error_string());
|
||||
exit(EXIT_FAILURE);
|
||||
} else if (rv == 0) {
|
||||
printf("%s: file is identical than remote.\n", argv[0]);
|
||||
}
|
||||
exit(EXIT_SUCCESS);
|
||||
}
|
Reference in New Issue
Block a user