Index: trunk/pswarp/src/pswarp.c
===================================================================
--- trunk/pswarp/src/pswarp.c	(revision 17781)
+++ trunk/pswarp/src/pswarp.c	(revision 18924)
@@ -2,9 +2,9 @@
 
 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, "    [-weight weight.fits] : provide a corresponding weight image (pixel varience)\n");
+    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, "    [-weight weight.fits] : provide a corresponding weight image (pixel varience)\n");
     psErrorStackPrint(stderr, "\n");
     exit (2);
@@ -24,13 +24,13 @@
     if (!config) usage();
 
-    if (!pswarpOptions(config)) {
-        psErrorStackPrint(stderr, "error parsing options\n");
-        exit(1);
-    }
-
     // load identify the data sources
     if (!pswarpParseCamera(config)) {
         psErrorStackPrint(stderr, "error setting up the camera\n");
-        exit (1);
+        exit(PS_EXIT_CONFIG_ERROR);
+    }
+
+    if (!pswarpOptions(config)) {
+        psErrorStackPrint(stderr, "error parsing options\n");
+        exit(PS_EXIT_SYS_ERROR);
     }
 
@@ -38,5 +38,5 @@
     if (!pswarpDefine(config)) {
         psErrorStackPrint(stderr, "error loading output definition\n");
-        exit (1);
+        exit(PS_EXIT_CONFIG_ERROR);
     }
 
@@ -44,5 +44,5 @@
     if (!pswarpLoop(config)) {
         psErrorStackPrint(stderr, "error warping data\n");
-        exit (1);
+        exit(PS_EXIT_DATA_ERROR);
     }
 
@@ -50,4 +50,4 @@
     pswarpCleanup(config);
     psLibFinalize();
-    exit(EXIT_SUCCESS);
+    exit(PS_EXIT_SUCCESS);
 }
