Index: trunk/ippTools/src/difftool.c
===================================================================
--- trunk/ippTools/src/difftool.c	(revision 18615)
+++ trunk/ippTools/src/difftool.c	(revision 18618)
@@ -293,4 +293,11 @@
     PXOPT_LOOKUP_BOOL(simple, config->args, "-simple", false);
     PXOPT_LOOKUP_BOOL(template, config->args, "-template", false);
+    PXOPT_LOOKUP_BOOL(input, config->args, "-input", false);
+
+    if (template && input) {
+        // User apparently wants both, which is the default behaviour
+        template = false;
+        input = false;
+    }
 
     // find all rawImfiles matching the default query
@@ -301,17 +308,24 @@
     }
 
-    if (template) {
-        // list only faulted rows
-        psStringAppend(&query, " %s", "WHERE template != 0");
-    } else {
-        // don't list faulted rows
-        psStringAppend(&query, " %s", "WHERE template = 0");
-    }
-
     if (psListLength(where->list)) {
         psString whereClause = psDBGenerateWhereConditionSQL(where, NULL);
-        psStringAppend(&query, " AND %s", whereClause);
+        psStringAppend(&query, " WHERE %s", whereClause);
         psFree(whereClause);
     }
+
+    // Add condition to get only templates or only inputs
+    {
+        psString whereClause = NULL;
+        if (template) {
+            psStringAppend(&whereClause, " %s", " template != 0");
+        } else if (input) {
+            psStringAppend(&whereClause, " %s", " template = 0");
+        }
+        if (whereClause) {
+            psStringAppend(&query, " %s %s", psListLength(where->list) ? "AND" : "WHERE", whereClause);
+        }
+        psFree(whereClause);
+    }
+
     psFree(where);
 
