Index: trunk/ppSim/src/ppSimArguments.c
===================================================================
--- trunk/ppSim/src/ppSimArguments.c	(revision 12976)
+++ trunk/ppSim/src/ppSimArguments.c	(revision 12996)
@@ -11,10 +11,11 @@
 
 // Print usage information and die
-static void usage(psMetadata *arguments, // Command-line arguments
+static void usage(const char *program,  // Name of the program
+                  psMetadata *arguments, // Command-line arguments
                   pmConfig *config      // Configuration
     )
 {
     fprintf(stderr, "\nPan-STARRS data simulator\n\n");
-    fprintf(stderr, "Usage: %s -camera CAMERA_NAME\n", config->argv[0]);
+    fprintf(stderr, "Usage: %s -camera CAMERA_NAME\n", program);
     fprintf(stderr, "\n");
     psArgumentHelp(arguments);
@@ -47,5 +48,5 @@
 }
 
-void ppSimArguments(pmConfig *config)
+void ppSimArguments(int argc, char *argv[], pmConfig *config)
 {
     assert(config);
@@ -76,9 +77,9 @@
     if (!config->camera) {
         psErrorStackPrint(stderr, "A camera name must be specified using the -camera option.");
-        usage(arguments, config);
-    }
-
-    if (*config->argc == 1 || !psArgumentParse(arguments, config->argc, config->argv) || *config->argc != 2) {
-        usage(arguments, config);
+        usage(argv[0], arguments, config);
+    }
+
+    if (argc == 1 || !psArgumentParse(arguments, &argc, argv) || argc != 2) {
+        usage(argv[0], arguments, config);
     }
 
@@ -107,5 +108,5 @@
     if (!typeStr) {
         psErrorStackPrint(stderr, "An exposure type must be specified using -type");
-        usage(arguments, config);
+        usage(argv[0], arguments, config);
     }
     ppSimType type;                     // Type to simulate
@@ -120,5 +121,5 @@
     } else {
         psError(PS_ERR_BAD_PARAMETER_VALUE, true, "Unrecognised exposure type: %s", typeStr);
-        usage(arguments, config);
+        usage(argv[0], arguments, config);
     }
     psMetadataAddS32(config->arguments, PS_LIST_TAIL, "TYPE", 0, "Exposure type", type);
@@ -134,5 +135,5 @@
         if (isnan(expTime)) {
             psErrorStackPrint(stderr, "The exposure time must be specified using -exptime");
-            usage(arguments, config);
+            usage(argv[0], arguments, config);
         }
     }
@@ -169,10 +170,9 @@
     if (binning <= 0) {
         psError(PS_ERR_BAD_PARAMETER_VALUE, true, "Binning (%d) is non-positive.", binning);
-        usage(arguments, config);
+        usage(argv[0], arguments, config);
     }
     psMetadataAddS32(config->arguments, PS_LIST_TAIL, "BINNING", 0, "Binning in x and y", binning);
 
-    psMetadataAddStr(config->arguments, PS_LIST_TAIL, "OUTPUT", 0, "Name of the output image",
-                     config->argv[1]);
+    psMetadataAddStr(config->arguments, PS_LIST_TAIL, "OUTPUT", 0, "Name of the output image", argv[1]);
 
     if (type == PPSIM_TYPE_OBJECT) {
@@ -188,5 +188,5 @@
             psError(PS_ERR_BAD_PARAMETER_VALUE, false,
                     "-ra, -dec, -pa, -scale, -zp, -seeing must be specified for OBJECT type");
-            usage(arguments, config);
+            usage(argv[0], arguments, config);
         }
         psMetadataAddF32(config->arguments, PS_LIST_TAIL, "SCALE", 0, "Plate scale (arcsec/pix)", scale);
