unmount.c,v

来自「TCP-IP红宝书源代码」· C,V 代码 · 共 59 行

C,V
59
字号
head	1.1;
access;
symbols;
locks
	dls:1.1; strict;
comment	@ * @;


1.1
date	97.09.21.19.28.54;	author dls;	state Dist;
branches;
next	;


desc
@@


1.1
log
@pre-3e code
@
text
@/* unmount.c - unmount */

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

/*------------------------------------------------------------------------
 *  unmount  -  remove an entry from the name prefix mapping table
 *------------------------------------------------------------------------
 */
SYSCALL	unmount(prefix)
char	*prefix;
{
	STATWORD ps;    
	struct	nament	*nptr;
	int	i;

	if (prefix == NULL)
		prefix = NULLSTR;
	else if (strlen(prefix) >= NAMPLEN)
		return(SYSERR);
	disable(ps);
	for (i=0 ; i<Nam.nnames ; i++) {
		nptr = &Nam.nametab[i];
		if (strcmp(prefix, nptr->npre) == 0) {
			for(Nam.nnames-- ; i<Nam.nnames ; i++)
				Nam.nametab[i] = Nam.nametab[i+1];
			restore(ps);
			return(OK);
		}
	}
	restore(ps);
	return(SYSERR);
}
@

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?