Index: trunk/psastro/src/psastroArguments.c
===================================================================
--- trunk/psastro/src/psastroArguments.c	(revision 9373)
+++ trunk/psastro/src/psastroArguments.c	(revision 9574)
@@ -1,10 +1,4 @@
 # include "psastro.h"
 # include <glob.h>
-// XXX leak free 2006.04.27
-
-static void usage (void) {
-    fprintf (stderr, "USAGE: psastro [-file image(s)] [-list imagelist] (output)\n");
-    exit (2);
-}
 
 pmConfig *psastroArguments (int argc, char **argv) {
@@ -13,5 +7,8 @@
     int N;
 
-    if (argc == 1) usage ();
+    if (argc == 1) {
+	psError(PSASTRO_ERR_ARGUMENTS, true, "No arguments supplied");
+	return NULL;
+    }
 
     // basic pslib options
@@ -50,12 +47,18 @@
 
     status = pmConfigFileSetsMD (config->arguments, config, "INPUT", "-file", "-list");
-    if (!status) { usage ();}
-
-    if (argc != 2) usage ();
-
+    if (!status) {
+	psError(PSASTRO_ERR_ARGUMENTS, true, "Missing -file (input) or -list (input)");
+	return NULL;
+    }
+    
+    if (argc != 2) {
+	psError(PSASTRO_ERR_ARGUMENTS, true, "Incorrect arguments supplied");
+	return NULL;
+    }
+    
     // output positions is fixed
     psMetadataAddStr (config->arguments, PS_LIST_TAIL, "OUTPUT", 0, "", argv[1]);
 
-    psTrace(__func__, 1, "Done with psastroArguments...\n");
+    psTrace("psastro", 1, "Done with psastroArguments...\n");
     return (config);
 }
