Cross Reference: getproto.c
xref
: /
illumos-gate
/
usr
/
src
/
cmd
/
ipf
/
lib
/
common
/
getproto.c
Home
History
Annotate
Line#
Navigate
Download
Search
only in
./
getproto.c revision 7c478bd95313f5f23a4c958a745db2134aa03244
#
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
;
}