Initial import
[samba] / packaging / Debian / debian-woody / wins2dns.awk
1 #!/usr/bin/awk -f
2 #
3 # Date: Wed, 26 Aug 1998 10:37:39 -0600 (MDT)
4 # From: Jason Gunthorpe <jgg@deltatee.com>
5 # To: samba@packages.debian.org
6 # Subject: Nifty samba script
7 #
8 # Here is a really nifty script I just wrote for samba, it takes the wins
9 # database in /var/samba/wins and writes out two dns files for it. In this
10 # way network wide wins clients can get into the dns for use by unix
11 # machines.
12
13 # Perhaps this could be included in  /usr/doc/examples or somesuch.
14 #
15
16 BEGIN {
17   FS="#|\"";
18 FORWARD="/tmp/wins.hosts"
19 REVERSE="/tmp/wins.rev"
20 DOMAIN="ven.ra.rockwell.com"
21 }
22 $3 == "00" {
23   split($4,a," " );
24   split(a[2],b,".");
25   while (sub(" ","-",$2));
26   $2=tolower($2);
27   if (b[1] == "255")
28     next;
29   if (length($2) >= 8)
30     print $2"\ta\t"a[2] > FORWARD
31   else
32     print $2"\t\ta\t"a[2] > FORWARD
33   print b[4]"."b[3]"\t\tptr\t"$2"."DOMAIN"." > REVERSE
34 }
35 END {
36   system("echo killall -HUP named");
37 }
38