Net-NIS-Netgroup

 view release on metacpan or  search on metacpan

Netgroup.xs  view on Meta::CPAN

#include "perl.h"
#include "XSUB.h"

MODULE = Net::NIS::Netgroup PACKAGE = Net::NIS::Netgroup

SV *
getdomainname()
    PREINIT:
    	int len = 512;
	char buf[512];
    PPCODE:
    	int ret = getdomainname(buf, len);
	if (ret == -1) {
		XPUSHs(&PL_sv_undef);
	} else {
		XPUSHs(sv_2mortal(newSVpv(buf, 0)));
	}

IV *
setdomainname(name)
    const char *name
    PREINIT:
    	int len = strlen(name) + 1;
    PPCODE:
    	int ret = setdomainname(name, len);
	if (ret == -1) {
		XPUSHs(&PL_sv_undef);
	} else {
		XPUSHs(sv_2mortal(newSViv(1)));
	}

IV *
innetgr(sv_netgroup, sv_host, sv_user, sv_domain)
    SV *sv_netgroup

Netgroup.xs  view on Meta::CPAN

    SV *sv_user
    SV *sv_domain
    PREINIT:
	char *netgroup;
	char *host;
	char *user;
	char *domain;

	int ret;

    PPCODE:
	ret = 0;

	if (!SvOK(sv_netgroup)) { netgroup = NULL; } else { netgroup = SvPV_nolen(sv_netgroup); }
	if (!SvOK(sv_host)) { host = NULL; } else { host = SvPV_nolen(sv_host); }
	if (!SvOK(sv_user)) { user = NULL; } else { user = SvPV_nolen(sv_user); }
	if (!SvOK(sv_domain)) { domain = NULL; } else { domain = SvPV_nolen(sv_domain); }

    	/*
    	printf("xs code: netgroup == %s\n", netgroup);
    	printf("xs code: host == '%s'\n", host);

Netgroup.xs  view on Meta::CPAN


    PREINIT:
	char *host;
	char *user;
	char *domain;

	HV *el;
	char *buf;
	int bufsize = 256;
	int len;
    PPCODE:

	if (stringify) {
		buf = malloc(bufsize);
		if (!buf) {
			Perl_croak(aTHX_ "Could not allocate memory");
		}
	}

	setnetgrent(netgroup);



( run in 1.569 second using v1.01-cache-2.11-cpan-71847e10f99 )