private static void processArgs(String[] args, List<String> pargs, Flags flags) {
    // Process all args beginning with a dash and skip the rest
    for (int i = 0; i<args.length; i++) {
      String arg = args[i];
      if (arg.equals("-t")) {
        if (++i >= args.length) {
          System.out.println("gsd.jar: -t must be followed by a value\n");
          printUsage();
          System.exit(0);
        } else {
          flags.setThreshold(Integer.parseInt(args[i]));
        }
      } else if (arg.charAt(0) == '-') {
        if (!setFlags(flags, arg)) {
          System.out.println();
          printUsage();
          System.exit(0);
        }
      } else {
        pargs.add(arg);
      }
    }

    if (pargs.size() > 2) {
      // Format prefix correctly
      String prefix = pargs.get(2);
      prefix = prefix.replace(".", "/");
      if (!prefix.endsWith("/")) {
        prefix = prefix + "/";
      }
      pargs.set(2, prefix);
    } else {
      pargs.add("");
    }
  }