view barpainet.c @ 515:ad72189eec07 libavformat

* replacing calls to not-always-available gmtime_r with our own code. The new helper function actually differs in semantics from gmtime_r, so if that seems to be a problem I can actually move it to dv.c completely, since only DV muxer uses the code anyway.
author romansh
date Wed, 18 Aug 2004 08:15:07 +0000
parents 05318cf2e886
children da1d5db0ce5c
line wrap: on
line source


#include <stdlib.h>
#include <strings.h>
#include "barpainet.h"

int inet_aton (const char * str, struct in_addr * add) {
	const char * pch = str;
	unsigned int add1 = 0, add2 = 0, add3 = 0, add4 = 0;
	
	add1 = atoi(pch);
	pch = strpbrk(pch,".");
	if (pch == 0 || ++pch == 0) goto done;
	add2 = atoi(pch);
	pch = strpbrk(pch,".");
	if (pch == 0 || ++pch == 0) goto done;
	add3 = atoi(pch);
	pch = strpbrk(pch,".");
	if (pch == 0 || ++pch == 0) goto done;
	add4 = atoi(pch);

done:
	add->s_addr=(add4<<24)+(add3<<16)+(add2<<8)+add1;
	
	return 1;	
}