summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--TODO2
-rwxr-xr-xminiircd8
2 files changed, 7 insertions, 3 deletions
diff --git a/TODO b/TODO
index 57c0056..a824a9f 100644
--- a/TODO
+++ b/TODO
@@ -1,5 +1,3 @@
-* Handle bad port specification.
-
* Wrap long lines.
* URL to Python.
diff --git a/miniircd b/miniircd
index 1e2a94c..0c02899 100755
--- a/miniircd
+++ b/miniircd
@@ -796,7 +796,13 @@ def main(argv):
elif opt in ("-p", "--password"):
password = val.lower()
elif opt == "--ports":
- ports = [int(x) for x in re.split("[,\s]+", val)]
+ ports = []
+ for port in re.split("[,\s]+", val):
+ try:
+ ports.append(int(port))
+ except ValueError:
+ sys.stderr.write("Bad port: \"%s\".\n" % port)
+ sys.exit(1)
elif opt in ("-v", "--verbose"):
verbose = True
server = Server(ports, password, verbose)