Rivoreo Source Code Repositories
src.rivoreo.one
/
net
/
ipfilter
/
55401138b1d52f95eaf25a654b0f3461e8aab1d9
/
.
/
lib
/
getproto.c
blob: 43a3029f4731ed08a49803b775ba5c305f3f9175 [
file
] [
log
] [
blame
] [
raw
]
#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
;
}