Imported from pacman-2.7.6.tar.gz
This commit is contained in:
parent
88c73d4d65
commit
d7c17ff1cc
7 changed files with 124 additions and 57 deletions
|
@ -1,5 +1,8 @@
|
||||||
VERSION DESCRIPTION
|
VERSION DESCRIPTION
|
||||||
-----------------------------------------------------------------------------
|
-----------------------------------------------------------------------------
|
||||||
|
2.7.6 - added --print-uris option
|
||||||
|
- fixed an http download bug (bug #667)
|
||||||
|
- fixed a segfault related to replaces/conflicts handling
|
||||||
2.7.5 - "replaces" packages were ignoring IgnorePkg in pacman.conf
|
2.7.5 - "replaces" packages were ignoring IgnorePkg in pacman.conf
|
||||||
- fixed another bug in conflict handling
|
- fixed another bug in conflict handling
|
||||||
- found an out-dated reference to /usr/abs, fixed
|
- found an out-dated reference to /usr/abs, fixed
|
||||||
|
|
|
@ -34,7 +34,7 @@ INSTALL_PROGRAM = @INSTALL_PROGRAM@ $(AM_INSTALL_PROGRAM_FLAGS)
|
||||||
INSTALL_DATA = @INSTALL_DATA@
|
INSTALL_DATA = @INSTALL_DATA@
|
||||||
INSTALL_SCRIPT = @INSTALL_SCRIPT@
|
INSTALL_SCRIPT = @INSTALL_SCRIPT@
|
||||||
|
|
||||||
PACVER = 2.7.5
|
PACVER = 2.7.6
|
||||||
|
|
||||||
TOPDIR = @srcdir@
|
TOPDIR = @srcdir@
|
||||||
SRCDIR = $(TOPDIR)/src/
|
SRCDIR = $(TOPDIR)/src/
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
.TH pacman 8 "February 6, 2004" "pacman #VERSION#" ""
|
.TH pacman 8 "April 3, 2004" "pacman #VERSION#" ""
|
||||||
.SH NAME
|
.SH NAME
|
||||||
pacman \- package manager utility
|
pacman \- package manager utility
|
||||||
.SH SYNOPSIS
|
.SH SYNOPSIS
|
||||||
|
@ -115,6 +115,11 @@ dependencies, conflicts, etc.
|
||||||
List all files in the specified repositories. Multiple repositories can
|
List all files in the specified repositories. Multiple repositories can
|
||||||
be specified on the command line.
|
be specified on the command line.
|
||||||
.TP
|
.TP
|
||||||
|
.B "\-p, \-\-print-uris"
|
||||||
|
Print out URIs for each specified package and its dependencies. These
|
||||||
|
can be piped to a file and downloaded at a later time, using a program
|
||||||
|
like wget.
|
||||||
|
.TP
|
||||||
.B "\-s, \-\-search <string>"
|
.B "\-s, \-\-search <string>"
|
||||||
This will search each package in the package list for names or descriptions
|
This will search each package in the package list for names or descriptions
|
||||||
that contains <string>.
|
that contains <string>.
|
||||||
|
@ -217,12 +222,9 @@ Overrides the default location of the toplevel database directory. The default
|
||||||
Instructs pacman to ignore any upgrades for this package when performing a
|
Instructs pacman to ignore any upgrades for this package when performing a
|
||||||
\fB--sysupgrade\fP.
|
\fB--sysupgrade\fP.
|
||||||
.TP
|
.TP
|
||||||
.B "ProxyServer = <host | ip>"
|
.B "ProxyServer = <host|ip>[:port]"
|
||||||
If set, pacman will use this proxy server for all ftp/http transfers.
|
If set, pacman will use this proxy server for all ftp/http transfers.
|
||||||
.TP
|
.TP
|
||||||
.B "ProxyPort = <port>"
|
|
||||||
Use this to set a different port for your proxy server (default is 80).
|
|
||||||
.TP
|
|
||||||
.B "NoPassiveFtp"
|
.B "NoPassiveFtp"
|
||||||
Disables passive ftp connections when downloading packages. (aka Active Mode)
|
Disables passive ftp connections when downloading packages. (aka Active Mode)
|
||||||
.TP
|
.TP
|
||||||
|
|
|
@ -1414,8 +1414,8 @@ static int HttpSendCmd(const char *cmd, char expresp, netbuf *nControl)
|
||||||
{
|
{
|
||||||
int ret = 0;
|
int ret = 0;
|
||||||
char *buf = nControl->response;
|
char *buf = nControl->response;
|
||||||
if (nControl->dir != FTPLIB_CONTROL)
|
//if (nControl->dir != FTPLIB_CONTROL)
|
||||||
return 0;
|
//return 0;
|
||||||
if (ftplib_debug > 2)
|
if (ftplib_debug > 2)
|
||||||
fprintf(stderr,"%s\n",cmd);
|
fprintf(stderr,"%s\n",cmd);
|
||||||
if (net_write(nControl->handle,cmd,strlen(cmd)) <= 0)
|
if (net_write(nControl->handle,cmd,strlen(cmd)) <= 0)
|
||||||
|
@ -1426,8 +1426,9 @@ static int HttpSendCmd(const char *cmd, char expresp, netbuf *nControl)
|
||||||
while (ret < 256) {
|
while (ret < 256) {
|
||||||
if (socket_wait(nControl) != 1)
|
if (socket_wait(nControl) != 1)
|
||||||
return 0;
|
return 0;
|
||||||
if (net_read(nControl->handle,buf,1) != 1)
|
if (net_read(nControl->handle,buf,1) != 1) {
|
||||||
break;
|
break;
|
||||||
|
}
|
||||||
ret++;
|
ret++;
|
||||||
if (*buf == '\r') continue;
|
if (*buf == '\r') continue;
|
||||||
if (*buf == '\n') break;
|
if (*buf == '\n') break;
|
||||||
|
|
117
src/pacman.c
117
src/pacman.c
|
@ -72,6 +72,7 @@ unsigned short pmo_r_cascade = 0;
|
||||||
unsigned short pmo_r_recurse = 0;
|
unsigned short pmo_r_recurse = 0;
|
||||||
unsigned short pmo_s_upgrade = 0;
|
unsigned short pmo_s_upgrade = 0;
|
||||||
unsigned short pmo_s_downloadonly = 0;
|
unsigned short pmo_s_downloadonly = 0;
|
||||||
|
unsigned short pmo_s_printuris = 0;
|
||||||
unsigned short pmo_s_sync = 0;
|
unsigned short pmo_s_sync = 0;
|
||||||
unsigned short pmo_s_search = 0;
|
unsigned short pmo_s_search = 0;
|
||||||
unsigned short pmo_s_clean = 0;
|
unsigned short pmo_s_clean = 0;
|
||||||
|
@ -80,7 +81,7 @@ unsigned short pmo_group = 0;
|
||||||
char *pmo_dbpath = NULL;
|
char *pmo_dbpath = NULL;
|
||||||
char *pmo_logfile = NULL;
|
char *pmo_logfile = NULL;
|
||||||
char *pmo_proxyhost = NULL;
|
char *pmo_proxyhost = NULL;
|
||||||
unsigned short pmo_proxyport = 80;
|
unsigned short pmo_proxyport = 0;
|
||||||
PMList *pmo_noupgrade = NULL;
|
PMList *pmo_noupgrade = NULL;
|
||||||
PMList *pmo_ignorepkg = NULL;
|
PMList *pmo_ignorepkg = NULL;
|
||||||
unsigned short pmo_usesyslog = 0;
|
unsigned short pmo_usesyslog = 0;
|
||||||
|
@ -942,7 +943,7 @@ int pacman_sync(pacdb_t *db, PMList *targets)
|
||||||
final = k;
|
final = k;
|
||||||
|
|
||||||
/* list targets */
|
/* list targets */
|
||||||
if(final && final->data && allgood) {
|
if(final && final->data && allgood && !pmo_s_printuris) {
|
||||||
PMList *list = NULL;
|
PMList *list = NULL;
|
||||||
char *str;
|
char *str;
|
||||||
for(i = rmtargs; i; i = i->next) {
|
for(i = rmtargs; i; i = i->next) {
|
||||||
|
@ -987,7 +988,7 @@ int pacman_sync(pacdb_t *db, PMList *targets)
|
||||||
confirm = yesno("\nProceed with download? [Y/n] ");
|
confirm = yesno("\nProceed with download? [Y/n] ");
|
||||||
} else {
|
} else {
|
||||||
/* don't get any confirmation if we're called from makepkg */
|
/* don't get any confirmation if we're called from makepkg */
|
||||||
if(pmo_d_resolve) {
|
if(pmo_d_resolve || pmo_s_printuris) {
|
||||||
confirm = 1;
|
confirm = 1;
|
||||||
} else {
|
} else {
|
||||||
confirm = yesno("\nProceed with upgrade? [Y/n] ");
|
confirm = yesno("\nProceed with upgrade? [Y/n] ");
|
||||||
|
@ -1025,46 +1026,64 @@ int pacman_sync(pacdb_t *db, PMList *targets)
|
||||||
struct stat buf;
|
struct stat buf;
|
||||||
char path[PATH_MAX];
|
char path[PATH_MAX];
|
||||||
|
|
||||||
snprintf(path, PATH_MAX, "%s/%s-%s.pkg.tar.gz",
|
if(pmo_s_printuris) {
|
||||||
ldir, sync->pkg->name, sync->pkg->version);
|
|
||||||
if(stat(path, &buf)) {
|
|
||||||
/* file is not in the cache dir, so add it to the list */
|
|
||||||
snprintf(path, PATH_MAX, "%s-%s.pkg.tar.gz", sync->pkg->name, sync->pkg->version);
|
snprintf(path, PATH_MAX, "%s-%s.pkg.tar.gz", sync->pkg->name, sync->pkg->version);
|
||||||
files = list_add(files, strdup(path));
|
files = list_add(files, strdup(path));
|
||||||
} else {
|
} else {
|
||||||
vprint(" %s-%s.pkg.tar.gz is already in the cache\n", sync->pkg->name, sync->pkg->version);
|
snprintf(path, PATH_MAX, "%s/%s-%s.pkg.tar.gz",
|
||||||
count++;
|
ldir, sync->pkg->name, sync->pkg->version);
|
||||||
|
if(stat(path, &buf)) {
|
||||||
|
/* file is not in the cache dir, so add it to the list */
|
||||||
|
snprintf(path, PATH_MAX, "%s-%s.pkg.tar.gz", sync->pkg->name, sync->pkg->version);
|
||||||
|
files = list_add(files, strdup(path));
|
||||||
|
} else {
|
||||||
|
vprint(" %s-%s.pkg.tar.gz is already in the cache\n", sync->pkg->name, sync->pkg->version);
|
||||||
|
count++;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if(files) {
|
if(files) {
|
||||||
struct stat buf;
|
if(pmo_s_printuris) {
|
||||||
|
server_t *server = (server_t*)current->servers->data;
|
||||||
printf("\n:: Retrieving packages from %s...\n", current->treename);
|
for(j = files; j; j = j->next) {
|
||||||
fflush(stdout);
|
if(!strcmp(server->protocol, "file")) {
|
||||||
if(stat(ldir, &buf)) {
|
printf("%s://%s%s\n", server->protocol, server->path,
|
||||||
mode_t oldmask;
|
(char*)j->data);
|
||||||
char parent[PATH_MAX];
|
} else {
|
||||||
|
printf("%s://%s%s%s\n", server->protocol,
|
||||||
/* no cache directory.... try creating it */
|
server->server, server->path, (char*)j->data);
|
||||||
snprintf(parent, PATH_MAX, "%svar/cache/pacman", pmo_root);
|
}
|
||||||
logaction(stderr, "warning: no %s cache exists. creating...", ldir);
|
}
|
||||||
oldmask = umask(0000);
|
} else {
|
||||||
mkdir(parent, 0755);
|
struct stat buf;
|
||||||
if(mkdir(ldir, 0755)) {
|
|
||||||
/* couldn't mkdir the cache directory, so fall back to /tmp and unlink
|
printf("\n:: Retrieving packages from %s...\n", current->treename);
|
||||||
* the package afterwards.
|
fflush(stdout);
|
||||||
*/
|
if(stat(ldir, &buf)) {
|
||||||
logaction(stderr, "warning: couldn't create package cache, using /tmp instead");
|
mode_t oldmask;
|
||||||
snprintf(ldir, PATH_MAX, "/tmp");
|
char parent[PATH_MAX];
|
||||||
varcache = 0;
|
|
||||||
|
/* no cache directory.... try creating it */
|
||||||
|
snprintf(parent, PATH_MAX, "%svar/cache/pacman", pmo_root);
|
||||||
|
logaction(stderr, "warning: no %s cache exists. creating...", ldir);
|
||||||
|
oldmask = umask(0000);
|
||||||
|
mkdir(parent, 0755);
|
||||||
|
if(mkdir(ldir, 0755)) {
|
||||||
|
/* couldn't mkdir the cache directory, so fall back to /tmp and unlink
|
||||||
|
* the package afterwards.
|
||||||
|
*/
|
||||||
|
logaction(stderr, "warning: couldn't create package cache, using /tmp instead");
|
||||||
|
snprintf(ldir, PATH_MAX, "/tmp");
|
||||||
|
varcache = 0;
|
||||||
|
}
|
||||||
|
umask(oldmask);
|
||||||
|
}
|
||||||
|
if(downloadfiles(current->servers, ldir, files)) {
|
||||||
|
fprintf(stderr, "error: failed to retrieve some files from %s\n", current->treename);
|
||||||
|
allgood = 0;
|
||||||
}
|
}
|
||||||
umask(oldmask);
|
|
||||||
}
|
|
||||||
if(downloadfiles(current->servers, ldir, files)) {
|
|
||||||
fprintf(stderr, "error: failed to retrieve some files from %s\n", current->treename);
|
|
||||||
allgood = 0;
|
|
||||||
}
|
}
|
||||||
count += list_count(files);
|
count += list_count(files);
|
||||||
FREELIST(files);
|
FREELIST(files);
|
||||||
|
@ -1077,6 +1096,10 @@ int pacman_sync(pacdb_t *db, PMList *targets)
|
||||||
|
|
||||||
/* double-check */
|
/* double-check */
|
||||||
FREELIST(files);
|
FREELIST(files);
|
||||||
|
if(pmo_s_printuris) {
|
||||||
|
/* we're done */
|
||||||
|
goto sync_cleanup;
|
||||||
|
}
|
||||||
|
|
||||||
if(allgood) {
|
if(allgood) {
|
||||||
/* Check integrity of files */
|
/* Check integrity of files */
|
||||||
|
@ -1128,14 +1151,19 @@ int pacman_sync(pacdb_t *db, PMList *targets)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if(allgood) {
|
if(allgood && rmtargs) {
|
||||||
/* Check dependencies of packages in rmtargs and make sure
|
/* Check dependencies of packages in rmtargs and make sure
|
||||||
* we won't be breaking anything by removing them.
|
* we won't be breaking anything by removing them.
|
||||||
* If a broken dep is detected, make sure it's not from a
|
* If a broken dep is detected, make sure it's not from a
|
||||||
* package that's in our final (upgrade) list.
|
* package that's in our final (upgrade) list.
|
||||||
*/
|
*/
|
||||||
vprint("checking dependencies...\n");
|
PMList *rmtargs_p = NULL;
|
||||||
i = checkdeps(db, PM_REMOVE, rmtargs);
|
for(i = rmtargs; i; i = i->next) {
|
||||||
|
pkginfo_t *p = db_scan(db, i->data, INFRQ_DESC | INFRQ_DEPENDS);
|
||||||
|
rmtargs_p = list_add(rmtargs_p, p);
|
||||||
|
}
|
||||||
|
vprint("checking dependencies of packages designated for removal...\n");
|
||||||
|
i = checkdeps(db, PM_REMOVE, rmtargs_p);
|
||||||
for(j = i; j; j = j->next) {
|
for(j = i; j; j = j->next) {
|
||||||
depmissing_t* miss = (depmissing_t*)j->data;
|
depmissing_t* miss = (depmissing_t*)j->data;
|
||||||
syncpkg_t *s = find_pkginsync(miss->depend.name, final);
|
syncpkg_t *s = find_pkginsync(miss->depend.name, final);
|
||||||
|
@ -1148,16 +1176,18 @@ int pacman_sync(pacdb_t *db, PMList *targets)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
FREELIST(i);
|
FREELIST(i);
|
||||||
|
FREELISTPKGS(rmtargs_p);
|
||||||
}
|
}
|
||||||
|
|
||||||
if(!pmo_s_downloadonly && allgood) {
|
if(!pmo_s_downloadonly && allgood) {
|
||||||
/* remove any conflicting packages (WITHOUT dep checks) */
|
/* remove any conflicting packages (WITHOUT dep checks) */
|
||||||
if(rmtargs) {
|
if(rmtargs) {
|
||||||
int retcode;
|
int retcode;
|
||||||
int oldupg = pmo_upgrade;
|
int oldval = pmo_nodeps;
|
||||||
pmo_upgrade = 1;
|
/* we make pacman_remove() skip dependency checks by setting pmo_nodeps high */
|
||||||
retcode = pacman_remove(db, rmtargs);
|
pmo_nodeps = 1;
|
||||||
pmo_upgrade = oldupg;
|
retcode = pacman_remove(db, rmtargs);
|
||||||
|
pmo_nodeps = oldval;
|
||||||
FREELIST(rmtargs);
|
FREELIST(rmtargs);
|
||||||
if(retcode == 1) {
|
if(retcode == 1) {
|
||||||
fprintf(stderr, "\nupgrade aborted.\n");
|
fprintf(stderr, "\nupgrade aborted.\n");
|
||||||
|
@ -1239,6 +1269,7 @@ int pacman_sync(pacdb_t *db, PMList *targets)
|
||||||
}
|
}
|
||||||
|
|
||||||
/* cleanup */
|
/* cleanup */
|
||||||
|
sync_cleanup:
|
||||||
for(i = final; i; i = i->next) {
|
for(i = final; i; i = i->next) {
|
||||||
syncpkg_t *sync = (syncpkg_t*)i->data;
|
syncpkg_t *sync = (syncpkg_t*)i->data;
|
||||||
if(sync) {
|
if(sync) {
|
||||||
|
@ -2900,6 +2931,7 @@ int parseargs(int op, int argc, char **argv)
|
||||||
{"info", no_argument, 0, 'i'},
|
{"info", no_argument, 0, 'i'},
|
||||||
{"sysupgrade", no_argument, 0, 'u'},
|
{"sysupgrade", no_argument, 0, 'u'},
|
||||||
{"downloadonly", no_argument, 0, 'w'},
|
{"downloadonly", no_argument, 0, 'w'},
|
||||||
|
{"print-uris", no_argument, 0, 'p'},
|
||||||
{"refresh", no_argument, 0, 'y'},
|
{"refresh", no_argument, 0, 'y'},
|
||||||
{"cascade", no_argument, 0, 'c'},
|
{"cascade", no_argument, 0, 'c'},
|
||||||
{"recursive", no_argument, 0, 's'},
|
{"recursive", no_argument, 0, 's'},
|
||||||
|
@ -2933,7 +2965,7 @@ int parseargs(int op, int argc, char **argv)
|
||||||
case 'i': pmo_q_info++; break;
|
case 'i': pmo_q_info++; break;
|
||||||
case 'l': pmo_q_list = 1; break;
|
case 'l': pmo_q_list = 1; break;
|
||||||
case 'n': pmo_nosave = 1; break;
|
case 'n': pmo_nosave = 1; break;
|
||||||
case 'p': pmo_q_isfile = 1; break;
|
case 'p': pmo_q_isfile = 1; pmo_s_printuris = 1; break;
|
||||||
case 'o': pmo_q_owns = 1; break;
|
case 'o': pmo_q_owns = 1; break;
|
||||||
case 'r': if(realpath(optarg, pmo_root) == NULL) {
|
case 'r': if(realpath(optarg, pmo_root) == NULL) {
|
||||||
perror("bad root path");
|
perror("bad root path");
|
||||||
|
@ -3230,6 +3262,7 @@ void usage(int op, char *myname)
|
||||||
printf(" -g, --groups view all members of a package group\n");
|
printf(" -g, --groups view all members of a package group\n");
|
||||||
printf(" -i, --info view package information\n");
|
printf(" -i, --info view package information\n");
|
||||||
printf(" -l, --list list all packages belonging to the specified repository\n");
|
printf(" -l, --list list all packages belonging to the specified repository\n");
|
||||||
|
printf(" -p, --print-uris print out download URIs for each package to be installed\n");
|
||||||
printf(" -s, --search search sync database for matching strings\n");
|
printf(" -s, --search search sync database for matching strings\n");
|
||||||
printf(" -u, --sysupgrade upgrade all packages that are out of date\n");
|
printf(" -u, --sysupgrade upgrade all packages that are out of date\n");
|
||||||
printf(" -w, --downloadonly download packages, but do not install/upgrade anything\n");
|
printf(" -w, --downloadonly download packages, but do not install/upgrade anything\n");
|
||||||
|
|
|
@ -22,7 +22,7 @@
|
||||||
#define _PAC_PACMAN_H
|
#define _PAC_PACMAN_H
|
||||||
|
|
||||||
#ifndef PACVER
|
#ifndef PACVER
|
||||||
#define PACVER "2.7.5"
|
#define PACVER "2.7.6"
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifndef PKGDIR
|
#ifndef PKGDIR
|
||||||
|
|
|
@ -145,13 +145,16 @@ int downloadfiles(PMList *servers, char *localpath, PMList *files)
|
||||||
} else {
|
} else {
|
||||||
vprint("FTP passive mode not set\n");
|
vprint("FTP passive mode not set\n");
|
||||||
}
|
}
|
||||||
/*} else if(!strcmp(server->protocol, "http") || (pmo_proxyhost && !strcmp(server->protocol, "ftp"))) {*/
|
} else if(pmo_proxyhost) {
|
||||||
} else if(!strcmp(server->protocol, "http") || pmo_proxyhost) {
|
|
||||||
char *host;
|
char *host;
|
||||||
unsigned port;
|
unsigned port;
|
||||||
host = (pmo_proxyhost) ? pmo_proxyhost : server->server;
|
host = (pmo_proxyhost) ? pmo_proxyhost : server->server;
|
||||||
port = (pmo_proxyhost) ? pmo_proxyport : 80;
|
port = (pmo_proxyhost) ? pmo_proxyport : 80;
|
||||||
vprint("Connecting to %s:%u\n", host, port);
|
if(strchr(host, ':')) {
|
||||||
|
vprint("Connecting to %s\n", host);
|
||||||
|
} else {
|
||||||
|
vprint("Connecting to %s:%u\n", host, port);
|
||||||
|
}
|
||||||
if(!HttpConnect(host, port, &control)) {
|
if(!HttpConnect(host, port, &control)) {
|
||||||
fprintf(stderr, "error: cannot connect to %s\n", host);
|
fprintf(stderr, "error: cannot connect to %s\n", host);
|
||||||
continue;
|
continue;
|
||||||
|
@ -159,7 +162,7 @@ int downloadfiles(PMList *servers, char *localpath, PMList *files)
|
||||||
}
|
}
|
||||||
|
|
||||||
/* set up our progress bar's callback (and idle timeout) */
|
/* set up our progress bar's callback (and idle timeout) */
|
||||||
if(strcmp(server->protocol, "file")) {
|
if(strcmp(server->protocol, "file") && control) {
|
||||||
FtpOptions(FTPLIB_CALLBACK, (long)log_progress, control);
|
FtpOptions(FTPLIB_CALLBACK, (long)log_progress, control);
|
||||||
FtpOptions(FTPLIB_IDLETIME, (long)1000, control);
|
FtpOptions(FTPLIB_IDLETIME, (long)1000, control);
|
||||||
FtpOptions(FTPLIB_CALLBACKARG, (long)&fsz, control);
|
FtpOptions(FTPLIB_CALLBACKARG, (long)&fsz, control);
|
||||||
|
@ -224,9 +227,34 @@ int downloadfiles(PMList *servers, char *localpath, PMList *files)
|
||||||
} else {
|
} else {
|
||||||
filedone = 1;
|
filedone = 1;
|
||||||
}
|
}
|
||||||
/*} else if(!strcmp(server->protocol, "http") || (pmo_proxyhost && !strcmp(server->protocol, "ftp"))) {*/
|
|
||||||
} else if(!strcmp(server->protocol, "http") || pmo_proxyhost) {
|
} else if(!strcmp(server->protocol, "http") || pmo_proxyhost) {
|
||||||
char src[PATH_MAX];
|
char src[PATH_MAX];
|
||||||
|
char *host;
|
||||||
|
unsigned port;
|
||||||
|
if(!strcmp(server->protocol, "http") && !pmo_proxyhost) {
|
||||||
|
/* HTTP servers hang up after each request (but not proxies), so
|
||||||
|
* we have to re-connect for each files.
|
||||||
|
*/
|
||||||
|
host = (pmo_proxyhost) ? pmo_proxyhost : server->server;
|
||||||
|
port = (pmo_proxyhost) ? pmo_proxyport : 80;
|
||||||
|
if(strchr(host, ':')) {
|
||||||
|
vprint("Connecting to %s\n", host);
|
||||||
|
} else {
|
||||||
|
vprint("Connecting to %s:%u\n", host, port);
|
||||||
|
}
|
||||||
|
if(!HttpConnect(host, port, &control)) {
|
||||||
|
fprintf(stderr, "error: cannot connect to %s\n", host);
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
/* set up our progress bar's callback (and idle timeout) */
|
||||||
|
if(strcmp(server->protocol, "file") && control) {
|
||||||
|
FtpOptions(FTPLIB_CALLBACK, (long)log_progress, control);
|
||||||
|
FtpOptions(FTPLIB_IDLETIME, (long)1000, control);
|
||||||
|
FtpOptions(FTPLIB_CALLBACKARG, (long)&fsz, control);
|
||||||
|
FtpOptions(FTPLIB_CALLBACKBYTES, (10*1024), control);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
if(!stat(output, &st)) {
|
if(!stat(output, &st)) {
|
||||||
offset = (int)st.st_size;
|
offset = (int)st.st_size;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Reference in a new issue