Index: trunk/Ohana/src/getstar/src/dvoImagesAtCoords.c
===================================================================
--- trunk/Ohana/src/getstar/src/dvoImagesAtCoords.c	(revision 35066)
+++ trunk/Ohana/src/getstar/src/dvoImagesAtCoords.c	(revision 36057)
@@ -9,4 +9,5 @@
 static int makePoint(double ra, double dec, Point **pointsOut);
 static int ListImagesAtCoords (Image *dbImages, Point *points, int Npoints);
+static int readPointFromFile(FILE *f, Point *pt);
 
 int main (int argc, char **argv) {
@@ -23,10 +24,15 @@
   
   Point *points;
+  int readStdin = 0;
   if (coordsFile) {
-      Npoints = readPoints(coordsFile, &points);
+      if (strcmp(coordsFile, "-") == 0) {
+        readStdin = 1;
+      } else {
+        Npoints = readPoints(coordsFile, &points);
+      }
   } else {
       Npoints = makePoint(cmd_line_ra, cmd_line_dec, &points);
   }
-  if (!Npoints) {
+  if (!Npoints && !readStdin) {
     exit(1);
   }
@@ -61,10 +67,52 @@
   }
   
-  if (MatchCoords (dbImages, NdbImages, points, Npoints)) {
-    ListImagesAtCoords(dbImages, points, Npoints);
-    exit(0);
+  if (readStdin) {
+    Point pt;
+    memset(&pt, 0, sizeof(pt));
+    pt.Nmatches = 0;
+    ALLOCATE(pt.matches, Match, 20);
+    pt.arrayLength = 20;
+
+    int status;
+    while ((status = readPointFromFile(stdin, &pt))) {
+      if (status < 0) {
+        fprintf(stdout, "ERROR malformed input line\n");
+        exit(1);
+      }
+      if (MatchCoords (dbImages, NdbImages, &pt, 1)) {
+        ListImagesAtCoords(dbImages, &pt, 1);
+      }
+      fprintf(stdout, "DONE\n");
+      fflush(stdout);
+      pt.Nmatches = 0;
+    }
   } else {
-    exit(PSTAMP_NO_OVERLAP);
-  }
+    if (MatchCoords (dbImages, NdbImages, points, Npoints)) {
+      ListImagesAtCoords(dbImages, points, Npoints);
+    } else {
+      exit(PSTAMP_NO_OVERLAP);
+    }
+  }
+  exit(0);
+}
+
+static int readPointFromFile(FILE *f, Point *pt) {
+    char buf[80];
+    char *good = fgets(buf, 80, f);
+    if (!good) {
+        return 0;
+    }
+    // fprintf(stderr, "READ: %s\n", buf);
+    int Nread = sscanf(buf, "%d %lf %lf\n", &pt->id, &pt->ra, &pt->dec);
+    if (Nread == 3) {
+        // got one
+        return 1;
+    } else if (Nread == -1) {
+        // all done time to go
+        return 0;
+    } else {
+        // fprintf(stderr, "malformed input line: %d\n", Nread);
+        return -1;
+    }
 }
 
