Git-Url: 
http://git.frugalware.org/gitweb/gitweb.cgi?p=pacman-g2/.git;a=commitdiff;h=37da12542e80c7449893a2e2c7be6cc3cf15d7e3

commit 37da12542e80c7449893a2e2c7be6cc3cf15d7e3
Author: Christian Hamar alias krix <[EMAIL PROTECTED]>
Date:   Tue Jul 24 22:02:38 2007 +0200

Revert "Adding package-counter to download part too \o/"
* UNDO PART II

This reverts commit d0bb9d33ca4b7638920e02328418a8549a496118.

diff --git a/lib/libftp/ftplib.c b/lib/libftp/ftplib.c
index db5e943..cbe3d70 100644
--- a/lib/libftp/ftplib.c
+++ b/lib/libftp/ftplib.c
@@ -82,7 +82,6 @@ struct NetBuf {
struct timeval idletime;
FtpCallback idlecb;
void *idlearg;
-       void *idlearg2;
int xfered;
int cbbytes;
int xfered1;
@@ -171,7 +170,7 @@ static int socket_wait(netbuf *ctl)
break;
}
}
-       while ((rv = ctl->idlecb(ctl, ctl->xfered, ctl->idlearg, 
ctl->idlearg2)));
+       while ((rv = ctl->idlecb(ctl, ctl->xfered, ctl->idlearg)));
return rv;
}

@@ -475,7 +474,6 @@ GLOBALDEF int FtpConnect(const char *host, netbuf 
**nControl)
ctrl->idlecb = NULL;
ctrl->idletime.tv_sec = ctrl->idletime.tv_usec = 0;
ctrl->idlearg = NULL;
-       ctrl->idlearg2 = NULL;
ctrl->xfered = 0;
ctrl->xfered1 = 0;
ctrl->cbbytes = 0;
@@ -522,10 +520,6 @@ GLOBALDEF int FtpOptions(int opt, long val, netbuf 
*nControl)
rv = 1;
nControl->idlearg = (void *) val;
break;
-               case FTPLIB_CALLBACKARG2:
-                       rv = 1;
-                       nControl->idlearg2 = (void *) val;
-                       break;
case FTPLIB_CALLBACKBYTES:
rv = 1;
nControl->cbbytes = (int) val;
@@ -716,7 +710,6 @@ static int FtpOpenPort(netbuf *nControl, netbuf **nData, 
int mode, int dir)
ctrl->dir = dir;
ctrl->idletime = nControl->idletime;
ctrl->idlearg = nControl->idlearg;
-       ctrl->idlearg2 = nControl->idlearg2;
ctrl->xfered = 0;
ctrl->xfered1 = 0;
ctrl->cbbytes = nControl->cbbytes;
@@ -897,7 +890,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) == 0)
+                       if (nData->idlecb(nData, nData->xfered, nData->idlearg) 
== 0)
return 0;
nData->xfered1 = 0;
}
@@ -928,7 +921,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->idlecb(nData, nData->xfered, nData->idlearg);
nData->xfered1 = 0;
}
}
@@ -1404,7 +1397,6 @@ GLOBALREF int HttpConnect(const char *host, unsigned 
short port, netbuf **nContr
ctrl->idlecb = NULL;
ctrl->idletime.tv_sec = ctrl->idletime.tv_usec = 0;
ctrl->idlearg = NULL;
-       ctrl->idlearg2 = NULL;
ctrl->xfered = 0;
ctrl->xfered1 = 0;
ctrl->cbbytes = 0;
diff --git a/lib/libftp/ftplib.h b/lib/libftp/ftplib.h
index efbe56f..f82ed9e 100644
--- a/lib/libftp/ftplib.h
+++ b/lib/libftp/ftplib.h
@@ -58,14 +58,13 @@
#define FTPLIB_IDLETIME 3
#define FTPLIB_CALLBACKARG 4
#define FTPLIB_CALLBACKBYTES 5
-#define FTPLIB_CALLBACKARG2 6

#ifdef __cplusplus
extern "C" {
#endif

typedef struct NetBuf netbuf;
-typedef int (*FtpCallback)(netbuf *nControl, int xfered, void *arg, void 
*arg2);
+typedef int (*FtpCallback)(netbuf *nControl, int xfered, void *arg);

/* v1 compatibility stuff */
#if !defined(_FTPLIB_NO_COMPAT)
diff --git a/lib/libpacman/server.c b/lib/libpacman/server.c
index 10af0d4..ce86737 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;
+       int fsz;
netbuf *control = NULL;
pmlist_t *lp;
int done = 0;
@@ -168,7 +168,6 @@ int _pacman_downloadfiles_forreal(pmlist_t *servers, const 
char *localpath,
if(files == NULL) {
return(0);
}
-       howmany = _pacman_list_count(files);

pm_errno = 0;

@@ -227,7 +226,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_CALLBACKBYTES, (10*1024), control);
}
}
@@ -420,7 +418,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_CALLBACKBYTES, (10*1024), control);
}
}
@@ -496,7 +493,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);
+                                               pm_dlcb(control, 
fsz-*pm_dloffset, &fsz);
}
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 34e35f0..4df1294 100644
--- a/src/pacman-g2/download.c
+++ b/src/pacman-g2/download.c
@@ -45,17 +45,15 @@ 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)
+int log_progress(PM_NETBUF *ctl, int xfered, void *arg)
{
int fsz = *(int*)arg;
-       int howmany = *(int*)arg2;
int pct = ((float)(xfered+offset) / fsz) * 100;
static int lastpct=0;
unsigned int i, cur;
@@ -105,14 +103,9 @@ int log_progress(PM_NETBUF *ctl, int xfered, void *arg, 
void *arg2)
eta_s -= eta_m * 60;
}

-       /* Need fixup :S i cant backport it from trans.c :S */
-       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++) {
+       printf(" %s [", sync_fnm);
+       cur = (int)((maxcols-64)*pct/100);
+       for(i = 0; i < maxcols-64; i++) {
if(chomp) {
if(i < cur) {
printf("-");
@@ -147,7 +140,6 @@ int log_progress(PM_NETBUF *ctl, int xfered, void *arg, 
void *arg2)
}
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 9667767..b1d777d 100644
--- a/src/pacman-g2/download.h
+++ b/src/pacman-g2/download.h
@@ -21,8 +21,6 @@
#ifndef _PM_DOWNLOAD_H
#define _PM_DOWNLOAD_H

-#include <math.h>
-
extern char sync_fnm[PM_DLFNM_LEN+1];
extern int offset;
extern struct timeval t0, t;
@@ -30,7 +28,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);
+int log_progress(PM_NETBUF *ctl, int xfered, void *arg);

#endif /* _PM_DOWNLOAD_H */
_______________________________________________
Frugalware-git mailing list
[email protected]
http://frugalware.org/mailman/listinfo/frugalware-git

Reply via email to