summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorWeisenhorn Geoffroy <geoffroy.weisenhorn@gmail.com>2008-09-29 19:11:52 +0200
committerHugues Hiegel <hugues@hiegel.fr>2011-10-21 16:21:16 +0200
commitf3e158877154ff1d9067e72a6eb118295964fea1 (patch)
tree3976164ca5cc2cb6ac0324a92537af6953766a75
parenta35336e979a2d4d257e5ea88064ed4550bbb3063 (diff)
Add NetBSD support
-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 ")