Git-Url:
http://git.frugalware.org/gitweb/gitweb.cgi?p=pacman-g2/.git;a=commitdiff;h=74be699dd7522f998970020df2ab560a3227accd
commit 74be699dd7522f998970020df2ab560a3227accd
Author: Christian Hamar alias krix <[EMAIL PROTECTED]>
Date: Tue Jul 24 22:02:15 2007 +0200
Revert "Small fixup (well another way to 'gain' remaining pkgs"
* UNDO, API break
This reverts commit 7b38029cf4c8fbcdb8361b50732c50bf97c79192.
diff --git a/lib/libftp/ftplib.c b/lib/libftp/ftplib.c
index 282037e..db5e943 100644
--- a/lib/libftp/ftplib.c
+++ b/lib/libftp/ftplib.c
@@ -83,7 +83,6 @@ struct NetBuf {
FtpCallback idlecb;
void *idlearg;
void *idlearg2;
- void *idlearg3;
int xfered;
int cbbytes;
int xfered1;
@@ -172,7 +171,7 @@ static int socket_wait(netbuf *ctl)
break;
}
}
- while ((rv = ctl->idlecb(ctl, ctl->xfered, ctl->idlearg, ctl->idlearg2,
ctl->idlearg3)));
+ while ((rv = ctl->idlecb(ctl, ctl->xfered, ctl->idlearg,
ctl->idlearg2)));
return rv;
}
@@ -477,7 +476,6 @@ GLOBALDEF int FtpConnect(const char *host, netbuf
**nControl)
ctrl->idletime.tv_sec = ctrl->idletime.tv_usec = 0;
ctrl->idlearg = NULL;
ctrl->idlearg2 = NULL;
- ctrl->idlearg3 = NULL;
ctrl->xfered = 0;
ctrl->xfered1 = 0;
ctrl->cbbytes = 0;
@@ -528,10 +526,6 @@ GLOBALDEF int FtpOptions(int opt, long val, netbuf
*nControl)
rv = 1;
nControl->idlearg2 = (void *) val;
break;
- case FTPLIB_CALLBACKARG3:
- rv = 1;
- nControl->idlearg3 = (void *) val;
- break;
case FTPLIB_CALLBACKBYTES:
rv = 1;
nControl->cbbytes = (int) val;
@@ -723,7 +717,6 @@ static int FtpOpenPort(netbuf *nControl, netbuf **nData,
int mode, int dir)
ctrl->idletime = nControl->idletime;
ctrl->idlearg = nControl->idlearg;
ctrl->idlearg2 = nControl->idlearg2;
- ctrl->idlearg3 = nControl->idlearg3;
ctrl->xfered = 0;
ctrl->xfered1 = 0;
ctrl->cbbytes = nControl->cbbytes;
@@ -904,7 +897,7 @@ GLOBALDEF int FtpRead(void *buf, int max, netbuf *nData)
nData->xfered1 += i;
if (nData->xfered1 > nData->cbbytes)
{
- if (nData->idlecb(nData, nData->xfered, nData->idlearg,
nData->idlearg2, nData->idlearg3) == 0)
+ if (nData->idlecb(nData, nData->xfered, nData->idlearg,
nData->idlearg2) == 0)
return 0;
nData->xfered1 = 0;
}
@@ -935,7 +928,7 @@ GLOBALDEF int FtpWrite(void *buf, int len, netbuf *nData)
nData->xfered1 += i;
if (nData->xfered1 > nData->cbbytes)
{
- nData->idlecb(nData, nData->xfered, nData->idlearg,
nData->idlearg2, nData->idlearg3);
+ nData->idlecb(nData, nData->xfered, nData->idlearg,
nData->idlearg2);
nData->xfered1 = 0;
}
}
@@ -1412,7 +1405,6 @@ GLOBALREF int HttpConnect(const char *host, unsigned
short port, netbuf **nContr
ctrl->idletime.tv_sec = ctrl->idletime.tv_usec = 0;
ctrl->idlearg = NULL;
ctrl->idlearg2 = NULL;
- ctrl->idlearg3 = NULL;
ctrl->xfered = 0;
ctrl->xfered1 = 0;
ctrl->cbbytes = 0;
diff --git a/lib/libftp/ftplib.h b/lib/libftp/ftplib.h
index 3776619..efbe56f 100644
--- a/lib/libftp/ftplib.h
+++ b/lib/libftp/ftplib.h
@@ -59,14 +59,13 @@
#define FTPLIB_CALLBACKARG 4
#define FTPLIB_CALLBACKBYTES 5
#define FTPLIB_CALLBACKARG2 6
-#define FTPLIB_CALLBACKARG3 7
#ifdef __cplusplus
extern "C" {
#endif
typedef struct NetBuf netbuf;
-typedef int (*FtpCallback)(netbuf *nControl, int xfered, void *arg, void
*arg2, void *arg3);
+typedef int (*FtpCallback)(netbuf *nControl, int xfered, void *arg, void
*arg2);
/* v1 compatibility stuff */
#if !defined(_FTPLIB_NO_COMPAT)
diff --git a/lib/libpacman/server.c b/lib/libpacman/server.c
index a7c9fce..10af0d4 100644
--- a/lib/libpacman/server.c
+++ b/lib/libpacman/server.c
@@ -158,7 +158,7 @@ int _pacman_downloadfiles(pmlist_t *servers, const char
*localpath, pmlist_t *fi
int _pacman_downloadfiles_forreal(pmlist_t *servers, const char *localpath,
pmlist_t *files, const char *mtime1, char *mtime2)
{
- int fsz, howmany, remain;
+ int fsz, howmany;
netbuf *control = NULL;
pmlist_t *lp;
int done = 0;
@@ -228,7 +228,6 @@ int _pacman_downloadfiles_forreal(pmlist_t *servers, const
char *localpath,
FtpOptions(FTPLIB_IDLETIME, (long)1000, control);
FtpOptions(FTPLIB_CALLBACKARG, (long)&fsz, control);
FtpOptions(FTPLIB_CALLBACKARG2, (long)&howmany, control);
- FtpOptions(FTPLIB_CALLBACKARG3, 0, control);
FtpOptions(FTPLIB_CALLBACKBYTES, (10*1024), control);
}
}
@@ -236,7 +235,6 @@ int _pacman_downloadfiles_forreal(pmlist_t *servers, const
char *localpath,
/* get each file in the list */
for(lp = files; lp; lp = lp->next) {
char *fn = (char *)lp->data;
- remain = howmany - _pacman_list_count(lp) + 1;
if(_pacman_list_is_strin(fn, complete)) {
continue;
@@ -423,7 +421,6 @@ int _pacman_downloadfiles_forreal(pmlist_t *servers, const
char *localpath,
FtpOptions(FTPLIB_IDLETIME, (long)1000, control);
FtpOptions(FTPLIB_CALLBACKARG, (long)&fsz, control);
FtpOptions(FTPLIB_CALLBACKARG2, (long)&howmany, control);
-
FtpOptions(FTPLIB_CALLBACKARG3, (long)&remain, control);
FtpOptions(FTPLIB_CALLBACKBYTES, (10*1024), control);
}
}
@@ -499,7 +496,7 @@ int _pacman_downloadfiles_forreal(pmlist_t *servers, const
char *localpath,
if(!strcmp(server->protocol, "file")) {
EVENT(handle->trans, PM_TRANS_EVT_RETRIEVE_LOCAL, pm_dlfnm, server->path);
} else if(pm_dlcb) {
- pm_dlcb(control,
fsz-*pm_dloffset, &fsz, &howmany, &remain);
+ pm_dlcb(control,
fsz-*pm_dloffset, &fsz, &howmany);
}
complete = _pacman_list_add(complete, fn);
/* rename "output.part" file to "output" file */
diff --git a/src/pacman-g2/download.c b/src/pacman-g2/download.c
index 5a8b4c3..34e35f0 100644
--- a/src/pacman-g2/download.c
+++ b/src/pacman-g2/download.c
@@ -45,17 +45,17 @@ struct timeval t0, t;
float rate;
int xfered1;
unsigned int eta_h, eta_m, eta_s;
+static int remain = 1;
/* pacman options */
extern config_t *config;
extern unsigned int maxcols;
-int log_progress(PM_NETBUF *ctl, int xfered, void *arg, void *arg2, void *arg3)
+int log_progress(PM_NETBUF *ctl, int xfered, void *arg, void *arg2)
{
int fsz = *(int*)arg;
int howmany = *(int*)arg2;
- int remain = *(int*)arg3;
int pct = ((float)(xfered+offset) / fsz) * 100;
static int lastpct=0;
unsigned int i, cur;
@@ -109,6 +109,7 @@ int log_progress(PM_NETBUF *ctl, int xfered, void *arg,
void *arg2, void *arg3)
putchar('(');
for(i = 0; i<(int)log10(howmany)-(int)log10(remain); i++)
putchar(' ');
+
printf("%d/%d) %s [", remain, howmany, sync_fnm);
cur = (int)((maxcols-68)*pct/100);
for(i = 0; i < maxcols-68; i++) {
@@ -146,6 +147,7 @@ int log_progress(PM_NETBUF *ctl, int xfered, void *arg,
void *arg2, void *arg3)
}
if(lastpct != 100 && pct == 100) {
printf("\n");
+ remain = remain + 1;
}
lastcur = cur;
lastpct = pct;
diff --git a/src/pacman-g2/download.h b/src/pacman-g2/download.h
index e0f3417..9667767 100644
--- a/src/pacman-g2/download.h
+++ b/src/pacman-g2/download.h
@@ -30,7 +30,7 @@ extern float rate;
extern int xfered1;
extern unsigned int eta_h, eta_m, eta_s;
-int log_progress(PM_NETBUF *ctl, int xfered, void *arg, void *arg2, void
*arg3);
+int log_progress(PM_NETBUF *ctl, int xfered, void *arg, void *arg2);
#endif /* _PM_DOWNLOAD_H */
_______________________________________________
Frugalware-git mailing list
[email protected]
http://frugalware.org/mailman/listinfo/frugalware-git