annotate barpainet.c @ 291:b19f70a6d60f libavformat

1/0 fix by (Tim Allen <tim at proximity dot com dot au>)
author michael
date Tue, 28 Oct 2003 10:55:15 +0000
parents 05318cf2e886
children da1d5db0ce5c
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
0
05318cf2e886 renamed libav to libavformat
bellard
parents:
diff changeset
1
05318cf2e886 renamed libav to libavformat
bellard
parents:
diff changeset
2 #include <stdlib.h>
05318cf2e886 renamed libav to libavformat
bellard
parents:
diff changeset
3 #include <strings.h>
05318cf2e886 renamed libav to libavformat
bellard
parents:
diff changeset
4 #include "barpainet.h"
05318cf2e886 renamed libav to libavformat
bellard
parents:
diff changeset
5
05318cf2e886 renamed libav to libavformat
bellard
parents:
diff changeset
6 int inet_aton (const char * str, struct in_addr * add) {
05318cf2e886 renamed libav to libavformat
bellard
parents:
diff changeset
7 const char * pch = str;
05318cf2e886 renamed libav to libavformat
bellard
parents:
diff changeset
8 unsigned int add1 = 0, add2 = 0, add3 = 0, add4 = 0;
05318cf2e886 renamed libav to libavformat
bellard
parents:
diff changeset
9
05318cf2e886 renamed libav to libavformat
bellard
parents:
diff changeset
10 add1 = atoi(pch);
05318cf2e886 renamed libav to libavformat
bellard
parents:
diff changeset
11 pch = strpbrk(pch,".");
05318cf2e886 renamed libav to libavformat
bellard
parents:
diff changeset
12 if (pch == 0 || ++pch == 0) goto done;
05318cf2e886 renamed libav to libavformat
bellard
parents:
diff changeset
13 add2 = atoi(pch);
05318cf2e886 renamed libav to libavformat
bellard
parents:
diff changeset
14 pch = strpbrk(pch,".");
05318cf2e886 renamed libav to libavformat
bellard
parents:
diff changeset
15 if (pch == 0 || ++pch == 0) goto done;
05318cf2e886 renamed libav to libavformat
bellard
parents:
diff changeset
16 add3 = atoi(pch);
05318cf2e886 renamed libav to libavformat
bellard
parents:
diff changeset
17 pch = strpbrk(pch,".");
05318cf2e886 renamed libav to libavformat
bellard
parents:
diff changeset
18 if (pch == 0 || ++pch == 0) goto done;
05318cf2e886 renamed libav to libavformat
bellard
parents:
diff changeset
19 add4 = atoi(pch);
05318cf2e886 renamed libav to libavformat
bellard
parents:
diff changeset
20
05318cf2e886 renamed libav to libavformat
bellard
parents:
diff changeset
21 done:
05318cf2e886 renamed libav to libavformat
bellard
parents:
diff changeset
22 add->s_addr=(add4<<24)+(add3<<16)+(add2<<8)+add1;
05318cf2e886 renamed libav to libavformat
bellard
parents:
diff changeset
23
05318cf2e886 renamed libav to libavformat
bellard
parents:
diff changeset
24 return 1;
05318cf2e886 renamed libav to libavformat
bellard
parents:
diff changeset
25 }