File: icmp.awk

package info (click to toggle)
netdiag 0.7-7
  • links: PTS
  • area: main
  • in suites: sarge
  • size: 1,460 kB
  • ctags: 1,286
  • sloc: ansic: 12,984; makefile: 288; awk: 130; sh: 64
file content (33 lines) | stat: -rw-r--r-- 493 bytes parent folder | download | duplicates (12)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
$2 ~ /----------------/ {
	start = 1
}
$1 ~ /41-255/{
	exit
}
$1=="#" {
	com++;
	}

start==1 {
	fstart = 2;
	if ($1 == "#")
		next		
	comment = $fstart
	for (i=fstart+1;i<=NF;i++)
	{
		if (substr($i,1,1)!= "[")
			comment = comment "-" $i
		else
			break
	}
	if (comment == "Unassigned")
		comment = "UNK " $1
	if ($1 > maxport)
		maxport = $1
	printf "strncpy(icmp_types[%d],\"%s\",SN_PORT_TYPE_LEN);\n",$1,comment > "icmp.gen" 
}
END{
	print "#define ICMPMAX " maxport > "icmpdefs.gen"
}