diff options
author | Arch Librarian <arch@canonical.com> | 2004-09-20 16:51:40 +0000 |
---|---|---|
committer | Arch Librarian <arch@canonical.com> | 2004-09-20 16:51:40 +0000 |
commit | bc4af0b920be60156e5567ada3339b432d3f6e3a (patch) | |
tree | 10c8aba51a021028bfa73dba828a7fb625c959b3 /apt-pkg/contrib/cmndline.cc | |
parent | 6a7cf7699dd3996bf0d6832d5da23f232b260713 (diff) |
More CD support
Author: jgg
Date: 1998-11-25 23:54:06 GMT
More CD support
Diffstat (limited to 'apt-pkg/contrib/cmndline.cc')
-rw-r--r-- | apt-pkg/contrib/cmndline.cc | 27 |
1 files changed, 25 insertions, 2 deletions
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; +} + /*}}}*/ |