Index: /trunk/MagicSoft/Mars/Changelog
===================================================================
--- /trunk/MagicSoft/Mars/Changelog	(revision 9441)
+++ /trunk/MagicSoft/Mars/Changelog	(revision 9442)
@@ -26,4 +26,7 @@
    * mbase/MDirIter.[h,cc]:
      - added AddFile member function
+
+   * mbase/MArgs.[h,cc]:
+     - added member function to remove an argument from the list
 
    * mgeom/MGeomPix.h:
Index: /trunk/MagicSoft/Mars/mbase/MArgs.cc
===================================================================
--- /trunk/MagicSoft/Mars/mbase/MArgs.cc	(revision 9441)
+++ /trunk/MagicSoft/Mars/mbase/MArgs.cc	(revision 9442)
@@ -292,4 +292,40 @@
 // --------------------------------------------------------------------------
 //
+// Return a pointer to the MArgsEntry of the i-th argument
+// This is ment for enumerations like
+//  executable file1 file2 file3
+//  GetArgumentStr(1) will return "file2"
+// Only arguments without a trailing '-' are considered
+//
+MArgsEntry *MArgs::GetArgument(Int_t i) const
+{
+    Int_t num = 0;
+
+    Bool_t allarg = kFALSE;
+
+    TIter Next(&fArgv);
+    MArgsEntry *e = NULL;
+    while ((e=static_cast<MArgsEntry*>(Next())))
+    {
+        const TString &s=*dynamic_cast<TString*>(e);
+
+        if (s=="--")
+        {
+            allarg = kTRUE;
+            continue;
+        }
+
+        if (s.BeginsWith("-") && !allarg)
+            continue;
+
+        if (i==num++)
+            return e;
+    }
+
+    return 0;
+}
+
+// --------------------------------------------------------------------------
+//
 // Return the TString corresponding to the i-th argument.
 // This is ment for enumerations like
@@ -299,4 +335,14 @@
 //
 TString MArgs::GetArgumentStr(Int_t i) const
+{
+    const MArgsEntry *e = GetArgument(i);
+    return e==0 ? "" : dynamic_cast<const TString&>(*e);
+}
+
+// --------------------------------------------------------------------------
+//
+// return the number of arguments without a trainling '-'
+//
+Int_t MArgs::GetNumArguments() const
 {
     Int_t num = 0;
@@ -317,38 +363,24 @@
             continue;
 
-        if (i==num++)
-            return *s;
-    }
-
-    return "";
-}
-
-// --------------------------------------------------------------------------
-//
-// return the number of arguments without a trainling '-'
-//
-Int_t MArgs::GetNumArguments() const
-{
-    Int_t num = 0;
-
-    Bool_t allarg = kFALSE;
-
-    TIter Next(&fArgv);
-    TString *s = NULL;
-    while ((s=dynamic_cast<TString*>(Next())))
-    {
-        if (*s=="--")
-        {
-            allarg = kTRUE;
-            continue;
-        }
-
-        if (s->BeginsWith("-") && !allarg)
-            continue;
-
         num++;
     }
 
     return num;
+}
+
+// --------------------------------------------------------------------------
+//
+// Remove the i-th argument from the list. Return kTRUE in case of sucess
+// kFALSE otherwise
+//
+Bool_t MArgs::RemoveArgument(Int_t i)
+{
+    MArgsEntry *e = GetArgument(i);
+    if (!e)
+        return kFALSE;
+
+    delete fArgv.Remove(e);
+
+    return kTRUE;
 }
 
Index: /trunk/MagicSoft/Mars/mbase/MArgs.h
===================================================================
--- /trunk/MagicSoft/Mars/mbase/MArgs.h	(revision 9441)
+++ /trunk/MagicSoft/Mars/mbase/MArgs.h	(revision 9442)
@@ -29,4 +29,6 @@
     Int_t fArgc; //!
     TList fArgv; //!
+
+    MArgsEntry *GetArgument(Int_t i) const;
 
 public:
@@ -66,4 +68,6 @@
     Int_t    GetNumEntries() const;
 
+    Bool_t   RemoveArgument(Int_t i);
+
     ClassDef(MArgs, 0)  //Class to parse command line arguments
 };
