Browse Source

Minor fixes for FTP support

Author: jgg
Date: 1999-03-15 08:10:39 GMT
Minor fixes for FTP support
debian/1.8.y
Arch Librarian 18 years ago
parent
commit
6d5dd02a49
  1. 16
      apt-pkg/acquire-method.cc
  2. 4
      apt-pkg/acquire.cc
  3. 4
      apt-pkg/contrib/configuration.h
  4. 23
      apt-pkg/contrib/fileutl.cc
  5. 3
      apt-pkg/contrib/fileutl.h
  6. 71
      apt-pkg/contrib/strutl.cc
  7. 2
      doc/apt-get.8.yo
  8. 22
      doc/examples/apt.conf

16
apt-pkg/acquire-method.cc

@ -1,6 +1,6 @@
// -*- mode: cpp; mode: fold -*-
// Description /*{{{*/
// $Id: acquire-method.cc,v 1.17 1999/02/08 07:30:49 jgg Exp $
// $Id: acquire-method.cc,v 1.18 1999/03/15 08:10:39 jgg Exp $
/* ######################################################################
Acquire Method
@ -69,7 +69,16 @@ void pkgAcqMethod::Fail(bool Transient)
// ---------------------------------------------------------------------
/* */
void pkgAcqMethod::Fail(string Err,bool Transient)
{
{
// Strip out junk from the error messages
for (char *I = Err.begin(); I != Err.end(); I++)
{
if (*I == '\r')
*I = ' ';
if (*I == '\n')
*I = ' ';
}
char S[1024];
if (Queue != 0)
{
@ -271,7 +280,8 @@ bool pkgAcqMethod::Configuration(string Message)
if (End == Equals)
return false;
Cnf.Set(string(I,Equals-I),string(Equals+1,End-Equals-1));
Cnf.Set(DeQuoteString(string(I,Equals-I)),
DeQuoteString(string(Equals+1,End-Equals-1)));
I = End;
}

4
apt-pkg/acquire.cc

@ -1,6 +1,6 @@
// -*- mode: cpp; mode: fold -*-
// Description /*{{{*/
// $Id: acquire.cc,v 1.27 1999/03/13 23:30:04 jgg Exp $
// $Id: acquire.cc,v 1.28 1999/03/15 08:10:39 jgg Exp $
/* ######################################################################
Acquire - File Acquiration
@ -709,7 +709,7 @@ void pkgAcquireStatus::Pulse(pkgAcquire *Owner)
else
CurrentCPS = (CurrentBytes - LastBytes)/Delta;
LastBytes = CurrentBytes;
ElapsedTime = Delta;
ElapsedTime = (unsigned long)Delta;
Time = NewTime;
}
}

4
apt-pkg/contrib/configuration.h

@ -1,6 +1,6 @@
// -*- mode: cpp; mode: fold -*-
// Description /*{{{*/
// $Id: configuration.h,v 1.9 1999/01/18 06:20:07 jgg Exp $
// $Id: configuration.h,v 1.10 1999/03/15 08:10:39 jgg Exp $
/* ######################################################################
Configuration Class
@ -60,7 +60,9 @@ class Configuration
string FindFile(const char *Name,const char *Default = 0);
string FindDir(const char *Name,const char *Default = 0);
int FindI(const char *Name,int Default = 0);
int FindI(string Name,bool Default = 0) {return FindI(Name.c_str(),Default);};
bool FindB(const char *Name,bool Default = false);
bool FindB(string Name,bool Default = false) {return FindB(Name.c_str(),Default);};
inline void Set(string Name,string Value) {Set(Name.c_str(),Value);};
void Set(const char *Name,string Value);

23
apt-pkg/contrib/fileutl.cc

@ -1,6 +1,6 @@
// -*- mode: cpp; mode: fold -*-
// Description /*{{{*/
// $Id: fileutl.cc,v 1.21 1999/02/16 04:18:35 jgg Exp $
// $Id: fileutl.cc,v 1.22 1999/03/15 08:10:39 jgg Exp $
/* ######################################################################
File Utilities
@ -164,15 +164,16 @@ void SetNonBlock(int Fd,bool Block)
// WaitFd - Wait for a FD to become readable /*{{{*/
// ---------------------------------------------------------------------
/* This waits for a FD to become readable using select. It is usefull for
applications making use of non-blocking sockets. */
applications making use of non-blocking sockets. The timeout is
in seconds. */
bool WaitFd(int Fd,bool write,unsigned long timeout)
{
fd_set Set;
struct timeval tv;
FD_ZERO(&Set);
FD_SET(Fd,&Set);
tv.tv_sec = timeout / 1000000;
tv.tv_usec = timeout % 1000000;
tv.tv_sec = timeout;
tv.tv_usec = 0;
if (write == true)
{
if (select(Fd+1,0,&Set,0,(timeout != 0?&tv:0)) <= 0)
@ -275,6 +276,20 @@ bool FileFd::Seek(unsigned long To)
return _error->Error("Unable to seek to %u",To);
}
return true;
}
/*}}}*/
// FileFd::Truncate - Truncate the file /*{{{*/
// ---------------------------------------------------------------------
/* */
bool FileFd::Truncate(unsigned long To)
{
if (ftruncate(iFd,To) != 0)
{
Flags |= Fail;
return _error->Error("Unable to truncate to %u",To);
}
return true;
}
/*}}}*/

3
apt-pkg/contrib/fileutl.h

@ -1,6 +1,6 @@
// -*- mode: cpp; mode: fold -*-
// Description /*{{{*/
// $Id: fileutl.h,v 1.14 1999/02/16 04:18:35 jgg Exp $
// $Id: fileutl.h,v 1.15 1999/03/15 08:10:39 jgg Exp $
/* ######################################################################
File Utilities
@ -42,6 +42,7 @@ class FileFd
bool Read(void *To,unsigned long Size);
bool Write(const void *From,unsigned long Size);
bool Seek(unsigned long To);
bool Truncate(unsigned long To);
unsigned long Tell();
unsigned long Size();
bool Close();

71
apt-pkg/contrib/strutl.cc

@ -1,6 +1,6 @@
// -*- mode: cpp; mode: fold -*-
// Description /*{{{*/
// $Id: strutl.cc,v 1.20 1999/02/27 22:29:11 jgg Exp $
// $Id: strutl.cc,v 1.21 1999/03/15 08:10:39 jgg Exp $
/* ######################################################################
String Util - Some usefull string functions.
@ -20,7 +20,7 @@
#endif
#include <apt-pkg/strutl.h>
#include <apt-pkg/fileutl.h>
#include <apt-pkg//fileutl.h>
#include <ctype.h>
#include <string.h>
@ -178,23 +178,20 @@ bool ParseCWord(const char *String,string &Res)
return true;
}
/*}}}*/
// DeQuoteString - Convert a string from quoted from /*{{{*/
// QuoteString - Convert a string into quoted from /*{{{*/
// ---------------------------------------------------------------------
/* This undoes QuoteString */
string DeQuoteString(string Str)
/* */
string QuoteString(string Str,const char *Bad)
{
string Res;
for (string::iterator I = Str.begin(); I != Str.end(); I++)
{
if (*I == '%' && I + 2 < Str.end())
if (strchr(Bad,*I) != 0 || isprint(*I) == 0 ||
*I <= 0x20 || *I >= 0x7F)
{
char Tmp[3];
Tmp[0] = I[1];
Tmp[1] = I[2];
Tmp[2] = 0;
Res += (char)strtol(Tmp,0,16);
I += 2;
continue;
char Buf[10];
sprintf(Buf,"%%%02x",(int)*I);
Res += Buf;
}
else
Res += *I;
@ -202,27 +199,31 @@ string DeQuoteString(string Str)
return Res;
}
/*}}}*/
// QuoteString - Convert a string into quoted from /*{{{*/
// DeQuoteString - Convert a string from quoted from /*{{{*/
// ---------------------------------------------------------------------
/* */
string QuoteString(string Str,const char *Bad)
/* This undoes QuoteString */
string DeQuoteString(string Str)
{
string Res;
for (string::iterator I = Str.begin(); I != Str.end(); I++)
{
if (strchr(Bad,*I) != 0 || isprint(*I) == 0 ||
*I <= 0x20 || *I >= 0x7F)
if (*I == '%' && I + 2 < Str.end())
{
char Buf[10];
sprintf(Buf,"%%%02x",(int)*I);
Res += Buf;
char Tmp[3];
Tmp[0] = I[1];
Tmp[1] = I[2];
Tmp[2] = 0;
Res += (char)strtol(Tmp,0,16);
I += 2;
continue;
}
else
Res += *I;
}
return Res;
return Res;
}
/*}}}*/
/*}}}*/
// SizeToStr - Convert a long into a human readable size /*{{{*/
// ---------------------------------------------------------------------
/* A max of 4 digits are shown before conversion to the next highest unit.
@ -597,6 +598,30 @@ static int MonthConv(char *Month)
}
}
/*}}}*/
// timegm - Internal timegm function if gnu is not available /*{{{*/
// ---------------------------------------------------------------------
/* Ripped this evil little function from wget - I prefer the use of
GNU timegm if possible as this technique will have interesting problems
with leap seconds, timezones and other.
Converts struct tm to time_t, assuming the data in tm is UTC rather
than local timezone (mktime assumes the latter).
Contributed by Roger Beeman <beeman@cisco.com>, with the help of
Mark Baushke <mdb@cisco.com> and the rest of the Gurus at CISCO. */
#ifndef __USE_MISC // glib sets this
static time_t timegm(struct tm *t)
{
time_t tl, tb;
tl = mktime (t);
if (tl == -1)
return -1;
tb = mktime (gmtime (&tl));
return (tl <= tb ? (tl + (tl - tb)) : (tl - (tb - tl)));
}
#endif
/*}}}*/
// StrToTime - Converts a string into a time_t /*{{{*/
// ---------------------------------------------------------------------
/* This handles all 3 populare time formats including RFC 1123, RFC 1036

2
doc/apt-get.8.yo

@ -66,7 +66,7 @@ list of locations from which to retrieve desired package files.
dit(bf(install))
bf(install) is followed by one or more em(packages) desired for installation.
Each em(package) is a package name, not a fully qualified filename
(for instance, in a Debian GNU/Linux system, em(lsdo) would be the argument
(for instance, in a Debian GNU/Linux system, em(ldso) would be the argument
provided, not em(ldso_1.9.6-2.deb)). All packages required by the package(s)
specified for installation will also be retrieved and installed. The
bf(/etc/apt/sources.list) file is used to locate the desired packages. If a

22
doc/examples/apt.conf

@ -1,4 +1,4 @@
// $Id: apt.conf,v 1.26 1999/03/02 21:19:06 jgg Exp $
// $Id: apt.conf,v 1.27 1999/03/15 08:10:39 jgg Exp $
/* This file is an index of all APT configuration directives. It should
NOT actually be used as a real config file, though it is a completely
valid file.
@ -66,6 +66,26 @@ Acquire
Max-Age "86400"; // 1 Day age on index files
No-Store "false"; // Prevent the cache from storing archives
};
ftp
{
Proxy "ftp://127.0.0.1/";
Proxy::http.us.debian.org "DIRECT"; // Specific per-host setting
// Required script to perform proxy login
ProxyLogin
{
"USER $(PROXY_USER)";
"PASS $(PROXY_PASS)";
"USER $(SITE_USER)@$(SITE):$(SITE_PORT)";
"PASS $(SITE_PASS)";
};
Timeout "120";
Passive "true";
Proxy::Passive "true";
Passive::http.us.debian.org "true"; // Specific per-host setting
};
cdrom
{

Loading…
Cancel
Save