Index: /branches/eam_branch_20080408/psLib/src/types/psMetadata.c
===================================================================
--- /branches/eam_branch_20080408/psLib/src/types/psMetadata.c	(revision 17390)
+++ /branches/eam_branch_20080408/psLib/src/types/psMetadata.c	(revision 17391)
@@ -12,6 +12,6 @@
  *  @author Ross Harman, MHPCC
  *
- *  @version $Revision: 1.168 $ $Name: not supported by cvs2svn $
- *  @date $Date: 2008-03-05 00:57:00 $
+ *  @version $Revision: 1.168.2.1 $ $Name: not supported by cvs2svn $
+ *  @date $Date: 2008-04-08 18:26:00 $
  *
  *  Copyright 2004-2005 Maui High Performance Computing Center, University of Hawaii
@@ -498,7 +498,17 @@
     psMetadataItem *inItem = NULL;
     while ((inItem = psMetadataGetAndIncrement(iter))) {
+
+	// XXX options:
+	// input MULTI & RESET  : replace an existing MULTI or ITEM of same name
+	// input MULTI & UPDATE : supplement an existing MULTI or ITEM of same name
+	// in both cases the name must exist in 'out' 
+
+	// XXX we can meet this condition by respecting the value of 
+	// XXX do we need to do something special if the existing item is not MULTI?
+
         // Need to look for MULTI, which won't be picked up using the iterator.
         psMetadataItem *multiCheckItem = psMetadataLookup(in, inItem->name);
         unsigned int flag = PS_META_REPLACE | PS_META_REQUIRE_ENTRY | PS_META_REQUIRE_TYPE; // Flag to indicate MULTI; otherwise, replace
+
         if (multiCheckItem->type == PS_DATA_METADATA_MULTI) {
             psTrace("psLib.types", 10, "MULTI: %s (%s)\n", inItem->name, inItem->comment);
Index: /branches/eam_branch_20080408/psLib/src/types/psMetadataConfig.c
===================================================================
--- /branches/eam_branch_20080408/psLib/src/types/psMetadataConfig.c	(revision 17390)
+++ /branches/eam_branch_20080408/psLib/src/types/psMetadataConfig.c	(revision 17391)
@@ -11,6 +11,6 @@
 *  @author Joshua Hoblitt, University of Hawaii 2006-2007
 *
-*  @version $Revision: 1.142 $ $Name: not supported by cvs2svn $
-*  @date $Date: 2007-11-08 04:24:01 $
+*  @version $Revision: 1.142.4.1 $ $Name: not supported by cvs2svn $
+*  @date $Date: 2008-04-08 18:26:00 $
 *
 *  Copyright 2004-2005 Maui High Performance Computing Center, University of Hawaii
@@ -802,6 +802,54 @@
     }
 
-    // If type is not MULTI or META then get the value and comment
-    if((mdType != PS_DATA_METADATA_MULTI) && (mdType != PS_DATA_METADATA)) {
+    // If type is MULTI or META then check for the (optional) directives UPDATE or RESET;
+    // otherwise, get the value and comment.
+    if((mdType == PS_DATA_METADATA_MULTI) || (mdType == PS_DATA_METADATA)) {
+        // Get the metadata item value if there is one.
+        status = 0;
+        strValue = getToken (&linePtr, "#", &status, true);
+
+        if (status) {
+            psError(PS_ERR_IO, true, _("Failed to examine line for optional directive."));
+            psFree(strType);
+            psFree(strValue);
+            return false;
+        }
+
+        if (strValue) {
+	    // found a directive, what does it say?
+	    if (strcasecmp (strValue, "UPDATE") && strcasecmp (strValue, "UPDATE")) {
+		psError(PS_ERR_IO, true, _("Invalid directive %s for METADATA or MULTI.", strValue));
+		psFree(strType);
+		psFree(strValue);
+		return false;
+	    }
+
+	    // found a directive, what does it say?
+	    if (!strcasecmp (strValue, "UPDATE")) {
+		// XXX set the flag DUPLICATE_OK (or whatver it is we need)
+		flags |= UPDATE;
+	    }
+	    if (!strcasecmp (strValue, "RESET")) {
+		// XXX set the flag REPLACE (or whatver it is we need)
+		flags |= RESET;
+	    }
+        }
+	psFree(strValue);
+	strValue = NULL;
+
+        // Not all lines will have comments, so NULL is ok.
+        status = 0;
+
+        // XXX this is a very ugly way of finding from the current position to
+        // the end of the line
+        strComment = getToken(&linePtr, "", &status, true);
+
+        if (status) {
+            psError(PS_ERR_IO, true, _("Error reading a metadata comment"));
+            psFree(strType);
+            psFree(strComment);
+            return false;
+        }
+    } else {
         // Get the metadata item value if there is one.
         status = 0;
@@ -833,5 +881,5 @@
             return false;
         }
-    }
+    } 
 
 #define PARSE_ADD_CASE(NAME, TYPE, PARSEFUNC) \
