docs: def main():
      """Program entry point.
      """
      global cf_verbose, cf_show_comment, cf_charset
      global cf_extract, cf_test_read, cf_test_unrar
      global cf_test_memory
  
      psw = None
  
      # parse args
      try:
          opts, args = getopt.getopt(sys.argv[1:], 'p:C:hvcxtRM')
      except getopt.error as ex:
          print(str(ex), file=sys.stderr)
          sys.exit(1)
  
      for o, v in opts:
          if o == '-p':
              psw = v
          elif o == '-h':
              xprint(usage)
              return
          elif o == '-v':
              cf_verbose += 1
          elif o == '-c':
              cf_show_comment = 1
          elif o == '-x':
              cf_extract = 1
          elif o == '-t':
              cf_test_read += 1
          elif o == '-T':
              cf_test_unrar = 1
          elif o == '-M':
              cf_test_memory = 1
          elif o == '-C':
              cf_charset = v
          else:
              raise Exception("unhandled switch: " + o)
  
      args2 = []
      for a in args:
          if a[0] == "@":
              for ln in open(a[1:], 'r'):
                  fn = ln[:-1]
                  args2.append(fn)
          else:
              args2.append(a)
      args = args2
  
      if not args:
          xprint(usage)
  
      # pypy .readinto()+memoryview() is buggy
      #if cf_test_read > 1 and hasattr(sys, 'pypy_version_info'):
      #    cf_test_read = 1
  
      for fn in args:
          test(fn, psw)