Index: trunk/ippTools/src/addtool.c
===================================================================
--- trunk/ippTools/src/addtool.c	(revision 37709)
+++ trunk/ippTools/src/addtool.c	(revision 38359)
@@ -167,4 +167,5 @@
         return false;
     }
+    
     // PXOPT_LOOKUP_STR(stage,       config->args, "-stage", false, false);
     PXOPT_LOOKUP_STR(workdir,     config->args, "-set_workdir", false, false);
@@ -182,5 +183,10 @@
     PXOPT_LOOKUP_BOOL(pretend,    config->args, "-pretend", false);
     PXOPT_LOOKUP_BOOL(simple,     config->args, "-simple", false);
-
+   
+    PXOPT_LOOKUP_F32(minra,     config->args, "-set_minra", false, false);
+    PXOPT_LOOKUP_F32(maxra,     config->args, "-set_maxra", false, false);
+    PXOPT_LOOKUP_F32(mindec,     config->args, "-set_mindec", false, false);
+    PXOPT_LOOKUP_F32(maxdec,     config->args, "-set_maxdec", false, false);
+   
     // prevent queueing an addRun if a given exposure has already been added to
     // the given dvo database
@@ -288,5 +294,7 @@
 	// this is silly, there is no dvodb in skycalRun...?
       }
-    }
+      
+
+     }
 
     if (strcmp(stage,"fullforce") == 0) {
@@ -326,4 +334,13 @@
         psString whereClause = psDBGenerateWhereConditionSQL(where, NULL);
         psStringAppend(&query, " AND %s", whereClause);
+	if (strcmp(stage,"diff") == 0) {
+	  //diff needs the ra /deg stuff
+	  psStringAppend(&query, " AND radeg >= %f", minra);
+	  psStringAppend(&query, " AND radeg <= %f", maxra);
+	  psStringAppend(&query, " AND decdeg >= %f", mindec);
+	  psStringAppend(&query, " AND decdeg <= %f", maxdec);
+
+	}
+
         psFree(whereClause);
     } else {
@@ -373,4 +390,5 @@
       //needs to be checked HAF xxx
       if (strcmp(stage,"diff") == 0) {
+
 	psStringAppend(&query, " GROUP BY diff_id, diff_skyfile_id ");  //this needs checking, but I think it shoul be fine? it groups by lots of stuff (including stack - we only want one of each stack in there
       }
@@ -380,5 +398,5 @@
       }
 
-
+      psError(PS_ERR_UNKNOWN, false , query);
 
 
