summaryrefslogtreecommitdiff
path: root/apt-pkg/contrib/strutl.cc
diff options
context:
space:
mode:
Diffstat (limited to 'apt-pkg/contrib/strutl.cc')
-rw-r--r--apt-pkg/contrib/strutl.cc26
1 files changed, 25 insertions, 1 deletions
diff --git a/apt-pkg/contrib/strutl.cc b/apt-pkg/contrib/strutl.cc
index c1a1cb4db..7175402a7 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.35 2001/02/20 07:03:17 jgg Exp $
+// $Id: strutl.cc,v 1.36 2001/02/23 05:45:27 jgg Exp $
/* ######################################################################
String Util - Some useful string functions.
@@ -880,6 +880,30 @@ void ioprintf(ostream &out,const char *format,...)
}
/*}}}*/
+// CheckDomainList - See if Host is in a , seperate list /*{{{*/
+// ---------------------------------------------------------------------
+/* The domain list is a comma seperate list of domains that are suffix
+ matched against the argument */
+bool CheckDomainList(string Host,string List)
+{
+ const char *Start = List.begin();
+ for (const char *Cur = List.begin(); Cur <= List.end() ; Cur++)
+ {
+ if (Cur < List.end() && *Cur != ',')
+ continue;
+
+ // Match the end of the string..
+ if ((Host.size() >= (Cur - List.begin())) &&
+ Cur - Start != 0 &&
+ stringcasecmp(Host.end() - (Cur - Start),Host.end(),Start,Cur) == 0)
+ return true;
+
+ Start = Cur + 1;
+ }
+ return false;
+}
+ /*}}}*/
+
// URI::CopyFrom - Copy from an object /*{{{*/
// ---------------------------------------------------------------------
/* This parses the URI into all of its components */