1028 @verb #13:"@chmod" any any any rdo #55 @program #13:"@chmod" any any any "@chmod " if (player != this) return $msg:mtell("huh") endif set_task_perms(player) if (length(args) != 2) return player:tell("Usage: ", verb, " <object/property/verb/file> <permissions>") endif {what, perms} = args "Make an allowance for poor UNIX users who want to @chmod " if (!valid(player:my_match_object(what)) && !index(what, ".") && !index(what, ":") && index(what, "!") != 1) {perms, what} = args endif if (index(what, ".") && (spec = $code_utils:parse_propref(what))) if (valid(object = player:my_match_object(spec[1]))) pname = spec[2] info = `property_info(object, pname) ! ANY' if (info == E_PROPNF) player:tell("That object does not have that property.") elseif (typeof(info) == $ERR) player:tell(info) else info[2] = perms = $perm_utils:apply(old_perms = info[2], perms) result = `set_property_info(object, pname, info) ! ANY' if (result == E_INVARG) player:tell("\"", perms, "\" is not a valid permissions string for a property.") elseif (typeof(result) == $ERR) player:tell(result) else player:tell("Property permissions changed from \"", old_perms, "\" to \"", perms, "\".") endif endif return endif endif if (spec = $code_utils:parse_verbref(what)) if (valid(object = player:my_match_object(spec[1]))) vname = spec[2] info = `verb_info(object, vname) ! ANY' if (info == E_VERBNF) player:tell("That object does not define that verb.") elseif (typeof(info) == $ERR) player:tell(info) elseif (!valid(owner = info[1])) player:tell("That verb is owned by an invalid object (", owner, "); it needs to be @chowned.") else info[2] = perms = $perm_utils:apply(old_perms = info[2], perms) if (index(perms, "w")) player:tell("Due to security concerns, you are not permitted to make verbs +w. Sorry.") elseif ((result = `set_verb_info(object, vname, info) ! ANY') == E_INVARG) player:tell("\"", perms, "\" is not a valid permissions string for a verb.") elseif (typeof(result) == $ERR) player:tell(result) else player:tell("Verb permissions changed from \"", old_perms, "\" to \"", perms, "\".") endif endif return endif endif if (spec = $code_utils:parse_fileref(what)) if (valid(object = player:my_match_object(spec[1]))) fname = spec[2] old_perms = `object:fileaccess(fname) ! ANY' if (old_perms == E_INVARG) player:tell("That object does not have that file.") elseif (typeof(old_perms) == $ERR) player:tell(old_perms) else perms = $perm_utils:apply(old_perms, perms) if ((result = `object:filesetaccess(fname, perms) ! ANY') == E_INVIND) player:tell("\"", perms, "\" is not a valid permissions string for a file.") elseif (typeof(result) == $ERR) player:tell(result) else player:tell("File permissions changed from \"", old_perms, "\" to \"", perms, "\".") endif endif return endif endif if (valid(object = player:my_match_object(what))) perms = $perm_utils:apply((object.r ? "r" | "") + (object.w ? "w" | "") + (object.f ? "f" | ""), perms) r = w = f = 0 for i in [1..length(perms)] if (perms[i] == "r") r = 1 elseif (perms[i] == "w") w = 1 elseif (perms[i] == "f") f = 1 else return player:tell("\"", perms, "\" is not a valid permissions string for an object.") endif endfor old_perms = (object.r ? "r" | "") + (object.w ? "w" | "") + (object.f ? "f" | "") try object.r = r object.w = w object.f = f player:tell("Object permissions changed from \"", old_perms, "\" to \"", perms, "\".") except (E_PERM) player:tell(E_PERM) endtry return endif $command_utils:object_match_failed(object, what) "Last modified by Dax (#789) on Tue May 3 13:45:55 2005 MDT." . 0