docs: def parseCmdline(rh):
      """
      Parse the request command input.
  
      Input:
         Request Handle
  
      Output:
         Request Handle updated with parsed input.
         Return code - 0: ok, non-zero: error
      """
  
      rh.printSysLog("Enter powerVM.parseCmdline")
  
      if rh.totalParms >= 2:
          rh.userid = rh.request[1].upper()
      else:
          # Userid is missing.
          msg = msgs.msg['0010'][1] % modId
          rh.printLn("ES", msg)
          rh.updateResults(msgs.msg['0010'][0])
          rh.printSysLog("Exit powerVM.parseCmdLine, rc: " +
              rh.results['overallRC'])
          return rh.results['overallRC']
  
      if rh.totalParms == 2:
          rh.subfunction = rh.userid
          rh.userid = ''
  
      if rh.totalParms >= 3:
          rh.subfunction = rh.request[2].upper()
  
      # Verify the subfunction is valid.
      if rh.subfunction not in subfuncHandler:
          # Subfunction is missing.
          subList = ', '.join(sorted(subfuncHandler.keys()))
          msg = msgs.msg['0011'][1] % (modId, subList)
          rh.printLn("ES", msg)
          rh.updateResults(msgs.msg['0011'][0])
  
      # Parse the rest of the command line.
      if rh.results['overallRC'] == 0:
          rh.argPos = 3               # Begin Parsing at 4th operand
          generalUtils.parseCmdline(rh, posOpsList, keyOpsList)
  
      waiting = 0
      if rh.results['overallRC'] == 0:
          if rh.subfunction == 'WAIT':
              waiting = 1
              if rh.parms['desiredState'] not in vmOSUpDownStates:
                  # Desired state is not: down, off, on or up.
                  msg = msgs.msg['0013'][1] % (modId,
                      rh.parms['desiredState'], ", ".join(vmOSUpDownStates))
                  rh.printLn("ES", msg)
                  rh.updateResults(msgs.msg['0013'][0])
  
      if (rh.results['overallRC'] == 0 and 'wait' in rh.parms):
          waiting = 1
          if 'desiredState' not in rh.parms:
              if rh.subfunction in ['ON', 'RESET', 'REBOOT']:
                  rh.parms['desiredState'] = 'up'
              else:
                  # OFF and SOFTOFF default to 'off'.
                  rh.parms['desiredState'] = 'off'
  
      if rh.results['overallRC'] == 0 and waiting == 1:
          if rh.subfunction == 'ON' or rh.subfunction == 'RESET':
              if ('desiredState' not in rh.parms or
                    rh.parms['desiredState'] not in vmOSUpStates):
                  # Desired state is not: on or up.
                  msg = msgs.msg['0013'][1] % (modId,
                      rh.parms['desiredState'], ", ".join(vmOSUpStates))
                  rh.printLn("ES", msg)
                  rh.updateResults(msgs.msg['0013'][0])
  
          if rh.results['overallRC'] == 0:
              if 'maxWait' not in rh.parms:
                  rh.parms['maxWait'] = 300
              if 'poll' not in rh.parms:
                  rh.parms['poll'] = 15
              rh.parms['maxQueries'] = (rh.parms['maxWait'] +
                  rh.parms['poll'] - 1) / rh.parms['poll']
              # If we had to do some rounding, give a warning
              # out to the command line user that the wait
              # won't be what they expected.
              if rh.parms['maxWait'] % rh.parms['poll'] != 0:
                  msg = msgs.msg['0017'][1] % (modId,
                      rh.parms['maxWait'], rh.parms['poll'],
                      rh.parms['maxQueries'] * rh.parms['poll'],
                      rh.parms['maxQueries'])
                  rh.printLn("W", msg)
  
      rh.printSysLog("Exit powerVM.parseCmdLine, rc: " +
          str(rh.results['overallRC']))
      return rh.results['overallRC']