File:  [XINU] / xinu / sys / namrepl.c
Revision 1.1.1.1 (vendor branch): download - view: text, annotated - select for diffs
Tue Apr 24 17:39:04 2018 UTC (8 years, 3 months ago) by root
Branches: xinu, MAIN
CVS tags: xinu-19870308, HEAD
Xinu for VAX

/* namrepl.c - namrepl */

#include <conf.h>
#include <kernel.h>
#include <name.h>

/*------------------------------------------------------------------------
 *  namrepl  -  using namespace, replace name with (newname,device)
 *------------------------------------------------------------------------
 */
SYSCALL	namrepl(name, newname)
char	*name;
char	*newname;
{
	register struct	nament	*nptr;
	register struct	nament	*nlast;
	int	plen, rlen;
	PStype	ps;
	
	disable(ps);
	nlast = &Nam.nametab[Nam.nnames];
	for (nptr= Nam.nametab ; nptr<nlast ; nptr++) {
		plen = strlen(nptr->npre);
		if (strncmp(nptr->npre, name, plen) == 0) {
			rlen = strlen(nptr->nrepl);
			if ((rlen+strlen(name)-plen) >= NAMLEN)
				break;
			strcpy(newname, nptr->nrepl);
			strcat(newname, name + plen);
			restore(ps);
			return(nptr->ndev);
		}
	}
	strcpy(newname, "");
	restore(ps);
	return(SYSERR);
}

unix.superglobalmegacorp.com

This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.