/* Note: Finds the next alphabetical property, regardless of the existence of the original property given. */ PropPtr propdir_next_elem(PropPtr root, char *path) { PropPtr p; char *n; if (!root) return (NULL); while (*path && *path == PROPDIR_DELIMITER) path++; if (!*path) return (NULL); n = index(path, PROPDIR_DELIMITER); while (n && *n == PROPDIR_DELIMITER) *(n++) = '\0'; if (n && *n) { /* just another propdir in the path */ p = locate_prop(root, path); if (p && PropDir(p)) { /* yup, found the propdir */ return (propdir_next_elem(PropDir(p), n)); } return (NULL); } else { /* aha, we are finally to the property subname itself. */ return (next_node(root, path)); } }
char * next_prop_name(dbref player, char *outbuf, char *name) { char *ptr; char buf[BUFFER_LEN]; PropPtr p, l; #ifdef DISKBASE fetchprops(player); #endif strcpy(buf, name); if (!*name || name[strlen(name) - 1] == PROPDIR_DELIMITER) { l = DBFETCH(player)->properties; p = propdir_first_elem(l, buf); if (!p) { *outbuf = '\0'; return NULL; } strcat(strcpy(outbuf, name), PropName(p)); } else { /* if (!(get_property(player,name))) { *outbuf = '\0'; return NULL; } */ l = DBFETCH(player)->properties; p = propdir_next_elem(l, buf); if (!p) { *outbuf = '\0'; return NULL; } strcpy(outbuf, name); ptr = rindex(outbuf, PROPDIR_DELIMITER); if (!ptr) ptr = outbuf; *(ptr++) = PROPDIR_DELIMITER; strcpy(ptr, PropName(p)); } return outbuf; }