Import Debian changes 20180207-1
[hcoop/debian/mlton.git] / runtime / basis / Net / NetProtDB.c
1 #include "platform.h"
2
3 static struct protoent *NetProtDB_protoent;
4
5 C_String_t NetProtDB_getEntryName(void) {
6 return (C_String_t)(NetProtDB_protoent->p_name);
7 }
8
9 C_Int_t NetProtDB_getEntryAliasesNum(void) {
10 int num = 0;
11 while (NetProtDB_protoent->p_aliases[num] != NULL) num++;
12 return num;
13 }
14
15 C_String_t NetProtDB_getEntryAliasesN(C_Int_t n) {
16 return (C_String_t)(NetProtDB_protoent->p_aliases[n]);
17 }
18
19 C_Int_t NetProtDB_getEntryProto(void) {
20 return NetProtDB_protoent->p_proto;
21 }
22
23 C_Int_t NetProtDB_getByName(NullString8_t name) {
24 NetProtDB_protoent = getprotobyname((const char*)name);
25 return (C_Int_t)(NetProtDB_protoent != NULL and NetProtDB_protoent->p_name != NULL);
26 }
27
28 C_Int_t NetProtDB_getByNumber(C_Int_t proto) {
29 NetProtDB_protoent = getprotobynumber(proto);
30 return (C_Int_t)(NetProtDB_protoent != NULL and NetProtDB_protoent->p_name != NULL);
31 }