summaryrefslogtreecommitdiff
path: root/apt-pkg/contrib
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/contrib
parentb7675e5dac28258f2d44bb63f13381dd4f5c9ec7 (diff)
More fixes
Author: jgg Date: 2000-01-16 05:36:17 GMT More fixes
Diffstat (limited to 'apt-pkg/contrib')
-rw-r--r--apt-pkg/contrib/configuration.cc11
-rw-r--r--apt-pkg/contrib/strutl.cc25
2 files changed, 27 insertions, 9 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];