Index: /trunk/ippdb/configure.ac
===================================================================
--- /trunk/ippdb/configure.ac	(revision 8160)
+++ /trunk/ippdb/configure.ac	(revision 8161)
@@ -1,5 +1,5 @@
 AC_PREREQ(2.59)
 
-AC_INIT([ippdb], [0.0.15], [pan-starrs.ifa.hawaii.edu])
+AC_INIT([ippdb], [0.0.1], [pan-starrs.ifa.hawaii.edu])
 AC_CONFIG_SRCDIR([ippdb.pc.in])
 
Index: /trunk/ippdb/src/ippdb.c
===================================================================
--- /trunk/ippdb/src/ippdb.c	(revision 8160)
+++ /trunk/ippdb/src/ippdb.c	(revision 8161)
@@ -77,4 +77,40 @@
 }
 
+bool ippdbPrintMetadatas(FILE *stream, psArray *mds, const char *mdname, bool mdconfigformat)
+{
+    PS_ASSERT_PTR_NON_NULL(mds, false);
+    PS_ASSERT_PTR_NON_NULL(mdname, false);
+
+    psMetadata *output = psMetadataAlloc();
+    for (long i = 0; i < psArrayLength(mds); i++) {
+        psMetadata *md = mds->data[i];
+        if (!psMetadataAddMetadata(
+            output,
+            PS_LIST_TAIL,
+            mdname,
+            PS_META_DUPLICATE_OK,
+            NULL,
+            md
+        )) {
+            psError(PS_ERR_UNKNOWN, false, "failed to add metadata");
+            psFree(md);
+            psFree(output);
+            return false;
+        }
+        psFree(md);
+    }
+
+    psString str = psMetadataConfigFormat(output);
+    if (!str) {
+        psError(PS_ERR_UNKNOWN, false, "failed to format data into a string");
+        psFree(output);
+    }
+    psFree(output);
+    fprintf(stream, "%s\n", str);
+    psFree(str);
+
+    return true;
+}
+
 static void weatherRowFree(weatherRow *object);
 
Index: /trunk/ippdb/src/ippdb.h
===================================================================
--- /trunk/ippdb/src/ippdb.h	(revision 8160)
+++ /trunk/ippdb/src/ippdb.h	(revision 8161)
@@ -29,4 +29,19 @@
 void ippdbCleanup(
     psDB            *dbh                ///< Database handle
+);
+
+/** Formats and prints an array of metadata
+ *
+ * When mdconfigformat is set the formated output is in psMetadataConfig
+ * format, otherwise it is in a simple tabular format.
+ *
+ * @return true on success
+ */
+
+bool ippdbPrintMetadatas(
+    FILE            *stream,            ///< a stream
+    psArray         *mds,               ///< An array of metadata
+    const char      *mdname,            ///< name of the metadata(s)
+    bool            mdconfigformat      ///< format as mdconfig or simple
 );
 
@@ -235,5 +250,8 @@
 /** Formats and prints an array of weatherRow objects
  *
- * @return A boolean - false on error
+ * When mdconfigformat is set the formated output is in psMetadataConfig
+ * format, otherwise it is in a simple tabular format.
+ *
+ * @return true on success
  */
 
@@ -447,5 +465,8 @@
 /** Formats and prints an array of skyp_transparencyRow objects
  *
- * @return A boolean - false on error
+ * When mdconfigformat is set the formated output is in psMetadataConfig
+ * format, otherwise it is in a simple tabular format.
+ *
+ * @return true on success
  */
 
@@ -667,5 +688,8 @@
 /** Formats and prints an array of skyp_absorptionRow objects
  *
- * @return A boolean - false on error
+ * When mdconfigformat is set the formated output is in psMetadataConfig
+ * format, otherwise it is in a simple tabular format.
+ *
+ * @return true on success
  */
 
@@ -875,5 +899,8 @@
 /** Formats and prints an array of skyp_emissionRow objects
  *
- * @return A boolean - false on error
+ * When mdconfigformat is set the formated output is in psMetadataConfig
+ * format, otherwise it is in a simple tabular format.
+ *
+ * @return true on success
  */
 
