This is patch12 to PennMUSH 1.7.7. After applying this patch, you will have version 1.7.7p12 To apply this patch, save it to a file in your top-level MUSH directory, and do the following: patch -p1 < 1.7.7-patch12 mv CHANGES CHANGES.177 ./Configure -S make versions make install If 'make versions' fails with an error about Sort::Versions, you can instead download game-txt-hlp-177p12.tar.gz from the ftp site and unpack that from your pennmush/ directory. If you use GNU patch 2.2, you probably want the above to be 'patch -b -p1', not just 'patch -p1'. Unix (or cygwin) users need not worry about failed hunks in src/switchinc.c, hdrs/switches.h, hdrs/cmds.h, or hdrs/funs.h. These files are automatically rebuilt on compile. Then @shutdown and restart your MUSH. - Alan/Javelin In this patch: Commands: * @channel/buffer creates a buffer for a channel to store the most recent messages broadcast on the channel. @channel/recall can be used to recall them. These are not stored across reboots and should be set up by #1's @startup. Functions/Substitutions: * accname() gives the accented name of an object (applying @nameaccent). * %~ gives the accented name of the enactor. Minor Changes: * The chat-related commands and functions have been moved out of bsd.c and funmisc.c and into extchat.c. Patch by Vadiv@M*U*S*H. * The notification stuff has been moved out of bsd.c and into a new notify.c file. * @name no longer requires a password for changing player names, and ignores one if given. Suggested by Ambrosia@M*U*S*H (and others). * @hook can not be used on the @password or @newpassword commands. * The dump_complete message is also shown after a forking dump, if one is defined. Suggested by Nathan Schuette. * @lock/leave on a room now prevents people within it from leaving via exits or via @tel. Suggested by Peter Bengtson, patch by BlaZe@M*U*S*H. Fixes: * Fixes from 1.7.6p8 * Cleanup of a few new db[x] mentions in the source to use dbdefs.h macros. Inspired by Vadiv@M*U*S*H. * @command/restrict didn't work properly for most flags, especially new ones. Reported by Caesar and Sholevi@M*U*S*H. * @pemit/list didn't honor NOSPOOF. Patch by Cheetah@M*U*S*H. Prereq: 1.7.7p11 rm -rf CHANGES*~ CHANGES*bak utils/mkvershlp.pl game/txt/hlp CHANGES* *** 1_7_7.231/Patchlevel Sat, 22 Feb 2003 15:29:30 -0600 dunemush (pennmush/5_Patchlevel 1.17.1.11.1.13 600) --- 1_7_7.308(w)/Patchlevel Sat, 22 Mar 2003 10:44:14 -0600 dunemush (pennmush/5_Patchlevel 1.17.1.11.1.14 600) *************** *** 1,2 **** Do not edit this file. It is maintained by the official PennMUSH patches. ! This is PennMUSH 1.7.7p11 --- 1,2 ---- Do not edit this file. It is maintained by the official PennMUSH patches. ! This is PennMUSH 1.7.7p12 *** 1_7_7.231/CHANGES Sat, 22 Feb 2003 15:29:30 -0600 dunemush (pennmush/g/23_CHANGES 1.48.1.23 600) --- 1_7_7.308(w)/CHANGES.177 Mon, 24 Mar 2003 12:09:06 -0600 dunemush (pennmush/g/23_CHANGES 1.48.1.41 600) *************** *** 18,23 **** --- 18,55 ---- ========================================================================== + Version 1.7.7 patchlevel 12 March 21, 2003 + + Commands: + * @channel/buffer creates a buffer for a channel to store the most + recent messages broadcast on the channel. @channel/recall can be + used to recall them. These are not stored across reboots and should + be set up by #1's @startup. + Functions/Substitutions: + * accname() gives the accented name of an object (applying @nameaccent). + * %~ gives the accented name of the enactor. + Minor Changes: + * The chat-related commands and functions have been moved out + of bsd.c and funmisc.c and into extchat.c. Patch by Vadiv@M*U*S*H. + * The notification stuff has been moved out of bsd.c and into a new + notify.c file. + * @name no longer requires a password for changing player names, + and ignores one if given. Suggested by Ambrosia@M*U*S*H (and others). + * @hook can not be used on the @password or @newpassword commands. + * The dump_complete message is also shown after a forking dump, + if one is defined. Suggested by Nathan Schuette. + * @lock/leave on a room now prevents people within it from leaving + via exits or via @tel. Suggested by Peter Bengtson, patch by + BlaZe@M*U*S*H. + Fixes: + * Fixes from 1.7.6p8 + * Cleanup of a few new db[x] mentions in the source to use dbdefs.h + macros. Inspired by Vadiv@M*U*S*H. + * @command/restrict didn't work properly for most flags, especially + new ones. Reported by Caesar and Sholevi@M*U*S*H. + * @pemit/list didn't honor NOSPOOF. Patch by Cheetah@M*U*S*H. + + Version 1.7.7 patchlevel 11 February 22, 2003 Commands: *** 1_7_7.231/game/txt/hlp/penntop.hlp Tue, 04 Feb 2003 22:13:06 -0600 dunemush (pennmush/13_penntop.hl 1.2.1.27.1.3.1.2.1.2.1.1.1.1.1.1.1.1.1.12.1.5 600) --- 1_7_7.308(w)/game/txt/hlp/penntop.hlp Thu, 06 Mar 2003 10:50:57 -0600 dunemush (pennmush/13_penntop.hl 1.2.1.27.1.3.1.2.1.2.1.1.1.1.1.1.1.1.1.12.1.6 600) *************** *** 1699,1709 **** Zone master rooms are a subset of zones. If a room is used as a zone master, it is a zone master room (ZMR). ZMRs are like local "master" rooms. Exits in the ZMR are global to that zone, and $commands on ! objects in the ZMR are global to that zone. Zone master rooms are ! only defined if globals are used. Zone master rooms are best used for ! very large zones which have a lot of global exits, or for zones with ! restricted commands that can go on a separate use-locked object from ! general ones. See also: ZONES, MASTER ROOM, EVALUATION & ZONE MASTERS --- 1699,1714 ---- Zone master rooms are a subset of zones. If a room is used as a zone master, it is a zone master room (ZMR). ZMRs are like local "master" rooms. Exits in the ZMR are global to that zone, and $commands on ! objects in the ZMR are global to that zone ($commands on the ZMR itself, ! like $commands on the master room, are ignored). If a ZMR is a player's ! personal zone, objects in the ZMR are checked for commands that the ! player can use anywhere (but exits are not checked unless the player ! is in a zoned room). ! ! Zone master rooms are only defined if globals are used. Zone master ! rooms are best used for very large zones which have a lot of global ! exits, or for zones with restricted commands that can go on a separate ! use-locked object from general ones. See also: ZONES, MASTER ROOM, EVALUATION & ZONE MASTERS *** 1_7_7.231/game/txt/hlp/pennfunc.hlp Wed, 12 Feb 2003 15:05:43 -0600 dunemush (pennmush/16_pennfunc.h 1.2.1.50.1.1.1.1.1.2.1.7.1.8.1.1.1.1.1.1.1.1.1.1.1.1.1.3.1.1.1.1.1.1.1.1.1.1.1.1.1.9.1.1.1.1.1.3.1.1.1.1.1.1.1.8 600) --- 1_7_7.308(w)/game/txt/hlp/pennfunc.hlp Tue, 18 Mar 2003 15:58:45 -0600 dunemush (pennmush/16_pennfunc.h 1.2.1.50.1.1.1.1.1.2.1.7.1.8.1.1.1.1.1.1.1.1.1.1.1.1.1.3.1.1.1.1.1.1.1.1.1.1.1.1.1.9.1.1.1.1.1.3.1.1.1.1.1.1.1.1.1.2 600) *************** *** 1263,1268 **** --- 1263,1275 ---- > say [foreach(is_alphanum,jt1o+)] You say, "1 1 1 1 0 " + & ACCNAME() + accname() + + accname() returns the name of object , applying the object's + @nameaccent, if any. + + Related functions: NAME(), ACCNAME(), INAME() & FULLNAME() fullname() *************** *** 1273,1279 **** >"[fullname(south)] You say, "South;sout;sou;so;s" ! Related functions: NAME(), INAME() & FUNCTIONS() functions() --- 1280,1286 ---- >"[fullname(south)] You say, "South;sout;sou;so;s" ! Related functions: NAME(), ACCNAME(), INAME() & FUNCTIONS() functions() *************** *** 2342,2348 **** error, but enough old code has been written that expects this behavior that it will continue to do this for the time being. Don't rely on it. ! Related functions: FULLNAME(), INAME() & NAND() nand(, ,...) --- 2349,2355 ---- error, but enough old code has been written that expects this behavior that it will continue to do this for the time being. Don't rely on it. ! Related functions: FULLNAME(), ACCNAME(), INAME() & NAND() nand(, ,...) *************** *** 3535,3546 **** attribute, %# refers to the original enactor and not the 'calling' object; 'me' refers to the object that supplied the attribute. ! However, unlike the u() function, the global registers r(0) through r(9) ! (%q0 - %q9) are preserved in their initial state. This means that functions ! "below" the level of the u() can reset global registers for temporary ! calculations, without needing to worry about "clobbering" the original ! values. ! This makes ulocal() particularly useful for global or shared code which calls arbitrary u() functions, where global register values need to be preserved from accidental user clobbering. --- 3542,3553 ---- attribute, %# refers to the original enactor and not the 'calling' object; 'me' refers to the object that supplied the attribute. ! However, unlike the u() function, the global registers r(0)-r(9) and ! r(A)-r(Z) (%q0-%q9, %qa-%qz) are preserved in their initial state. This ! means that functions "below" the level of the u() can reset global ! registers for temporary calculations, without needing to worry about ! "clobbering" the original values. ! This makes ulocal() particularly useful for global or shared code which calls arbitrary u() functions, where global register values need to be preserved from accidental user clobbering. *** 1_7_7.231/game/txt/hlp/pennflag.hlp Tue, 04 Feb 2003 22:25:42 -0600 dunemush (pennmush/17_pennflag.h 1.1.1.1.1.2.1.1.1.2.1.1.1.2.1.1.2.1.2.1.1.1.1.2.1.4.1.2.1.4 600) --- 1_7_7.308(w)/game/txt/hlp/pennflag.hlp Sat, 15 Mar 2003 20:28:51 -0600 dunemush (pennmush/17_pennflag.h 1.1.1.1.1.2.1.1.1.2.1.1.1.2.1.1.2.1.2.1.1.1.1.2.1.4.1.2.2.2 600) *************** *** 47,59 **** V - Visual W - Wizard X - Safe Z - Shared, Z_Tel ! a - Audible b - Debug c - Connected, Cloudy d - Destroy_Ok e - Enter_Ok g - Gagged h - Halt j - Jury_Ok l - Light m - Myopic, Mistrust n - No_Command o - On-Vacation p - Puppet, Paranoid r - Royalty s - Suspect t - Transparent u - Uninspected v - Verbose ! w - No_Warn x - Terse ? - Unregistered ^ - Listen_Parent ~ - Noaccents --------------------------------------------------------------------- Some flags may not be enabled on some MUSHes. @flag/list will show --- 47,59 ---- V - Visual W - Wizard X - Safe Z - Shared, Z_Tel ! a - Audible b - Debug c - Connected d - Destroy_Ok e - Enter_Ok g - Gagged h - Halt j - Jury_Ok l - Light m - Myopic, Mistrust n - No_Command o - On-Vacation p - Puppet, Paranoid r - Royalty s - Suspect t - Transparent u - Uninspected v - Verbose ! w - No_Warn x - Terse, Cloudy ? - Unregistered ^ - Listen_Parent ~ - Noaccents --------------------------------------------------------------------- Some flags may not be enabled on some MUSHes. @flag/list will show *** 1_7_7.231/game/txt/hlp/penncmd.hlp Sat, 22 Feb 2003 14:01:23 -0600 dunemush (pennmush/18_penncmd.hl 1.2.1.1.1.47.1.1.1.1.1.3.1.4.1.1.1.1.1.1.1.1.1.1.1.1.1.1.1.1.1.2.1.10.1.1.1.1.1.4.1.6 600) --- 1_7_7.308(w)/game/txt/hlp/penncmd.hlp Wed, 12 Mar 2003 12:25:37 -0600 dunemush (pennmush/18_penncmd.hl 1.2.1.1.1.47.1.1.1.1.1.3.1.4.1.1.1.1.1.1.1.1.1.1.1.1.1.1.1.1.1.2.1.10.1.1.1.1.1.1.1.4 600) *************** *** 1936,1942 **** @lock/speech Who can speak/pose/emit in this room @lock/listen Who can trigger my @ahear/^-pattern actions @lock/command Who can trigger my $-pattern commands ! @lock/leave Who can leave this object @lock/drop Who can drop this object or in this room @lock/give Who can give this object @lock/follow Who can follow this object --- 1936,1942 ---- @lock/speech Who can speak/pose/emit in this room @lock/listen Who can trigger my @ahear/^-pattern actions @lock/command Who can trigger my $-pattern commands ! @lock/leave Who can leave this object (or room, via exits/@tel) @lock/drop Who can drop this object or in this room @lock/give Who can give this object @lock/follow Who can follow this object *************** *** 2043,2053 **** See also: go, @omove, @oxmove, @amove & @name ! @name = [] Changes the name of , which can be a thing, player, exit, or room. You can refer to object by name, DBREF number, or as "me" ! or "here". For a player, it requires the player's password. & @newpassword @newpassword = --- 2043,2057 ---- See also: go, @omove, @oxmove, @amove & @name ! @name = Changes the name of , which can be a thing, player, exit, or room. You can refer to object by name, DBREF number, or as "me" ! or "here". ! ! When changing a player's name on games that support multi-word player ! names, the name should be enclosed in quotes: ! @name me = "James Bond" & @newpassword @newpassword = *************** *** 2541,2547 **** @remit[/switches] = . Sends the message to all contents of , which can be a room, ! thing, or player. (The TinyMUSH equivalent is @pemit/contents). The /silent switch stops the remitter from getting feedback if they're in a different location than the target. --- 2545,2552 ---- @remit[/switches] = . Sends the message to all contents of , which can be a room, ! thing, or player. The message is also sent to the itself. ! (The TinyMUSH equivalent is @pemit/contents). The /silent switch stops the remitter from getting feedback if they're in a different location than the target. *** 1_7_7.231/game/txt/hlp/pennchat.hlp Sun, 15 Sep 2002 15:53:06 -0500 dunemush (pennmush/19_pennchat.h 1.2.1.4.1.4 600) --- 1_7_7.308(w)/game/txt/hlp/pennchat.hlp Sun, 16 Mar 2003 16:54:10 -0600 dunemush (pennmush/19_pennchat.h 1.2.1.4.1.5 600) *************** *** 58,72 **** Wizards may add and remove other players from channels by providing a player name as a second argument. ! Some channels may be restricted in who can join them and/or speak ! on them. If the Extended Chat System is enabled, @channel/list will ! show you the channel's name, number of users, number of message ! since last restart, access information, and your status. See ! "help channel-list" for an explanation of how to read the listing. @channel/what will show you the channel's name, access information, and a description of the channel's purpose. ! More details are provided in "help @channel2". See also: chat & @channel2 @channel/who @channel/hide = --- 58,73 ---- Wizards may add and remove other players from channels by providing a player name as a second argument. ! Channels may be restricted in who can join them and/or speak on ! them. @channel/list will show you the channel's name, number of users, ! number of message since last restart, access information, and your ! status. See "help channel-list" for an explanation of how to read ! the listing. ! @channel/what will show you the channel's name, access information, and a description of the channel's purpose. ! More commands are provided in "help @channel2". See also: chat & @channel2 @channel/who @channel/hide = *************** *** 88,109 **** & @channel3 @channel/mute = @channel/gag = ! Some channels broadcast messages when players connect or disconnect ! from the MUSH. If you're on such a channel and don't want to hear ! those messages, use @channel/mute =yes. To resume hearing ! the messages, use @channel/mute =no. You can also use ! @channel/unmute . If you want to remain on a channel but not receive any messages on the channel, use @channel/gag =yes. To resume hearing, ! use @channel/gag =no (or @channel/ungag ). If you ! disconnect, the channel will be automatically ungagged for you. If the ! channel does not have the "open" priv, you can not speak on it while ! you are gagged. ! ! If you do not specify a channel with these commands, you mute or ! gag (or unmute or ungag) all channels at once. See "help @channel4" for more. & @channel4 --- 89,113 ---- & @channel3 @channel/mute = @channel/gag = + @channel/recall [ = ] ! Some channels broadcast messages when players connect or disconnect from ! the MUSH. If you don't want to hear those messages, use @channel/mute ! =yes. To resume hearing the messages, use @channel/mute ! =no or @channel/unmute . Leave out ! to mute or unmute all channels. If you want to remain on a channel but not receive any messages on the channel, use @channel/gag =yes. To resume hearing, ! use @channel/gag =no (or @channel/ungag ). When ! you disconnect, the channel will be automatically ungagged for you. ! Leave out to gag or ungag all channels. If the channel does ! not have the "open" priv, you can not speak on it while you are gagged. ! ! @channel/recall shows you the most recent messages on the channel; ! the number of messages depends on how the channel is configured, but ! can be limited by specifying . You must be on a channel to ! recall from it. See "help @channel4" for more. & @channel4 *************** *** 134,145 **** --- 138,153 ---- @channel/priv = @channel/quiet = @channel/wipe + @channel/buffer = @channel/decompile[/brief] @channel/chown = The "priv" switch changes the channel's access privileges. The "quiet" switch turns the quiet status of a channel on and off. The "wipe" switch clears a channel of players without deleting it. + The "buffer" switch sets the maximum number of full-length lines that + the channel will buffer for @chan/recall. Many more shorter lines may + actually be buffered. Setting it to 0 turns off buffering. The "decompile" and "chown" switches can only be used by Wizards. @channel/decompile produces a decompile of matching channels. If the *************** *** 149,174 **** & channel-list Here's the legend for reading the @channel/list output: ! Channel Name Num Users Num Msgs Access Locks Status ! Sample 1 0 [DPOWQHo jsmvh*] [On QH] ! ||||||| |||||| | || ! Channel is DISABLED----------------------------/|||||| |||||| | || ! Channel allows PLAYERS--------------------------/||||| |||||| | || ! Channel allows OBJECTS---------------------------/|||| |||||| | || ! Channel is Wizard-only (W) or Admin-only (A)------/||| |||||| | || ! Channel is QUIET-----------------------------------/|| |||||| | || ! Channel is HIDE_OK----------------------------------/| |||||| | || ! Channel is OPEN (non-members can speak on it)--------/ |||||| | || ! Channel has @clock/join set----------------------------|||||| | || ! Channel has @clock/speak set----------------------------/|||| | || ! Channel has @clock/mod set-------------------------------/||| | || ! Channel has @clock/see set--------------------------------/|| | || ! Channel has @clock/hide set--------------------------------/| | || ! Player is the owner of the channel--------------------------/ | || ! Player is currently on/off/gagging the channel------------------/ || ! If on, player has the channel muted---------------------------------/| ! If on, player is hiding on the channel-------------------------------/ ! & @clock @clock/join [= ] @clock/speak [= ] --- 157,182 ---- & channel-list Here's the legend for reading the @channel/list output: ! Channel Name Num Users Num Msgs Access Locks Status Buf ! Sample 1 0 [DPOWQHo jsmvh*] [On QH] 4 ! ||||||| |||||| | || | ! Channel is DISABLED----------------------------/|||||| |||||| | || | ! Channel allows PLAYERS--------------------------/||||| |||||| | || | ! Channel allows OBJECTS---------------------------/|||| |||||| | || | ! Channel is Wizard-only (W) or Admin-only (A)------/||| |||||| | || | ! Channel is QUIET-----------------------------------/|| |||||| | || | ! Channel is HIDE_OK----------------------------------/| |||||| | || | ! Channel is OPEN (non-members can speak on it)--------/ |||||| | || | ! Channel has @clock/join set----------------------------|||||| | || | ! Channel has @clock/speak set----------------------------/|||| | || | ! Channel has @clock/mod set-------------------------------/||| | || | ! Channel has @clock/see set--------------------------------/|| | || | ! Channel has @clock/hide set--------------------------------/| | || | ! Player is the owner of the channel--------------------------/ | || | ! Player is currently on/off/gagging the channel------------------/ || | ! If on, player has the channel muted---------------------------------/| | ! If on, player is hiding on the channel-------------------------------/ | ! Size of the channel buffer in full-length lines---------------------------/ & @clock @clock/join [= ] @clock/speak [= ] *** 1_7_7.231/src/SWITCHES Tue, 14 Jan 2003 22:56:21 -0600 dunemush (pennmush/b/22_SWITCHES 1.12.1.3.1.2 600) --- 1_7_7.308(w)/src/SWITCHES Sun, 16 Mar 2003 16:02:11 -0600 dunemush (pennmush/b/22_SWITCHES 1.12.1.3.1.4 600) *************** *** 9,14 **** --- 9,15 ---- BEFORE BLIND BRIEF + BUFFER CHECK CHOWN CLEAR *************** *** 88,93 **** --- 89,95 ---- QUIET READ REBOOT + RECALL REMOVE RENAME REGISTER *** 1_7_7.231/src/wiz.c Thu, 06 Feb 2003 11:14:31 -0600 dunemush (pennmush/b/23_wiz.c 1.44.1.1.1.1.1.2.1.7.1.1.1.1.1.1.1.1.1.1.1.8.1.2.2.2.1.2.1.1.1.1.1.1.1.2.1.1.1.2.2.3 660) --- 1_7_7.308(w)/src/wiz.c Tue, 25 Mar 2003 16:22:38 -0600 dunemush (pennmush/b/23_wiz.c 1.44.1.1.1.1.1.2.1.7.1.1.1.1.1.1.1.1.1.1.1.8.1.2.2.2.1.2.1.1.1.1.1.1.1.2.1.1.1.2.2.4 660) *************** *** 470,476 **** * player. */ /* now check to see if the absolute room is set NO_TEL */ ! if (NoTel(absroom) && !controls(player, absroom) && !Tel_Anywhere(player)) { notify(player, T("Teleports are not allowed in this room.")); --- 470,476 ---- * player. */ /* now check to see if the absolute room is set NO_TEL */ ! if ((NoTel(absroom) || !eval_lock(player, absroom, Leave_Lock)) && !controls(player, absroom) && !Tel_Anywhere(player)) { notify(player, T("Teleports are not allowed in this room.")); *** 1_7_7.231/src/help.c Mon, 27 Jan 2003 09:40:07 -0600 dunemush (pennmush/f/32_help.c 1.4.1.2.1.1.1.3.2.2.1.1.2.1.1.2.1.2.1.2.1.3.1.9 660) --- 1_7_7.308(w)/src/help.c Tue, 25 Mar 2003 16:22:37 -0600 dunemush (pennmush/f/32_help.c 1.4.1.2.1.1.1.3.2.2.1.1.2.1.1.2.1.2.1.2.1.3.1.10 660) *************** *** 1,3 **** --- 1,10 ---- + /** + * \file help.c + * + * \brief The PennMUSH help system. + * + * + */ #include "config.h" #include #include *************** *** 31,39 **** static void help_build_index(help_file *h, int restricted); typedef struct TLIST { ! char topic[TOPIC_NAME_LEN + 1]; ! struct TLIST *next; } tlist; tlist *top = NULL; --- 38,47 ---- static void help_build_index(help_file *h, int restricted); + /** Linked list of help topic names. */ typedef struct TLIST { ! char topic[TOPIC_NAME_LEN + 1]; /**< Name of topic */ ! struct TLIST *next; /**< Pointer to next list entry */ } tlist; tlist *top = NULL; *************** *** 41,47 **** unsigned num_topics = 0; unsigned top_topics = 0; ! void write_topic(long int p); #define TRUE 1 #define FALSE 0 --- 49,55 ---- unsigned num_topics = 0; unsigned top_topics = 0; ! static void write_topic(long int p); #define TRUE 1 #define FALSE 0 *************** *** 59,76 **** do_new_spitfile(player, arg_left, h, h->admin); } void ! init_help_files() { hash_init(&help_files, 8, sizeof(help_file)); help_init = 1; } void ! add_help_file(command_name, filename, admin) ! const char *command_name; ! const char *filename; ! int admin; { help_file *h; char newfilename[256] = "\0"; --- 67,92 ---- do_new_spitfile(player, arg_left, h, h->admin); } + /** Initialize the helpfile hashtable, which contains the names of the + * help files. + */ void ! init_help_files(void) { hash_init(&help_files, 8, sizeof(help_file)); help_init = 1; } + /** Add new help command. This function is + * the basis for the help_command directive in mush.cnf. It creates + * a new help entry for the hash table, builds a help index, + * and adds the new command to the command table. + * \param command_name name of help command to add. + * \param filename name of the help file to use for this command. + * \param admin if 1, this command reads admin topics, rather than standard. + */ void ! add_help_file(const char *command_name, const char *filename, int admin) { help_file *h; char newfilename[256] = "\0"; *************** *** 113,121 **** hashadd(h->command, h, &help_files); } void ! help_reindex(player) ! dbref player; { help_file *curr; --- 129,142 ---- hashadd(h->command, h, &help_files); } + /** Rebuild a help file index. + * \verbatim + * This command implements @readcache. + * \endverbatim + * \param player the enactor. + */ void ! help_reindex(dbref player) { help_file *curr; *************** *** 136,146 **** } static void ! do_new_spitfile(player, arg1, help_dat, restricted) ! dbref player; ! char *arg1; ! help_file *help_dat; ! int restricted; /* 1 = admin help, 0 = regular help */ { help_indx *entry = NULL; FILE *fp; --- 157,163 ---- } static void ! do_new_spitfile(dbref player, char *arg1, help_file *help_dat, int restricted) { help_indx *entry = NULL; FILE *fp; *************** *** 265,273 **** notify_format(player, T("%s output truncated."), help_dat->command); } ! void ! write_topic(p) ! long int p; { tlist *cur, *nextptr; help_indx *temp; --- 282,289 ---- notify_format(player, T("%s output truncated."), help_dat->command); } ! static void ! write_topic(long int p) { tlist *cur, *nextptr; help_indx *temp; *************** *** 303,311 **** } static void ! help_build_index(h, restricted) ! help_file *h; ! int restricted; { long bigpos, pos = 0; int in_topic; --- 319,325 ---- } static void ! help_build_index(help_file *h, int restricted) { long bigpos, pos = 0; int in_topic; *** 1_7_7.231/src/htab.c Sun, 01 Dec 2002 21:14:41 -0600 dunemush (pennmush/b/30_htab.c 1.8.1.6 660) --- 1_7_7.308(w)/src/htab.c Tue, 25 Mar 2003 16:22:37 -0600 dunemush (pennmush/b/30_htab.c 1.8.1.10 660) *************** *** 1,8 **** ! /* htab.c - table hashing routines */ ! ! /* This code is ripped out of TinyMUSH 2.2. */ ! /* Minor tweaking to make in Penn-compatible by Trivian (xeno@mix.hive.no) */ ! #include "config.h" #include "copyrite.h" --- 1,12 ---- ! /** ! * \file htab.c ! * ! * \brief Hashtable routines. ! * This code is largely ripped out of TinyMUSH 2.2.5, with tweaks ! * to make it Penn-compatible by Trivian. ! * ! * ! */ #include "config.h" #include "copyrite.h" *************** *** 15,20 **** --- 19,26 ---- #include "mymalloc.h" #include "confmagic.h" + static HASHENT *hash_new(HASHTAB *htab, const char *key); + /* --------------------------------------------------------------------------- * hash_val: Compute hash value of a string for a hash table. */ *************** *** 42,50 **** /* The whole new hash function */ int ! hash_val(k, mask) ! register const char *k; /* the key */ ! int mask; { register u4 a, b, c; /* the internal state */ u4 len, length; /* how many key bytes still need mixing */ --- 48,54 ---- /* The whole new hash function */ int ! hash_val(register const char *k, int mask) { register u4 a, b, c; /* the internal state */ u4 len, length; /* how many key bytes still need mixing */ *************** *** 100,119 **** #else /* NEW_HASH_FUN */ int ! hash_val(key, hashmask) ! const char *key; ! int hashmask; { int hash = 0; const char *sp; - /* - * If the string pointer is null, return 0. If not, add up the - * numeric value of all the characters and return the sum, - * modulo the size of the hash table. - */ - if (!key || !*key) return 0; for (sp = key; *sp; sp++) --- 104,123 ---- #else /* NEW_HASH_FUN */ + /** Compute a hash value for mask-style hashing. + * Given a null key, return 0. Otherwise, add up the numeric value + * of all the characters and return the sum modulo the size of the + * hash table. + * \param key key to hash. + * \param hashmask hash table size to use as modulus. + * \return hash value. + */ int ! hash_val(const char *key, int hashmask) { int hash = 0; const char *sp; if (!key || !*key) return 0; for (sp = key; *sp; sp++) *************** *** 126,154 **** * hash_getmask: Get hash mask for mask-style hashing. */ int ! hash_getmask(size) ! int *size; { int tsize; if (!size || !*size) return 0; - /* Get next power-of-two >= size, return power-1 as the mask - * for ANDing - */ - for (tsize = 1; tsize < *size; tsize = tsize << 1) ; *size = tsize; return tsize - 1; } void ! hash_init(htab, size, data_size) ! HASHTAB *htab; ! int size; ! int data_size; { int i; --- 130,160 ---- * hash_getmask: Get hash mask for mask-style hashing. */ + /** Get the hash mask for mask-style hashing. + * Given the data size, return closest power-of-two less than that size. + * \param size data size. + * \return hash mask. + */ int ! hash_getmask(int *size) { int tsize; if (!size || !*size) return 0; for (tsize = 1; tsize < *size; tsize = tsize << 1) ; *size = tsize; return tsize - 1; } + /** Initialize a hashtable. + * \param htab pointer to hash table to initialize. + * \param size size of hashtable. + * \param data_size size of an individual datum to store in the table. + */ void ! hash_init(HASHTAB *htab, int size, int data_size) { int i; *************** *** 162,171 **** htab->entry_size = data_size; } HASHENT * ! hash_find(htab, key) ! HASHTAB *htab; ! const char *key; { int hval, cmp; HASHENT *hptr; --- 168,180 ---- htab->entry_size = data_size; } + /** Return a hashtable entry given a key. + * \param htab pointer to hash table to search. + * \param key key to look up in the table. + * \return pointer to hash table entry for given key. + */ HASHENT * ! hash_find(HASHTAB *htab, const char *key) { int hval, cmp; HASHENT *hptr; *************** *** 184,192 **** return NULL; } void * ! hash_value(entry) ! HASHENT *entry; { if (entry) return entry->data; --- 193,204 ---- return NULL; } + /** Return the value stored in a hash entry. + * \param entry pointer to a hash table entry. + * \return generic pointer to the stored value. + */ void * ! hash_value(HASHENT *entry) { if (entry) return entry->data; *************** *** 194,202 **** return NULL; } char * ! hash_key(entry) ! HASHENT *entry; { if (entry) return entry->key; --- 206,217 ---- return NULL; } + /** Return the key stored in a hash entry. + * \param entry pointer to a hash table entry. + * \return pointer to the stored key. + */ char * ! hash_key(HASHENT *entry) { if (entry) return entry->key; *************** *** 204,213 **** return NULL; } void ! hash_resize(htab, size) ! HASHTAB *htab; ! int size; { int i; HASHENT **oldarr; --- 219,230 ---- return NULL; } + /** Resize a hash table. + * \param htab pointer to hashtable. + * \param size new size. + */ void ! hash_resize(HASHTAB *htab, int size) { int i; HASHENT **oldarr; *************** *** 261,267 **** return; } ! HASHENT * hash_new(HASHTAB *htab, const char *key) { int hval; --- 278,284 ---- return; } ! static HASHENT * hash_new(HASHTAB *htab, const char *key) { int hval; *************** *** 308,319 **** return hptr; } int ! hash_add(htab, key, hashdata, extra_size) ! HASHTAB *htab; ! const char *key; ! void *hashdata; ! int extra_size __attribute__ ((__unused__)); { HASHENT *hptr; --- 325,341 ---- return hptr; } + /** Add an entry to a hash table. + * \param htab pointer to hash table. + * \param key key string to store data under. + * \param hashdata void pointer to data to be stored. + * \param extra_size unused. + * \retval -1 failure. + * \retval 0 success. + */ int ! hash_add(HASHTAB *htab, const char *key, void *hashdata, ! int extra_size __attribute__ ((__unused__))) { HASHENT *hptr; *************** *** 331,340 **** return 0; } void ! hash_delete(htab, entry) ! HASHTAB *htab; ! HASHENT *entry; { int hval; HASHENT *hptr, *last; --- 353,364 ---- return 0; } + /** Delete an entry in a hash table. + * \param htab pointer to hash table. + * \param entry pointer to hash entry to delete (and free). + */ void ! hash_delete(HASHTAB *htab, HASHENT *entry) { int hval; HASHENT *hptr, *last; *************** *** 360,369 **** hash_resize(htab, htab->hashsize >> 1); } void ! hash_flush(htab, size) ! HASHTAB *htab; ! int size; { HASHENT *hent, *thent; int i; --- 384,395 ---- hash_resize(htab, htab->hashsize >> 1); } + /** Flush a hash table, freeing all entries. + * \param htab pointer to a hash table. + * \param size size of hash table. + */ void ! hash_flush(HASHTAB *htab, int size) { HASHENT *hent, *thent; int i; *************** *** 391,399 **** } } void * ! hash_firstentry(htab) ! HASHTAB *htab; { int hval; --- 417,430 ---- } } + /** Return the first entry of a hash table. + * This function is used with hash_nextentry() to iterate through a + * hash table. + * \param htab pointer to hash table. + * \return first hash table entry. + */ void * ! hash_firstentry(HASHTAB *htab) { int hval; *************** *** 406,414 **** return NULL; } void * ! hash_nextentry(htab) ! HASHTAB *htab; { int hval; HASHENT *hptr; --- 437,451 ---- return NULL; } + /** Return the next entry of a hash table. + * This function is used with hash_firstentry() to iterate through a + * hash table. hash_firstentry() must be called before calling + * this function. + * \param htab pointer to hash table. + * \return next hash table entry. + */ void * ! hash_nextentry(HASHTAB *htab) { int hval; HASHENT *hptr; *************** *** 431,451 **** return NULL; } void ! hash_stats_header(player) ! dbref player; { notify_format(player, "Table Buckets Entries LChain ECh 1Ch 2Ch 3Ch 4+Ch AvgCh ~Memory"); } void ! hash_stats(player, htab, hname) ! dbref player; ! HASHTAB *htab; ! const char *hname; { - /* Report some statistics on the hash table */ int longest = 0, n; int lengths[5]; double chainlens = 0.0; --- 468,491 ---- return NULL; } + /** Display a header for a stats listing. + * \param player player to notify with header. + */ void ! hash_stats_header(dbref player) { notify_format(player, "Table Buckets Entries LChain ECh 1Ch 2Ch 3Ch 4+Ch AvgCh ~Memory"); } + /** Display stats on a hashtable. + * \param player player to notify with stats. + * \param htab pointer to the hash table. + * \param hname name of the hash table. + */ void ! hash_stats(dbref player, HASHTAB *htab, const char *hname) { int longest = 0, n; int lengths[5]; double chainlens = 0.0; *** 1_7_7.231/src/switchinc.c Thu, 09 Jan 2003 21:37:52 -0600 dunemush (pennmush/b/32_switchinc. 1.3.1.2.1.6.1.18.1.2.1.2.2.5.1.4.2.4.1.1.1.2.1.5.1.2.1.5.2.1.1.31.3.4.1.2.1.4.1.2 660) --- 1_7_7.308(w)/src/switchinc.c Tue, 25 Mar 2003 16:22:38 -0600 dunemush (pennmush/b/32_switchinc. 1.3.1.2.1.6.1.18.1.2.1.2.2.5.1.4.2.4.1.1.1.2.1.5.1.2.1.5.2.1.1.31.3.4.1.5.1.4 660) *************** *** 11,16 **** --- 11,17 ---- {"BEFORE", SWITCH_BEFORE}, {"BLIND", SWITCH_BLIND}, {"BRIEF", SWITCH_BRIEF}, + {"BUFFER", SWITCH_BUFFER}, {"CHECK", SWITCH_CHECK}, {"CHOWN", SWITCH_CHOWN}, {"CLEAR", SWITCH_CLEAR}, *************** *** 82,88 **** {"PARANOID", SWITCH_PARANOID}, {"PLAYERS", SWITCH_PLAYERS}, {"PORT", SWITCH_PORT}, - {"POSE", SWITCH_POSE}, {"PRESERVE", SWITCH_PRESERVE}, {"PRINT", SWITCH_PRINT}, {"PRIVS", SWITCH_PRIVS}, --- 83,88 ---- *************** *** 91,96 **** --- 91,97 ---- {"QUIET", SWITCH_QUIET}, {"READ", SWITCH_READ}, {"REBOOT", SWITCH_REBOOT}, + {"RECALL", SWITCH_RECALL}, {"REGISTER", SWITCH_REGISTER}, {"REMOVE", SWITCH_REMOVE}, {"RENAME", SWITCH_RENAME}, *************** *** 99,105 **** {"RETROACTIVE", SWITCH_RETROACTIVE}, {"ROOM", SWITCH_ROOM}, {"ROOMS", SWITCH_ROOMS}, - {"ROYALTY", SWITCH_ROYALTY}, {"SEE", SWITCH_SEE}, {"SEEFLAG", SWITCH_SEEFLAG}, {"SELF", SWITCH_SELF}, --- 100,105 ---- *** 1_7_7.231/src/speech.c Mon, 03 Feb 2003 11:05:37 -0600 dunemush (pennmush/b/35_speech.c 1.21.1.2.1.3.1.5.1.1.1.7.1.3.1.1.1.8.1.1.1.1.1.1.1.10.1.2.1.13.2.4.1.1.2.3 660) --- 1_7_7.308(w)/src/speech.c Tue, 25 Mar 2003 16:22:38 -0600 dunemush (pennmush/b/35_speech.c 1.21.1.2.1.3.1.5.1.1.1.7.1.3.1.1.1.8.1.1.1.1.1.1.1.10.1.2.1.13.2.4.1.1.3.2 660) *************** *** 847,853 **** /* Figure out the 'name' of the player */ if (PAGE_ALIASES && (a = atr_get_noparent(player, "ALIAS"))) ! current = tprintf("%s(%s)", Name(player), uncompress(a->value)); else current = (char *) Name(player); --- 847,853 ---- /* Figure out the 'name' of the player */ if (PAGE_ALIASES && (a = atr_get_noparent(player, "ALIAS"))) ! current = tprintf("%s (%s)", Name(player), uncompress(a->value)); else current = (char *) Name(player); *** 1_7_7.231/src/set.c Tue, 14 Jan 2003 22:56:21 -0600 dunemush (pennmush/b/38_set.c 1.26.1.5.1.1.2.1.1.1.1.1.1.11.1.1.1.3 660) --- 1_7_7.308(w)/src/set.c Tue, 25 Mar 2003 16:22:38 -0600 dunemush (pennmush/b/38_set.c 1.26.1.5.1.1.2.1.1.1.1.1.1.11.1.1.1.5 660) *************** *** 110,126 **** password++; } } ! /* check for null password */ ! if (!God(player) && !*password) { ! notify(player, ! T("You must specify a password to change a player name.")); ! notify(player, T("E.g.: @name player = newname password")); ! return; ! } else if (!God(player) && !password_check(thing, password)) { ! notify(player, T("Incorrect password.")); ! return; ! } else if (strcasecmp(newname, Name(thing)) ! && !ok_player_name(newname)) { /* strcasecmp allows changing foo to Foo, etc. */ notify(player, T("You can't give a player that name.")); return; --- 110,117 ---- password++; } } ! if (strcasecmp(newname, Name(thing)) ! && !ok_player_name(newname)) { /* strcasecmp allows changing foo to Foo, etc. */ notify(player, T("You can't give a player that name.")); return; *** 1_7_7.231/src/player.c Sun, 16 Feb 2003 22:20:24 -0600 dunemush (pennmush/b/47_player.c 1.15.1.1.1.1.1.4.1.6.1.8 660) --- 1_7_7.308(w)/src/player.c Tue, 25 Mar 2003 16:22:37 -0600 dunemush (pennmush/b/47_player.c 1.15.1.1.1.1.1.4.1.6.1.9 660) *************** *** 366,372 **** Home(player) = PLAYER_START; Owner(player) = player; Parent(player) = NOTHING; ! db[player].type = TYPE_PLAYER; flags = string_to_bits(options.player_flags); copy_flag_bitmask(Flags(player), flags); destroy_flag_bitmask(flags); --- 366,372 ---- Home(player) = PLAYER_START; Owner(player) = player; Parent(player) = NOTHING; ! Type(player) = TYPE_PLAYER; flags = string_to_bits(options.player_flags); copy_flag_bitmask(Flags(player), flags); destroy_flag_bitmask(flags); *** 1_7_7.231/src/parse.c Sun, 22 Dec 2002 18:01:26 -0600 dunemush (pennmush/b/48_parse.c 1.23.1.10.1.2.1.1.1.1.1.2.1.2.1.9 660) --- 1_7_7.308(w)/src/parse.c Tue, 25 Mar 2003 16:22:37 -0600 dunemush (pennmush/b/48_parse.c 1.23.1.10.1.2.1.1.1.1.1.2.1.2.1.10 660) *************** *** 547,552 **** --- 547,555 ---- safe_str("0 0", buff, bp); } break; + case '~': /* enactor accented name */ + safe_str(accented_name(enactor), buff, bp); + break; case '0': case '1': case '2': *** 1_7_7.231/src/mymalloc.c Wed, 24 Jan 2001 16:56:43 -0600 dunemush (pennmush/b/49_mymalloc.c 1.2 660) --- 1_7_7.308(w)/src/mymalloc.c Tue, 25 Mar 2003 16:22:37 -0600 dunemush (pennmush/b/49_mymalloc.c 1.3 660) *************** *** 1,4 **** ! /* A wrapper for the various malloc package options. See options.h * for descriptions of each. * Each package's source code must include config.h, mymalloc.h, * and confmagic.h. --- 1,9 ---- ! /** ! * \file mymalloc.c ! * ! * \brief Malloc wrapper file. ! * ! * A wrapper for the various malloc package options. See options.h * for descriptions of each. * Each package's source code must include config.h, mymalloc.h, * and confmagic.h. *** 1_7_7.231/src/mycrypt.c Sun, 01 Dec 2002 21:14:41 -0600 dunemush (pennmush/b/50_mycrypt.c 1.9 660) --- 1_7_7.308(w)/src/mycrypt.c Tue, 25 Mar 2003 16:22:37 -0600 dunemush (pennmush/b/50_mycrypt.c 1.10 660) *************** *** 1,5 **** ! /* This file defines the function mush_crypt(key) used for password ! * encryption, depending on the system. */ #include "config.h" --- 1,11 ---- ! /** ! * \file mycrypt.c ! * ! * \brief Password encryption for PennMUSH ! * ! * This file defines the function mush_crypt(key) used for password ! * encryption, depending on the system. Actually, we pretty much ! * expect to use SHS. */ #include "config.h" *************** *** 12,17 **** --- 18,28 ---- #include "confmagic.h" char *mush_crypt(const char *key); + + /** Encrypt a password and return ciphertext. + * \param key plaintext to encrypt. + * \return encrypted password. + */ char * mush_crypt(const char *key) { *** 1_7_7.231/src/move.c Wed, 12 Feb 2003 17:02:38 -0600 dunemush (pennmush/b/51_move.c 1.1.1.18.1.5.1.13.1.3.1.9.1.1.1.1.1.2.1.1.1.1.1.12 660) --- 1_7_7.308(w)/src/move.c Tue, 25 Mar 2003 16:22:37 -0600 dunemush (pennmush/b/51_move.c 1.1.1.18.1.5.1.13.1.3.1.9.1.1.1.1.1.2.1.1.1.1.1.14 660) *************** *** 1,4 **** ! /* move.c */ #include "copyrite.h" #include "config.h" --- 1,10 ---- ! /** ! * \file move.c ! * ! * \brief Movement commands for PennMUSH. ! * ! * ! */ #include "copyrite.h" #include "config.h" *************** *** 38,57 **** static int is_following(dbref follower, dbref leader); static void follower_command(dbref leader, dbref loc, const char *com); void ! moveto(what, where) ! dbref what; ! dbref where; { enter_room(what, where, 0); } void ! moveit(what, where, nomovemsgs) ! dbref what; ! dbref where; ! int nomovemsgs; { dbref loc, old; dbref absloc, absold; --- 44,67 ---- static int is_following(dbref follower, dbref leader); static void follower_command(dbref leader, dbref loc, const char *com); + /** A convenience wrapper for enter_room(). + * \param what object to move. + * \param where location to move it to. + */ void ! moveto(dbref what, dbref where) { enter_room(what, where, 0); } + /** Send an object somewhere. + * \param what object to move. + * \param where location to move it to. + * \param nomovemsgs if 1, don't show movement messages. + */ void ! moveit(dbref what, dbref where, int nomovemsgs) { dbref loc, old; dbref absloc, absold; *************** *** 126,134 **** #define Dropper(thing) (Hearer(thing) && Connected(Owner(thing))) static void ! send_contents(loc, dest) ! dbref loc; ! dbref dest; { dbref first; dbref rest; --- 136,142 ---- #define Dropper(thing) (Hearer(thing) && Connected(Owner(thing))) static void ! send_contents(dbref loc, dbref dest) { dbref first; dbref rest; *************** *** 154,162 **** } static void ! maybe_dropto(loc, dropto) ! dbref loc; ! dbref dropto; { dbref thing; if (loc == dropto) --- 162,168 ---- } static void ! maybe_dropto(dbref loc, dbref dropto) { dbref thing; if (loc == dropto) *************** *** 173,183 **** send_contents(loc, dropto); } void ! enter_room(player, loc, nomovemsgs) ! dbref player; ! dbref loc; ! int nomovemsgs; { dbref old; dbref dropto; --- 179,191 ---- send_contents(loc, dropto); } + /** Enter a container. + * \param player object entering the container. + * \param loc container to enter. + * \param nomovemsgs if 1, don't give movement messages. + */ void ! enter_room(dbref player, dbref loc, int nomovemsgs) { dbref old; dbref dropto; *************** *** 237,248 **** } ! /* teleports player to location while removing items they shouldnt take */ void ! safe_tel(player, dest, nomovemsgs) ! dbref player; ! dbref dest; ! int nomovemsgs; { dbref first; dbref rest; --- 245,257 ---- } ! /** Teleport player to location while removing items they shouldn't take. ! * \param player player to teleport. ! * \param dest location to teleport player to. ! * \param nomovemsgs if 1, don't show movement messages ! */ void ! safe_tel(dbref player, dbref dest, int nomovemsgs) { dbref first; dbref rest; *************** *** 280,293 **** enter_room(player, dest, nomovemsgs); } ! /* This checks to see if there's a go-able direction. It doesn't * check whether the GOTO command is restricted. That should be * done by the command parser. */ int ! can_move(player, direction) ! dbref player; ! const char *direction; { if (!strcasecmp(direction, "home") && !Fixed(player)) return 1; --- 289,303 ---- enter_room(player, dest, nomovemsgs); } ! /** Can a player go in a given direction? ! * This checks to see if there's a go-able direction. It doesn't * check whether the GOTO command is restricted. That should be * done by the command parser. + * \param player dbref of mover. + * \param direction name of direction to move. */ int ! can_move(dbref player, const char *direction) { if (!strcasecmp(direction, "home") && !Fixed(player)) return 1; *************** *** 298,306 **** } static dbref ! find_var_dest(player, exit_obj) ! dbref player; ! dbref exit_obj; { /* This is used to evaluate the u-function DESTINATION on an exit with * a VARIABLE (ambiguous) link. --- 308,314 ---- } static dbref ! find_var_dest(dbref player, dbref exit_obj) { /* This is used to evaluate the u-function DESTINATION on an exit with * a VARIABLE (ambiguous) link. *************** *** 336,341 **** --- 344,354 ---- } + /** The move command. + * \param player the enactor. + * \param direction name of direction to move. + * \param type type of motion to check (global, zone, neither). + */ void do_move(dbref player, const char *direction, enum move_type type) { *************** *** 384,389 **** --- 397,407 ---- default: /* we got one */ /* check to see if we're allowed to pass */ + if (!eval_lock(player, Location(player), Leave_Lock)) { + notify(player, T("You can't go that way.")); + return; + } + if (could_doit(player, exit_m)) { switch (Location(exit_m)) { case HOME: *************** *** 452,461 **** } } void ! do_firstexit(player, what) ! dbref player; ! const char *what; { dbref thing; dbref loc; --- 470,484 ---- } } + /** Move an exit to the first position in the room's exit list. + * \verbatim + * This implements @firstexit. + * \endverbatim + * \param player the enactor. + * \param what name of exit to promote. + */ void ! do_firstexit(dbref player, const char *what) { dbref thing; dbref loc; *************** *** 475,484 **** } void ! do_get(player, what) ! dbref player; ! const char *what; { dbref loc = Location(player); dbref thing; --- 498,509 ---- } + /** The get command. + * \param player the enactor. + * \param what name of object to get. + */ void ! do_get(dbref player, const char *what) { dbref loc = Location(player); dbref thing; *************** *** 595,604 **** } void ! do_drop(player, name) ! dbref player; ! const char *name; { dbref loc; dbref thing; --- 620,631 ---- } + /** Drop an object. + * \param player the enactor. + * \param name name of object to drop. + */ void ! do_drop(dbref player, const char *name) { dbref loc; dbref thing; *************** *** 653,662 **** } void ! do_enter(player, what) ! dbref player; ! const char *what; { dbref thing; dbref loc; --- 680,691 ---- } + /** The enter command. + * \param player the enactor. + * \param what name of object to enter. + */ void ! do_enter(dbref player, const char *what) { dbref thing; dbref loc; *************** *** 699,707 **** } } void ! do_leave(player) ! dbref player; { dbref loc; loc = Location(player); --- 728,738 ---- } } + /** The leave command. + * \param player the enactor. + */ void ! do_leave(dbref player) { dbref loc; loc = Location(player); *************** *** 718,750 **** follower_command(player, loc, "leave"); } int ! global_exit(player, direction) ! dbref player; ! const char *direction; { return (GoodObject (match_result(player, direction, TYPE_EXIT, MAT_GLOBAL | MAT_EXIT))); } int ! remote_exit(player, direction) ! dbref player; ! const char *direction; { return (GoodObject (match_result(player, direction, TYPE_EXIT, MAT_REMOTES | MAT_EXIT))); } void ! move_wrapper(player, command) ! dbref player; ! const char *command; { - /* check local exit, then zone exit, then global. If nothing is - * matched, treat it as local so player will get an error message. - */ - if (!Mobile(player)) return; if (!strcasecmp(command, "home") && Fixed(player)) { --- 749,789 ---- follower_command(player, loc, "leave"); } + /** Is direction a global exit? + * \param player looker. + * \param direction name of exit. + * \retval 1 direction is a global exit. + * \retval 0 direction is not a global exit. + */ int ! global_exit(dbref player, const char *direction) { return (GoodObject (match_result(player, direction, TYPE_EXIT, MAT_GLOBAL | MAT_EXIT))); } + /** Is direction a remote exit? + * \param player looker. + * \param direction name of exit. + * \retval 1 direction is a remote exit. + * \retval 0 direction is not a remote exit. + */ int ! remote_exit(dbref player, const char *direction) { return (GoodObject (match_result(player, direction, TYPE_EXIT, MAT_REMOTES | MAT_EXIT))); } + /** Wrapper for exit movement. + * We check local exit, then zone exit, then global. If nothing is + * matched, treat it as local so player will get an error message. + * \param player the mover. + * \param command direction to move. + */ void ! move_wrapper(dbref player, const char *command) { if (!Mobile(player)) return; if (!strcasecmp(command, "home") && Fixed(player)) { *************** *** 764,776 **** /* Routines for dealing with the follow commands */ ! /* follow tries to start following * follow alone lists who you're following */ void ! do_follow(player, arg) ! dbref player; ! const char *arg; { dbref leader; if (arg && *arg) { --- 803,816 ---- /* Routines for dealing with the follow commands */ ! /** The follow command. ! * follow tries to start following * follow alone lists who you're following + * \param the enactor. + * \param arg name of object to follow. */ void ! do_follow(dbref player, const char *arg) { dbref leader; if (arg && *arg) { *************** *** 816,828 **** } } ! /* unfollow removes someone from your following list ! * unfollow alone removes everyone from your following list. (1.7.4p3) */ void ! do_unfollow(player, arg) ! dbref player; ! const char *arg; { dbref leader; if (arg && *arg) { --- 856,869 ---- } } ! /** The unfollow command. ! * unfollow removes someone from your following list ! * unfollow alone removes everyone from your following list. ! * \param player the enactor. ! * \parma arg object to stop following. */ void ! do_unfollow(dbref player, const char *arg) { dbref leader; if (arg && *arg) { *************** *** 851,863 **** } ! /* dismiss removes someone from your followers list * dismiss alone removes everyone from your followers list. */ void ! do_dismiss(player, arg) ! dbref player; ! const char *arg; { dbref follower; if (arg && *arg) { --- 892,905 ---- } ! /** The dismiss command. ! * dismiss removes someone from your followers list * dismiss alone removes everyone from your followers list. + * \param player the enactor. + * \param arg name of object to dismiss. */ void ! do_dismiss(dbref player, const char *arg) { dbref follower; if (arg && *arg) { *************** *** 881,893 **** } } ! /* desert removes someone from your followers and following list * desert alone removes everyone from both lists */ void ! do_desert(player, arg) ! dbref player; ! const char *arg; { dbref who; if (arg && *arg) { --- 923,936 ---- } } ! /** The desert command. ! * desert removes someone from your followers and following list * desert alone removes everyone from both lists + * \param player the enactor. + * \param arg name of object to desert. */ void ! do_desert(dbref player, const char *arg) { dbref who; if (arg && *arg) { *************** *** 917,925 **** /* Add someone to a player's FOLLOWERS attribute */ static void ! add_follower(leader, follower) ! dbref leader; ! dbref follower; { ATTR *a; char tbuf1[BUFFER_LEN]; --- 960,966 ---- /* Add someone to a player's FOLLOWERS attribute */ static void ! add_follower(dbref leader, dbref follower) { ATTR *a; char tbuf1[BUFFER_LEN]; *************** *** 939,947 **** /* Add someone to a player's FOLLOWING attribute */ static void ! add_following(follower, leader) ! dbref follower; ! dbref leader; { ATTR *a; char tbuf1[BUFFER_LEN]; --- 980,986 ---- /* Add someone to a player's FOLLOWING attribute */ static void ! add_following(dbref follower, dbref leader) { ATTR *a; char tbuf1[BUFFER_LEN]; *************** *** 960,969 **** } static void ! add_follow(leader, follower, noisy) ! dbref leader; ! dbref follower; ! int noisy; { char msg[BUFFER_LEN]; add_follower(leader, follower); --- 999,1005 ---- } static void ! add_follow(dbref leader, dbref follower, int noisy) { char msg[BUFFER_LEN]; add_follower(leader, follower); *************** *** 979,987 **** /* Delete someone from a player's FOLLOWERS attribute */ static void ! del_follower(leader, follower) ! dbref leader; ! dbref follower; { ATTR *a; char tbuf1[BUFFER_LEN]; --- 1015,1021 ---- /* Delete someone from a player's FOLLOWERS attribute */ static void ! del_follower(dbref leader, dbref follower) { ATTR *a; char tbuf1[BUFFER_LEN]; *************** *** 998,1006 **** /* Delete someone from a player's FOLLOWING attribute */ static void ! del_following(follower, leader) ! dbref follower; ! dbref leader; { ATTR *a; char tbuf1[BUFFER_LEN]; --- 1032,1038 ---- /* Delete someone from a player's FOLLOWING attribute */ static void ! del_following(dbref follower, dbref leader) { ATTR *a; char tbuf1[BUFFER_LEN]; *************** *** 1016,1025 **** } static void ! del_follow(leader, follower, noisy) ! dbref leader; ! dbref follower; ! int noisy; { char msg[BUFFER_LEN]; del_follower(leader, follower); --- 1048,1054 ---- } static void ! del_follow(dbref leader, dbref follower, int noisy) { char msg[BUFFER_LEN]; del_follower(leader, follower); *************** *** 1034,1041 **** /* Return a list of names of players who are my followers, comma-separated */ static char * ! list_followers(player) ! dbref player; { ATTR *a; char tbuf1[BUFFER_LEN]; --- 1063,1069 ---- /* Return a list of names of players who are my followers, comma-separated */ static char * ! list_followers(dbref player) { ATTR *a; char tbuf1[BUFFER_LEN]; *************** *** 1066,1073 **** /* Return a list of names of players who I'm following, comma-separated */ static char * ! list_following(player) ! dbref player; { ATTR *a; char tbuf1[BUFFER_LEN]; --- 1094,1100 ---- /* Return a list of names of players who I'm following, comma-separated */ static char * ! list_following(dbref player) { ATTR *a; char tbuf1[BUFFER_LEN]; *************** *** 1098,1106 **** /* Is follower following leader? */ static int ! is_following(follower, leader) ! dbref follower; ! dbref leader; { ATTR *a; char *s, *sp; --- 1125,1131 ---- /* Is follower following leader? */ static int ! is_following(dbref follower, dbref leader) { ATTR *a; char *s, *sp; *************** *** 1121,1130 **** return 0; } void ! clear_followers(leader, noisy) ! dbref leader; ! int noisy; { ATTR *a; char *s, *sp; --- 1146,1157 ---- return 0; } + /** Clear a player's followers list. + * \param leader dbref of player whose list is to be cleared. + * \param noisy if 1, notify the player. + */ void ! clear_followers(dbref leader, int noisy) { ATTR *a; char *s, *sp; *************** *** 1147,1156 **** (void) atr_clr(leader, "FOLLOWERS", GOD); } void ! clear_following(follower, noisy) ! dbref follower; ! int noisy; { ATTR *a; char *s, *sp; --- 1174,1185 ---- (void) atr_clr(leader, "FOLLOWERS", GOD); } + /** Clear a player's following list. + * \param follower dbref of player whose list is to be cleared. + * \param noisy if 1, notify the player. + */ void ! clear_following(dbref follower, int noisy) { ATTR *a; char *s, *sp; *** 1_7_7.231/src/memcheck.c Sun, 01 Dec 2002 21:14:41 -0600 dunemush (pennmush/c/1_memcheck.c 1.8.1.4 660) --- 1_7_7.308(w)/src/memcheck.c Tue, 25 Mar 2003 16:22:37 -0600 dunemush (pennmush/c/1_memcheck.c 1.8.1.5 660) *************** *** 1,3 **** --- 1,13 ---- + /** + * \file memcheck.c + * + * \brief A simple memory allocation tracker for PennMUSH. + * + * This code isn't usually compiled in, but it's handy to debug + * memory leaks sometimes. + * + * + */ #include "config.h" #include "conf.h" #include "copyrite.h" *************** *** 16,25 **** typedef struct mem_check MEM; struct mem_check { ! int ref_count; ! MEM *next; ! char ref_name[BUFFER_LEN]; }; static MEM *my_check = NULL; --- 26,36 ---- typedef struct mem_check MEM; + /** A linked list for storing memory allocation counts */ struct mem_check { ! int ref_count; /**< Number of allocations of this type. */ ! MEM *next; /**< Pointer to next in linked list. */ ! char ref_name[BUFFER_LEN]; /**< Name of this allocation type. */ }; static MEM *my_check = NULL; *************** *** 28,36 **** *** AN INFINITE LOOP. DANGER, WILL ROBINSON! ***/ void ! add_check(ref) ! const char *ref; { MEM *loop, *newcheck, *prev = NULL; size_t reflen; --- 39,49 ---- *** AN INFINITE LOOP. DANGER, WILL ROBINSON! ***/ + /** Add an allocation check. + * \param ref type of allocation. + */ void ! add_check(const char *ref) { MEM *loop, *newcheck, *prev = NULL; size_t reflen; *************** *** 57,65 **** return; } void ! del_check(ref) ! const char *ref; { MEM *loop, *prev = NULL; int cmp; --- 70,80 ---- return; } + /** Remove an allocation check. + * \param ref type of allocation to remove. + */ void ! del_check(const char *ref) { MEM *loop, *prev = NULL; int cmp; *************** *** 85,95 **** ref); } void ! list_mem_check(player) ! dbref player; { - MEM *loop; for (loop = my_check; loop; loop = loop->next) { --- 100,111 ---- ref); } + /** List allocations. + * \param player the enactor. + */ void ! list_mem_check(dbref player) { MEM *loop; for (loop = my_check; loop; loop = loop->next) { *************** *** 97,106 **** } } void ! log_mem_check() { - MEM *loop; for (loop = my_check; loop; loop = loop->next) { --- 113,123 ---- } } + /** Log all allocations. + */ void ! log_mem_check(void) { MEM *loop; for (loop = my_check; loop; loop = loop->next) { *** 1_7_7.231/src/match.c Wed, 12 Feb 2003 17:02:38 -0600 dunemush (pennmush/c/2_match.c 1.24.1.1.1.4.1.1.1.1.1.1.1.1.1.1.1.16 660) --- 1_7_7.308(w)/src/match.c Tue, 25 Mar 2003 16:22:37 -0600 dunemush (pennmush/c/2_match.c 1.24.1.1.1.4.1.1.1.1.1.1.1.1.1.1.1.18 660) *************** *** 1,7 **** ! /* match.c */ ! /* Routines for parsing arguments */ ! ! /*********************************************************************** * These are the PennMUSH name-matching routines, fully re-entrant. * match_result(who,name,type,flags) - return match, AMBIGUOUS, or NOTHING * noisy_match_result(who,name,type,flags) - return match or NOTHING, --- 1,8 ---- ! /** ! * \file match.c ! * ! * \brief Matching of object names. ! * * These are the PennMUSH name-matching routines, fully re-entrant. * match_result(who,name,type,flags) - return match, AMBIGUOUS, or NOTHING * noisy_match_result(who,name,type,flags) - return match or NOTHING, *************** *** 67,73 **** extern int check_alias(const char *command, const char *list); /* game.c */ ! /* A wrapper for returning a match, AMBIGUOUS, or NOTHING */ dbref match_result(const dbref who, const char *name, const int type, --- 68,81 ---- extern int check_alias(const char *command, const char *list); /* game.c */ ! /** A wrapper for returning a match, AMBIGUOUS, or NOTHING. ! * This function attempts to match a name for who, and ! * can return the matched dbref, AMBIGUOUS, or NOTHING. ! * \param who the looker. ! * \param name name to try to match. ! * \param type type of object to match. ! * \param flags match flags. ! * \return dbref of matched object, or AMBIGUOUS, or NOTHING. */ dbref match_result(const dbref who, const char *name, const int type, *************** *** 76,84 **** return match_result_internal(who, name, type, flags); } ! /* A wrapper for returning a match or NOTHING ! * Ambiguous matches return NOTHING ! * It will also notify the player of non-matches or ambiguous matches */ dbref noisy_match_result(const dbref who, const char *name, const int type, --- 84,99 ---- return match_result_internal(who, name, type, flags); } ! /** A noisy wrapper for returning a match or NOTHING. ! * This function attempts to match a name for who, and ! * can return the matched dbref or NOTHING (in ambiguous cases, ! * NOTHING is returned). If no match is made, the looker is notified ! * of the failure to match or ambiguity. ! * \param who the looker. ! * \param name name to try to match. ! * \param type type of object to match. ! * \param flags match flags. ! * \return dbref of matched object, or NOTHING. */ dbref noisy_match_result(const dbref who, const char *name, const int type, *************** *** 87,94 **** return match_result_internal(who, name, type, flags | MAT_NOISY); } ! /* A wrapper for returning a match or NOTHING ! * Ambiguous matches return the last matched thing */ dbref last_match_result(const dbref who, const char *name, const int type, --- 102,116 ---- return match_result_internal(who, name, type, flags | MAT_NOISY); } ! /** A noisy wrapper for returning a match or NOTHING. ! * This function attempts to match a name for who, and ! * can return the matched dbref or NOTHING. In ambiguous cases, ! * the last matched thing is returned. ! * \param who the looker. ! * \param name name to try to match. ! * \param type type of object to match. ! * \param flags match flags. ! * \return dbref of matched object, or NOTHING. */ dbref last_match_result(const dbref who, const char *name, const int type, *************** *** 97,103 **** return match_result_internal(who, name, type, flags | MAT_LAST); } ! /* Wrapper for a noisy match with control checks */ dbref match_controlled(dbref player, const char *name) { --- 119,133 ---- return match_result_internal(who, name, type, flags | MAT_LAST); } ! /** Wrapper for a noisy match with control checks. ! * This function performs a noisy_match_result() and then checks that ! * the looker controls the matched object before returning it. ! * If the control check fails, the looker is notified and NOTHING ! * is returned. ! * \param player the looker. ! * \param name name to try to match. ! * \return dbref of matched controlled object, or NOTHING. ! */ dbref match_controlled(dbref player, const char *name) { *** 1_7_7.231/src/malias.c Sun, 08 Dec 2002 22:10:45 -0600 dunemush (pennmush/c/3_malias.c 1.36.1.2 660) --- 1_7_7.308(w)/src/malias.c Tue, 25 Mar 2003 16:22:37 -0600 dunemush (pennmush/c/3_malias.c 1.36.1.5 660) *************** *** 1,5 **** ! /*-------------------------------------------------------------------* ! * malias.c - Global @mail aliases/lists * * This code implements an extension to extended @mail which allows * admin (and others who are so em@powered) to create mail aliases --- 1,9 ---- ! /** ! * \file malias.c ! * ! * \brief Global mail aliases/lists ! * ! * \verbatim * * This code implements an extension to extended @mail which allows * admin (and others who are so em@powered) to create mail aliases *************** *** 25,31 **** * @malias/stat * @malias/chown !name=owner (Admin only) * @malias/nuke (Admin only) ! *-------------------------------------------------------------------*/ #define MA_INC 3 #include "config.h" --- 29,37 ---- * @malias/stat * @malias/chown !name=owner (Admin only) * @malias/nuke (Admin only) ! * ! * \endverbatim ! */ #define MA_INC 3 #include "config.h" *************** *** 66,71 **** --- 72,78 ---- int ma_top = 0; struct mail_alias *malias; + /** Privilege table for maliases. */ static PRIV malias_priv_table[] = { {"Admin", 'A', ALIAS_ADMIN, ALIAS_ADMIN}, {"Members", 'M', ALIAS_MEMBERS, ALIAS_MEMBERS}, *************** *** 73,79 **** {NULL, '\0', 0, 0} }; - static const char *get_privs(int flags); static const char *get_shortprivs(struct mail_alias *m); --- 80,85 ---- *************** *** 82,92 **** ***********************************************************/ void ! do_malias(player, arg1, arg2) ! dbref player; ! char *arg1; ! char *arg2; { if (!arg1 || !*arg1) { if (arg2 && *arg2) { --- 88,103 ---- ***********************************************************/ + /** List or create a malias. + * \verbatim + * This implements the @malias command (with no switches). + * \endverbatim + * \param player the enactor. + * \param arg1 name of malias to create or list, or NULL to list all. + * \param arg2 parameters for creation, or NULL to list. + */ void ! do_malias(dbref player, char *arg1, char *arg2) { if (!arg1 || !*arg1) { if (arg2 && *arg2) { *************** *** 107,117 **** } void ! do_malias_create(player, alias, tolist) ! dbref player; ! char *alias; ! char *tolist; { char *head, *tail, spot; struct mail_alias *m; --- 118,133 ---- } + /** Create a malias. + * \verbatim + * This implements the @malias/create command. + * \endverbatim + * \param player the enactor. + * \param arg1 name of malias to create. + * \param arg2 parameters for creation. + */ void ! do_malias_create(dbref player, char *alias, char *tolist) { char *head, *tail, spot; struct mail_alias *m; *************** *** 245,254 **** } ! void ! do_malias_list(player) ! dbref player; { struct mail_alias *m; int i = 0; --- 261,274 ---- } ! /** List maliases. ! * \verbatim ! * This function implements @malias/list. ! * \endverbatim ! * \param player the enactor. ! */ void ! do_malias_list(dbref player) { struct mail_alias *m; int i = 0; *************** *** 275,284 **** notify(player, T("***** End of Mail Aliases *****")); } void ! do_malias_members(player, alias) ! dbref player; ! char *alias; { struct mail_alias *m; int i = 0; --- 295,309 ---- notify(player, T("***** End of Mail Aliases *****")); } + /** List malias members. + * \verbatim + * This function implements @malias/members. + * \endverbatim + * \param player the enactor. + * \param alias name of the alias to list members of. + */ void ! do_malias_members(dbref player, char *alias) { struct mail_alias *m; int i = 0; *************** *** 311,322 **** } ! void ! do_malias_desc(player, alias, desc) ! dbref player; ! char *alias; ! char *desc; { struct mail_alias *m; --- 336,351 ---- } ! /** Describe a malias. ! * \verbatim ! * This implements the @malias/desc command. ! * \endverbatim ! * \param player the enactor. ! * \param alias name of the malias to describe. ! * \param desc description to set. ! */ void ! do_malias_desc(dbref player, char *alias, char *desc) { struct mail_alias *m; *************** *** 334,344 **** } void ! do_malias_chown(player, alias, owner) ! dbref player; ! char *alias; ! char *owner; { struct mail_alias *m; dbref no = NOTHING; --- 363,378 ---- } + /** Change ownership of a malias. + * \verbatim + * This implements the @malias/chown command. + * \endverbatim + * \param player the enactor. + * \param alias name of the malias to chown. + * \param owner name of the new owner. + */ void ! do_malias_chown(dbref player, char *alias, char *owner) { struct mail_alias *m; dbref no = NOTHING; *************** *** 363,373 **** void ! do_malias_rename(player, alias, newname) ! dbref player; ! char *alias; ! char *newname; { struct mail_alias *m; --- 397,412 ---- + /** Change name of a malias. + * \verbatim + * This implements the @malias/rename command. + * \endverbatim + * \param player the enactor. + * \param alias name of the malias to rename. + * \param newname new name for the malias. + */ void ! do_malias_rename(dbref player, char *alias, char *newname) { struct mail_alias *m; *************** *** 398,407 **** void ! do_malias_destroy(player, alias) ! dbref player; ! char *alias; { struct mail_alias *m; m = get_malias(player, alias); --- 437,451 ---- + /** Delete a malias. + * \verbatim + * This implements the @malias/destroy command. + * \endverbatim + * \param player the enactor. + * \param alias name of the malias to destroy. + */ void ! do_malias_destroy(dbref player, char *alias) { struct mail_alias *m; m = get_malias(player, alias); *************** *** 426,436 **** } void ! do_malias_set(player, alias, tolist) ! dbref player; ! char *alias; ! char *tolist; { struct mail_alias *m; int i = 0; --- 470,485 ---- } + /** Set the membership list for a malias. + * \verbatim + * This implements the @malias/set command. + * \endverbatim + * \param player the enactor. + * \param alias name of the malias to set members for. + * \param tolist space-separated list of players to set as members. + */ void ! do_malias_set(dbref player, char *alias, char *tolist) { struct mail_alias *m; int i = 0; *************** *** 524,532 **** void ! do_malias_all(player) ! dbref player; { struct mail_alias *m; int i; --- 573,586 ---- + /** List all maliases. + * \verbatim + * This implements the @malias/list command. + * \endverbatim + * \param player the enactor. + */ void ! do_malias_all(dbref player) { struct mail_alias *m; int i; *************** *** 552,560 **** void ! do_malias_stats(player) ! dbref player; { if (!Hasprivs(player)) notify(player, T("MAIL: Permission denied.")); --- 606,619 ---- + /** Statistics on maliases. + * \verbatim + * This implements the @malias/stat command. + * \endverbatim + * \param player the enactor. + */ void ! do_malias_stats(dbref player) { if (!Hasprivs(player)) notify(player, T("MAIL: Permission denied.")); *************** *** 565,573 **** } } void ! do_malias_nuke(player) ! dbref player; { struct mail_alias *m; int i; --- 624,637 ---- } } + /** Remove all maliases. + * \verbatim + * This implements the @malias/nuke command. + * \endverbatim + * \param player the enactor. + */ void ! do_malias_nuke(dbref player) { struct mail_alias *m; int i; *************** *** 593,605 **** } ! void ! do_malias_privs(player, alias, privs, type) ! dbref player; ! char *alias; ! char *privs; ! int type; /* 0 = nprivs, 1 = mprivs */ { struct mail_alias *m; int *p; --- 657,673 ---- } ! /** Set permisions on maliases. ! * \verbatim ! * This implements @malias/use and @malias/see ! * \endverbatim ! * \param player the enactor. ! * \param alias name of the malias. ! * \param privs string of privs to set. ! * \param type if 1, setting nprivs, if 0, mprivs. ! */ void ! do_malias_privs(dbref player, char *alias, char *privs, int type) { struct mail_alias *m; int *p; *************** *** 620,701 **** } void ! do_malias_mprivs(player, alias, privs) ! dbref player; ! char *alias; ! char *privs; ! { ! const char TYPES[] = " everyone admin members owner"; ! struct mail_alias *m; ! char *ch; ! ! if (!(m = get_malias(player, alias))) { ! notify(player, T("MAIL: I cannot find that alias!")); ! return; ! } ! if (!Wizard(player) && (m->owner != player)) { ! notify(player, T("MAIL: Permission denied.")); ! return; ! } ! if (!strchr("=+-", *privs)) { ! notify(player, ! T ! ("MAIL: First character of permisisons must be one of '=', '+', '-',")); ! notify(player, T(" to set, add, remove permissions, respectively.")); ! return; ! } ! ch = strstr(TYPES, tprintf(" %s", privs + 1)); ! if (!ch) { ! notify_format(player, T("MAIL: Unknown permission type '%s'."), privs + 1); ! notify(player, ! T ! ("Must be one of 'everyone', 'members', 'admin', 'owner' (can be abbreviated).")); ! return; ! } ! if (*privs == '=') { /* setting permissions */ ! if (*ch == 'e') ! m->mflags = 0; ! else if (*ch == 'm') ! m->mflags = ALIAS_MEMBERS; ! else if (*ch == 'a') ! m->mflags = ALIAS_ADMIN; ! else if (*ch == 'o') ! m->mflags = ALIAS_OWNER; ! } else if ((*privs == '+') && m->mflags) { /* adding permissions */ ! if (*ch == 'm') ! m->mflags |= ALIAS_MEMBERS; ! else if (*ch == 'a') ! m->mflags |= ALIAS_ADMIN; ! else if (*ch == 'e') { /* DUMMY */ ! } else if (*ch == 'o') { /* DUMMY */ ! } ! } else if (*privs == '-') { /* removing permissions */ ! if (!m->mflags) ! m->mflags = ALIAS_ADMIN | ALIAS_MEMBERS; ! if (*ch == 'm') ! m->mflags &= ~ALIAS_MEMBERS; ! else if (*ch == 'a') ! m->mflags &= ~ALIAS_ADMIN; ! else if (*ch == 'e') { /* DUMMY */ ! } else if (*ch == 'o') { /* DUMMY */ ! } ! if (!m->mflags) ! m->mflags = ALIAS_OWNER; ! } ! notify_format(player, ! T("MAIL: Permission to list alias '%s' changed to %s"), ! alias, get_privs(m->mflags)); ! } ! ! ! ! ! void ! do_malias_add(player, alias, tolist) ! dbref player; ! char *alias; ! char *tolist; { char *head, *tail, spot; struct mail_alias *m; --- 688,700 ---- } + /** Add players to a malias. + * \param player dbref of enactor. + * \param alias name of malias. + * \param tolist string with list of players to add. + */ void ! do_malias_add(dbref player, char *alias, char *tolist) { char *head, *tail, spot; struct mail_alias *m; *************** *** 797,807 **** void ! do_malias_remove(player, alias, tolist) ! dbref player; ! char *alias; ! char *tolist; { char *head, *tail, spot; struct mail_alias *m; --- 796,808 ---- + /** Remove players from a malias. + * \param player dbref of enactor. + * \param alias name of malias. + * \param tolist string with list of players to remove. + */ void ! do_malias_remove(dbref player, char *alias, char *tolist) { char *head, *tail, spot; struct mail_alias *m; *************** *** 886,917 **** ***********************************************************/ static const char * ! get_privs(flags) ! int flags; ! { ! static char privs[20]; ! privs[0] = '\0'; ! if (!flags) ! strcpy(privs, "EVERYONE"); ! else { ! if (flags & ALIAS_MEMBERS) ! strcpy(privs, "MEMBERS"); ! if (flags & ALIAS_ADMIN) { ! if (*privs) ! strcat(privs, " | "); ! strcat(privs, "ADMIN"); ! } ! if (!(*privs)) ! strcpy(privs, "OWNER"); ! } ! ! return privs; ! } ! ! ! static const char * ! get_shortprivs(m) ! struct mail_alias *m; { static char privs[10]; strcpy(privs, "-- -- "); --- 887,893 ---- ***********************************************************/ static const char * ! get_shortprivs(struct mail_alias *m) { static char privs[10]; strcpy(privs, "-- -- "); *************** *** 942,951 **** } int ! ismember(m, player) ! struct mail_alias *m; ! dbref player; { int i; for (i = 0; i < m->size; i++) { --- 918,931 ---- } + /** Is a player a member of a malias? + * \param m pointer to malias. + * \param player dbref of player. + * \retval 1 player is a member of the malias. + * \retval 0 player is not a member of the malias. + */ int ! ismember(struct mail_alias *m, dbref player) { int i; for (i = 0; i < m->size; i++) { *************** *** 955,964 **** return 0; } ! /* Remove a destroyed player from all maliases */ void ! malias_cleanup(player) ! dbref player; { struct mail_alias *m; int n, i = 0; --- 935,945 ---- return 0; } ! /** Remove a destroyed player from all maliases. ! * \param player player to remove from maliases. ! */ void ! malias_cleanup(dbref player) { struct mail_alias *m; int n, i = 0; *************** *** 972,1013 **** } } struct mail_alias * ! get_malias(player, alias) ! dbref player; ! char *alias; { const char *mal; struct mail_alias *m; int i = 0; - int x = 0; ! if ((*alias == '#') && Hasprivs(player)) { ! x = atoi(alias + 1); ! if (x < 0 || x > (ma_top - 1)) ! return NULL; ! else ! return &malias[x]; ! } else { ! if (*alias != MALIAS_TOKEN) ! return NULL; ! mal = alias + 1; ! for (i = 0; i < ma_top; i++) { ! m = &malias[i]; ! if ((m->owner == player) || (m->nflags == 0) || ! /* ((m->nflags & ALIAS_ADMIN) && Hasprivs(player)) || */ ! Hasprivs(player) || ! ((m->nflags & ALIAS_MEMBERS) && ismember(m, player))) { #ifdef macintosh ! if (!strcasecmp(mal, (char *) (m->name))) #else ! if (!strcasecmp(mal, m->name)) #endif ! return m; ! } } } return NULL; --- 953,988 ---- } } + /** Get a malias pointer with permission checking. + * \param player player dbref, for permission check. + * \param alias name of malias to retrieve. + * \return pointer to malias structure, or NULL if player can't see it. + */ struct mail_alias * ! get_malias(dbref player, char *alias) { const char *mal; struct mail_alias *m; int i = 0; ! if (*alias != MALIAS_TOKEN) ! return NULL; ! mal = alias + 1; ! for (i = 0; i < ma_top; i++) { ! m = &malias[i]; ! if ((m->owner == player) || (m->nflags == 0) || ! /* ((m->nflags & ALIAS_ADMIN) && Hasprivs(player)) || */ ! Hasprivs(player) || ! ((m->nflags & ALIAS_MEMBERS) && ismember(m, player))) { #ifdef macintosh ! if (!strcasecmp(mal, (char *) (m->name))) #else ! if (!strcasecmp(mal, m->name)) #endif ! return m; } } return NULL; *************** *** 1017,1033 **** - - - /*********************************************************** ***** Loading and saving of mail-aliases ***** ***********************************************************/ ! void ! load_malias(fp) ! FILE *fp; { int i, j; char buffer[BUFFER_LEN]; --- 992,1006 ---- /*********************************************************** ***** Loading and saving of mail-aliases ***** ***********************************************************/ ! /** Load maliases from the mail db. ! * \param fp file pointer to read from. ! */ void ! load_malias(FILE * fp) { int i, j; char buffer[BUFFER_LEN]; *************** *** 1076,1085 **** } } ! void ! save_malias(fp) ! FILE *fp; { int i, j; struct mail_alias *m; --- 1049,1059 ---- } } ! /** Write maliases to the maildb ! * \param fp file pointer to write to. ! */ void ! save_malias(FILE * fp) { int i, j; struct mail_alias *m; *************** *** 1110,1119 **** #else /* MAIL_ALIASES */ void ! load_malias(fp) /* Skip mail aliases, */ ! FILE *fp; /* when they shall not be used, */ ! { char buffer[BUFFER_LEN]; char *s; --- 1084,1096 ---- #else /* MAIL_ALIASES */ + /** Dummy function to read and discard malias data in a maildb. + * When MAIL_ALIASES isn't defined, we use this. + * \param fp file pointer to read from. + */ void ! load_malias(FILE * fp) ! { /* Skip mail aliases, */ char buffer[BUFFER_LEN]; char *s; *** 1_7_7.231/src/look.c Sat, 22 Feb 2003 13:33:43 -0600 dunemush (pennmush/c/4_look.c 1.21.1.2.1.9.1.1.1.1.1.2 660) --- 1_7_7.308(w)/src/look.c Tue, 25 Mar 2003 16:22:37 -0600 dunemush (pennmush/c/4_look.c 1.21.1.2.1.9.1.1.1.1.1.4 660) *************** *** 1,9 **** ! /* look.c */ #include "config.h" #include "copyrite.h" - /* commands which look at things */ #include #include "conf.h" --- 1,14 ---- ! /** ! * \file look.c ! * ! * \brief Commands that look at things. ! * ! * ! */ #include "config.h" #include "copyrite.h" #include #include "conf.h" *************** *** 28,33 **** --- 33,39 ---- extern void decompile_flags(dbref player, dbref thing, const char *name); /* from flags.c */ extern void decompile_powers(dbref player, dbref thing, const char *name); /* from flags.c */ + extern const char *channel_description(dbref player); extern PRIV attr_privs[]; static void look_exits(dbref player, dbref loc, const char *exit_name); *************** *** 42,50 **** (dbref player, dbref thing, char const *pattern, ATTR *atr, void *args); static int look_helper_veiled (dbref player, dbref thing, char const *pattern, ATTR *atr, void *args); - #ifdef CHAT_SYSTEM - static const char *channel_description(dbref player); - #endif void decompile_atrs(dbref player, dbref thing, const char *name, const char *pattern, const char *prefix, int skipdef); void decompile_locks(dbref player, dbref thing, const char *name, int skipdef); --- 48,53 ---- *************** *** 393,408 **** } } void look_room(dbref player, dbref loc, enum look_type style) { - /* look at a room. Flag value of this function: - * 0 -- normal look, caused by "look" command. - * 1 -- remote look, done through a TRANSPARENTED exit. - * 2 -- auto-look, caused by moving. Obey TERSE. - * 3 -- remote look, through a CLOUDY TRANSPARENTED exit: desc only - * 4 -- remote look, though a CLOUDY (!TRANS) exit: contents only - */ PUEBLOBUFF; ATTR *a; --- 396,414 ---- } } + /** Look at a room. + * The style parameter tells you what kind of look it is: + * LOOK_NORMAL (caused by "look"), LOOK_TRANS (look through a transparent + * exit), LOOK_AUTO (automatic look, by moving), + * LOOK_CLOUDY (look through a cloudy exit - contents only), LOOK_CLOUDYTRANS + * (look through a cloudy transparent exit - desc only). + * \param player the looker. + * \param loc room being looked at. + * \param style how the room is being looked at. + */ void look_room(dbref player, dbref loc, enum look_type style) { PUEBLOBUFF; ATTR *a; *************** *** 523,528 **** --- 529,537 ---- restore_global_env("look_desc_save", preserves); } + /** An automatic look (due to motion). + * \param player the looker. + */ void do_look_around(dbref player) { *************** *** 532,540 **** look_room(player, loc, LOOK_AUTO); /* auto-look. Obey TERSE. */ } void do_look_at(dbref player, const char *name, int key) - /* 0 is normal, 1 is "outside" */ { dbref thing; dbref loc; --- 541,553 ---- look_room(player, loc, LOOK_AUTO); /* auto-look. Obey TERSE. */ } + /** Look at something. + * \param player the looker. + * \param name name of object to look at. + * \param key 0 for normal look, 1 for look/outside. + */ void do_look_at(dbref player, const char *name, int key) { dbref thing; dbref loc; *************** *** 620,647 **** } ! #ifdef CHAT_SYSTEM ! static const char * ! channel_description(dbref player) ! { ! static char buf[BUFFER_LEN]; ! char *bp; ! CHANLIST *c; ! ! if ((c = Chanlist(player))) { ! bp = buf; ! safe_str(T("Channels:"), buf, &bp); ! for (; c; c = c->next) { ! safe_chr(' ', buf, &bp); ! safe_str(ChanName(c->chan), buf, &bp); ! } ! *bp = '\0'; ! } else ! strcpy(buf, T("Channels: *NONE*")); ! return buf; ! } ! #endif ! void do_examine(dbref player, const char *name, int brief, int all) { --- 633,644 ---- } ! /** Examine an object. ! * \param player the enactor doing the examining. ! * \param name name of object to examine. ! * \param brief if 1, a brief examination. ! * \param all if 1, include veiled attributes. ! */ void do_examine(dbref player, const char *name, int brief, int all) { *************** *** 739,746 **** notify_format(player, T("Powers: %s"), power_description(thing)); #ifdef CHAT_SYSTEM ! if (IsPlayer(thing) || Chanlist(thing)) ! notify(player, channel_description(thing)); #endif /* CHAT_SYSTEM */ notify_format(player, T("Warnings checked: %s"), unparse_warnings(thing)); --- 736,742 ---- notify_format(player, T("Powers: %s"), power_description(thing)); #ifdef CHAT_SYSTEM ! notify(player, channel_description(thing)); #endif /* CHAT_SYSTEM */ notify_format(player, T("Warnings checked: %s"), unparse_warnings(thing)); *************** *** 855,860 **** --- 851,859 ---- mush_free((Malloc_t) tbuf, "string"); } + /** The score command: check a player's money. + * \param player the enactor. + */ void do_score(dbref player) { *************** *** 864,869 **** --- 863,871 ---- Pennies(player), Pennies(player) == 1 ? MONEY : MONIES); } + /** The inventory command. + * \param player the enactor. + */ void do_inventory(dbref player) { *************** *** 880,885 **** --- 882,892 ---- do_score(player); } + /** The find command. + * \param player the enactor. + * \param name name pattern to search for. + * \param argv array of additional arguments (for dbref ranges) + */ void do_find(dbref player, const char *name, char *argv[]) { *************** *** 925,931 **** notify_format(player, T("*** %d objects found ***"), count); } ! /* check the current location for bugs */ void do_sweep(dbref player, const char *arg1) { --- 932,944 ---- notify_format(player, T("*** %d objects found ***"), count); } ! /** Sweep the current location for bugs. ! * \verbatim ! * This implements @sweep. ! * \endverbatim ! * \param player the enactor. ! * \param arg1 optional area to sweep. ! */ void do_sweep(dbref player, const char *arg1) { *************** *** 1046,1051 **** --- 1059,1071 ---- } } + /** Locate a player. + * \verbatim + * This implements @whereis. + * \endverbatim + * \param player the enactor. + * \param name name of player to locate. + */ void do_whereis(dbref player, const char *name) { *************** *** 1072,1077 **** --- 1092,1107 ---- } + /** Find the entrances to a room. + * \verbatim + * This implements @entrances, which finds things linked to an object + * (typically exits, but can be any type). + * \endverbatim + * \param player the enactor. + * \param where name of object to find entrances on. + * \param argv array of arguments for dbref range limitation. + * \param val what type of 'entrances' to find. + */ void do_entrances(dbref player, const char *where, char *argv[], enum ent_type val) { *************** *** 1187,1196 **** } } struct dh_args { ! char const *prefix; ! char const *name; ! int skipdef; }; static int --- 1217,1227 ---- } } + /** Store arguments for decompile_helper() */ struct dh_args { ! char const *prefix; /**< Decompile/tf prefix */ ! char const *name; /**< Decompile object name */ ! int skipdef; /**< Skip default flags on attributes if true */ }; static int *************** *** 1241,1246 **** --- 1272,1285 ---- return 1; } + /** Decompile attributes on an object. + * \param player the enactor. + * \param thing object with attributes to decompile. + * \param name name to refer to object by in decompile. + * \param pattern pattern to match attributes to decompile. + * \param prefix prefix to use for decompile/tf. + * \param skipdef if true, skip showing default attribute flags. + */ void decompile_atrs(dbref player, dbref thing, const char *name, const char *pattern, const char *prefix, int skipdef) *************** *** 1254,1259 **** --- 1293,1304 ---- notify(player, T("@@ No attributes found. @@")); } + /** Decompile locks on an object. + * \param player the enactor. + * \param thing object with attributes to decompile. + * \param name name to refer to object by in decompile. + * \param skipdef if true, skip showing default lock flags. + */ void decompile_locks(dbref player, dbref thing, const char *name, int skipdef) { *************** *** 1283,1288 **** --- 1328,1342 ---- } } + /** Decompile. + * \verbatim + * This implements @decompile. + * \endverbatim + * \param player the enactor. + * \param name name of object to decompile. + * \param dbflag flag for type of decompile to perform. + * \param skipdef if true, skip showing default flags on attributes/locks. + */ void do_decompile(dbref player, const char *name, enum dec_type dbflag, int skipdef) { *** 1_7_7.231/src/log.c Thu, 26 Dec 2002 14:20:42 -0600 dunemush (pennmush/c/5_log.c 1.10.1.2.2.4.1.1.2.2 660) --- 1_7_7.308(w)/src/log.c Tue, 25 Mar 2003 16:22:37 -0600 dunemush (pennmush/c/5_log.c 1.10.1.2.2.4.1.1.2.2.1.3 660) *************** *** 1,4 **** ! /* log.c */ #include "copyrite.h" #include "config.h" --- 1,10 ---- ! /** ! * \file log.c ! * ! * \brief Logging for PennMUSH. ! * ! * ! */ #include "copyrite.h" #include "config.h" *************** *** 24,32 **** #include "log.h" #include "confmagic.h" ! char *quick_unparse(dbref object); ! void start_log(FILE ** fp, const char *filename); ! void end_log(FILE * fp); #ifdef macintosh #include "PMInit.h" --- 30,38 ---- #include "log.h" #include "confmagic.h" ! static char *quick_unparse(dbref object); ! static void start_log(FILE ** fp, const char *filename); ! static void end_log(FILE * fp); #ifdef macintosh #include "PMInit.h" *************** *** 40,48 **** FILE *cmdlog_fp; ! char * ! quick_unparse(object) ! dbref object; { static char buff[BUFFER_LEN], *bp; --- 46,53 ---- FILE *cmdlog_fp; ! static char * ! quick_unparse(dbref object) { static char buff[BUFFER_LEN], *bp; *************** *** 66,75 **** return buff; } ! void ! start_log(fp, filename) ! FILE **fp; ! const char *filename; { char newfilename[256] = "\0"; --- 71,78 ---- return buff; } ! static void ! start_log(FILE ** fp, const char *filename) { char newfilename[256] = "\0"; *************** *** 91,98 **** fflush(*fp); } void ! start_all_logs() { #ifndef SINGLE_LOGFILE start_log(&connlog_fp, CONNLOG); --- 94,103 ---- fflush(*fp); } + /** Open all logfiles. + */ void ! start_all_logs(void) { #ifndef SINGLE_LOGFILE start_log(&connlog_fp, CONNLOG); *************** *** 105,113 **** #endif /* SINGLE_LOGFILE */ } ! void ! end_log(fp) ! FILE *fp; { if (fp != stderr) { fprintf(fp, "END OF LOG.\n"); --- 110,117 ---- #endif /* SINGLE_LOGFILE */ } ! static void ! end_log(FILE * fp) { if (fp != stderr) { fprintf(fp, "END OF LOG.\n"); *************** *** 116,123 **** } } void ! end_all_logs() { #ifndef SINGLE_LOGFILE /* close up the log files */ --- 120,129 ---- } } + /** Close all logfiles. + */ void ! end_all_logs(void) { #ifndef SINGLE_LOGFILE /* close up the log files */ *************** *** 130,141 **** } void WIN32_CDECL do_rawlog(int logtype, const char *fmt, ...) { - /* take a log type and format list and args, write to appropriate logfile. - * log types are defined in log.h - */ struct tm *ttm; char timebuf[18]; char tbuf1[BUFFER_LEN + 50]; --- 136,150 ---- } + /** Log a raw message. + * take a log type and format list and args, write to appropriate logfile. + * log types are defined in log.h + * \param logtype type of log to print message to. + * \param fmt format string for message. + */ void WIN32_CDECL do_rawlog(int logtype, const char *fmt, ...) { struct tm *ttm; char timebuf[18]; char tbuf1[BUFFER_LEN + 50]; *************** *** 185,197 **** fflush(f); } void WIN32_CDECL do_log(int logtype, dbref player, dbref object, const char *fmt, ...) { - /* take a log type and format list and args, write to appropriate logfile. - * log types are defined in mushdb.h - */ - /* tbuf1 had 50 extra chars because we might pass this function * both a label string and a command which could be up to BUFFER_LEN * in length - for example, when logging @forces --- 194,211 ---- fflush(f); } + /** Log a message, with useful information. + * take a log type and format list and args, write to appropriate logfile. + * log types are defined in log.h. Unlike do_rawlog, this version + * tags messages with prefixes, and uses dbref information passed to it. + * \param logtype type of log to print message to. + * \param player dbref that generated the log message. + * \param object second dbref involved in log message (e.g. force logs) + * \param fmt mesage format string. + */ void WIN32_CDECL do_log(int logtype, dbref player, dbref object, const char *fmt, ...) { /* tbuf1 had 50 extra chars because we might pass this function * both a label string and a command which could be up to BUFFER_LEN * in length - for example, when logging @forces *************** *** 262,280 **** } } void ! do_logwipe(player, logtype, str) ! dbref player; ! int logtype; ! char *str; { - /* Wipe out a game log. This is intended for those emergencies where - * the log has grown out of bounds, overflowing the disk quota, etc. - * Because someone with the god password can use this command to wipe - * out 'intrusion' traces, we also require the log_wipe_passwd given - * in mush.cnf - */ - if (strcmp(str, LOG_WIPE_PASSWD)) { const char *lname; switch (logtype) { --- 276,293 ---- } } + /** Wipe out a game log. This is intended for those emergencies where + * the log has grown out of bounds, overflowing the disk quota, etc. + * Because someone with the god password can use this command to wipe + * out 'intrusion' traces, we also require the log_wipe_passwd given + * in mush.cnf + * \param player the enactor. + * \param logtype type of log to wipe. + * \param str password for wiping logs. + */ void ! do_logwipe(dbref player, int logtype, char *str) { if (strcmp(str, LOG_WIPE_PASSWD)) { const char *lname; switch (logtype) { *** 1_7_7.231/src/lock.c Thu, 23 Jan 2003 10:24:07 -0600 dunemush (pennmush/c/6_lock.c 1.17.1.13.1.1.1.4 660) --- 1_7_7.308(w)/src/lock.c Tue, 25 Mar 2003 16:22:37 -0600 dunemush (pennmush/c/6_lock.c 1.17.1.13.1.1.1.8 660) *************** *** 1,8 **** ! /* lock.c */ ! ! /* * This is the core of Ralph Melton's rewrite of the @lock system. ! * These are some of my underlying assumptions: * * 1) Locks are checked many more times than they are set, so it is * quite worthwhile to spend time when setting locks if it expedites --- 1,12 ---- ! /** ! * \file lock.c ! * ! * \brief Locks for PennMUSH. ! * ! * \verbatim ! * * This is the core of Ralph Melton's rewrite of the @lock system. ! * These are some of the underlying assumptions: * * 1) Locks are checked many more times than they are set, so it is * quite worthwhile to spend time when setting locks if it expedites *************** *** 19,24 **** --- 23,30 ---- * than for people to check for locks in MUSHcode. Therefore, it is * reasonable to incur a minor slowdown for checking locks in MUSHcode * in order to speed up the server's checking. + * + * \endverbatim */ #include "copyrite.h" *************** *** 118,123 **** --- 124,131 ---- static lock_type check_lock_type(dbref player, dbref thing, lock_type name); static int delete_lock(dbref player, dbref thing, lock_type type); static int can_write_lock(dbref player, dbref thing, lock_list *lock); + static lock_list *getlockstruct(dbref thing, lock_type type); + static lock_list *getlockstruct_noparent(dbref thing, lock_type type); /* Assuming 4096 byte pages */ #define LOCKS_PER_PAGE 200 *************** *** 126,137 **** --- 134,154 ---- static lock_list *next_free_lock(void); static void free_lock(lock_list *ll); + + /** Return a list of lock flag characters. + * \param ll pointer to a lock. + * \return string of lock flag characters. + */ const char * lock_flags(lock_list *ll) { return privs_to_letters(lock_privs, L_FLAGS(ll)); } + /** Return a list of lock flag names. + * \param ll pointer to a lock. + * \return string of lock flag names, space-separated. + */ const char * lock_flags_long(lock_list *ll) { *************** *** 151,156 **** --- 168,174 ---- return f; } + /** Initialize the lock strtree. */ void init_locks(void) { *************** *** 226,233 **** free_list = ll; } ! /* Given a lock type, find a lock. ! * This depends on the implementation of lock_type as a string. */ struct boolexp * getlock(dbref thing, lock_type type) --- 244,253 ---- free_list = ll; } ! /** Given a lock type, find a lock, possibly checking parents. ! * \param thing object on which lock is to be found. ! * \param type type of lock to find. ! * \return pointer to boolexp of lock. */ struct boolexp * getlock(dbref thing, lock_type type) *************** *** 239,244 **** --- 259,269 ---- return L_KEY(ll); } + /** Given a lock type, find a lock without checking parents. + * \param thing object on which lock is to be found. + * \param type type of lock to find. + * \return pointer to boolexp of lock. + */ struct boolexp * getlock_noparent(dbref thing, lock_type type) { *************** *** 249,255 **** return L_KEY(ll); } ! lock_list * getlockstruct(dbref thing, lock_type type) { lock_list *ll; --- 274,280 ---- return L_KEY(ll); } ! static lock_list * getlockstruct(dbref thing, lock_type type) { lock_list *ll; *************** *** 273,279 **** return NULL; } ! lock_list * getlockstruct_noparent(dbref thing, lock_type type) { lock_list *ll = Locks(thing); --- 298,304 ---- return NULL; } ! static lock_list * getlockstruct_noparent(dbref thing, lock_type type) { lock_list *ll = Locks(thing); *************** *** 291,297 **** } ! /* Is this lock in our set of canonical locks? */ lock_type match_lock(lock_type type) { --- 316,325 ---- } ! /** Determine if a lock type is one of the standard types or not. ! * \param type type of lock to check. ! * \return canonical lock type or NULL ! */ lock_type match_lock(lock_type type) { *************** *** 304,310 **** return NULL; } ! /* Return the proper entry from lock_types, or NULL */ const lock_list * get_lockproto(lock_type type) { --- 332,341 ---- return NULL; } ! /** Return the proper entry from lock_types, or NULL. ! * \param type of lock to look up. ! * \return lock_types entry for lock. ! */ const lock_list * get_lockproto(lock_type type) { *************** *** 318,328 **** } ! /* Set the lock type on thing to boolexp. * This is a primitive routine, to be called by other routines. * It will go somewhat wonky if given a NULL boolexp. * It will allocate memory if called with a string that is not already * in the lock table. */ int add_lock(dbref player, dbref thing, lock_type type, struct boolexp *key, --- 349,367 ---- } ! /** Add a lock to an object (primitive). ! * Set the lock type on thing to boolexp. * This is a primitive routine, to be called by other routines. * It will go somewhat wonky if given a NULL boolexp. * It will allocate memory if called with a string that is not already * in the lock table. + * \param player the enactor, for permission checking. + * \param thing object on which to set the lock. + * \param type type of lock to set. + * \param key lock boolexp pointer (should not be NULL!). + * \param flags lock flags. + * \retval 0 failure. + * \retval 1 success. */ int add_lock(dbref player, dbref thing, lock_type type, struct boolexp *key, *************** *** 382,390 **** return 1; } ! /* Set the lock type on thing to boolexp. * Used only on db load, when we can't safely test the player's * permissions because they're not loaded yet. */ int add_lock_raw(dbref player, dbref thing, lock_type type, struct boolexp *key, --- 421,440 ---- return 1; } ! /** Add a lock to an object on db load. ! * Set the lock type on thing to boolexp. * Used only on db load, when we can't safely test the player's * permissions because they're not loaded yet. + * This is a primitive routine, to be called by other routines. + * It will go somewhat wonky if given a NULL boolexp. + * It will allocate memory if called with a string that is not already + * in the lock table. + * \param player lock creator. + * \param thing object on which to set the lock. + * \param type type of lock to set. + * \param key lock boolexp pointer (should not be NULL!). + * \param flags lock flags. + * \retval 0 failure. */ int add_lock_raw(dbref player, dbref thing, lock_type type, struct boolexp *key, *************** *** 435,441 **** free_lock(ll); } ! /* Another primitive routine. */ int delete_lock(dbref player, dbref thing, lock_type type) { --- 485,496 ---- free_lock(ll); } ! /** Delete a lock from an object (primitive). ! * Another primitive routine. ! * \param player the enactor, for permission checking. ! * \param thing object on which to remove the lock. ! * \param type type of lock to remove. ! */ int delete_lock(dbref player, dbref thing, lock_type type) { *************** *** 459,467 **** return 1; } void ! free_locks(ll) ! lock_list *ll; { lock_list *ll2; while (ll) { --- 514,525 ---- return 1; } + /** Free all locks in a list. + * Used by the object destruction routines. + * \param ll pointer to list of locks. + */ void ! free_locks(lock_list *ll) { lock_list *ll2; while (ll) { *************** *** 472,478 **** } ! /* Check to see that the lock type is a valid type. * If it's not in our lock table, it's not valid, * unless it begins with 'user:' or an abbreviation thereof, * in which case the lock type is the part after the :. --- 530,536 ---- } ! /** Check to see that the lock type is a valid type. * If it's not in our lock table, it's not valid, * unless it begins with 'user:' or an abbreviation thereof, * in which case the lock type is the part after the :. *************** *** 480,485 **** --- 538,548 ---- * will confuse our db-reading routines. * * Might destructively modify name. + * + * \param player the enactor, for notification. + * \param thing object on which to check the lock. + * \param name name of lock type. + * \return lock type, or NULL. */ static lock_type check_lock_type(dbref player, dbref thing, lock_type name) *************** *** 522,527 **** --- 585,598 ---- return sp; } + /** Unlock a lock (user interface). + * \verbatim + * This implements @unlock. + * \endverbatim + * \param player the enactor. + * \param name name of object to unlock. + * \param type type of lock to unlock. + */ void do_unlock(dbref player, const char *name, lock_type type) { *************** *** 550,561 **** } } void ! do_lock(player, name, keyname, type) ! dbref player; ! const char *name; ! const char *keyname; ! lock_type type; { lock_type real_type; dbref thing; --- 621,637 ---- } } + /** Set/lock a lock (user interface). + * \verbatim + * This implements @lock. + * \endverbatim + * \param player the enactor. + * \param name name of object to lock. + * \param keyname key to lock the lock to, as a string. + * \param type type of lock to lock. + */ void ! do_lock(dbref player, const char *name, const char *keyname, lock_type type) { lock_type real_type; dbref thing; *************** *** 609,614 **** --- 685,695 ---- } } + /** Copy the locks from one object to another. + * \param player the enactor. + * \param orig the source object. + * \param clone the destination object. + */ void clone_locks(dbref player, dbref orig, dbref clone) { *************** *** 620,632 **** } ! /* Evaluate lock ltype on thing for player */ int eval_lock(dbref player, dbref thing, lock_type ltype) { return eval_boolexp(player, getlock(thing, ltype), thing); } int lock_visual(dbref thing, lock_type ltype) { --- 701,726 ---- } ! /** Evaluate a lock. ! * Evaluate lock ltype on thing for player. ! * \param player dbref attempting to pass the lock. ! * \param thing object containing the lock. ! * \param ltype type of lock to check. ! * \retval 1 player passes the lock. ! * \retval 0 player does not pass the lock. ! */ int eval_lock(dbref player, dbref thing, lock_type ltype) { return eval_boolexp(player, getlock(thing, ltype), thing); } + /** Determine if a lock is visual. + * \param thing object containing the lock. + * \param ltype type of lock to check. + * \retval (non-zero) lock is visual. + * \retval 0 lock is not visual. + */ int lock_visual(dbref thing, lock_type ltype) { *************** *** 637,642 **** --- 731,744 ---- return 0; } + /** Set flags on a lock (user interface). + * \verbatim + * This implements @lset. + * \endverbatim + * \param player the enactor. + * \param what string in the form obj/lock. + * \param flags list of flags to set. + */ void do_lset(dbref player, char *what, char *flags) { *** 1_7_7.231/src/info_slave.c Sun, 09 Feb 2003 14:38:28 -0600 dunemush (pennmush/c/7_info_slave 1.9.1.4.1.3 660) --- 1_7_7.308(w)/src/info_slave.c Tue, 25 Mar 2003 16:22:37 -0600 dunemush (pennmush/c/7_info_slave 1.9.1.4.1.4 660) *************** *** 1,4 **** ! /* info_slave.c */ #include "copyrite.h" #include "config.h" --- 1,14 ---- ! /** ! * \file info_slave.c ! * ! * \brief The information slave process. ! * ! * When running PennMUSH under Unix, a second process (info_slave) is ! * started and the server farms out DNS and ident lookups to the ! * info_slave, and reads responses from the info_slave asynchronously. ! * Communication between server and slave is by means of a local socket. ! * ! */ #include "copyrite.h" #include "config.h" *** 1_7_7.231/src/ident.c Sun, 01 Dec 2002 21:14:41 -0600 dunemush (pennmush/c/8_ident.c 1.19.1.4.1.12 660) --- 1_7_7.308(w)/src/ident.c Tue, 25 Mar 2003 16:22:37 -0600 dunemush (pennmush/c/8_ident.c 1.19.1.4.1.13 660) *************** *** 1,11 **** ! /* ! ** ident.c High-level calls to the ident lib ! ** ! ** Author: Pär Emanuelsson ! ** Hacked by: Peter Eriksson ! ! ** Many changes by Shawn Wagner to be protocol independent ! ** for PennMUSH */ #include "config.h" --- 1,13 ---- ! /** ! * \file ident.c ! * ! * \brief High-level calls to the ident library. ! * ! * Author: Pär Emanuelsson ! * Hacked by: Peter Eriksson ! * ! * Many changes by Shawn Wagner to be protocol independent ! * for PennMUSH */ #include "config.h" *************** *** 64,72 **** /* Low-level calls and macros */ typedef struct { ! int fd; ! char buf[IDBUFSIZE]; } ident_t; --- 66,75 ---- /* Low-level calls and macros */ + /** Structure to track an ident connection. */ typedef struct { ! int fd; /**< file descriptor to read from. */ ! char buf[IDBUFSIZE]; /**< buffer to hold ident data. */ } ident_t; *************** *** 105,110 **** --- 108,121 ---- return ident_query(&localaddr.addr, llen, &remoteaddr.addr, rlen, timeout); } + /** Perform an ident query and return the result. + * \param laddr local socket address data. + * \param llen local socket address data length. + * \param raddr remote socket address data. + * \param rlen remote socket address data length. + * \param timeout pointer to timeout value for query. + * \return ident responses in IDENT pointer, or NULL. + */ IDENT * ident_query(struct sockaddr *laddr, socklen_t llen, struct sockaddr *raddr, socklen_t rlen, int *timeout) *************** *** 152,157 **** --- 163,175 ---- return ident; /* At last! */ } + /** Perform an ident lookup and return the remote identifier as a + * newly allocated string. This function allocates memory that + * should be freed by the caller. + * \param fd socket to use for ident lookup. + * \param timeout pointer to timeout value for lookup. + * \return allocated string containing identifier, or NULL. + */ char * ident_id(int fd, int *timeout) { *************** *** 166,171 **** --- 184,192 ---- return id; } + /** Free an IDENT structure and all elements. + * \param id pointer to IDENT structure to free. + */ void ident_free(IDENT *id) { *** 1_7_7.231/src/game.c Wed, 19 Feb 2003 10:08:06 -0600 dunemush (pennmush/c/10_game.c 1.50.1.8.1.1.1.1.2.1.1.1.2.1.1.4.1.1.1.1.1.1.1.1.1.1.2.1.1.2.1.1.1.1.1.1.1.2.1.1.1.2.1.1.1.1.1.1.1.1.1.5.1.3.1.2.1.2.1.1.1.2.1.16 660) --- 1_7_7.308(w)/src/game.c Tue, 25 Mar 2003 16:22:37 -0600 dunemush (pennmush/c/10_game.c 1.50.1.8.1.1.1.1.2.1.1.1.2.1.1.4.1.1.1.1.1.1.1.1.1.1.2.1.1.2.1.1.1.1.1.1.1.2.1.1.1.2.1.1.1.1.1.1.1.1.1.5.1.3.1.2.1.2.1.1.1.1.1.2 660) *************** *** 1,4 **** ! /* game.c */ #include "copyrite.h" #include "config.h" --- 1,10 ---- ! /** ! * \file game.c ! * ! * \brief The main game driver. ! * ! * ! */ #include "copyrite.h" #include "config.h" *************** *** 124,130 **** void do_dolist(dbref player, char *list, char *command, dbref cause, unsigned int flags); void do_uptime(dbref player, int mortal); ! char *make_new_epoch_file(const char *basename, int the_epoch); void dest_info(dbref thing, dbref tt); #ifdef HAS_GETRUSAGE void rusage_stats(void); --- 130,136 ---- void do_dolist(dbref player, char *list, char *command, dbref cause, unsigned int flags); void do_uptime(dbref player, int mortal); ! static char *make_new_epoch_file(const char *basename, int the_epoch); void dest_info(dbref thing, dbref tt); #ifdef HAS_GETRUSAGE void rusage_stats(void); *************** *** 148,158 **** Pid_t forked_dump_pid = -1; ! /* ! * used to allocate storage for temporary stuff, cleared before command ! * execution */ - void do_dump(dbref player, char *num, enum dump_type flag) { --- 154,167 ---- Pid_t forked_dump_pid = -1; ! /** User command to dump the database. ! * \verbatim ! * This implements the @dump command. ! * \endverbatim ! * \param player the enactor, for permission checking. ! * \param num checkpoint interval, as a string. ! * \param flag type of dump. */ void do_dump(dbref player, char *num, enum dump_type flag) { *************** *** 208,216 **** } ! /* print out stuff into error file */ void ! report() { if (GoodObject(cplr)) do_rawlog(LT_TRACE, T("TRACE: Cmd:%s\tdepth:%d\tby #%d at #%d"), ccom, --- 217,227 ---- } ! /** Print global variables to the trace log. ! * This function is used for error reporting. ! */ void ! report(void) { if (GoodObject(cplr)) do_rawlog(LT_TRACE, T("TRACE: Cmd:%s\tdepth:%d\tby #%d at #%d"), ccom, *************** *** 220,227 **** } #ifdef HAS_GETRUSAGE void ! rusage_stats() { struct rusage usage; int pid; --- 231,240 ---- } #ifdef HAS_GETRUSAGE + /** Log process statistics to the error log. + */ void ! rusage_stats(void) { struct rusage usage; int pid; *************** *** 252,257 **** --- 265,277 ---- #endif /* HAS_GETRUSAGE */ + /** User interface to shut down the MUSH. + * \verbatim + * This implements the @shutdown command. + * \endverbatim + * \param player the enactor, for permission checking. + * \param flag type of shutdown to perform. + */ void do_shutdown(dbref player, enum shutdown_type flag) { *************** *** 288,294 **** jmp_buf db_err; static int ! dump_database_internal() { char realdumpfile[2048]; char realtmpfl[2048]; --- 308,314 ---- jmp_buf db_err; static int ! dump_database_internal(void) { char realdumpfile[2048]; char realtmpfl[2048]; *************** *** 402,407 **** --- 422,434 ---- return 0; } + /** Crash gracefully. + * This function is called when something disastrous happens - typically + * a failure to malloc memory or a signal like segfault. + * It logs the fault, does its best to dump a panic database, and + * exits abruptly. This function does not return. + * \param message message to log to the error log. + */ void panic(const char *message) { *************** *** 447,454 **** } } void ! dump_database() { epoch++; --- 474,485 ---- } } + /** Dump the database. + * This function is a wrapper for dump_database_internal() that does + * a little logging before and after the dump. + */ void ! dump_database(void) { epoch++; *************** *** 457,462 **** --- 488,502 ---- do_rawlog(LT_ERR, "DUMPING: %s.#%d# (done)", dumpfile, epoch); } + /** Dump a database, possibly by forking the process. + * This function calls dump_database_internal() to dump the MUSH + * databases. If we're configured to do so, it forks first, so that + * the child process can perform the dump while the parent continues + * to run the MUSH for the players. If we can't fork, this function + * warns players online that a dump is taking place and the game + * may pause. + * \param forking if 1, attempt a forking dump. + */ void fork_and_dump(int forking) { *************** *** 524,531 **** } } void ! do_restart() { dbref thing; ATTR *s; --- 564,576 ---- } } + /** Start up the MUSH. + * This function does all of the work that's necessary to start up + * MUSH objects and code for the game. It sets up player aliases, + * fixes null object names, and triggers all object startups. + */ void ! do_restart(void) { dbref thing; ATTR *s; *************** *** 573,578 **** --- 618,630 ---- extern void init_names(void); extern struct db_stat_info current_state; + /** Initialize game structures and read the most of the configuration file. + * This function runs before we read in the databases. It is responsible + * for recording the MUSH start time, setting up all the hash and + * prefix tables and similar structures, and reading the portions of the + * config file that don't require database load. + * \param conf file name of the configuration file. + */ void init_game_config(const char *conf) { *************** *** 615,626 **** config_file_startup(conf, 0); } ! /* Code that should be run after dbs are loaded (usually because we ! * need to have the flag table loaded, or because they run last. */ void init_game_postdb(const char *conf) { /* Commands and functions require the flag table for restrictions */ command_init_preconfig(); command_init_postconfig(); --- 667,688 ---- config_file_startup(conf, 0); } ! /** Post-db-load configuration. ! * This function contains code that should be run after dbs are loaded ! * (usually because we need to have the flag table loaded, or because they ! * run last). It reads in the portions of the config file that rely ! * on flags being defined. ! * \param conf file name of the configuration file. */ void init_game_postdb(const char *conf) { + /* access file stuff */ + read_access_file(); + /* initialize random number generator */ + initialize_mt(); + /* set up signal handlers for the timer */ + init_timer(); /* Commands and functions require the flag table for restrictions */ command_init_preconfig(); command_init_postconfig(); *************** *** 634,641 **** } int ! init_game_dbs() { FILE *f; --- 696,708 ---- } + /** Read the game databases. + * This function reads in the object, mail, and chat databases. + * \retval -1 error. + * \retval 0 success. + */ int ! init_game_dbs(void) { FILE *f; *************** *** 764,782 **** if (panicdb) db_close(f); - /* now do access file stuff */ - read_access_file(); - - /* initialize random number generator */ - initialize_mt(); - /* set up dumper */ strcpy(dumpfile, outfile); - init_timer(); return 0; } void do_readcache(dbref player) { --- 831,848 ---- if (panicdb) db_close(f); /* set up dumper */ strcpy(dumpfile, outfile); return 0; } + /** Read cached text files. + * \verbatim + * This implements the @readcache function. + * \endverbatim + * \param player the enactor, for permission checking. + */ void do_readcache(dbref player) { *************** *** 791,802 **** #define list_match(x) list_check(x, player, '$', ':', cptr, 0) #define cmd_match(x) atr_comm_match(x, player, '$', ':', cptr, 0, NULL, NULL); void process_command(dbref player, char *command, dbref cause, int from_port) - /* from_port = 1 if this is direct input from a port (i.e. typed - * directly by a player). attrib sets - * don't get parsed then. - */ { int a; char *p; /* utility */ --- 857,881 ---- #define list_match(x) list_check(x, player, '$', ':', cptr, 0) #define cmd_match(x) atr_comm_match(x, player, '$', ':', cptr, 0, NULL, NULL); + /** Attempt to match and execute a command. + * This function performs some sanity checks and then attempts to + * run a command. It checks, in order: home, built-in commands, + * enter aliases, leave aliases, $commands on neighboring objects or + * the player, $commands on the container, $commands on inventory, + * exits in the zone master room, $commands on objects in the ZMR, + * $commands on the ZMO, $commands on the player's zone, exits in the + * master room, and $commands on objectrs in the master room. + * + * When a command is directly input from a socket, we don't parse + * the value in attribute sets. + * + * \param player the enactor. + * \param command command to match and execute. + * \param cause object which caused the command to be executed. + * \param from_port if 1, the command was direct input from a socket. + */ void process_command(dbref player, char *command, dbref cause, int from_port) { int a; char *p; /* utility */ *************** *** 916,954 **** /* now do check on zones */ if ((!a) && (Zone(Location(player)) != NOTHING)) { if (IsRoom(Zone(Location(player)))) { ! ! /* zone of player's location is a zone master room */ ! ! if (Location(player) != Zone(player)) { ! ! /* check zone master room exits */ ! if (remote_exit(player, cptr)) { ! if (!Mobile(player)) ! goto done; ! else { ! do_move(player, cptr, 2); ! goto done; ! } ! } else ! /* check commands in the zone master room if no exits ! * can match more than one $command in zone master room ! */ ! a += list_match(Contents(Zone(Location(player)))); ! } /* end of zone master room check */ ! } else ! /* try matching commands on area zone object if GLOBALS ! * aren't in use or zone object isn't a room */ ! if ((!a) && (Zone(Location(player)) != NOTHING)) a += cmd_match(Zone(Location(player))); } - /* end of matching on zone of player's location */ /* if nothing matched with zone master room/zone object, try * matching zone commands on the player's personal zone */ if ((!a) && (Zone(player) != NOTHING) && (Zone(Location(player)) != Zone(player))) { ! a += cmd_match(Zone(player)); } /* end of zone stuff */ /* check global exits only if no other commands are matched */ --- 995,1028 ---- /* now do check on zones */ if ((!a) && (Zone(Location(player)) != NOTHING)) { if (IsRoom(Zone(Location(player)))) { ! /* zone of player's location is a zone master room, ! * so we check for exits and commands */ ! /* check zone master room exits */ ! if (remote_exit(player, cptr)) { ! if (!Mobile(player)) ! goto done; ! else { ! do_move(player, cptr, 2); ! goto done; ! } ! } else ! a += list_match(Contents(Zone(Location(player)))); ! } else a += cmd_match(Zone(Location(player))); } /* if nothing matched with zone master room/zone object, try * matching zone commands on the player's personal zone */ if ((!a) && (Zone(player) != NOTHING) && (Zone(Location(player)) != Zone(player))) { ! if (IsRoom(Zone(player))) ! /* Player's personal zone is a zone master room, so we ! * also check commands on objects in that room ! */ ! a += list_match(Contents(Zone(player))); ! else ! a += cmd_match(Zone(player)); } /* end of zone stuff */ /* check global exits only if no other commands are matched */ *************** *** 974,979 **** --- 1048,1054 ---- do_log(LT_HUH, player, 0, "%s", unp); } } + /* command has been executed. Free up memory. */ done: *************** *** 985,990 **** --- 1060,1071 ---- #undef list_match #undef cmd_match + /** Check to see if a string matches part of a semicolon-separated list. + * \param command string to match. + * \param list semicolon-separated list of aliases to match against. + * \retval 1 string matched an alias. + * \retval 0 string failed to match an alias. + */ int check_alias(const char *command, const char *list) { *************** *** 1008,1014 **** return 0; } ! /* match a list of things */ int list_check(dbref thing, dbref player, char type, char end, char *str, int just_match) --- 1089,1107 ---- return 0; } ! /** Match a command or listen pattern against a list of things. ! * This function iterates through a list of things (using the object ! * Next pointer, so typically this is a list of contents of an object), ! * and checks each for an attribute matching a command/listen pattern. ! * \param thing first object on list. ! * \param player the enactor. ! * \param type type of attribute to match ('$' or '^') ! * \param end character that signals the end of the matchable portion (':') ! * \param str string to match against the attributes. ! * \param just_match if 1, don't execute the command on match. ! * \retval 1 a match was made. ! * \retval 0 no match was made. ! */ int list_check(dbref thing, dbref player, char type, char end, char *str, int just_match) *************** *** 1023,1028 **** --- 1116,1131 ---- return (match); } + /** Match a command against an attribute of aliases. + * This function iterates through a list of things (using the object + * Next pointer, so typically this is a list of contents of an object), + * and checks each for an attribute of aliases that might be matched + * (as in EALIAS). + * \param thing first object on list. + * \param command command to attempt to match. + * \param type name of attribute of aliases to match against. + * \return dbref of first matching object, or -1 if none. + */ int alias_list_check(dbref thing, const char *command, const char *type) { *************** *** 1041,1046 **** --- 1144,1157 ---- return -1; } + /** Check a command against a list of aliases on a location + * (as for LALIAS). + * \param loc location with attribute of aliases. + * \param command command to attempt to match. + * \param type name of attribute of aliases to match against. + * \retval 1 successful match. + * \retval 0 failure. + */ int loc_alias_check(dbref loc, const char *command, const char *type) { *************** *** 1054,1059 **** --- 1165,1178 ---- return 0; } + /** Can an object hear? + * This function determines if a given object can hear. A Hearer is: + * a connected player, a puppet, an AUDIBLE object with a FORWARDLIST + * attribute, or an object with a LISTEN attribute. + * \param thing object to check. + * \retval 1 object can hear. + * \retval 0 object can't hear. + */ int Hearer(dbref thing) { *************** *** 1078,1083 **** --- 1197,1210 ---- return 0; } + /** Might an object be responsive to commands? + * This function determines if a given object might pick up a $command. + * That is, if it has any attributes with $commands on them that are + * not set no_command. + * \param thing object to check. + * \retval 1 object responds to commands. + * \retval 0 object doesn't respond to commands. + */ int Commer(dbref thing) { *************** *** 1094,1099 **** --- 1221,1233 ---- return (0); } + /** Is an object listening? + * This function determines if a given object is a Listener. A Listener + * is a thing or room that has the MONITOR flag set. + * \param thing object to check. + * \retval 1 object is a Listener. + * \retval 0 object isn't listening with ^patterns. + */ int Listener(dbref thing) { *************** *** 1103,1108 **** --- 1237,1250 ---- return (ThingListen(thing) || RoomListen(thing)); } + /** Reset all players' m