blob: 882ae1663a4f57544d714ca6ccb46c3e9d645d6a (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
|
/* posix */
#include <sys/types.h>
#include <unistd.h>
#include <ctype.h>
/* bsd extensions */
#include <sys/uio.h>
#include <sys/socket.h>
#include <netinet/in.h>
#include "priv.h"
/*
* return ndb attribute type of an ip name
*/
int
_sock_ipattr(char *name)
{
char *p;
int dot = 0;
int alpha = 0;
for(p = name; *p; p++){
if(isdigit(*p))
;
else if(isalpha(*p) || *p == '-')
alpha = 1;
else if(*p == '.')
dot = 1;
else if(*p == ':')
return Tip;
else
return Tsys;
}
if(alpha){
if(dot)
return Tdom;
else
return Tsys;
}
if(dot)
return Tip;
else
return Tsys;
}
|