コード例 #1
0
ファイル: wiz.c プロジェクト: hyena/fuzzball
int
blessprops_wildcard(dbref player, dbref thing, const char *dir, const char *wild, int blessp)
{
	char propname[BUFFER_LEN];
	char wld[BUFFER_LEN];
	char buf[BUFFER_LEN];
	char buf2[BUFFER_LEN];
	char *ptr, *wldcrd = wld;
	PropPtr propadr, pptr;
	int i, cnt = 0;
	int recurse = 0;

#ifdef GOD_PRIV
	if(tp_strict_god_priv && !God(player) && God(OWNER(thing))) {
		notify(player,"Only God may touch what is God's.");
		return 0;
	}
#endif

	strcpyn(wld, sizeof(wld), wild);
	i = strlen(wld);
	if (i && wld[i - 1] == PROPDIR_DELIMITER)
		strcatn(wld, sizeof(wld), "*");
	for (wldcrd = wld; *wldcrd == PROPDIR_DELIMITER; wldcrd++) ;
	if (!strcmp(wldcrd, "**"))
		recurse = 1;

	for (ptr = wldcrd; *ptr && *ptr != PROPDIR_DELIMITER; ptr++) ;
	if (*ptr)
		*ptr++ = '\0';

	propadr = first_prop(thing, (char *) dir, &pptr, propname, sizeof(propname));
	while (propadr) {
		if (equalstr(wldcrd, propname)) {
			snprintf(buf, sizeof(buf), "%s%c%s", dir, PROPDIR_DELIMITER, propname);
			if (!Prop_System(buf) && ((!Prop_Hidden(buf) && !(PropFlags(propadr) & PROP_SYSPERMS))
				|| Wizard(OWNER(player)))) {
				if (!*ptr || recurse) {
					cnt++;
					if (blessp) {
						set_property_flags(thing, buf, PROP_BLESSED);
						snprintf(buf2, sizeof(buf2), "Blessed %s", buf);
					} else {
						clear_property_flags(thing, buf, PROP_BLESSED);
						snprintf(buf2, sizeof(buf2), "Unblessed %s", buf);
					}
					notify(player, buf2);
				}
				if (recurse)
					ptr = "**";
				cnt += blessprops_wildcard(player, thing, buf, ptr, blessp);
			}
		}
		propadr = next_prop(pptr, propadr, propname, sizeof(propname));
	}
	return cnt;
}
コード例 #2
0
ファイル: game.c プロジェクト: CyberLeo/protomuck
void
find_path( dbref loc, const char *pathname, char buf[BUFFER_LEN] ) {
    PropPtr propadr, pptr;

#ifdef DISKBASE
    fetchprops(loc);
#endif
    buf[0] = '\0';
    propadr = first_prop(loc, "@u/d/", &pptr, buf);

    while (propadr > 0) {
	if( exit_prefix(buf, pathname) )
	    return;
	propadr = next_prop(pptr, propadr, buf);
    }
    buf[0] = '\0';
}
コード例 #3
0
ファイル: mfuns2.c プロジェクト: GlowMUCK/GlowMUCK
const char *
mfn_dirprops(MFUNARGS)
{
    char propname[BUFFER_LEN];
    PropPtr propadr, pptr;
    char buf2[BUFFER_LEN];
    int list_limit = MAX_MFUN_LIST_LEN;
    dbref obj;
    int outlen, nextlen;

    if(argc > 1) {
	obj = mesg_dbref_local(player, what, perms, argv[1]);
	if (obj == AMBIGUOUS || obj == UNKNOWN || obj == NOTHING || obj == HOME)
	    ABORT_MPI("DIRPROPS","Match failed");
	if (obj == PERMDENIED)
	    ABORT_MPI("DIRPROPS",NOPERM_MESG);
    } else obj = what;

    buf[0] = '\0';
    outlen = 0;

#ifdef DISKBASE
	fetchprops(obj);
#endif

    propadr = first_prop(obj, argv[0], &pptr, propname);
    while ((propadr > 0) && *propname) {
	    if ( ( !Prop_Hidden(propname) && !(PropFlags(propadr) & PROP_SYSPERMS))
		    || (Permlevel(perms) >= tp_hidden_prop_mlevel)) {
		sprintf(buf2, "%s", propname);
		nextlen = strlen(buf2);
		if ((outlen + nextlen) >= (BUFFER_LEN - 3))
		    break;
		if (outlen) strcat((buf+(outlen++)), "\r");
		strcat((buf + outlen), buf2);
		outlen += nextlen;
		list_limit--;
	    }
	propadr = next_prop(pptr, propadr, propname);
    }

    return buf;
}
コード例 #4
0
ファイル: extract.c プロジェクト: GlowMUCK/GlowMUCK
void 
check_properties(const char *dir, dbref obj)
{
    int     val;
    char   *buf, *prop;
    PropPtr pptr;
    PropPtr pref;
    char    name[BUFFER_LEN];

    pref = first_prop(obj, dir, &pptr, name);
    while (pref > 0) {
	buf = (char *) malloc(strlen(dir) + strlen(name) + 2);
	(void) strcat(strcpy(buf, dir), name);
	if (prop = (char *) get_property_class(obj, buf))
	    printf("%s%c%s\n", buf + 1, PROP_DELIMITER, uncompress(prop));
	else if (val = get_property_value(obj, buf))
	    printf("%s%c^%d\n", buf + 1, PROP_DELIMITER, val);
	if (is_propdir(obj, buf))
	    check_properties((char *) strcat(buf, "/"), obj);
	free(buf);
	pref = next_prop(pptr, pref, name);
    }
}