summaryrefslogtreecommitdiffstats
path: root/contrib/ipfilter/lib/getproto.c
blob: 2581e283765bd4bdd52630eacb892e939c8cfed0 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
/*	$FreeBSD$	*/

#include "ipf.h"

int getproto(name)
char *name;
{
	struct protoent *p;
	char *s;

	for (s = name; *s != '\0'; s++)
		if (!ISDIGIT(*s))
			break;
	if (*s == '\0')
		return atoi(name);

	p = getprotobyname(name);
	if (p != NULL)
		return p->p_proto;
	return -1;
}
OpenPOWER on IntegriCloud