+def usage(retval = 0):
+ print "%s [options]\n" % sys.argv[0]
+ print " -h --help Show this help"
+ print " -p --port PORT Specify the port to use (default %u)" % port
+ print " -a --address ADDRESS Specify the address to bind to (default %s)" % address
+ print " -H --host-names Show all services, regardless of the type"
+ print " -d --domain DOMAIN Specify the domain to browse"
+ sys.exit(retval)
+
+try:
+ opts, args = getopt.getopt(sys.argv[1:], "hp:a:Hd:", ["help", "port=", "address=", "host-names", "domain="])
+except getopt.GetoptError:
+ usage(2)
+
+for o, a in opts:
+ if o in ("-h", "--help"):
+ usage()