convert arptables to new packaging style
[openwrt.git] / openwrt / package / arpwatch / patches / 021_debian_arp2ethers
1 Index: arpwatch/arp2ethers
2 diff -u arpwatch/arp2ethers:1.1.1.1 arpwatch/arp2ethers:1.1.1.1.14.1
3 --- arpwatch/arp2ethers:1.1.1.1 Tue Apr 17 13:31:36 2001
4 +++ arpwatch/arp2ethers Tue Apr 17 13:56:38 2001
5 @@ -1,5 +1,5 @@
6 -#!/bin/csh -f
7 -# @(#) $Id$ (LBL)
8 +#!/bin/sh
9 +# @(#) $Header$ (LBL)
10 #
11 # Convert arp.dat to ethers format
12 #
13 @@ -12,12 +12,74 @@
14 # - append "-old", "-old1", etc. as necessary
15 # - sort
16 #
17 +# 1999-04-12 KELEMEN Peter <fuji@debian.org>
18 +# Use sh(1) instead of csh(1).
19 +#
20 +# 2000-03-21 Erik Warmelink <erik@selwerd.nl>
21 +# Use next instead of continue in included p.awk.
22
23 sort +2rn arp.dat | \
24 awk 'NF == 4 { print }' | \
25 - awk -f p.awk | \
26 +# 1999-04-12 KELEMEN Peter <fuji@debian.org>
27 +# awk -f p.awk | \
28 + awk '
29 +# Only print the first ethernet address seen
30 +
31 +{
32 + e = $1
33 + if (seen[e])
34 + next
35 + seen[e] = 1
36 + print $0
37 +}
38 + ' | \
39 egrep -v '\.[0-9][0-9]*$' | \
40 sed -e 's/ .* / /' | \
41 - awk -f d.awk | \
42 - awk -f e.awk | \
43 +# 1999-04-12 KELEMEN Peter <fuji@debian.org>
44 +# awk -f d.awk | \
45 + awk '
46 +# DECnet hacking
47 +
48 +BEGIN {
49 + n = 0
50 + sdecnet = "aa:0:4:"
51 + ldecnet = length(sdecnet)
52 +}
53 +
54 +{
55 + ++n
56 + e[n] = $1
57 + h[n] = $2
58 + if (sdecnet == substr($1, 1, ldecnet))
59 + decnet[$2] = 1
60 +}
61 +
62 +END {
63 + for (i = 1; i <= n; ++i) {
64 + if (decnet[h[i]] && sdecnet != substr(e[i], 1, ldecnet))
65 + h[i] = h[i] "-ip"
66 + print e[i] "\t" h[i]
67 + }
68 +}
69 + ' | \
70 +# 1999-04-12 KELEMEN Peter <fuji@debian.org>
71 +# awk -f e.awk | \
72 + awk '
73 +# Add -old suffix to ethers file, as required. Assumed sorted input
74 +
75 +{
76 + if (!seen[$2]) {
77 + seen[$2] = 1
78 + print
79 + next
80 + }
81 + h = $2 "-old"
82 + s = h
83 + for (n = 1; seen[h]; ++n)
84 + h = s n
85 + seen[h] = 1
86 + print $1 "\t" h
87 + next
88 +}
89 + ' | \
90 sort
This page took 0.039759 seconds and 5 git commands to generate.