Net-Hesiod

 view release on metacpan or  search on metacpan

Hesiod.xs  view on Meta::CPAN

hesiod_resolve(context,name,type)
	void *	context;
	const char *	name;
	const char *	type;
	PREINIT:
		char ** results;
		char ** res;
		int i;
		dTARGET;
		SV *tmp;
	PPCODE:
		results = hesiod_resolve(context,name,type);
		/* Handle an invalid query */
		if ( ! results ) { XSRETURN_EMPTY; }
		res = results;
		i =0;
		while ( *res )
		{	tmp = sv_newmortal();
			sv_setpv(tmp,*res);
			XPUSHs(tmp);
			i++;

Hesiod.xs  view on Meta::CPAN



void
hesiod_getpwnam(context,name)
	void *	context;
	const char *	name;
	PREINIT:
		struct passwd *pw;
		dTARGET;
		SV *tmp;
	PPCODE:
		pw = hesiod_getpwnam(context,name);
		/* Handle errors by returning empty */
		if ( ! pw ) { XSRETURN_EMPTY; }
		/* Presumably, have a valid response */
		tmp = sv_newmortal(); sv_setpv(tmp,pw->pw_name);
		XPUSHs(tmp);
		tmp = sv_newmortal(); sv_setpv(tmp,pw->pw_passwd);
		XPUSHs(tmp);
		tmp = sv_newmortal(); sv_setiv(tmp,pw->pw_uid);
		XPUSHs(tmp);

Hesiod.xs  view on Meta::CPAN

		XSRETURN(9);

void
hesiod_getpwuid(context,uid)
	void *	context;
	uid_t	uid;
	PREINIT:
		struct passwd *pw;
		dTARGET;
		SV *tmp;
	PPCODE:
		pw = hesiod_getpwuid(context,uid);
		/* Handle errors by returning empty */
		if ( ! pw ) { XSRETURN_EMPTY; }
		/* Presumably, have a valid response */
		tmp = sv_newmortal(); sv_setpv(tmp,pw->pw_name);
		XPUSHs(tmp);
		tmp = sv_newmortal(); sv_setpv(tmp,pw->pw_passwd);
		XPUSHs(tmp);
		tmp = sv_newmortal(); sv_setiv(tmp,pw->pw_uid);
		XPUSHs(tmp);

Hesiod.xs  view on Meta::CPAN

struct servent *
hesiod_getservbyname(context,name, proto)
	void *	context;
	const char *	name;
	const char *	proto;
	PREINIT:
		struct servent *sent;
		dTARGET;
		SV *tmp;
		int port;
	PPCODE:
		sent = hesiod_getservbyname(context,name, proto);
		/* Handle errors by returning empty */
		if ( ! sent ) { XSRETURN_EMPTY; }
		/* Presumably, have a valid response */
		/* servent struct is supposed to store port number in
			network byte order.  We return it in host order
			to be consistent with perl getservbyname */
		port = ntohs(sent->s_port);
		tmp= sv_newmortal(); sv_setpv(tmp,sent->s_name);
		XPUSHs(tmp);

Hesiod.xs  view on Meta::CPAN

		XSRETURN(4);

struct hesiod_postoffice *
hesiod_getmailhost(context,user)
	void *	context;
	char *	user;
	PREINIT:
		struct hesiod_postoffice *po;
		dTARGET;
		SV * tmp;
	PPCODE:
		po = hesiod_getmailhost(context,user);
		/* Handle errors by returning empty */
		if ( ! po ) { XSRETURN_EMPTY; }
		/* Presumably, have a valid response */
		tmp= sv_newmortal(); sv_setpv(tmp,po->hesiod_po_type);
		XPUSHs(tmp);
		tmp= sv_newmortal(); sv_setpv(tmp,po->hesiod_po_host);
		XPUSHs(tmp);
		tmp= sv_newmortal(); sv_setpv(tmp,po->hesiod_po_name);
		XPUSHs(tmp);



( run in 0.588 second using v1.01-cache-2.11-cpan-5511b514fd6 )