Index: branches/tap_branches/pswarp/src/pswarpArguments.c
===================================================================
--- branches/tap_branches/pswarp/src/pswarpArguments.c	(revision 25900)
+++ branches/tap_branches/pswarp/src/pswarpArguments.c	(revision 27838)
@@ -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,5 +87,5 @@
         psThreadPoolInit (nThreads);
     }
-    pswarpSetThreads ();
+    pswarpSetThreads();
 
     if ((N = psArgumentGet(argc, argv, "-dumpconfig"))) {
@@ -87,6 +102,5 @@
 
     if (argc != 3) {
-        psError(PSWARP_ERR_ARGUMENTS, true, "Incorrect arguments supplied");
-        return NULL;
+        usage();
     }
 
@@ -160,5 +174,5 @@
     bool PSF = psMetadataLookupBool(&status, recipe, "PSF"); ///< Generate a PSF model?
     if (!status) {
-	PSF = true;
+        PSF = true;
         psWarning("PSF is not set in the %s recipe --- defaulting to TRUE.", PSWARP_RECIPE);
     }
