diff options
author | Arch Librarian <arch@canonical.com> | 2004-09-20 16:52:40 +0000 |
---|---|---|
committer | Arch Librarian <arch@canonical.com> | 2004-09-20 16:52:40 +0000 |
commit | 1bc849af8f694ab80887bd0e9b94280f78771dbc (patch) | |
tree | 9ef7ce0628b4e3fb0bdd14b352507d8f3a09da2d /apt-pkg/contrib | |
parent | 17caf1b19355813fa7a58828d4979ecf21b1e1f9 (diff) |
Clean support
Author: jgg
Date: 1999-02-01 08:11:57 GMT
Clean support
Diffstat (limited to 'apt-pkg/contrib')
-rw-r--r-- | apt-pkg/contrib/strutl.cc | 28 | ||||
-rw-r--r-- | apt-pkg/contrib/strutl.h | 3 |
2 files changed, 28 insertions, 3 deletions
diff --git a/apt-pkg/contrib/strutl.cc b/apt-pkg/contrib/strutl.cc index e0188e3b8..b5086be04 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.18 1999/01/27 02:48:52 jgg Exp $ +// $Id: strutl.cc,v 1.19 1999/02/01 08:11:57 jgg Exp $ /* ###################################################################### String Util - Some usefull string functions. @@ -116,7 +116,7 @@ bool ParseQuoteWord(const char *&String,string &Res) { Tmp[0] = Start[1]; Tmp[1] = Start[2]; - Tmp[3] = 0; + Tmp[2] = 0; *I = (char)strtol(Tmp,0,16); Start += 3; continue; @@ -177,6 +177,30 @@ bool ParseCWord(const char *String,string &Res) return true; } /*}}}*/ +// DeQuoteString - Convert a string from quoted from /*{{{*/ +// --------------------------------------------------------------------- +/* This undoes QuoteString */ +string DeQuoteString(string Str) +{ + string Res; + for (string::iterator I = Str.begin(); I != Str.end(); I++) + { + if (*I == '%' && I + 2 < Str.end()) + { + 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; +} + /*}}}*/ // QuoteString - Convert a string into quoted from /*{{{*/ // --------------------------------------------------------------------- /* */ diff --git a/apt-pkg/contrib/strutl.h b/apt-pkg/contrib/strutl.h index e9a31f144..a79f28e4e 100644 --- a/apt-pkg/contrib/strutl.h +++ b/apt-pkg/contrib/strutl.h @@ -1,6 +1,6 @@ // -*- mode: cpp; mode: fold -*- // Description /*{{{*/ -// $Id: strutl.h,v 1.11 1999/01/27 02:48:53 jgg Exp $ +// $Id: strutl.h,v 1.12 1999/02/01 08:11:57 jgg Exp $ /* ###################################################################### String Util - These are some usefull string functions @@ -30,6 +30,7 @@ char *_strtabexpand(char *String,size_t Len); bool ParseQuoteWord(const char *&String,string &Res); bool ParseCWord(const char *String,string &Res); string QuoteString(string Str,const char *Bad); +string DeQuoteString(string Str); string SizeToStr(double Bytes); string TimeToStr(unsigned long Sec); string SubstVar(string Str,string Subst,string Contents); |