You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
17 lines
305 B
C
17 lines
305 B
C
24 years ago
|
#include "fmt.h"
|
||
|
#include "ip4.h"
|
||
|
|
||
24 years ago
|
unsigned int fmt_ip4(char *s,const char ip[4])
|
||
24 years ago
|
{
|
||
|
unsigned int len;
|
||
|
int i;
|
||
|
|
||
|
len = 0;
|
||
|
for (i=0; i<4; ++i) {
|
||
|
register unsigned int j;
|
||
|
len+=(j=fmt_ulong(s,(unsigned long) (unsigned char) ip[i]))+1;
|
||
24 years ago
|
if (s && i<3) { s+=j; *s++='.'; }
|
||
24 years ago
|
}
|
||
24 years ago
|
return len-1;
|
||
24 years ago
|
}
|