|
|
1.1 root 1: /* namrepl.c - namrepl */
2:
3: #include <conf.h>
4: #include <kernel.h>
5: #include <name.h>
6:
7: /*------------------------------------------------------------------------
8: * namrepl - using namespace, replace name with (newname,device)
9: *------------------------------------------------------------------------
10: */
11: SYSCALL namrepl(name, newname)
12: char *name;
13: char *newname;
14: {
15: register struct nament *nptr;
16: register struct nament *nlast;
17: int plen, rlen;
18: PStype ps;
19:
20: disable(ps);
21: nlast = &Nam.nametab[Nam.nnames];
22: for (nptr= Nam.nametab ; nptr<nlast ; nptr++) {
23: plen = strlen(nptr->npre);
24: if (strncmp(nptr->npre, name, plen) == 0) {
25: rlen = strlen(nptr->nrepl);
26: if ((rlen+strlen(name)-plen) >= NAMLEN)
27: break;
28: strcpy(newname, nptr->nrepl);
29: strcat(newname, name + plen);
30: restore(ps);
31: return(nptr->ndev);
32: }
33: }
34: strcpy(newname, "");
35: restore(ps);
36: return(SYSERR);
37: }
This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.