From bc4af0b920be60156e5567ada3339b432d3f6e3a Mon Sep 17 00:00:00 2001 From: Arch Librarian Date: Mon, 20 Sep 2004 16:51:40 +0000 Subject: More CD support Author: jgg Date: 1998-11-25 23:54:06 GMT More CD support --- apt-pkg/contrib/cmndline.cc | 27 +++++++++++++++++++++++++-- 1 file changed, 25 insertions(+), 2 deletions(-) (limited to 'apt-pkg/contrib/cmndline.cc') diff --git a/apt-pkg/contrib/cmndline.cc b/apt-pkg/contrib/cmndline.cc index 9546eac8f..858a5300a 100644 --- a/apt-pkg/contrib/cmndline.cc +++ b/apt-pkg/contrib/cmndline.cc @@ -1,6 +1,6 @@ // -*- mode: cpp; mode: fold -*- // Description /*{{{*/ -// $Id: cmndline.cc,v 1.5 1998/10/24 20:14:34 jgg Exp $ +// $Id: cmndline.cc,v 1.6 1998/11/25 23:54:22 jgg Exp $ /* ###################################################################### Command Line Class - Sophisticated command line parser @@ -302,7 +302,7 @@ bool CommandLine::HandleOpt(int &I,int argc,const char *argv[], return true; } /*}}}*/ -// CommandLine::FileSize - Count the number of filenames /*{{{*/ +// CommandLine::FileSize - Count the number of filenames /*{{{*/ // --------------------------------------------------------------------- /* */ unsigned int CommandLine::FileSize() const @@ -313,3 +313,26 @@ unsigned int CommandLine::FileSize() const return Count; } /*}}}*/ +// CommandLine::DispatchArg - Do something with the first arg /*{{{*/ +// --------------------------------------------------------------------- +/* */ +bool CommandLine::DispatchArg(Dispatch *Map) +{ + int I; + for (I = 0; Map[I].Match != 0; I++) + { + if (strcmp(FileList[0],Map[I].Match) == 0) + { + bool Res = Map[I].Handler(*this); + if (Res == false && _error->PendingError() == false) + _error->Error("Handler silently failed"); + return Res; + } + } + + // No matching name + if (Map[I].Match == 0) + _error->Error("Invalid operation %s",FileList[0]); + return false; +} + /*}}}*/ -- cgit v1.2.3