@@ -1087,5 +1114,8 @@
 /** Formats and prints an array of dimmRow objects
  *
- * @return A boolean - false on error
+ * When mdconfigformat is set the formated output is in psMetadataConfig
+ * format, otherwise it is in a simple tabular format.
+ *
+ * @return true on success
  */
 
@@ -1295,5 +1325,8 @@
 /** Formats and prints an array of skyp_irRow objects
  *
- * @return A boolean - false on error
+ * When mdconfigformat is set the formated output is in psMetadataConfig
+ * format, otherwise it is in a simple tabular format.
+ *
+ * @return true on success
  */
 
@@ -1495,5 +1528,8 @@
 /** Formats and prints an array of domeRow objects
  *
- * @return A boolean - false on error
+ * When mdconfigformat is set the formated output is in psMetadataConfig
+ * format, otherwise it is in a simple tabular format.
+ *
+ * @return true on success
  */
 
@@ -1699,5 +1735,8 @@
 /** Formats and prints an array of telescopeRow objects
  *
- * @return A boolean - false on error
+ * When mdconfigformat is set the formated output is in psMetadataConfig
+ * format, otherwise it is in a simple tabular format.
+ *
+ * @return true on success
  */
 
@@ -1903,5 +1942,8 @@
 /** Formats and prints an array of summitExpRow objects
  *
- * @return A boolean - false on error
+ * When mdconfigformat is set the formated output is in psMetadataConfig
+ * format, otherwise it is in a simple tabular format.
+ *
+ * @return true on success
  */
 
@@ -2107,5 +2149,8 @@
 /** Formats and prints an array of pzPendingExpRow objects
  *
- * @return A boolean - false on error
+ * When mdconfigformat is set the formated output is in psMetadataConfig
+ * format, otherwise it is in a simple tabular format.
+ *
+ * @return true on success
  */
 
@@ -2315,5 +2360,8 @@
 /** Formats and prints an array of pzPendingImfileRow objects
  *
- * @return A boolean - false on error
+ * When mdconfigformat is set the formated output is in psMetadataConfig
+ * format, otherwise it is in a simple tabular format.
+ *
+ * @return true on success
  */
 
@@ -2519,5 +2567,8 @@
 /** Formats and prints an array of newExpRow objects
  *
- * @return A boolean - false on error
+ * When mdconfigformat is set the formated output is in psMetadataConfig
+ * format, otherwise it is in a simple tabular format.
+ *
+ * @return true on success
  */
 
@@ -2719,5 +2770,8 @@
 /** Formats and prints an array of newImfileRow objects
  *
- * @return A boolean - false on error
+ * When mdconfigformat is set the formated output is in psMetadataConfig
+ * format, otherwise it is in a simple tabular format.
+ *
+ * @return true on success
  */
 
@@ -2947,5 +3001,8 @@
 /** Formats and prints an array of rawDetrendExpRow objects
  *
- * @return A boolean - false on error
+ * When mdconfigformat is set the formated output is in psMetadataConfig
+ * format, otherwise it is in a simple tabular format.
+ *
+ * @return true on success
  */
 
@@ -3175,5 +3232,8 @@
 /** Formats and prints an array of rawScienceExpRow objects
  *
- * @return A boolean - false on error
+ * When mdconfigformat is set the formated output is in psMetadataConfig
+ * format, otherwise it is in a simple tabular format.
+ *
+ * @return true on success
  */
 
@@ -3375,5 +3435,8 @@
 /** Formats and prints an array of rawImfileRow objects
  *
- * @return A boolean - false on error
+ * When mdconfigformat is set the formated output is in psMetadataConfig
+ * format, otherwise it is in a simple tabular format.
+ *
+ * @return true on success
  */
 
@@ -3611,5 +3674,8 @@
 /** Formats and prints an array of p1PendingExpRow objects
  *
- * @return A boolean - false on error
+ * When mdconfigformat is set the formated output is in psMetadataConfig
+ * format, otherwise it is in a simple tabular format.
+ *
+ * @return true on success
  */
 
@@ -3851,5 +3917,8 @@
 /** Formats and prints an array of p2PendingExpRow objects
  *
- * @return A boolean - false on error
+ * When mdconfigformat is set the formated output is in psMetadataConfig
+ * format, otherwise it is in a simple tabular format.
+ *
+ * @return true on success
  */
 
