ReactOS 0.4.15-dev-7842-g558ab78
iputils.c File Reference
#include <headers.h>
#include <datatypes.h>
#include <options.h>
#include <utils.h>
Include dependency graph for iputils.c:

Go to the source code of this file.

Functions

int split_ip (char *text, u8b *dest, int place)
 
int get_ip (char *text, u32b *dest)
 

Function Documentation

◆ get_ip()

int get_ip ( char text,
u32b dest 
)

Definition at line 35 of file iputils.c.

36{
37 /* Don't touch this, unless you like pointer aritmethic */
38
39 *dest = 0;
40
41 if( !text )
42 return -1;
43
44 while( *text != '\0' )
45 {
46 if( *text == '.' )
47 {
48 *dest = *dest << 8;
49 text++;
50 continue;
51 }
52 *dest *= 10;
53 *dest += (u8b)(*text-48);
54 /* 48 is not a hack, is just the code of 0 */
55 text++;
56 }
57
58 return 0;
59}
unsigned char u8b
Definition: datatypes.h:4
const WCHAR * text
Definition: package.c:1799
static char * dest
Definition: rtl.c:135

◆ split_ip()

int split_ip ( char text,
u8b dest,
int  place 
)

Definition at line 6 of file iputils.c.

7{
8 int dotcount;
9
10 /* Don't touch this, unless you like pointer aritmethic */
11
12 *dest = 0;
13
14 if( !text )
15 return -1;
16
17 for( dotcount = 0; (dotcount < place) && ( text ); text++ )
18 if( *text == '.' )
19 dotcount++;
20
21 if( !text )
22 return -2;
23
24 while(( *text != '.' ) && ( *text != '\0' ))
25 {
26 *dest *= 10;
27 *dest += (u8b)(*text-48);
28 /* 48 is not a hack, is just the code of 0 */
29 text++;
30 }
31
32 return 0;
33}
static char * place
Definition: getopt.c:55

Referenced by init_leases_list().