Index: trunk/psastro/src/psastroLoadReferences.c
===================================================================
--- trunk/psastro/src/psastroLoadReferences.c	(revision 7332)
+++ trunk/psastro/src/psastroLoadReferences.c	(revision 7573)
@@ -3,4 +3,5 @@
 
 # define ELIXIR_MODE 1
+# define PIPE_MODE 1
 
 psArray *psastroLoadReferences (pmConfig *config) {
@@ -8,5 +9,5 @@
     int fd;
     bool status;
-    char tempFile[64], tempLine[256];
+    char tempLine[256];
 
     // select the DVO database?
@@ -25,4 +26,31 @@
     // getstar -region RAmin RAmax DECmin DECmax
 
+# if PIPE_MODE
+    // use fork to add timeout capability
+    // use cfitsio |filename format to avoid tempFile
+    # if ELIXIR_MODE
+    sprintf (tempLine, "getstar -D CATFORMAT elixir -D CATMODE mef -region %f %f %f %f |", RAmin, DECmin, RAmax, DECmax, tempFile);
+    # else
+    sprintf (tempLine, "getstar -D CATFORMAT panstarrs -D CATMODE mef -region %f %f %f %f |", RAmin, DECmin, RAmax, DECmax, tempFile);
+    # endif
+
+    psTrace (__func__, 3, "%s\n", tempLine);
+
+    // the output from getstar is a file with the Average table
+    psFits *fits = psFitsOpen (tempLine, "r");
+
+    # if ELIXIR_MODE
+    psFitsMoveExtName (fits, "DVO_AVERAGE_ELIXIR");
+    # else
+    psFitsMoveExtName (fits, "DVO_AVERAGE_PANSTARRS");
+    # endif
+
+    psMetadata *header = psFitsReadHeader (NULL, fits);
+    psArray *table = psFitsReadTable (fits);
+    psFitsClose (fits);
+
+# else /***** use a temp file instead ****/
+
+    char tempFile[64];
     sprintf (tempFile, "/tmp/psastro.XXXXXX");
     if ((fd = mkstemp (tempFile)) == -1) {
@@ -61,4 +89,6 @@
     unlink (tempFile);
 
+# endif
+
     // convert the Average table to the pmAstromObj entries
     psArray *refs = psArrayAlloc (table->n);
