/**
   * Return an array containing all command line arguments.
   *
   * @return the command line arguments passed to Nachos.
   */
  public static String[] getCommandLineArguments() {
    String[] result = new String[args.length];

    System.arraycopy(args, 0, result, 0, args.length);

    return result;
  }
  private static void processArgs() {
    for (int i = 0; i < args.length; ) {
      String arg = args[i++];
      if (arg.length() > 0 && arg.charAt(0) == '-') {
        if (arg.equals("-d")) {
          Lib.assertTrue(i < args.length, "switch without argument");
          Lib.enableDebugFlags(args[i++]);
        } else if (arg.equals("-h")) {
          System.out.print(help);
          System.exit(1);
        } else if (arg.equals("-m")) {
          Lib.assertTrue(i < args.length, "switch without argument");
          try {
            numPhysPages = Integer.parseInt(args[i++]);
          } catch (NumberFormatException e) {
            Lib.assertNotReached("bad value for -m switch");
          }
        } else if (arg.equals("-s")) {
          Lib.assertTrue(i < args.length, "switch without argument");
          try {
            randomSeed = Long.parseLong(args[i++]);
          } catch (NumberFormatException e) {
            Lib.assertNotReached("bad value for -s switch");
          }
        } else if (arg.equals("-x")) {
          Lib.assertTrue(i < args.length, "switch without argument");
          shellProgramName = args[i++];
        } else if (arg.equals("-z")) {
          System.out.print(copyright);
          System.exit(1);
        }
        // these switches are reserved for the autograder
        else if (arg.equals("-[]")) {
          Lib.assertTrue(i < args.length, "switch without argument");
          configFileName = args[i++];
        } else if (arg.equals("--")) {
          Lib.assertTrue(i < args.length, "switch without argument");
          autoGraderClassName = args[i++];
        }
      }
    }

    Lib.seedRandom(randomSeed);
  }