summaryrefslogtreecommitdiff
path: root/apt-pkg
diff options
context:
space:
mode:
authorArch Librarian <arch@canonical.com>2004-09-20 16:55:40 +0000
committerArch Librarian <arch@canonical.com>2004-09-20 16:55:40 +0000
commit7834cb579fe88a11bd3850363bbd4c77797581bb (patch)
treec41841b664cbd29e9abd6addf54634faf0559120 /apt-pkg
parentb7675e5dac28258f2d44bb63f13381dd4f5c9ec7 (diff)
More fixes
Author: jgg Date: 2000-01-16 05:36:17 GMT More fixes
Diffstat (limited to 'apt-pkg')
-rw-r--r--apt-pkg/contrib/configuration.cc11
-rw-r--r--apt-pkg/contrib/strutl.cc25
-rw-r--r--apt-pkg/orderlist.cc8
3 files changed, 31 insertions, 13 deletions
diff --git a/apt-pkg/contrib/configuration.cc b/apt-pkg/contrib/configuration.cc
index 1c58b9881..302feee6e 100644
--- a/apt-pkg/contrib/configuration.cc
+++ b/apt-pkg/contrib/configuration.cc
@@ -1,6 +1,6 @@
// -*- mode: cpp; mode: fold -*-
// Description /*{{{*/
-// $Id: configuration.cc,v 1.13 1999/07/02 23:17:00 jgg Exp $
+// $Id: configuration.cc,v 1.14 2000/01/16 05:36:17 jgg Exp $
/* ######################################################################
Configuration Class
@@ -322,8 +322,9 @@ bool ReadConfigFile(Configuration &Conf,string FName)
break;
}
}
-
+
// Look for multi line comments
+ InQuote = false;
for (char *I = Buffer; *I != 0; I++)
{
if (*I == '"')
@@ -357,9 +358,13 @@ bool ReadConfigFile(Configuration &Conf,string FName)
continue;
// We now have a valid line fragment
+ InQuote = false;
for (char *I = Buffer; *I != 0;)
{
- if (*I == '{' || *I == ';' || *I == '}')
+ if (*I == '"')
+ InQuote = !InQuote;
+
+ if (InQuote == false && (*I == '{' || *I == ';' || *I == '}'))
{
// Put the last fragement into the buffer
char *Start = Buffer;
diff --git a/apt-pkg/contrib/strutl.cc b/apt-pkg/contrib/strutl.cc
index 9899694c6..f8a3f8e2b 100644
--- a/apt-pkg/contrib/strutl.cc
+++ b/apt-pkg/contrib/strutl.cc
@@ -1,6 +1,6 @@
// -*- mode: cpp; mode: fold -*-
// Description /*{{{*/
-// $Id: strutl.cc,v 1.33 2000/01/14 06:26:37 jgg Exp $
+// $Id: strutl.cc,v 1.34 2000/01/16 05:36:17 jgg Exp $
/* ######################################################################
String Util - Some usefull string functions.
@@ -87,7 +87,8 @@ char *_strtabexpand(char *String,size_t Len)
// ---------------------------------------------------------------------
/* This grabs a single word, converts any % escaped characters to their
proper values and advances the pointer. Double quotes are understood
- and striped out as well. This is for URI/URL parsing. */
+ and striped out as well. This is for URI/URL parsing. It also can
+ understand [] brackets.*/
bool ParseQuoteWord(const char *&String,string &Res)
{
// Skip leading whitespace
@@ -101,7 +102,13 @@ bool ParseQuoteWord(const char *&String,string &Res)
{
if (*C == '"')
{
- for (C++;*C != 0 && *C != '"'; C++);
+ for (C++; *C != 0 && *C != '"'; C++);
+ if (*C == 0)
+ return false;
+ }
+ if (*C == '[')
+ {
+ for (C++; *C != 0 && *C != ']'; C++);
if (*C == 0)
return false;
}
@@ -867,10 +874,10 @@ URI::operator string()
Res = Access + ':';
if (Host.empty() == false)
- {
+ {
if (Access.empty() == false)
Res += "//";
-
+
if (User.empty() == false)
{
Res += User;
@@ -879,7 +886,13 @@ URI::operator string()
Res += "@";
}
- Res += Host;
+ // Add RFC 2732 escaping characters
+ if (Access.empty() == false &&
+ (Host.find('/') != string::npos || Host.find(':') != string::npos))
+ Res += '[' + Host + ']';
+ else
+ Res += Host;
+
if (Port != 0)
{
char S[30];
diff --git a/apt-pkg/orderlist.cc b/apt-pkg/orderlist.cc
index bfe91507e..fbd21d400 100644
--- a/apt-pkg/orderlist.cc
+++ b/apt-pkg/orderlist.cc
@@ -1,6 +1,6 @@
// -*- mode: cpp; mode: fold -*-
// Description /*{{{*/
-// $Id: orderlist.cc,v 1.9 1999/11/04 06:05:02 jgg Exp $
+// $Id: orderlist.cc,v 1.10 2000/01/16 05:36:17 jgg Exp $
/* ######################################################################
Order List - Represents and Manipulates an ordered list of packages.
@@ -209,7 +209,7 @@ bool pkgOrderList::OrderUnpack(string *FileList)
for (iterator I = List; I != End; I++)
{
PkgIterator P(Cache,*I);
- cout << P.Name() << endl;
+ cout << P.Name() << ' ' << IsMissing(P) << endl;
}*/
return true;
@@ -312,14 +312,14 @@ int pkgOrderList::OrderCompareA(const void *a, const void *b)
// We order packages with a set state toward the front
int Res;
- if ((Res = BoolCompare(Me->IsNow(A),Me->IsNow(B))) == 0)
+ if ((Res = BoolCompare(Me->IsNow(A),Me->IsNow(B))) != 0)
return -1*Res;
// We order missing files to toward the end
if (Me->FileList != 0)
{
if ((Res = BoolCompare(Me->IsMissing(A),
- Me->IsMissing(B))) == 0)
+ Me->IsMissing(B))) != 0)
return Res;
}