xbps/bin/xbps-fetch/main.c
Juan RP 3905c2106c Properly build shared/static libxbps and utils.
xbps-fetch: added -v flag to see verbose messages in libfetch.

--HG--
extra : convert_revision : xtraeme%40gmail.com-20091030111726-axf9paz2k01ntqzz
2009-10-30 12:17:26 +01:00

42 lines
625 B
C

#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], ".", flags);
if (rv != 0) {
printf("%s: %s\n", argv[0], xbps_fetch_error_string());
exit(EXIT_FAILURE);
}
exit(EXIT_SUCCESS);
}