code: private int doall(String cmd, String argv[], int startindex) {
      int exitCode = 0;
      int i = startindex;
      boolean rmSkipTrash = false;
      
      // Check for -skipTrash option in rm/rmr
      if(("-rm".equals(cmd) || "-rmr".equals(cmd)) 
          && "-skipTrash".equals(argv[i])) {
        rmSkipTrash = true;
        i++;
      }
  
      //
      // for each source file, issue the command
      //
      for (; i < argv.length; i++) {
        try {
          //
          // issue the command to the fs
          //
          if ("-cat".equals(cmd)) {
            cat(argv[i], true);
          } else if ("-du".equals(cmd)) {
            du(argv[i]);
          } else if ("-dus".equals(cmd)) {
            dus(argv[i]);
          } else if (Count.matches(cmd)) {
            new Count(argv, i, getConf()).runAll();
          } else if ("-text".equals(cmd)) {
            text(argv[i]);
          } else if ("-decompress".equals(cmd)) {
            decompress(argv[i]);
          }
        } catch (RemoteException e) {
          //
          // This is a error returned by hadoop server. Print
          // out the first line of the error message.
          //
          exitCode = -1;
          try {
            String[] content;
            content = e.getLocalizedMessage().split("\n");
            System.err.println(cmd.substring(1) + ": " +
                               content[0]);
          } catch (Exception ex) {
            System.err.println(cmd.substring(1) + ": " +
                               ex.getLocalizedMessage());
          }
        } catch (IOException e) {
          //
          // IO exception encountered locally.
          //
          exitCode = -1;
          String content = e.getLocalizedMessage();
          if (content != null) {
            content = content.split("\n")[0];
          }
          System.err.println(cmd.substring(1) + ": " +
                            content);
        }
      }
      return exitCode;
    }
docs: Apply operation specified by 'cmd' on all parameters
  starting from argv[startindex].