_unset.c

umud/CMD/_unset.c · 984 B

From the archive umud1.13.tar.gz

Download the archive   « Back to the archive contents

/*
	Copyright (C) 1991, Marcus J. Ranum. All rights reserved.
*/

#ifndef	lint
static	char	RCSid[] = "$Header: /usr/users/mjr/hacks/umud/CMD/RCS/_unset.c,v 1.1 91/07/04 17:33:24 mjr Rel $";
#endif

/* configure all options BEFORE including system stuff. */
#include	"config.h"


#include	"mud.h"
#include	"match.h"

/*
unset an object attribute

no checks are made for whether or not the attribute set is important
or anything.
*/

/* ARGSUSED */
cmd__unset(argc,argv,who,aswho)
int	argc;
char	*argv[];
char	*who;
char	*aswho;
{
	Obj	*op;
	char	ob[MAXOID];

	if(matchlocal(who,argv[1],ut_loc(who),MTCH_UNIQ|MTCH_MEOK|MTCH_NONLOC,ob))
		return(1);

	if((op = cache_get(ob)) == (Obj *)0) {
		say(who,"cannot find object ",ob,"\n",(char *)0);
		return(1);
	}

	if(objunsetattr(op,argv[2])) {
		say(who,"cannot unset attribute ",argv[2],"\n",(char *)0);
		return(1);
	}

	if(cache_put(op,argv[1])) {
		say(who,"cannot write object ",argv[1],"\n",(char *)0);
		return(1);
	}
	return(0);
}

Site Stats

Snippets: 1791
Codebases: 571