code: def main(argv):
      all = 0
      verbose = 0
      altpath = None
      exts = None
      try:
          optlist, args = getopt.getopt(
              argv[1:],
              "haVvqp:e:",
              [
                  "help",
                  "all",
                  "version",
                  "verbose",
                  "quiet",
                  "path=",
                  "exts=",
              ],
          )
      except getopt.GetoptError as msg:
          sys.stderr.write(
              "which: error: %s. Your invocation was: %s\n"
              % (msg, argv)
          )
          sys.stderr.write("Try 'which --help'.\n")
          return 1
      for opt, optarg in optlist:
          if opt in ("-h", "--help"):
              print(_cmdlnUsage)
              return 0
          elif opt in ("-V", "--version"):
              print("which %s" % __version__)
              return 0
          elif opt in ("-a", "--all"):
              all = 1
          elif opt in ("-v", "--verbose"):
              verbose = 1
          elif opt in ("-q", "--quiet"):
              verbose = 0
          elif opt in ("-p", "--path"):
              if optarg:
                  altpath = optarg.split(os.pathsep)
              else:
                  altpath = []
          elif opt in ("-e", "--exts"):
              if optarg:
                  exts = optarg.split(os.pathsep)
              else:
                  exts = []
  
      if len(args) == 0:
          return -1
  
      failures = 0
      for arg in args:
          # print "debug: search for %r" % arg
          nmatches = 0
          for match in whichgen(
              arg, path=altpath, verbose=verbose, exts=exts
          ):
              if verbose:
                  print("%s (%s)" % match)
              else:
                  print(match)
              nmatches += 1
              if not all:
                  break
          if not nmatches:
              failures += 1
      return failures
  
file_path: python-markdown2/tools/which.py
imports: import os
  import sys
  import getopt
  import stat
label_desc: Use image node_id 7 for calling a global function with example usage: main(argv) and returns: failures, unknown, int, int, int