Index: branches/simmosaic_branches/pswarp/src/pswarpArguments.c
===================================================================
--- branches/simmosaic_branches/pswarp/src/pswarpArguments.c	(revision 24860)
+++ branches/simmosaic_branches/pswarp/src/pswarpArguments.c	(revision 27839)
@@ -14,4 +14,16 @@
 # include <glob.h>
 
+
+static void usage (void) {
+    fprintf(stderr, "USAGE: pswarp [-file image(s)] [-list imagelist] [options] (output) (skycell)\n");
+    fprintf(stderr, "  options:\n");
+    fprintf(stderr, "    [-astrom astrom.cmp] : provide an alternative astrometry calibration\n");
+    fprintf(stderr, "    [-mask mask.fits] : provide a corresponding mask image\n");
+    fprintf(stderr, "    [-variance variance.fits] : provide a corresponding variance image\n");
+    psErrorStackPrint(stderr, "\n");
+    exit(PS_EXIT_CONFIG_ERROR);
+}
+
+
 pmConfig *pswarpArguments (int argc, char **argv) {
 
@@ -20,12 +32,11 @@
 
     if (argc == 1) {
-        psError(PSWARP_ERR_ARGUMENTS, true, "No arguments supplied");
-        return NULL;
+        usage();
     }
 
     // load config data from default locations
     pmConfig *config = pmConfigRead(&argc, argv, PSWARP_RECIPE);
-    if (config == NULL) {
-        psError(PSWARP_ERR_CONFIG, false, "Can't read site configuration");
+    if (!config) {
+        psError(psErrorCodeLast(), false, "Can't read configuration");
         return NULL;
     }
@@ -33,5 +44,9 @@
     // save the following additional recipe values based on command-line options
     // these options override the PSWARP recipe values loaded from recipe files
-    pmConfigRecipeOptions (config, PSWARP_RECIPE);
+    if (!pmConfigRecipeOptions(config, PSWARP_RECIPE)) {
+        psError(psErrorCodeLast(), false, "Can't do something with recipes");
+        psFree(config);
+        return NULL;
+    }
 
     pmConfigFileSetsMD(config->arguments, &argc, argv, "ASTROM",   "-astrom", "-astromlist");
@@ -72,11 +87,6 @@
         psThreadPoolInit (nThreads);
     }
-    pswarpSetThreads ();
-
-    // PSF determination?
-    if ((N = psArgumentGet(argc, argv, "-psf"))) {
-        psArgumentRemove(N, &argc, argv);
-        psMetadataAddBool(config->arguments, PS_LIST_TAIL, "PSF", 0, "Do PSF determination?", true);
-    }
+    pswarpSetThreads();
+
     if ((N = psArgumentGet(argc, argv, "-dumpconfig"))) {
         psArgumentRemove(N, &argc, argv);
@@ -92,6 +102,5 @@
 
     if (argc != 3) {
-        psError(PSWARP_ERR_ARGUMENTS, true, "Incorrect arguments supplied");
-        return NULL;
+        usage();
     }
 
@@ -161,4 +170,10 @@
         poorFrac = 0.0;
         psWarning("POOR.FRAC is not set in the %s recipe --- defaulting to %f.", PSWARP_RECIPE, poorFrac);
+    }
+
+    bool PSF = psMetadataLookupBool(&status, recipe, "PSF"); ///< Generate a PSF model?
+    if (!status) {
+        PSF = true;
+        psWarning("PSF is not set in the %s recipe --- defaulting to TRUE.", PSWARP_RECIPE);
     }
 
@@ -174,4 +189,5 @@
     psMetadataAddF32(recipe, PS_LIST_TAIL, "POOR.FRAC", PS_META_REPLACE,
                      "Fraction of bad flux for a pixel to be marked as poor", poorFrac);
+    psMetadataAddBool(recipe, PS_LIST_TAIL, "PSF", PS_META_REPLACE, "Generate a PSF Model?", PSF);
 
     // Set recipe values in the arguments
@@ -186,4 +202,5 @@
     psMetadataAddF32(config->arguments, PS_LIST_TAIL, "POOR.FRAC", 0,
                      "Fraction of bad flux for a pixel to be marked as poor", poorFrac);
+    psMetadataAddBool(config->arguments, PS_LIST_TAIL, "PSF", PS_META_REPLACE, "Generate a PSF Model?", PSF);
 
     psTrace("pswarp", 1, "Done with pswarpArguments...\n");
