1*0Sstevel@tonic-gate #include "ipf.h"
2*0Sstevel@tonic-gate 
3*0Sstevel@tonic-gate int getproto(name)
4*0Sstevel@tonic-gate char *name;
5*0Sstevel@tonic-gate {
6*0Sstevel@tonic-gate 	struct protoent *p;
7*0Sstevel@tonic-gate 	char *s;
8*0Sstevel@tonic-gate 
9*0Sstevel@tonic-gate 	for (s = name; *s != '\0'; s++)
10*0Sstevel@tonic-gate 		if (!isdigit(*s))
11*0Sstevel@tonic-gate 			break;
12*0Sstevel@tonic-gate 	if (*s == '\0')
13*0Sstevel@tonic-gate 		return atoi(name);
14*0Sstevel@tonic-gate 
15*0Sstevel@tonic-gate 	p = getprotobyname(name);
16*0Sstevel@tonic-gate 	if (p != NULL)
17*0Sstevel@tonic-gate 		return p->p_proto;
18*0Sstevel@tonic-gate 	return -1;
19*0Sstevel@tonic-gate }
20