@@ -4059,5 +4128,8 @@
 /** Formats and prints an array of p2PendingImfileRow objects
  *
- * @return A boolean - false on error
+ * When mdconfigformat is set the formated output is in psMetadataConfig
+ * format, otherwise it is in a simple tabular format.
+ *
+ * @return true on success
  */
 
@@ -4299,5 +4371,8 @@
 /** Formats and prints an array of p2DoneExpRow objects
  *
- * @return A boolean - false on error
+ * When mdconfigformat is set the formated output is in psMetadataConfig
+ * format, otherwise it is in a simple tabular format.
+ *
+ * @return true on success
  */
 
@@ -4507,5 +4582,8 @@
 /** Formats and prints an array of p2DoneImfileRow objects
  *
- * @return A boolean - false on error
+ * When mdconfigformat is set the formated output is in psMetadataConfig
+ * format, otherwise it is in a simple tabular format.
+ *
+ * @return true on success
  */
 
@@ -4743,5 +4821,8 @@
 /** Formats and prints an array of p3PendingExpRow objects
  *
- * @return A boolean - false on error
+ * When mdconfigformat is set the formated output is in psMetadataConfig
+ * format, otherwise it is in a simple tabular format.
+ *
+ * @return true on success
  */
 
@@ -4935,5 +5016,8 @@
 /** Formats and prints an array of detRunRow objects
  *
- * @return A boolean - false on error
+ * When mdconfigformat is set the formated output is in psMetadataConfig
+ * format, otherwise it is in a simple tabular format.
+ *
+ * @return true on success
  */
 
@@ -5171,5 +5255,8 @@
 /** Formats and prints an array of detInputExpRow objects
  *
- * @return A boolean - false on error
+ * When mdconfigformat is set the formated output is in psMetadataConfig
+ * format, otherwise it is in a simple tabular format.
+ *
+ * @return true on success
  */
 
@@ -5375,5 +5462,8 @@
 /** Formats and prints an array of detProcessedImfileRow objects
  *
- * @return A boolean - false on error
+ * When mdconfigformat is set the formated output is in psMetadataConfig
+ * format, otherwise it is in a simple tabular format.
+ *
+ * @return true on success
  */
 
@@ -5579,5 +5669,8 @@
 /** Formats and prints an array of detStackedImfileRow objects
  *
- * @return A boolean - false on error
+ * When mdconfigformat is set the formated output is in psMetadataConfig
+ * format, otherwise it is in a simple tabular format.
+ *
+ * @return true on success
  */
 
@@ -5783,5 +5876,8 @@
 /** Formats and prints an array of detNormalizedImfileRow objects
  *
- * @return A boolean - false on error
+ * When mdconfigformat is set the formated output is in psMetadataConfig
+ * format, otherwise it is in a simple tabular format.
+ *
+ * @return true on success
  */
 
@@ -5979,5 +6075,8 @@
 /** Formats and prints an array of detMasterFrameRow objects
  *
- * @return A boolean - false on error
+ * When mdconfigformat is set the formated output is in psMetadataConfig
+ * format, otherwise it is in a simple tabular format.
+ *
+ * @return true on success
  */
 
@@ -6179,5 +6278,8 @@
 /** Formats and prints an array of detMasterImfileRow objects
  *
- * @return A boolean - false on error
+ * When mdconfigformat is set the formated output is in psMetadataConfig
+ * format, otherwise it is in a simple tabular format.
+ *
+ * @return true on success
  */
 
@@ -6395,5 +6497,8 @@
 /** Formats and prints an array of detResidImfileAnalysisRow objects
  *
- * @return A boolean - false on error
+ * When mdconfigformat is set the formated output is in psMetadataConfig
+ * format, otherwise it is in a simple tabular format.
+ *
+ * @return true on success
  */
 
@@ -6599,5 +6704,8 @@
 /** Formats and prints an array of detResidExpAnalysisRow objects
  *
- * @return A boolean - false on error
+ * When mdconfigformat is set the formated output is in psMetadataConfig
+ * format, otherwise it is in a simple tabular format.
+ *
+ * @return true on success
  */
 
