libxbps: added xbps_fetch_error_string(), that returns libfetch
fetchLastErrString. Hook xbps-fetch to the tree and use the new function to print errors. --HG-- extra : convert_revision : xtraeme%40gmail.com-20091030021303-6wu9sri5o8kgvfwl
This commit is contained in:
parent
e479879e9f
commit
79f9f34775
@ -6,6 +6,7 @@ SUBDIRS += xbps-digest
|
|||||||
SUBDIRS += xbps-fetch
|
SUBDIRS += xbps-fetch
|
||||||
SUBDIRS += xbps-pkgdb
|
SUBDIRS += xbps-pkgdb
|
||||||
SUBDIRS += xbps-repo
|
SUBDIRS += xbps-repo
|
||||||
|
SUBDIRS += xbps-fetch
|
||||||
|
|
||||||
.PHONY: all
|
.PHONY: all
|
||||||
all:
|
all:
|
||||||
|
@ -5,10 +5,18 @@
|
|||||||
int
|
int
|
||||||
main(int argc, char **argv)
|
main(int argc, char **argv)
|
||||||
{
|
{
|
||||||
|
int rv = 0;
|
||||||
|
|
||||||
if (argc != 2) {
|
if (argc != 2) {
|
||||||
printf("Usage: xbps-fetch [options] URL\n");
|
printf("Usage: xbps-fetch [options] URL\n");
|
||||||
exit(EXIT_FAILURE);
|
exit(EXIT_FAILURE);
|
||||||
}
|
}
|
||||||
|
|
||||||
return xbps_fetch_file(argv[1], ".");
|
rv = xbps_fetch_file(argv[1], ".");
|
||||||
|
if (rv != 0) {
|
||||||
|
printf("xbps-fetch: couldn't download %s!\n", argv[1]);
|
||||||
|
printf("xbps-fetch: %s\n", xbps_fetch_error_string());
|
||||||
|
exit(EXIT_FAILURE);
|
||||||
|
}
|
||||||
|
exit(EXIT_SUCCESS);
|
||||||
}
|
}
|
||||||
|
@ -86,6 +86,7 @@ int SYMEXPORT xbps_fetch_file(const char *, const char *);
|
|||||||
void SYMEXPORT (*xbps_fetch_start_cb)(const char *, off_t *, off_t *);
|
void SYMEXPORT (*xbps_fetch_start_cb)(const char *, off_t *, off_t *);
|
||||||
void SYMEXPORT (*xbps_fetch_update_cb)(off_t *);
|
void SYMEXPORT (*xbps_fetch_update_cb)(off_t *);
|
||||||
void SYMEXPORT (*xbps_fetch_end_cb)(void);
|
void SYMEXPORT (*xbps_fetch_end_cb)(void);
|
||||||
|
const char SYMEXPORT *xbps_fetch_error_string(void);
|
||||||
|
|
||||||
/* From lib/fexec.c */
|
/* From lib/fexec.c */
|
||||||
int SYMEXPORT xbps_file_exec(const char *, ...);
|
int SYMEXPORT xbps_file_exec(const char *, ...);
|
||||||
|
@ -164,6 +164,12 @@ stat_end(struct xferstat *xsp)
|
|||||||
xsp->name, size, stat_bps(xsp));
|
xsp->name, size, stat_bps(xsp));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
const char SYMEXPORT *
|
||||||
|
xbps_fetch_error_string(void)
|
||||||
|
{
|
||||||
|
return fetchLastErrString;
|
||||||
|
}
|
||||||
|
|
||||||
int SYMEXPORT
|
int SYMEXPORT
|
||||||
xbps_fetch_file(const char *uri, const char *outputdir)
|
xbps_fetch_file(const char *uri, const char *outputdir)
|
||||||
{
|
{
|
||||||
|
4
prog.mk
4
prog.mk
@ -22,10 +22,12 @@ clean:
|
|||||||
.PHONY: install
|
.PHONY: install
|
||||||
install: $(BIN) $(BIN_STATIC) $(MAN)
|
install: $(BIN) $(BIN_STATIC) $(MAN)
|
||||||
install -d $(SBINDIR)
|
install -d $(SBINDIR)
|
||||||
install -d $(MANDIR)
|
|
||||||
install $(INSTALL_STRIPPED) -m 755 $(BIN) $(SBINDIR)
|
install $(INSTALL_STRIPPED) -m 755 $(BIN) $(SBINDIR)
|
||||||
install $(INSTALL_STRIPPED) -m 755 $(BIN_STATIC) $(SBINDIR)
|
install $(INSTALL_STRIPPED) -m 755 $(BIN_STATIC) $(SBINDIR)
|
||||||
|
ifdef MAN
|
||||||
|
install -d $(MANDIR)
|
||||||
install -m 644 $(MAN) $(MANDIR)
|
install -m 644 $(MAN) $(MANDIR)
|
||||||
|
endif
|
||||||
|
|
||||||
.PHONY: uninstall
|
.PHONY: uninstall
|
||||||
uninstall:
|
uninstall:
|
||||||
|
Loading…
Reference in New Issue
Block a user