import(re)
fileName = "services"
protocolNameMap = %{
	"tcp"	=> "IPPROTO_TCP"
	"udp"	=> "IPPROTO_UDP"
}
lines = open(fileName).readlines()
for ([serviceName, portNumber, protocol] in \
			lines:*match(r"^(\w+)\s+(\d+)/(\w+)").skipnil():*group(1, 2, 3)) {
	text = format('{ "%s",', serviceName)
	tabs = "\t" * (6 - (int(text.len() / 4) + 1))
	printf('%s%s%4d, %s },\n', text, tabs, int(portNumber), protocolNameMap[protocol])
}
