summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rwxr-xr-xwoof7
1 files changed, 6 insertions, 1 deletions
diff --git a/woof b/woof
index 10ab18a..9bcc635 100755
--- a/woof
+++ b/woof
@@ -23,6 +23,7 @@
# Solaris support by Colin Marquardt, <colin.marquardt@zmd.de>
# FreeBSD support with the help from Andy Gimblett, <A.M.Gimblett@swansea.ac.uk>
# Cygwin support by Stefan Reichör <stefan@xsteve.at>
+# NetBSD support by Geoffroy Weisenhorn, <geoffroy.weisenhorn@gmail.com>
import sys, os, popen2, signal, select, socket, getopt, commands
import urllib, BaseHTTPServer
@@ -63,6 +64,10 @@ def find_ip ():
netstat = commands.getoutput ("LC_MESSAGES=C netstat -arn")
defiface = [i.split ()[-1] for i in netstat.split ('\n')
if len(i) > 2 and i.split ()[0] == "0.0.0.0"]
+ elif platform == "NetBSD":
+ netstat = commands.getoutput ("LC_MESSAGES=C netstat -arn")
+ defiface = [i.split ()[-1] for i in netstat.split ('\n')
+ if len(i) > 2 and i.split ()[0] == "default"]
else:
print >>sys.stderr, "Unsupported platform; please add support for your platform in find_ip().";
return None
@@ -73,7 +78,7 @@ def find_ip ():
if platform == "Linux":
ifcfg = commands.getoutput ("LC_MESSAGES=C ifconfig "
+ defiface[0]).split ("inet addr:")
- elif platform in ("Darwin", "FreeBSD", "SunOS"):
+ elif platform in ("Darwin", "FreeBSD", "SunOS", "NetBSD"):
ifcfg = commands.getoutput ("LC_MESSAGES=C ifconfig "
+ defiface[0]).split ("inet ")