This is patch32 to PennMUSH 1.7.7. After applying this patch, you will have version 1.7.7p32 To apply this patch, save it to a file in your top-level MUSH directory, and do the following: patch -p1 < 1.7.7-patch32 ./Configure -d make update make clean make install If you receive errors from your src/*local.c files, please insert #include "conf.h" just before the line that includes "externs.h" in those files (or, if you haven't changed them, just cp the src/*local.dst files over them). If you use GNU patch 2.2, you probably want the above to be 'patch -b -p1', not just 'patch -p1'. If you have mysql libraries and don't want them linked in, use ./Configure -d -D no_mysql 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. On the off chance they appear not to be, simply rm them and re-run make. Then @shutdown and restart your MUSH. - Alan/Javelin In this patch: Major Changes: * SQL support. PennMUSH can now operate as an SQL client and perform queries against an SQL server. Currently only the MySQL server is supported. This adds the @sql command, the sql() and sqlescape() functions, and the Sql_Ok power. See README.SQL for some additional information. Mostly based on patches by Hans Engelen. * Creating a leaf attribute automatically creates associated branch attributes if they are not already present. [TAP] * When a $command matches on an object, but the object's use-lock or command-lock prevents the command from being run, the object's COMMAND_LOCK`FAILURE, COMMAND_LOCK`OFAILURE, and COMMAND_LOCK`AFAILURE attributes will be triggered if the $command never successfully matched, rather than returning a Huh? to the player. * Exits and rooms may now run $commands. Rooms are treated as being located in themselves for purposes of location checks. Exits are treated as being located in their source room. Suggested by [TAP]. Commands: * 'empty ' attempts to get each item in and put it alongside (in 's location). * 'give to ' syntax added. Minor Changes (user-visible): * @COST attribute is now evaluated, so you can make costs depend on who's paying, a selected item, etc. Suggested by Walker@M*U*S*H. Also, the amount given is passed in as %0, so you can code vendors that accept any amount. * New OBJID^ lock atom. * The server now maintains a rolling log of activity (commands issued, evaluations parsed, and locks evaluated), that is dumped to the log file on panic, or can be seen by God with @uptime. This aids debugging code that causes a "clean" panic rather than a crash. Suggested by Intrevis@M*U*S*H. * When checking a use/command/listen-lock on an object with patterns that get matched, we only check the lock once and cache the result, to prevent multiple lock evaluations if multiple patterns match. [TAP] * @chan/recall now shows nospoof tags for @cemit'd lines. Suggested by Sholevi@M*U*S*H. * SUSPECT flag can now be applied to any type of object. Suggested by Oriens@Alexandria. Minor Changes (internals): * fun_escape() and fun_secure() use the same list of special characters, rather than each having their own copy. [SW] * Buffer queue code used by @chan/buffer and the activity log refactored into src/bufferq.c and hdrs/bufferq.h. * Added mush_panicf(), with printf()-style format and arguments. [SW] Fixes: * @shutdown/panic and @shutdown/paranoid work again. [SW] * A panic DB could be created before the database files were actually read, causing problems on the next restart. [SW] * Win32 and Debian installer portability fixes. [EEH] * Code cleanup around errno. [SW] * The locate() function now respects visibility and interactions. Report by Jules@M*U*S*H. Prereq: 1.7.7p31 *** 1_7_7.977/Patchlevel Tue, 11 May 2004 10:54:19 -0500 dunemush (pennmush/5_Patchlevel 1.17.1.11.1.33 600) --- 1_7_7.1049(w)/Patchlevel Wed, 26 May 2004 12:34:58 -0500 dunemush (pennmush/5_Patchlevel 1.17.1.11.1.34 600) *************** *** 1,2 **** Do not edit this file. It is maintained by the official PennMUSH patches. ! This is PennMUSH 1.7.7p31 --- 1,2 ---- Do not edit this file. It is maintained by the official PennMUSH patches. ! This is PennMUSH 1.7.7p32 *** 1_7_7.977/CHANGES.177 Tue, 11 May 2004 10:54:19 -0500 dunemush (pennmush/g/23_CHANGES 1.48.1.258.1.14.1.77 600) --- 1_7_7.1049(w)/CHANGES.177 Mon, 31 May 2004 08:42:10 -0500 dunemush (pennmush/g/23_CHANGES 1.48.1.258.1.14.1.103 600) *************** *** 18,30 **** --- 18,106 ---- ========================================================================== + Version 1.7.7 patchlevel 32 May 26, 2004 + + Major Changes: + * SQL support. PennMUSH can now operate as an SQL client and perform + queries against an SQL server. Currently only the MySQL server is + supported. This adds the @sql command, the sql() and sqlescape() + functions, and the Sql_Ok power. See README.SQL for some + additional information. Mostly based on patches by Hans Engelen. + * Creating a leaf attribute automatically creates associated branch + attributes if they are not already present. [TAP] + * When a $command matches on an object, but the object's use-lock or + command-lock prevents the command from being run, the object's + COMMAND_LOCK`FAILURE, COMMAND_LOCK`OFAILURE, and COMMAND_LOCK`AFAILURE + attributes will be triggered if the $command never successfully + matched, rather than returning a Huh? to the player. + * Exits and rooms may now run $commands. Rooms are treated as being + located in themselves for purposes of location checks. Exits are + treated as being located in their source room. Suggested by [TAP]. + Commands: + * 'empty ' attempts to get each item in and put + it alongside (in 's location). + * 'give to ' syntax added. + Minor Changes (user-visible): + * @COST attribute is now evaluated, so you can make costs depend + on who's paying, a selected item, etc. Suggested by Walker@M*U*S*H. + Also, the amount given is passed in as %0, so you can code + vendors that accept any amount. + * New OBJID^ lock atom. + * The server now maintains a rolling log of activity (commands issued, + evaluations parsed, and locks evaluated), that is dumped to the log + file on panic, or can be seen by God with @uptime. This aids + debugging code that causes a "clean" panic rather than a crash. + Suggested by Intrevis@M*U*S*H. + * When checking a use/command/listen-lock on an object with patterns + that get matched, we only check the lock once and cache the result, + to prevent multiple lock evaluations if multiple patterns match. [TAP] + * @chan/recall now shows nospoof tags for @cemit'd lines. + Suggested by Sholevi@M*U*S*H. + * SUSPECT flag can now be applied to any type of object. + Suggested by Oriens@Alexandria. + Minor Changes (internals): + * fun_escape() and fun_secure() use the same list of special characters, + rather than each having their own copy. [SW] + * Buffer queue code used by @chan/buffer and the activity log refactored + into src/bufferq.c and hdrs/bufferq.h. + * Added mush_panicf(), with printf()-style format and arguments. [SW] + Fixes: + * @scan correctly shows attributes on parents again. Report by + Wayne@PDX. + * @shutdown/panic and @shutdown/paranoid work again. [SW] + * A panic DB could be created before the database files were actually read, + causing problems on the next restart. [SW] + * Win32 and Debian installer portability fixes. [EEH] + * Code cleanup around errno. [SW] + * The locate() function now respects visibility and interactions. + Report by Jules@M*U*S*H. + + Version 1.7.7 patchlevel 31 May 11, 2004 + Minor Changes: + * netmush is now started with only a single argument - the path to + the configuration file. The error log file (typically game/netmush.log) + is now configured in mush.cnf. Suggested by Vadiv@M*U*S*H. + * The restart script now bases its decision about whether the mush + is already running on the full path to the configuration file, + which means you can leave mush.cnf named mush.cnf without fear + of restart problems when multiple mushes are using the same + host. This also facilitates make update. Suggested by Vadiv@M*U*S*H. + * The GAMEDIR environment variable can be passed to 'make update' + to cause it to update *.cnf files in directories other than + game/ (using the template *.dst files in game/). + E.g.: make GAMEDIR=/home/othermush/game update + Commands: + * @nscemit. Suggested by Mystery8@ST:AW. + Functions: + * nscemit(). Suggested by Mystery8@ST:AW. Flags: * New HEAVY admin flag, prevents an object from being teleported by a mortal between two containers they own. Admin without this flag can now be teleported. Fixes: + * Help fixes by Anri@AkaneaMUSH and Intrevis@M*U*S*H. * mix() now treats empty lists as empty, instead of containing a single null element. Report by Luke@M*U*S*H. * @power messages no longer reference 'flags'. Report by Nymeria@M*U*S*H. *** 1_7_7.977/game/txt/hlp/penntop.hlp Tue, 11 May 2004 16:07:54 -0500 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.1.1.1.1.8.1.7 600) --- 1_7_7.1049(w)/game/txt/hlp/penntop.hlp Mon, 17 May 2004 19:52:33 -0500 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.1.1.1.1.8.1.9 600) *************** *** 573,582 **** matched. Local commands are always checked first and ALWAYS negate global commands. - Note that if something is typed in that results in a "Huh?" all the - objects in the master room will end up being checked for it. This is - one of the reasons why having too many global commands can lead to lag. - Because local commands overrule global commands, you can easily prevent a global command from working in a specific room by setting a copy of the global command in that room. Alternatively, if a global command is --- 573,578 ---- *************** *** 658,664 **** set off its @fail/@ofail/@afail. Other failure sets include: Failing to enter an object (@efail, @oefail, @aefail) ! Failing to leave an object (@lfail, @lefail, @alfail) Other failures (&`FAILURE, &`OFAILURE, &`AFAILURE) where the can be: FOLLOW_LOCK, PAGE_LOCK --- 654,661 ---- set off its @fail/@ofail/@afail. Other failure sets include: Failing to enter an object (@efail, @oefail, @aefail) ! Failing to leave an object (@lfail, @olfail, @alfail) ! Failing to use an object (@ufail, @oufail, @aufail) Other failures (&`FAILURE, &`OFAILURE, &`AFAILURE) where the can be: FOLLOW_LOCK, PAGE_LOCK *************** *** 1695,1701 **** Whenever someone in the same room as the object types the command name, the action list is carried out by the object, as long as: ! - the person typing the command passes the object's uselock - the object is not set NO_COMMAND or HALT Such attributes can also be @triggered as if the $: --- 1692,1699 ---- Whenever someone in the same room as the object types the command name, the action list is carried out by the object, as long as: ! - the person typing the command passes the object's @lock/use ! and @lock/command - the object is not set NO_COMMAND or HALT Such attributes can also be @triggered as if the $: *************** *** 1722,1727 **** --- 1720,1732 ---- You could then type: > wave Guest Rhyanna waves to Guest. + + If a command would match, but the enactor can't pass the lock, the + object may define generic failure behavior by setting the + COMMAND_LOCK`FAILURE, COMMAND_LOCK`OFAILURE, and/or COMMAND_LOCK`AFAILURE + attributes. These are triggered on all objects with matching commands + and failing locks, but only if no command successfully matched, + and take the place of the usual "Huh?" message. *BE SURE TO @LOCK/USE ME==ME IF YOU SET MACROS ON YOURSELF!* *** 1_7_7.977/game/txt/hlp/pennfunc.hlp Mon, 05 Apr 2004 00:19:02 -0500 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.1.1.1.1.1.1.5 600) --- 1_7_7.1049(w)/game/txt/hlp/pennfunc.hlp Mon, 24 May 2004 20:58:40 -0500 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.1.1.1.1.1.1.7 600) *************** *** 51,56 **** --- 51,57 ---- Mail functions: manipulate @mail (MAIL, FOLDERSTATS) Math functions: number manipulation, generic or integers only (ADD, DIV) Regular expression functions: Regular expressions (REGMATCH, REGEDIT) + SQL functions: Access SQL databases (SQL, SQLESCAPE) String functions: string manipulation (ESCAPE, FLIP) Time functions: Formatting and display of time (TIME, CONVSECS) Utility functions: general utilities (ISINT, COMP) *************** *** 180,186 **** vadd() vcross() vdim() vdot() vmag() vmax() vmin() vmul() vsub() vunit() & Regular expression functions ! This functions take a regular expression (regexp, or re) and match it against assorted things. regedit() regeditall() regeditalli() regediti() regmatch() --- 181,187 ---- vadd() vcross() vdim() vdot() vmag() vmax() vmin() vmul() vsub() vunit() & Regular expression functions ! These functions take a regular expression (regexp, or re) and match it against assorted things. regedit() regeditall() regeditalli() regediti() regmatch() *************** *** 189,194 **** --- 190,202 ---- reswitchi() See also: string functions, regexp + & SQL functions + These functions perform queries or other operations on an SQL + database to which the MUSH is connected, if SQL support is + available and enabled. + + sql() sqlescape() + & String functions String functions take at least one string and return a transformed string, parts of a string, or a value related to the string(s). *************** *** 3373,3378 **** --- 3381,3426 ---- > say [splice(foo bar baz,eek moof gleep,bar)] You say, "foo moof baz" + & SQL() + sql(,[[,]) + + Performs an SQL query if the MUSH is configured to connect to an + SQL database server. This function requires a WIZARD flag or + the Sql_Ok power. + + By default, SELECT queries will return their data space-separated. + Usually, it's more useful to specify a character to delimit + rows returned (and sometimes another character to delimit the + fields/columns returned, if they may contain spaces). + + is evaluated, so it's useful to either read it from + another attribute with u() or use lit() to protect commas. If + you will be interpolating user-provided values into the query, + be careful to escape them with sqlescape(), like this: + + &SEL_GETID obj = SELECT id FROM mytable WHERE name = '[sqlescape(%0)]' + &DOIT obj = $do *: ... [setq(0,u(SEL_GETID,%0))] ... + + See also: sqlescape(), @sql + + & SQLESCAPE() + sqlescape() + + This function performs SQL-server-implemented escaping of strings. + It's important to escape arbitrary data before passing it to the + sql() function or @sql command to prevent SQL injection attacks. + + Example: + > think sqlescape(You don't say) + You don\'t say + + When used in an SQL query, the results of an sqlescape() function + should be enclosed in single quotes. + + You must be a WIZARD or have the Sql_Ok power to use this function. + + See also: sql(), @sql + & SQRT() sqrt() *** 1_7_7.977/game/txt/hlp/pennflag.hlp Tue, 11 May 2004 10:13:56 -0500 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.14 600) --- 1_7_7.1049(w)/game/txt/hlp/pennflag.hlp Thu, 27 May 2004 19:42:36 -0500 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.17 600) *************** *** 56,62 **** v - Verbose w - No_Warn x - Terse, Cloudy ? - Unregistered ^ - Listen_Parent ~ - Noaccents " - NoSpoof ! --------------------------------------------------------------------- Some flags may not be enabled on some MUSHes. @flag/list will show which are available. --- 56,62 ---- v - Verbose w - No_Warn x - Terse, Cloudy ? - Unregistered ^ - Listen_Parent ~ - Noaccents " - NoSpoof ! ----------------------------------------------------------------------- Some flags may not be enabled on some MUSHes. @flag/list will show which are available. *************** *** 577,588 **** & ROYALTY Flag: ROYALTY (all types) ! If this flag is set on any type of object, then that object will ! be able to @tel and examine as if it was a wizard. Royalty players ! do not need money, nor are they affected by quotas or restricted ! building. Royalty is not able to change things like a wizard could. ! Only wizards may set it on players, although players who are ROYALTY ! may set their objects ROYALTY. & SAFE Flag: SAFE (all types) --- 577,587 ---- & ROYALTY Flag: ROYALTY (all types) ! If this flag is set on any type of object, then that object will be ! able to @tel and examine as if it was a wizard. Royalty players are ! not affected by quotas or restricted building. Royalty is not able to ! change things like a wizard could. Only wizards may set it on players, ! although players who are ROYALTY may set their objects ROYALTY. & SAFE Flag: SAFE (all types) *************** *** 601,612 **** If a room is STICKY, its drop-to is delayed until the last person leaves (See DROP-TOs). This flag is meaningless for exits. & SUSPECT ! Flag: SUSPECT (players) This flag is only settable by wizards. Players with this flag have their connects, disconnects, name changes, and kills reported to ! all connected wizards. All their actions are also logged to the MUSH ! log files. & TEMPLE The TEMPLE flag is no longer available in PennMUSH. Please see help changes for more information. --- 600,611 ---- If a room is STICKY, its drop-to is delayed until the last person leaves (See DROP-TOs). This flag is meaningless for exits. & SUSPECT ! Flag: SUSPECT (all types) This flag is only settable by wizards. Players with this flag have their connects, disconnects, name changes, and kills reported to ! all connected wizards. Actions by any object with this flag are ! also logged to the MUSH log files. & TEMPLE The TEMPLE flag is no longer available in PennMUSH. Please see help changes for more information. *** 1_7_7.977/game/txt/hlp/penncmd.hlp Tue, 11 May 2004 10:13:56 -0500 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.1.1.1.1.25 600) --- 1_7_7.1049(w)/game/txt/hlp/penncmd.hlp Mon, 24 May 2004 20:08:04 -0500 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.1.1.1.1.33 600) *************** *** 71,78 **** @flag @hide @hook @kick @log @motd @newpassword @pcreate @poll @poor @power @purge @quota @readcache @rejectmotd ! @shutdown @sitelock @squota @uptime @wall ! @wizmotd @wizwall cd ch cv & ] The "]" command-prefix instructs the MUSH that the rest of the command --- 71,79 ---- @flag @hide @hook @kick @log @motd @newpassword @pcreate @poll @poor @power @purge @quota @readcache @rejectmotd ! @shutdown @sitelock @sql @squota @uptime ! @wall @wizmotd @wizwall cd ch ! cv & ] The "]" command-prefix instructs the MUSH that the rest of the command *************** *** 712,718 **** @cost = This sets the number of pennies that need to be given to an object to ! trigger its @pay/@opay/@apay attributes. Example: @cost exit-machine=10 --- 713,721 ---- @cost = This sets the number of pennies that need to be given to an object to ! trigger its @pay/@opay/@apay attributes. It is evaluated, so you ! may use functions as well as simple integers; the amount given by ! the player is passed as %0. Example: @cost exit-machine=10 *************** *** 723,728 **** --- 726,734 ---- > Your exit has been created. (The exit will also have been opened by the machine.) + @cost charity=%0 + @pay charity=Thanks for your donation of %0. + See also: give, MONEY, @pay, money() & @cpattr & @mvattr *************** *** 1999,2014 **** For example, @lock/use Admin Commands=flag^wizard|flag^royalty ! You can test for the current IP address or hostname of the owner ! of the object (who must be connected to pass this test) with: ! @lock =ip^ ! @lock =hostname^ ! ! You may use wildcards (*, ?) in these patterns. Note that hostname ! tests are insecure; players who control their reverse DNS can spoof ! any hostname. ! See also: locktypes, @clock & locktypes & locklist & lock types --- 2005,2015 ---- For example, @lock/use Admin Commands=flag^wizard|flag^royalty ! You can test for an object id, instead of a dbref, with: ! ! @lock =objid^ ! See also: locktypes, @clock, objid() & locktypes & locklist & lock types *************** *** 2588,2599 **** See also: MONEY & @power @power =[!] ! This is a wizard-only command which allows the granting of special ! privileges to objects of any type. ! A list of powers is given in "help powers list". & @prefix @prefix = --- 2589,2657 ---- See also: MONEY & @power + @power/list [] + @power @power =[!] ! This is a wizard-only command which manipuates powers, special privileges ! that can be granted to objects. See also "help powers". ! ! @power/list lists the defined powers. A list of standard powers with ! explanations is given in "help powers list". ! ! When given a power name as an argument, @power displays information ! about a power. ! ! @power =[!] sets (or clears) the given power on an ! object. ! ! God can add, delete, and otherwise manipulate power definitions. ! See help @power2 for these commands. ! & @power2 ! @power/add =[], [], [], [] ! @power/delete ! @power/alias = ! @power/letter [=] ! @power/restrict =[], [] ! @power/type = ! @power/enable ! @power/disable ! ! These commands manipulate power definitions. Only God may use them. ! /disable disables a power, making it invisible and unusable ! /enable re-enables a disabled power ! /alias adds a new alias for an existing power ! /letter changes or removes a single-letter alias for an existing power. ! /restrict changes power permissions (see help @power3) ! /type changes power type(s) (see help @power3) ! /delete deletes a power completely, removing it from all objects ! in the database and the removing it permanently from the ! power table. It requires the exact power name or alias to be used. ! Be very very careful with this. ! See help @power3 for information on @power/add ! & @power3 ! @power/add is used to add a new power with the given name. Arguments ! other than the power name are optional: ! ! gives the power's one-letter abbreviation, which must ! not conflict with the one-letter abbreviation of another power that ! could be applied to the same object type(s). It defaults to none, which ! means it won't appear in a list of power characters but can still be ! tested for with haspower(), andlpowers(), and orlpowers(). ! specifies the space-separated list of types to which the power ! applies, and may be 'any' or one or more of 'room', 'thing', 'player', ! or 'exit'. It defaults to 'any'. ! specifies the space-separated list of permissions for who can ! set and/or see the power. See 'help power permissions' for details. ! It defaults to 'any' ! specifies the space-separated list of permissions for who ! can clear the power on an object they control. It defaults to ! whatever is given, or 'any'. ! ! Powers added with @power/add are saved with the database when it ! is dumped, and do not need to be re-added at startup. They are ! treated exactly as any other power in the server. & @prefix @prefix = *************** *** 2970,2975 **** --- 3028,3048 ---- @sitelock/remove will delete entries that were added with @sitelock if their host-pattern matches exactly. + & @sql + @sql + + This command issues and SQL query if the MUSH supports SQL and + can connect to an SQL server. You must be WIZARD or have the + Sql_Ok power to use @sql. + + Generally, the sql() function is more useful for coding, as it + delimits its return values, but @sql is handy for INSERT-type + queries and quick checks. If you pass arbitrary data to @sql, + be sure you call sqlescape() on it (see the example in help sql()). + + Example: @sql SHOW TABLES + + See also: sql(), sqlescape() & @squota @squota [= [+|-] ] *************** *** 3610,3615 **** --- 3683,3706 ---- following or leading you. See also: follow, unfollow, dismiss, followers(), following() + & empty + empty + + The empty command attempts to move all the contents of + to 's location. You must either be holding + (in which case the command is like getting 's + for each item) or be in the same location as (in which + case the command is like getting 's and dropping it). + + The empty command assumes that all 's items pass through the + hands of the player running the command. Therefore, the same kinds of + locks and messages that are applied in a possessive get (and, possibly, + a drop) are applied to each item in . It is therefore possible + to fail to empty an object for many reasons, even when you could do so + using "extraphysical" methods (teleporting items, forcing the object + to drop them, or forcing the items to leave the object.) + + See also: get, drop & get & take get *************** *** 3623,3629 **** --- 3714,3722 ---- See also: @lock, ENTER_OK, give, drop, @success, inventory & give give[/silent] = + give[/silent] to give = + give to Gives player the specified of pennies or . You can't give someone pennies if their new total would be greater than 10000 pennies. *** 1_7_7.977/game/restart Sun, 02 May 2004 11:38:40 -0500 dunemush (pennmush/39_restart 1.1.1.1.1.1.1.2.1.1.1.1.1.2.1.2.2.1.2.2.1.1.1.1.1.1 700) --- 1_7_7.1049(w)/game/restart Thu, 13 May 2004 11:42:54 -0500 dunemush (pennmush/39_restart 1.1.1.1.1.1.1.2.1.1.1.1.1.2.1.2.2.1.2.2.1.1.1.1.1.4 700) *************** *** 1,39 **** #!/bin/sh # - # usage: restart ! #-- options ! ! # If this doesn't work, you can set GAMEDIR to the directory this ! # script lives in by hand. ! GAMEDIR=`which $0 | sed 's/\/[^\/]*$//'` ! ! # The config file ! CONF_FILE=mush.cnf ! ! # The error log file ! LOG=log/netmush.log # Uncomment the line below to attempt to allow crashes to produce # core dumps. If you're getting crashes, this is the best way # to debug them. #ulimit -c unlimited - if [ ! -d $GAMEDIR ]; then - echo "GAMEDIR doesn't appear to be a directory. It's: $GAMEDIR" - exit 1 - fi - - cd $GAMEDIR - echo Running from `pwd` - - if [ ! -f $CONF_FILE ]; then - echo "CONF_FILE doesn't exist. It's: $CONF_FILE" - echo "Create $CONF_FILE from $GAMEDIR/mushcnf.dst" - exit 1 - fi - # Internationalization stuff # Set LANG here to get international character sets and, if someone's # done it, translation of messages. --- 1,18 ---- #!/bin/sh # # usage: restart + # + # REQUIRED: You must set this to the path to your game directory. + # E.g.: /home/mush/game + GAMEDIR= ! # OPTIONAL things that you may want to tweak. # Uncomment the line below to attempt to allow crashes to produce # core dumps. If you're getting crashes, this is the best way # to debug them. #ulimit -c unlimited # Internationalization stuff # Set LANG here to get international character sets and, if someone's # done it, translation of messages. *************** *** 50,55 **** --- 29,60 ---- #TZ=:EST5EDT #export TZ + + # The config file. Best to keep this as is. If you must change + # the name, make it a link to mush.cnf. + CONF_FILE=mush.cnf + + ####################################################################### + + if [ -z $GAMEDIR ]; then + echo "You must set GAMEDIR in the restart script." + exit 1 + fi + + if [ ! -d $GAMEDIR ]; then + echo "GAMEDIR doesn't appear to be a directory. It's: $GAMEDIR" + exit 1 + fi + + cd $GAMEDIR + echo Running from `pwd` + + if [ ! -f $CONF_FILE ]; then + echo "CONF_FILE doesn't exist. It's: $CONF_FILE" + echo "Create $CONF_FILE from $GAMEDIR/mushcnf.dst" + exit 1 + fi + # If netmush isn't here, they probably didn't make install # In any case, we'd better not proceed. if [ ! -e netmush ]; then *************** *** 80,90 **** # Prevent double-starting things. You may need to provide a pathname for # some of the commands. System V flavors need "ps -f" instead of "ps uwx". ! mush=`ps uwx | grep " $CONF_FILE" | grep -v grep | wc -l` if [ $mush -gt 0 ]; then ! echo Mush already active or some other process is using $CONF_FILE. exit 0 fi --- 85,95 ---- # Prevent double-starting things. You may need to provide a pathname for # some of the commands. System V flavors need "ps -f" instead of "ps uwx". ! mush=`ps uwwx | grep " $GAMEDIR/$CONF_FILE" | grep -v grep | wc -l` if [ $mush -gt 0 ]; then ! echo Mush already active or some other process is using $GAMEDIR/$CONF_FILE. exit 0 fi *************** *** 134,137 **** DATEMSK="${GAMEDIR}/getdate.template" export DATEMSK ! LC_ALL=$LANG LANG=$LANG ./netmush $CONF_FILE $LOG & --- 139,142 ---- DATEMSK="${GAMEDIR}/getdate.template" export DATEMSK ! LC_ALL=$LANG LANG=$LANG ./netmush $GAMEDIR/$CONF_FILE & *** 1_7_7.977/game/mushcnf.dst Thu, 06 May 2004 00:22:48 -0500 dunemush (pennmush/41_mushcnf.ds 1.1.1.19.1.1.1.2.1.1.1.8.1.1.1.1.1.29 600) --- 1_7_7.1049(w)/game/mushcnf.dst Mon, 24 May 2004 15:24:42 -0500 dunemush (pennmush/41_mushcnf.ds 1.1.1.19.1.1.1.2.1.1.1.8.1.1.1.1.1.31 600) *************** *** 474,479 **** --- 474,482 ---- ### MUSH. ### + # Filename to log important messages (startups, errors, shutdowns) + error_log log/netmush.log + # Filename to log connections to connect_log log/connect.log *************** *** 535,540 **** --- 538,565 ---- # trigger @aconnect/@adisconnect in a connecting player's location # if the location is a room or thing? room_connects no + + ### + ### SQL connectivity + ### + + # What SQL server platform should we use? Options include: + # mysql, disabled (the default) + sql_platform disabled + + # What's the SQL hostname? Use '127.0.0.1' for a TCP connection + # to the local host, and 'localhost' for a domain socket connection. + sql_host 127.0.0.1 + + # What's the SQL database? You have to set this to a database that + # you create. + sql_database mush + + # What username to access the database? + sql_username mush + + # What password for that user? Change this! + sql_password mush ### ### Options affecting commands and functions *** 1_7_7.977/config_h.SH Mon, 24 Nov 2003 12:34:48 -0600 dunemush (pennmush/b/17_config_h.S 1.17.1.2.1.1.1.10 660) --- 1_7_7.1049(w)/config_h.SH Mon, 24 May 2004 11:39:51 -0500 dunemush (pennmush/b/17_config_h.S 1.17.1.2.1.1.1.11 660) *************** *** 833,838 **** --- 833,843 ---- */ #$i_stdarg I_STDARG /**/ + /* HAS_MYSQL: + * Defined if mysql client libraries are available. + */ + #$d_mysql HAS_MYSQL /**/ + /* HAS_OPENSSL: * Defined if openssl 0.9.6+ is available. */ *** 1_7_7.977/src/local.dst Tue, 17 Feb 2004 15:57:52 -0600 dunemush (pennmush/b/19_local.dst 1.19 660) --- 1_7_7.1049(w)/src/local.dst Mon, 31 May 2004 08:42:40 -0500 dunemush (pennmush/b/19_local.dst 1.20 660) *************** *** 11,19 **** #include "config.h" #include #include #include "externs.h" #include "parse.h" - #include "conf.h" #include "htab.h" #include "command.h" #include "confmagic.h" --- 11,19 ---- #include "config.h" #include #include + #include "conf.h" #include "externs.h" #include "parse.h" #include "htab.h" #include "command.h" #include "confmagic.h" *** 1_7_7.977/src/funlocal.dst Sun, 01 Dec 2002 21:14:41 -0600 dunemush (pennmush/b/20_funlocal.d 1.5 660) --- 1_7_7.1049(w)/src/funlocal.dst Mon, 31 May 2004 08:42:40 -0500 dunemush (pennmush/b/20_funlocal.d 1.6 660) *************** *** 15,20 **** --- 15,21 ---- #include "copyrite.h" #include "config.h" #include + #include "conf.h" #include "externs.h" #include "parse.h" #include "confmagic.h" *** 1_7_7.977/src/cmdlocal.dst Sun, 15 Feb 2004 14:04:06 -0600 dunemush (pennmush/b/21_cmdlocal.d 1.14 660) --- 1_7_7.1049(w)/src/cmdlocal.dst Mon, 31 May 2004 08:42:40 -0500 dunemush (pennmush/b/21_cmdlocal.d 1.15 660) *************** *** 10,15 **** --- 10,16 ---- #include "copyrite.h" #include "config.h" #include + #include "conf.h" #include "externs.h" #include "parse.h" #include "htab.h" *** 1_7_7.977/src/wiz.c Tue, 11 May 2004 10:08:19 -0500 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.17.1.9.1.14 660) --- 1_7_7.1049(w)/src/wiz.c Mon, 31 May 2004 08:42:43 -0500 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.17.1.9.1.18 660) *************** *** 30,39 **** #include "process.h" #endif #include "conf.h" #include "mushdb.h" #include "attrib.h" #include "match.h" - #include "externs.h" #include "access.h" #include "parse.h" #include "mymalloc.h" --- 30,39 ---- #include "process.h" #endif #include "conf.h" + #include "externs.h" #include "mushdb.h" #include "attrib.h" #include "match.h" #include "access.h" #include "parse.h" #include "mymalloc.h" *************** *** 2010,2015 **** --- 2010,2016 ---- #ifdef HAS_OPENSSL close_ssl_connections(); #endif + sql_shutdown(); shutdown_queues(); fork_and_dump(0); #ifndef PROFILING *************** *** 2028,2034 **** local_shutdown(); end_all_logs(); #ifndef WIN32 ! execl("netmush", "netmush", confname, errlog, NULL); #else execl("pennmush.exe", "pennmush.exe", "/run", NULL); #endif /* WIN32 */ --- 2029,2035 ---- local_shutdown(); end_all_logs(); #ifndef WIN32 ! execl("netmush", "netmush", confname, NULL); #else execl("pennmush.exe", "pennmush.exe", "/run", NULL); #endif /* WIN32 */ *** 1_7_7.977/src/warnings.c Tue, 11 May 2004 10:08:19 -0500 dunemush (pennmush/b/25_warnings.c 1.21.1.1.1.7 660) --- 1_7_7.1049(w)/src/warnings.c Mon, 31 May 2004 08:42:42 -0500 dunemush (pennmush/b/25_warnings.c 1.21.1.1.1.8 660) *************** *** 14,24 **** #include "copyrite.h" #include "conf.h" #include "mushdb.h" #include "lock.h" #include "flags.h" #include "dbdefs.h" - #include "externs.h" #include "match.h" #include "attrib.h" #include "confmagic.h" --- 14,24 ---- #include "copyrite.h" #include "conf.h" + #include "externs.h" #include "mushdb.h" #include "lock.h" #include "flags.h" #include "dbdefs.h" #include "match.h" #include "attrib.h" #include "confmagic.h" *** 1_7_7.977/src/unparse.c Wed, 29 Oct 2003 14:21:02 -0600 dunemush (pennmush/b/28_unparse.c 1.16.1.7.1.10 660) --- 1_7_7.1049(w)/src/unparse.c Mon, 31 May 2004 08:42:42 -0500 dunemush (pennmush/b/28_unparse.c 1.16.1.7.1.11 660) *************** *** 11,21 **** #include #include "conf.h" #include "mushdb.h" #include "dbdefs.h" #include "flags.h" #include "lock.h" - #include "externs.h" #include "attrib.h" #include "ansi.h" #include "pueblo.h" --- 11,21 ---- #include #include "conf.h" + #include "externs.h" #include "mushdb.h" #include "dbdefs.h" #include "flags.h" #include "lock.h" #include "attrib.h" #include "ansi.h" #include "pueblo.h" *** 1_7_7.977/src/timer.c Tue, 11 May 2004 10:08:19 -0500 dunemush (pennmush/b/29_timer.c 1.29.1.7.1.18 660) --- 1_7_7.1049(w)/src/timer.c Mon, 31 May 2004 08:42:42 -0500 dunemush (pennmush/b/29_timer.c 1.29.1.7.1.19 660) *************** *** 27,38 **** #endif #include "conf.h" #include "dbdefs.h" #include "lock.h" #include "extmail.h" #include "match.h" #include "flags.h" - #include "externs.h" #include "access.h" #include "log.h" #include "game.h" --- 27,38 ---- #endif #include "conf.h" + #include "externs.h" #include "dbdefs.h" #include "lock.h" #include "extmail.h" #include "match.h" #include "flags.h" #include "access.h" #include "log.h" #include "game.h" *** 1_7_7.977/src/help.c Sat, 01 May 2004 13:51:07 -0500 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.21 660) --- 1_7_7.1049(w)/src/help.c Mon, 31 May 2004 08:42:42 -0500 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.22 660) *************** *** 10,15 **** --- 10,16 ---- #include #include #include + #include "conf.h" #include "externs.h" #include "command.h" #include "htab.h" *** 1_7_7.977/src/speech.c Tue, 11 May 2004 10:08:19 -0500 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.1.1.5.1.1.1.6.1.1.1.4 660) --- 1_7_7.1049(w)/src/speech.c Mon, 31 May 2004 08:42:42 -0500 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.1.1.5.1.1.1.6.1.1.1.5 660) *************** *** 36,44 **** int flags); dbref na_zemit(dbref current, void *data); extern int i_comp(const void *s1, const void *s2); - static const char *spname(dbref thing); ! static const char * spname(dbref thing) { /* if FULL_INVIS is defined, dark wizards and dark objects will be --- 36,43 ---- int flags); dbref na_zemit(dbref current, void *data); extern int i_comp(const void *s1, const void *s2); ! const char * spname(dbref thing) { /* if FULL_INVIS is defined, dark wizards and dark objects will be *************** *** 897,930 **** mush_free((Malloc_t) msgbuf, "string"); if (hp) free((Malloc_t) hp); - } - - /** A notify_anything function for formatting speaker data for NOSPOOF. - * \param speaker the speaker. - * \param func unused. - * \param fdata unused. - * \param para if 1, format for paranoid nospoof; if 0, normal nospoof. - * \return formatted string. - */ - char * - ns_esnotify(dbref speaker, na_lookup func __attribute__ ((__unused__)), - void *fdata __attribute__ ((__unused__)), int para) - { - char *dest, *bp; - bp = dest = mush_malloc(BUFFER_LEN, "string"); - - if (!GoodObject(speaker)) - *dest = '\0'; - else if (para) { - if (speaker == Owner(speaker)) - safe_format(dest, &bp, "[%s(#%d)] ", Name(speaker), speaker); - else - safe_format(dest, &bp, "[%s(#%d)'s %s(#%d)] ", Name(Owner(speaker)), - Owner(speaker), Name(speaker), speaker); - } else - safe_format(dest, &bp, "[%s:] ", spname(speaker)); - *bp = '\0'; - return dest; } --- 896,901 ---- *** 1_7_7.977/src/sig.c Sat, 19 Apr 2003 11:49:38 -0500 dunemush (pennmush/b/37_sig.c 1.22 660) --- 1_7_7.1049(w)/src/sig.c Mon, 31 May 2004 08:42:42 -0500 dunemush (pennmush/b/37_sig.c 1.23 660) *************** *** 7,14 **** */ #include "config.h" - #include "externs.h" #include #include "confmagic.h" #ifndef HAS_SIGPROCMASK --- 7,15 ---- */ #include "config.h" #include + #include "conf.h" + #include "externs.h" #include "confmagic.h" #ifndef HAS_SIGPROCMASK *** 1_7_7.977/src/set.c Tue, 11 May 2004 10:52:49 -0500 dunemush (pennmush/b/38_set.c 1.26.1.5.1.1.2.1.1.1.1.1.1.11.1.1.1.1.1.1.1.1.1.1.1.1.1.31 660) --- 1_7_7.1049(w)/src/set.c Mon, 31 May 2004 08:42:42 -0500 dunemush (pennmush/b/38_set.c 1.26.1.5.1.1.2.1.1.1.1.1.1.11.1.1.1.1.1.1.1.1.1.1.1.1.1.32 660) *************** *** 22,31 **** #include #include "conf.h" #include "mushdb.h" #include "match.h" #include "attrib.h" - #include "externs.h" #include "ansi.h" #include "command.h" #include "mymalloc.h" --- 22,31 ---- #include #include "conf.h" + #include "externs.h" #include "mushdb.h" #include "match.h" #include "attrib.h" #include "ansi.h" #include "command.h" #include "mymalloc.h" *** 1_7_7.977/src/rob.c Sat, 03 Apr 2004 20:43:54 -0600 dunemush (pennmush/b/42_rob.c 1.18.1.2.1.3.1.3.1.15 660) --- 1_7_7.1049(w)/src/rob.c Mon, 31 May 2004 08:42:42 -0500 dunemush (pennmush/b/42_rob.c 1.18.1.2.1.3.1.3.1.23 660) *************** *** 14,23 **** #include #include #include "conf.h" #include "mushdb.h" #include "attrib.h" #include "match.h" ! #include "externs.h" #include "flags.h" #include "log.h" #include "lock.h" --- 14,24 ---- #include #include #include "conf.h" + #include "externs.h" #include "mushdb.h" #include "attrib.h" #include "match.h" ! #include "parse.h" #include "flags.h" #include "log.h" #include "lock.h" *************** *** 25,30 **** --- 26,33 ---- #include "game.h" #include "confmagic.h" + static void do_give_to(dbref player, char *arg, int silent); + /** The kill command - send an object back home. * \param player the enactor. * \param what name of object to kill. *************** *** 145,150 **** --- 148,161 ---- char *myenv[10]; int i; + /* If we have a recipient, but no amnt, try parsing for + * 'give to ' instead of 'give =' + */ + if (recipient && *recipient && (!amnt || !*amnt)) { + do_give_to(player, recipient, silent); + return; + } + /* check recipient */ switch (who = match_result(player, recipient, TYPE_PLAYER, *************** *** 159,165 **** /* Can't give to garbage... */ if (IsGarbage(who)) { ! notify(player, T("Give to whome?")); return; } --- 170,176 ---- /* Can't give to garbage... */ if (IsGarbage(who)) { ! notify(player, T("Give to whom?")); return; } *************** *** 186,191 **** --- 197,207 ---- notify(player, T("You can't give yourself away!")); return; } + /* Don't give things to themselves. */ + if (thing == who) { + notify(player, T("You can't give an object to itself!")); + return; + } if (!eval_lock(player, thing, Give_Lock)) { notify(player, T("You can't give that away.")); return; *************** *** 261,268 **** /* give pennies to an object */ int cost = 0; ATTR *a; a = atr_get(who, "COST"); ! if (a && (amount < (cost = atoi(atr_value(a))))) { notify(player, T("Feeling poor today?")); giveto(player, amount); return; --- 277,310 ---- /* give pennies to an object */ int cost = 0; ATTR *a; + char *preserveq[NUMQ]; + char *preserves[10]; + char fbuff[BUFFER_LEN]; + char *fbp, *asave; + char const *ap; + a = atr_get(who, "COST"); ! if (!a) { ! /* No cost attribute */ ! notify_format(player, T("%s refuses your money."), Name(who)); ! giveto(player, amount); ! return; ! } ! save_global_regs("give_save", preserveq); ! save_global_env("give_save", preserves); ! asave = safe_atr_value(a); ! ap = asave; ! fbp = fbuff; ! safe_integer_sbuf(amount, paid, &pb); ! *pb = '\0'; ! wenv[0] = paid; ! process_expression(fbuff, &fbp, &ap, who, player, player, ! PE_DEFAULT, PT_DEFAULT, NULL); ! *fbp = '\0'; ! free((Malloc_t) asave); ! restore_global_regs("give_save", preserveq); ! restore_global_env("give_save", preserves); ! if (amount < (cost = atoi(fbuff))) { notify(player, T("Feeling poor today?")); giveto(player, amount); return; *************** *** 277,282 **** --- 319,325 ---- } giveto(player, amount - cost); giveto(who, cost); + pb = paid; safe_integer_sbuf(cost, paid, &pb); *pb = '\0'; real_did_it(player, who, "PAYMENT", NULL, "OPAYMENT", NULL, "APAYMENT", *************** *** 308,311 **** --- 351,400 ---- NOTHING, pay_env, NA_INTER_SEE); } } + } + + + + /** The other syntax of the give command. + * \param player the enactor/giver. + * \param arg "something to someone". + * \param silent if 1, hush the usual messages. + */ + static void + do_give_to(dbref player, char *arg, int silent) + { + char *s; + + /* Parse out the object and recipient */ + upcasestr(arg); + s = (char *) string_match(arg, "TO "); + if (!s) { + notify(player, T("Did you want to give something *to* someone?")); + return; + } + while ((s > arg) && isspace(*(s - 1))) { + s--; + } + if (s == arg) { + notify(player, T("Give what?")); + return; + } + *s++ = '\0'; + s = (char *) string_match(s, "TO "); + s += 3; + while (*s && isspace(*s)) + s++; + if (!*s) { + notify(player, T("Give to whom?")); + return; + } + /* At this point, 'arg' is the object, and 's' is the recipient. + * But be double-safe to be sure we don't loop. + */ + if (!*arg || !*s) { + notify(player, T("I don't know what you mean.")); + return; + } + do_give(player, s, arg, silent); + return; } *** 1_7_7.977/src/predicat.c Tue, 11 May 2004 10:08:19 -0500 dunemush (pennmush/b/44_predicat.c 1.1.1.34.1.1.1.3.1.4.2.38.1.8 660) --- 1_7_7.1049(w)/src/predicat.c Mon, 31 May 2004 08:42:42 -0500 dunemush (pennmush/b/44_predicat.c 1.1.1.34.1.1.1.3.1.4.2.38.1.11 660) *************** *** 78,112 **** return (buff); } - /** Notify a player with a formatted string. - * This is a safer replacement for notify(player, tprintf(fmt, ...)) - * \param player player to notify. - * \param fmt format string. - */ - void WIN32_CDECL - notify_format(dbref player, const char *fmt, ...) - { - #ifdef HAS_VSNPRINTF - char buff[BUFFER_LEN]; - #else - char buff[BUFFER_LEN * 3]; - #endif - va_list args; - - va_start(args, fmt); - - #ifdef HAS_VSNPRINTF - vsnprintf(buff, sizeof buff, fmt, args); - #else - vsprintf(buff, fmt, args); - #endif - - buff[BUFFER_LEN - 1] = '\0'; - va_end(args); - notify(player, buff); - } - - /** lock evaluation -- determines if player passes lock on thing, for * the purposes of picking up an object or moving through an exit. * \param player to check against lock. --- 78,83 ---- *************** *** 172,186 **** * \param odef default message to others. * \param awhat action attribute to trigger. * \param loc location in which action is taking place. */ ! void did_it(dbref player, dbref thing, const char *what, const char *def, const char *owhat, const char *odef, const char *awhat, dbref loc) { /* Bunch o' nulls */ static char *myenv[10] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; ! real_did_it(player, thing, what, def, owhat, odef, awhat, loc, myenv, ! NA_INTER_HEAR); } --- 143,159 ---- * \param odef default message to others. * \param awhat action attribute to trigger. * \param loc location in which action is taking place. + * \retval 0 no attributes were evaluated (only defaults used). + * \retval 1 some attributes were evaluated. */ ! int did_it(dbref player, dbref thing, const char *what, const char *def, const char *owhat, const char *odef, const char *awhat, dbref loc) { /* Bunch o' nulls */ static char *myenv[10] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; ! return real_did_it(player, thing, what, def, owhat, odef, awhat, loc, myenv, ! NA_INTER_HEAR); } *************** *** 194,208 **** * \param awhat action attribute to trigger. * \param loc location in which action is taking place. * \param flags interaction flags to pass to real_did_it. */ ! void did_it_interact(dbref player, dbref thing, const char *what, const char *def, const char *owhat, const char *odef, const char *awhat, dbref loc, int flags) { /* Bunch o' nulls */ static char *myenv[10] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; ! real_did_it(player, thing, what, def, owhat, odef, awhat, loc, myenv, flags); } /** Take an action on an object and trigger attributes. --- 167,184 ---- * \param awhat action attribute to trigger. * \param loc location in which action is taking place. * \param flags interaction flags to pass to real_did_it. + * \retval 0 no attributes were present, only defaults were used if given. + * \retval 1 some attributes were evaluated and used. */ ! int did_it_interact(dbref player, dbref thing, const char *what, const char *def, const char *owhat, const char *odef, const char *awhat, dbref loc, int flags) { /* Bunch o' nulls */ static char *myenv[10] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; ! return real_did_it(player, thing, what, def, owhat, odef, awhat, loc, myenv, ! flags); } /** Take an action on an object and trigger attributes. *************** *** 222,229 **** * \param loc location in which action is taking place. * \param myenv copy of the environment. * \param flags flags controlling type of interaction involved. */ ! void real_did_it(dbref player, dbref thing, const char *what, const char *def, const char *owhat, const char *odef, const char *awhat, dbref loc, char *myenv[10], int flags) --- 198,207 ---- * \param loc location in which action is taking place. * \param myenv copy of the environment. * \param flags flags controlling type of interaction involved. + * \retval 0 no attributes were present, only defaults were used if given. + * \retval 1 some attributes were evaluated and used. */ ! int real_did_it(dbref player, dbref thing, const char *what, const char *def, const char *owhat, const char *odef, const char *awhat, dbref loc, char *myenv[10], int flags) *************** *** 236,241 **** --- 214,220 ---- char *preserves[10]; char *preserveq[NUMQ]; int need_pres = 0; + int attribs_used = 0; loc = (loc == NOTHING) ? Location(player) : loc; *************** *** 246,251 **** --- 225,231 ---- if (what && *what) { d = atr_get(thing, what); if (d) { + attribs_used = 1; if (!need_pres) { need_pres = 1; save_global_regs("did_it_save", preserveq); *************** *** 268,273 **** --- 248,254 ---- if (owhat && *owhat) { d = atr_get(thing, owhat); if (d) { + attribs_used = 1; if (!need_pres) { need_pres = 1; save_global_regs("did_it_save", preserveq); *************** *** 303,309 **** wnxt[j] = myenv[j]; for (j = 0; j < NUMQ; j++) rnxt[j] = NULL; ! charge_action(player, thing, awhat); } /** Return the first object near another object that is visible to a player. --- 284,291 ---- wnxt[j] = myenv[j]; for (j = 0; j < NUMQ; j++) rnxt[j] = NULL; ! attribs_used = charge_action(player, thing, awhat) || attribs_used; ! return attribs_used; } /** Return the first object near another object that is visible to a player. *** 1_7_7.977/src/plyrlist.c Mon, 28 Apr 2003 22:03:14 -0500 dunemush (pennmush/b/46_plyrlist.c 1.5.1.1.1.3.1.2 660) --- 1_7_7.1049(w)/src/plyrlist.c Mon, 31 May 2004 08:42:42 -0500 dunemush (pennmush/b/46_plyrlist.c 1.5.1.1.1.3.1.2.1.1 660) *************** *** 15,24 **** #include "copyrite.h" #include "conf.h" #include "mushdb.h" #include "dbdefs.h" #include "flags.h" - #include "externs.h" #include "htab.h" #include "confmagic.h" --- 15,24 ---- #include "copyrite.h" #include "conf.h" + #include "externs.h" #include "mushdb.h" #include "dbdefs.h" #include "flags.h" #include "htab.h" #include "confmagic.h" *** 1_7_7.977/src/player.c Sun, 02 May 2004 11:58:26 -0500 dunemush (pennmush/b/47_player.c 1.15.1.1.1.1.1.4.1.6.1.1.1.13 660) --- 1_7_7.1049(w)/src/player.c Mon, 31 May 2004 08:42:42 -0500 dunemush (pennmush/b/47_player.c 1.15.1.1.1.1.1.4.1.6.1.1.1.14 660) *************** *** 25,33 **** #include #include "conf.h" #include "mushdb.h" #include "attrib.h" - #include "externs.h" #include "access.h" #include "mymalloc.h" #include "log.h" --- 25,33 ---- #include #include "conf.h" + #include "externs.h" #include "mushdb.h" #include "attrib.h" #include "access.h" #include "mymalloc.h" #include "log.h" *** 1_7_7.977/src/parse.c Sat, 01 May 2004 14:18:30 -0500 dunemush (pennmush/b/48_parse.c 1.23.1.10.1.2.1.1.1.1.1.2.1.2.1.34 660) --- 1_7_7.1049(w)/src/parse.c Mon, 31 May 2004 08:42:42 -0500 dunemush (pennmush/b/48_parse.c 1.23.1.10.1.2.1.1.1.1.1.2.1.2.1.38 660) *************** *** 18,26 **** #include #include "conf.h" #include "ansi.h" #include "dbdefs.h" - #include "externs.h" #include "function.h" #include "case.h" #include "match.h" --- 18,26 ---- #include #include "conf.h" + #include "externs.h" #include "ansi.h" #include "dbdefs.h" #include "function.h" #include "case.h" #include "match.h" *************** *** 490,495 **** --- 490,504 ---- pe_info->debug_strings = NULL; } else { old_iter_limit = -1; + } + + /* If we've been asked to evaluate, log the expression if: + * (a) the last thing we logged wasn't an expression, and + * (b) this expression isn't a substring of the last thing we logged + */ + if ((eflags & PE_EVALUATE) && + ((last_activity_type() != LA_PE) || !strstr(last_activity(), *str))) { + log_activity(LA_PE, executor, *str); } if (eflags != PE_NOTHING) { *** 1_7_7.977/src/move.c Fri, 27 Feb 2004 15:31:35 -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.24 660) --- 1_7_7.1049(w)/src/move.c Mon, 31 May 2004 08:42:42 -0500 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.29 660) *************** *** 13,22 **** #include #include "conf.h" #include "mushdb.h" #include "attrib.h" #include "match.h" - #include "externs.h" #include "flags.h" #include "lock.h" #include "dbdefs.h" --- 13,22 ---- #include #include "conf.h" + #include "externs.h" #include "mushdb.h" #include "attrib.h" #include "match.h" #include "flags.h" #include "lock.h" #include "dbdefs.h" *************** *** 694,699 **** --- 694,833 ---- safe_format(tbuf2, &tp, T("drops %s."), Name(thing)); *tp = '\0'; did_it(player, thing, "DROP", tbuf1, "ODROP", tbuf2, "ADROP", NOTHING); + } + + /** The empty command. + * This command causes the player to attempt to move everything in + * the thing to the location of the thing. + * Thing must be in player's inventory or in player's location. + * For each item in thing, movement is allowed if one of these is true: + * (a) thing is inside player, and player is allowed to get thing's item + * (b) thing is next to player, player is allowed to get thing's item, + * and player is allowed to drop item in player's location. + * We do not consider the cases of forcing the object to drop the items, + * teleporting the items out, or forcing the items to leave; + * 'empty' implies that the items pass through the player's hands. + * + * There is a choice to be made here with regard to locks - do we + * check locks on the thing (e.g. enter locks) and its location + * (e.g. drop locks) once or each time? If we choose once, we break + * locks that might make decisions based on the number of items there. + * If we choose multiple, we risk running side effects more than once. + * We choose multiple, as that's what would happen if the + * player did it manually. + * \param player the enactor. + * \param what the name of the object to empty. + */ + void + do_empty(dbref player, const char *what) + { + dbref player_loc; + dbref thing, thing_loc; + dbref item; + int empty_ok; + int count = 0; + int next; + + if ((player_loc = Location(player)) == NOTHING) + return; + thing = + noisy_match_result(player, what, TYPE_THING | TYPE_PLAYER, + MAT_NEAR_THINGS | MAT_ENGLISH); + if (!GoodObject(thing)) + return; + thing_loc = Location(thing); + + /* Object to empty must be in player's inventory or location */ + if ((thing_loc != player) && (thing_loc != player_loc)) { + notify(player, T("You can't empty that from here.")); + return; + } + for (item = first_visible(player, Contents(thing)); GoodObject(item); + item = first_visible(player, next)) { + next = Next(item); + if (IsExit(item)) + continue; /* No dropping exits */ + empty_ok = 0; + if (player == thing) { + /* empty me: You don't need to get what's in your inventory already */ + if (eval_lock(player, item, Drop_Lock) && + (!IsRoom(thing_loc) || eval_lock(player, thing_loc, Drop_Lock))) + empty_ok = 1; + } + /* Check that player can get stuff from thing */ + else if (controls(player, thing) || + (EnterOk(thing) && eval_lock(player, thing, Enter_Lock))) { + /* Check that player can get item */ + if (!could_doit(player, item)) { + /* Send failure message if set, otherwise be quiet */ + fail_lock(player, thing, Basic_Lock, NULL, NOTHING); + continue; + } + /* Now check for dropping in the destination */ + /* Thing is in player's inventory - sufficient */ + if (thing_loc == player) + empty_ok = 1; + /* Thing is in player's location - player must also be able to drop */ + else if (eval_lock(player, item, Drop_Lock) && + (!IsRoom(thing_loc) || eval_lock(player, thing_loc, Drop_Lock))) + empty_ok = 1; + } + /* Now do the work, if we should. That includes triggering messages */ + if (empty_ok) { + int i; + char tbuf1[BUFFER_LEN], tbuf2[BUFFER_LEN], *tp; + char *myenv[10]; + count++; + /* Get messages */ + if (thing != player) { + notify_format(thing, T("%s was taken from you."), Name(item)); + notify_format(item, T("%s took you."), Name(player)); + tp = tbuf1; + safe_format(tbuf1, &tp, T("You take %s from %s."), Name(item), + Name(thing)); + *tp = '\0'; + tp = tbuf2; + safe_format(tbuf2, &tp, T("takes %s from %s."), Name(item), + Name(thing)); + *tp = '\0'; + moveto(item, player); + did_it(player, item, "SUCCESS", tbuf1, "OSUCCESS", tbuf2, "ASUCCESS", + NOTHING); + myenv[0] = (char *) mush_malloc(BUFFER_LEN, "dbref"); + sprintf(myenv[0], "#%d", item); + for (i = 1; i < 10; i++) + myenv[i] = NULL; + real_did_it(player, player, "RECEIVE", NULL, "ORECEIVE", NULL, + "ARECEIVE", NOTHING, myenv, NA_INTER_SEE); + mush_free(myenv[0], "dbref"); + } + /* Drop messages */ + if (thing_loc != player) { + if (Sticky(item) && !Fixed(item)) { + safe_tel(thing, HOME, 0); + } else if ((Location(thing_loc) != NOTHING) && IsRoom(thing_loc) + && !Sticky(thing_loc) + && eval_lock(item, thing_loc, Dropto_Lock)) { + /* location has immediate dropto */ + notify_format(item, T("%s drops you."), Name(player)); + moveto(item, Location(thing_loc)); + } else { + notify_format(item, T("%s drops you."), Name(player)); + moveto(item, thing_loc); + } + tp = tbuf1; + safe_format(tbuf1, &tp, T("You drop %s."), Name(item)); + *tp = '\0'; + tp = tbuf2; + safe_format(tbuf2, &tp, T("drops %s."), Name(item)); + *tp = '\0'; + did_it(player, item, "DROP", tbuf1, "ODROP", tbuf2, "ADROP", NOTHING); + } + } + } + notify_format(player, T("You remove %d object%s from %s."), + count, (count == 1) ? "" : "s", Name(thing)); + return; } *** 1_7_7.977/src/malias.c Tue, 11 May 2004 10:52:49 -0500 dunemush (pennmush/c/3_malias.c 1.36.1.11 660) --- 1_7_7.1049(w)/src/malias.c Mon, 31 May 2004 08:42:42 -0500 dunemush (pennmush/c/3_malias.c 1.36.1.12 660) *************** *** 49,57 **** #include #include "conf.h" #include "mushdb.h" #include "dbdefs.h" - #include "externs.h" #include "match.h" #include "parse.h" #include "malias.h" --- 49,57 ---- #include #include "conf.h" + #include "externs.h" #include "mushdb.h" #include "dbdefs.h" #include "match.h" #include "parse.h" #include "malias.h" *** 1_7_7.977/src/look.c Sat, 01 May 2004 13:10:31 -0500 dunemush (pennmush/c/4_look.c 1.21.1.2.1.9.1.1.1.1.1.27 660) --- 1_7_7.1049(w)/src/look.c Mon, 31 May 2004 08:42:42 -0500 dunemush (pennmush/c/4_look.c 1.21.1.2.1.9.1.1.1.1.1.28 660) *************** *** 12,24 **** #include #include "conf.h" #include "mushdb.h" #include "dbdefs.h" #include "flags.h" #include "lock.h" #include "attrib.h" #include "match.h" - #include "externs.h" #include "ansi.h" #include "pueblo.h" #include "extchat.h" --- 12,24 ---- #include #include "conf.h" + #include "externs.h" #include "mushdb.h" #include "dbdefs.h" #include "flags.h" #include "lock.h" #include "attrib.h" #include "match.h" #include "ansi.h" #include "pueblo.h" #include "extchat.h" *** 1_7_7.977/src/log.c Tue, 11 May 2004 10:52:49 -0500 dunemush (pennmush/c/5_log.c 1.10.1.2.2.4.1.1.2.2.1.11 660) --- 1_7_7.1049(w)/src/log.c Mon, 31 May 2004 08:42:42 -0500 dunemush (pennmush/c/5_log.c 1.10.1.2.2.4.1.1.2.2.1.20 660) *************** *** 28,33 **** --- 28,34 ---- #include "flags.h" #include "dbdefs.h" #include "htab.h" + #include "bufferq.h" #include "log.h" #include "confmagic.h" *************** *** 35,40 **** --- 36,43 ---- static void start_log(FILE ** fp, const char *filename); static void end_log(const char *filename); + BUFFERQ *activity_bq = NULL; + HASHTAB htab_logfiles; /**< Hash table of logfile names and descriptors */ #ifdef macintosh *************** *** 127,132 **** --- 130,160 ---- start_log(&cmdlog_fp, CMDLOG); } + /** Redirect stderr to a error log file. + * Should be called after start_all_logs(). + * \param log name of logfile to redirect stderr to. + */ + void + redirect_stderr(void) + { + FILE *errlog_fp; + + fprintf(stderr, T("Redirecting stderr to %s\n"), ERRLOG); + errlog_fp = fopen(ERRLOG, "a"); + if (!errlog_fp) { + fprintf(stderr, T("Unable to open %s. Error output to stderr.\n"), ERRLOG); + } else { + + if (!freopen(ERRLOG, "a", stderr)) { + printf(T("Ack! Failed reopening stderr!")); + exit(1); + } + setvbuf(stderr, NULL, _IOLBF, BUFSIZ); + fclose(errlog_fp); + } + } + + static void end_log(const char *filename) { *************** *** 369,372 **** --- 397,502 ---- return; } notify(player, T("Log wiped.")); + } + + + /** Log a message to the activity log. + * \param type message type (an LA_* constant) + * \param player object responsible for the message. + * \param action message to log. + */ + void + log_activity(int type, dbref player, const char *action) + { + if (!activity_bq) + activity_bq = allocate_bufferq(ACTIVITY_LOG_SIZE); + add_to_bufferq(activity_bq, type, player, action); + } + + /** Retrieve the last logged message from the activity log. + * \return last logged message or an empty string. + */ + const char * + last_activity(void) + { + if (!activity_bq) + return ""; + else + return BufferQLast(activity_bq); + } + + /** Retrieve the type of the last logged message from the activity log. + * \return last type of last logged message or -1. + */ + int + last_activity_type(void) + { + if (!activity_bq) + return -1; + else + return BufferQLastType(activity_bq); + } + + + /** Dump out (to a player or the error log) the activity buffer queue. + * \param player player to receive notification, if notifying. + * \param num_lines number of lines of buffer to dump (0 = all). + * \param dump if 1, dump to error log; if 0, notify player. + */ + void + notify_activity(dbref player, int num_lines, int dump) + { + int type; + dbref plr; + time_t timestamp; + char *buf; + char *p = NULL; + char *stamp; + int skip; + const char *typestr; + + if (!activity_bq) + return; + + if (dump || !num_lines) + num_lines = BufferQNum(activity_bq); + skip = BufferQNum(activity_bq) - num_lines; + + if (dump) + do_rawlog(LT_ERR, "Dumping recent activity:"); + else + notify(player, T("GAME: Recall from activity log")); + + do { + buf = iter_bufferq(activity_bq, &p, &plr, &type, ×tamp); + if (skip <= 0) { + if (buf) { + stamp = show_time(timestamp, 0); + switch (type) { + case LA_CMD: + typestr = "CMD"; + break; + case LA_PE: + typestr = "EXP"; + break; + case LA_LOCK: + typestr = "LCK"; + break; + default: + typestr = "???"; + break; + } + + if (dump) + do_rawlog(LT_ERR, "[%s/#%d/%s] %s", stamp, plr, typestr, buf); + else + notify_format(player, "[%s/#%d/%s] %s", stamp, plr, typestr, buf); + } + } + skip--; + } while (buf); + + + if (!dump) + notify(player, T("GAME: End recall")); } *** 1_7_7.977/src/lock.c Tue, 11 May 2004 10:08:19 -0500 dunemush (pennmush/c/6_lock.c 1.17.1.13.1.1.1.1.1.16 660) --- 1_7_7.1049(w)/src/lock.c Mon, 31 May 2004 08:42:42 -0500 dunemush (pennmush/c/6_lock.c 1.17.1.13.1.1.1.1.1.20 660) *************** *** 34,43 **** #include #include #include "conf.h" #include "boolexp.h" #include "mushdb.h" #include "attrib.h" - #include "externs.h" #include "dbdefs.h" #include "lock.h" #include "match.h" --- 34,43 ---- #include #include #include "conf.h" + #include "externs.h" #include "boolexp.h" #include "mushdb.h" #include "attrib.h" #include "dbdefs.h" #include "lock.h" #include "match.h" *************** *** 729,735 **** int eval_lock(dbref player, dbref thing, lock_type ltype) { ! return eval_boolexp(player, getlock(thing, ltype), thing); } /** Active a lock's failure attributes. --- 729,737 ---- int eval_lock(dbref player, dbref thing, lock_type ltype) { ! boolexp b = getlock(thing, ltype); ! log_activity(LA_LOCK, thing, unparse_boolexp(player, b, UB_DBREF)); ! return eval_boolexp(player, b, thing); } /** Active a lock's failure attributes. *************** *** 738,745 **** * \param ltype type of lock failed. * \param def default message if there is no appropriate failure attribute. * \param loc location in which action is taking place. */ ! void fail_lock(dbref player, dbref thing, lock_type ltype, const char *def, dbref loc) { --- 740,749 ---- * \param ltype type of lock failed. * \param def default message if there is no appropriate failure attribute. * \param loc location in which action is taking place. + * \retval 1 some attribute on the object was actually evaluated. + * \retval 0 no attributes were evaluated (only defaults used). */ ! int fail_lock(dbref player, dbref thing, lock_type ltype, const char *def, dbref loc) { *************** *** 779,785 **** upcasestr(atr); upcasestr(oatr); upcasestr(aatr); ! did_it(player, thing, atr, def, oatr, NULL, aatr, loc); } --- 783,789 ---- upcasestr(atr); upcasestr(oatr); upcasestr(aatr); ! return did_it(player, thing, atr, def, oatr, NULL, aatr, loc); } *** 1_7_7.977/src/ident.c Sat, 01 May 2004 13:51:07 -0500 dunemush (pennmush/c/8_ident.c 1.19.1.4.1.15 660) --- 1_7_7.1049(w)/src/ident.c Mon, 31 May 2004 08:42:42 -0500 dunemush (pennmush/c/8_ident.c 1.19.1.4.1.16 660) *************** *** 56,65 **** #endif #include "conf.h" #include "attrib.h" #include "ident.h" #include "mymalloc.h" - #include "externs.h" #include "mysocket.h" #include "confmagic.h" --- 56,65 ---- #endif #include "conf.h" + #include "externs.h" #include "attrib.h" #include "ident.h" #include "mymalloc.h" #include "mysocket.h" #include "confmagic.h" *** 1_7_7.977/src/game.c Tue, 11 May 2004 10:08:19 -0500 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.1.1.1.1.12.1.3.1.7.1.2.2.1.1.8 660) --- 1_7_7.1049(w)/src/game.c Mon, 31 May 2004 08:42:42 -0500 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.1.1.1.1.12.1.3.1.7.1.2.2.1.1.17 660) *************** *** 45,53 **** #endif #include "conf.h" #include "mushdb.h" #include "game.h" - #include "externs.h" #include "attrib.h" #include "match.h" #include "case.h" --- 45,53 ---- #endif #include "conf.h" + #include "externs.h" #include "mushdb.h" #include "game.h" #include "attrib.h" #include "match.h" #include "case.h" *************** *** 89,94 **** --- 89,95 ---- #endif /* declarations */ + int database_loaded = 0; /**< True after the database has been read. */ char dumpfile[200]; /**< File name to dump database to */ time_t start_time; /**< MUSH start time (since process exec'd) */ time_t first_start_time = 0; /**< MUSH start time (since last shutdown) */ *************** *** 97,107 **** static int epoch = 0; static int reserved; /**< Reserved file descriptor */ int depth = 0; /**< excessive recursion prevention */ extern dbref cplr; extern char ccom[]; - #ifndef errno - extern int errno; - #endif extern void initialize_mt(void); --- 98,110 ---- static int epoch = 0; static int reserved; /**< Reserved file descriptor */ int depth = 0; /**< excessive recursion prevention */ + static dbref *errdblist = NULL; /**< List of dbrefs to return errors from */ + static dbref *errdbtail; /**< Pointer to end of errdblist */ + static int errdbsize = 4; /**< Current size of errdblist array */ + static void errdb_grow(void); + extern dbref cplr; extern char ccom[]; extern void initialize_mt(void); *************** *** 113,118 **** --- 116,122 ---- static FILE *db_open(const char *filename); static FILE *db_open_write(const char *filename); static void db_close(FILE * f); + static int fail_commands(dbref player); void do_readcache(dbref player); int check_alias(const char *command, const char *list); int list_check(dbref thing, dbref player, char type, *************** *** 244,249 **** --- 248,254 ---- depth, cplr, Location(cplr)); else do_rawlog(LT_TRACE, "TRACE: Cmd:%s\tdepth:%d\tby #%d", ccom, depth, cplr); + notify_activity(NOTHING, 0, 1); } #ifdef HAS_GETRUSAGE *************** *** 473,497 **** /* shut down interface */ emergency_shutdown(); ! /* dump panic file */ ! if (setjmp(db_err)) { ! /* Dump failed. We're in deep doo-doo */ ! do_rawlog(LT_ERR, T("CANNOT DUMP PANIC DB. OOPS.")); ! _exit(134); ! } else { ! if ((f = fopen(panicfile, FOPEN_WRITE)) == NULL) { ! do_rawlog(LT_ERR, T("CANNOT OPEN PANIC FILE, YOU LOSE")); ! _exit(135); } else { ! do_rawlog(LT_ERR, T("DUMPING: %s"), panicfile); ! db_write(f, DBF_PANIC); ! dump_mail(f); ! save_chatdb(f); ! fclose(f); ! do_rawlog(LT_ERR, T("DUMPING: %s (done)"), panicfile); ! _exit(136); } } } /** Dump the database. --- 478,533 ---- /* shut down interface */ emergency_shutdown(); ! /* dump panic file if we have a database read. */ ! if (database_loaded) { ! if (setjmp(db_err)) { ! /* Dump failed. We're in deep doo-doo */ ! do_rawlog(LT_ERR, T("CANNOT DUMP PANIC DB. OOPS.")); ! _exit(134); } else { ! if ((f = fopen(panicfile, FOPEN_WRITE)) == NULL) { ! do_rawlog(LT_ERR, T("CANNOT OPEN PANIC FILE, YOU LOSE")); ! _exit(135); ! } else { ! do_rawlog(LT_ERR, T("DUMPING: %s"), panicfile); ! db_write(f, DBF_PANIC); ! dump_mail(f); ! save_chatdb(f); ! fclose(f); ! do_rawlog(LT_ERR, T("DUMPING: %s (done)"), panicfile); ! } } + } else { + do_rawlog(LT_ERR, T("Skipping panic dump because database isn't loaded.")); } + _exit(136); + } + + /** Crash gracefully. + * Calls mush_panic() with its arguments formatted. + * \param msg printf()-style format string. + */ + void + mush_panicf(const char *msg, ...) + { + #ifdef HAS_VSNPRINTF + char c[BUFFER_LEN]; + #else + char c[BUFFER_LEN * 3]; + #endif + va_list args; + + va_start(args, msg); + + #ifdef HAS_VSNPRINTF + vsnprintf(c, sizeof c, msg, args); + #else + vsprintf(c, msg, args); + #endif + c[BUFFER_LEN - 1] = '\0'; + va_end(args); + + mush_panic(c); } /** Dump the database. *************** *** 695,703 **** start_time = time((time_t *) 0); if (!first_start_time) first_start_time = start_time; - do_rawlog(LT_ERR, "%s", VERSION); - do_rawlog(LT_ERR, T("MUSH restarted, PID %d, at %s"), - (int) getpid(), show_time(start_time, 0)); /* initialize all the hash and prefix tables */ init_flagspaces(); --- 731,736 ---- *************** *** 718,726 **** --- 751,767 ---- local_configs(); conf_default_set(); config_file_startup(conf, 0); + start_all_logs(); + #ifndef macintosh + redirect_stderr(); + #endif /* Initialize the attribute chunk storage */ chunk_init(); + + do_rawlog(LT_ERR, "%s", VERSION); + do_rawlog(LT_ERR, T("MUSH restarted, PID %d, at %s"), + (int) getpid(), show_time(start_time, 0)); } /** Post-db-load configuration. *************** *** 930,936 **** /** Check each attribute on each object in x for a $command matching cptr */ #define list_match(x) list_check(x, player, '$', ':', cptr, 0) /** Check each attribute on x for a $command matching cptr */ ! #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 --- 971,989 ---- /** Check each attribute on each object in x for a $command matching cptr */ #define list_match(x) list_check(x, player, '$', ':', cptr, 0) /** Check each attribute on x for a $command matching cptr */ ! #define cmd_match(x) atr_comm_match(x, player, '$', ':', cptr, 0, NULL, NULL, &errdb) ! #define MAYBE_ADD_ERRDB(errdb) \ ! do { \ ! if (GoodObject(errdb)) { \ ! if ((errdbtail - errdblist) >= errdbsize) \ ! errdb_grow(); \ ! if ((errdbtail - errdblist) < errdbsize) { \ ! *errdbtail = errdb; \ ! errdbtail++; \ ! } \ ! errdb = NOTHING; \ ! } \ ! } while(0) /** Attempt to match and execute a command. * This function performs some sanity checks and then attempts to *************** *** 960,966 **** --- 1013,1025 ---- char temp[BUFFER_LEN]; /* utility */ int i; /* utility */ char *cptr; + dbref errdb; + dbref check_loc; + if (!errdblist) + errdblist = mush_malloc(errdbsize * sizeof(dbref), "errdblist"); + errdbtail = errdblist; + errdb = NOTHING; depth = 0; if (!command) { do_log(LT_ERR, NOTHING, NOTHING, T("ERROR: No command!!!")); *************** *** 984,1004 **** T("Attempt to execute command by halted object #%d"), player); return; } ! /* Players and things should not have invalid locations. This check * must be done _after_ the destroyed-object check. */ ! if ((!GoodObject(Location(player)) || ! (IsGarbage(Location(player)))) && Mobile(player)) { notify_format(Owner(player), T("Invalid location on command execution: %s(#%d)"), Name(player), player); do_log(LT_ERR, NOTHING, NOTHING, T("Command attempted by %s(#%d) in invalid location #%d."), Name(player), player, Location(player)); ! moveto(player, PLAYER_START); /* move it someplace valid */ } orator = player; if (options.log_commands || Suspect(player)) do_log(LT_CMD, player, NOTHING, "%s", command); --- 1043,1066 ---- T("Attempt to execute command by halted object #%d"), player); return; } ! /* Players, things, and exits should not have invalid locations. This check * must be done _after_ the destroyed-object check. */ ! check_loc = IsExit(player) ? Source(player) : (IsRoom(player) ? player : ! Location(player)); ! if (!GoodObject(check_loc) || IsGarbage(check_loc)) { notify_format(Owner(player), T("Invalid location on command execution: %s(#%d)"), Name(player), player); do_log(LT_ERR, NOTHING, NOTHING, T("Command attempted by %s(#%d) in invalid location #%d."), Name(player), player, Location(player)); ! if (Mobile(player)) ! moveto(player, PLAYER_START); /* move it someplace valid */ } orator = player; + log_activity(LA_CMD, player, command); if (options.log_commands || Suspect(player)) do_log(LT_CMD, player, NOTHING, "%s", command); *************** *** 1035,1075 **** cptr = command_parse(player, cause, command, from_port); if (cptr) { a = 0; ! if (!Gagged(player) && Mobile(player)) { ! ! /* if the "player" is an exit or room, no need to do these checks */ ! /* try matching enter aliases */ ! if (Location(player) != NOTHING && ! (i = alias_list_check(Contents(Location(player)), ! cptr, "EALIAS")) != -1) { ! ! sprintf(temp, "#%d", i); ! do_enter(player, temp); ! goto done; ! } ! /* if that didn't work, try matching leave aliases */ ! if (!IsRoom(Location(player)) && ! (loc_alias_check(Location(player), cptr, "LALIAS"))) { ! do_leave(player); ! goto done; } /* try matching user defined functions before chopping */ /* try objects in the player's location, the location itself, * and objects in the player's inventory. */ ! if (GoodObject(Location(player))) { ! a += list_match(Contents(Location(player))); ! if (Location(player) != player) ! a += cmd_match(Location(player)); } ! if (Location(player) != player) a += list_match(Contents(player)); /* 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 */ --- 1097,1139 ---- cptr = command_parse(player, cause, command, from_port); if (cptr) { a = 0; ! if (!Gagged(player)) { ! if (Mobile(player)) { ! /* if the "player" is an exit or room, no need to do these checks */ ! /* try matching enter aliases */ ! if (check_loc != NOTHING && ! (i = alias_list_check(Contents(check_loc), cptr, "EALIAS")) != -1) { ! ! sprintf(temp, "#%d", i); ! do_enter(player, temp); ! goto done; ! } ! /* if that didn't work, try matching leave aliases */ ! if (!IsRoom(check_loc) && (loc_alias_check(check_loc, cptr, "LALIAS"))) { ! do_leave(player); ! goto done; ! } } + /* try matching user defined functions before chopping */ /* try objects in the player's location, the location itself, * and objects in the player's inventory. */ ! if (GoodObject(check_loc)) { ! a += list_match(Contents(check_loc)); ! if (check_loc != player) { ! a += cmd_match(check_loc); ! MAYBE_ADD_ERRDB(errdb); ! } } ! if (check_loc != player) a += list_match(Contents(player)); /* now do check on zones */ ! if ((!a) && (Zone(check_loc) != NOTHING)) { ! if (IsRoom(Zone(check_loc))) { /* zone of player's location is a zone master room, * so we check for exits and commands */ *************** *** 1082,1107 **** 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 */ ! if ((!a) && (Location(player) != MASTER_ROOM)) { if (global_exit(player, cptr)) { if (!Mobile(player)) goto done; --- 1146,1175 ---- goto done; } } else ! a += list_match(Contents(Zone(check_loc))); ! } else { ! a += cmd_match(Zone(check_loc)); ! MAYBE_ADD_ERRDB(errdb); ! } } /* 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(check_loc) != 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)); + MAYBE_ADD_ERRDB(errdb); + } } /* end of zone stuff */ /* check global exits only if no other commands are matched */ ! if ((!a) && (check_loc != MASTER_ROOM)) { if (global_exit(player, cptr)) { if (!Mobile(player)) goto done; *************** *** 1118,1126 **** /* end of master room check */ } /* end of special checks */ if (!a) { ! notify(player, T("Huh? (Type \"help\" for help.)")); ! if (options.log_huhs) ! do_log(LT_HUH, player, 0, "%s", unp); } } --- 1186,1200 ---- /* end of master room check */ } /* end of special checks */ if (!a) { ! /* Do we have any error dbs queued up, and if so, do any ! * have associated failure messages? ! */ ! if ((errdblist == errdbtail) || (!fail_commands(player))) { ! /* Nope. This is totally unmatched */ ! notify(player, T("Huh? (Type \"help\" for help.)")); ! if (options.log_huhs) ! do_log(LT_HUH, player, 0, "%s", unp); ! } } } *************** *** 1134,1148 **** COMMAND (cmd_with) { dbref what; char *cptr = arg_right; what = noisy_match_result(player, arg_left, NOTYPE, MAT_NEARBY); if (!GoodObject(what)) return; if (!SW_ISSET(sw, SWITCH_ROOM)) { /* Run commands on a single object */ ! if (!cmd_match(what)) notify(player, T("No matching command.")); } else { /* Run commands on objects in a masterish room */ --- 1208,1227 ---- COMMAND (cmd_with) { dbref what; char *cptr = arg_right; + dbref errdb; what = noisy_match_result(player, arg_left, NOTYPE, MAT_NEARBY); if (!GoodObject(what)) return; + errdbtail = errdblist; + errdb = NOTHING; if (!SW_ISSET(sw, SWITCH_ROOM)) { /* Run commands on a single object */ ! if (!cmd_match(what)) { ! MAYBE_ADD_ERRDB(errdb); notify(player, T("No matching command.")); + } } else { /* Run commands on objects in a masterish room */ *************** *** 1207,1216 **** int just_match) { int match = 0; while (thing != NOTHING) { ! if (atr_comm_match(thing, player, type, end, str, just_match, NULL, NULL)) match = 1; thing = Next(thing); } return (match); --- 1286,1300 ---- int just_match) { int match = 0; + dbref errdb = NOTHING; while (thing != NOTHING) { ! if (atr_comm_match ! (thing, player, type, end, str, just_match, NULL, NULL, &errdb)) match = 1; + else { + MAYBE_ADD_ERRDB(errdb); + } thing = Next(thing); } return (match); *************** *** 1350,1356 **** if (IsPlayer(a)) s_Pennies(a, amt); notify_format(player, ! T("The money supply of all players has been reset to %d %s."), amt, MONIES); do_log(LT_WIZ, player, NOTHING, T("** POOR done ** Money supply reset to %d %s."), amt, MONIES); --- 1434,1441 ---- if (IsPlayer(a)) s_Pennies(a, amt); notify_format(player, ! T ! ("The money supply of all players has been reset to %d %s."), amt, MONIES); do_log(LT_WIZ, player, NOTHING, T("** POOR done ** Money supply reset to %d %s."), amt, MONIES); *************** *** 1386,1393 **** * \param placestr value for #@ token. */ void ! bind_and_queue(dbref player, dbref cause, char *action, const char *arg, ! const char *placestr) { char *repl, *command; const char *replace[2]; --- 1471,1478 ---- * \param placestr value for #@ token. */ void ! bind_and_queue(dbref player, dbref cause, char *action, ! const char *arg, const char *placestr) { char *repl, *command; const char *replace[2]; *************** *** 1409,1415 **** /** Would the scan command find an matching attribute on x for player p? */ #define ScanFind(p,x) \ (Can_Examine(p,x) && \ ! ((num = atr_comm_match(x, p, '$', ':', command, 1, atrname, &ptr)) != 0)) /** Scan for matches of $commands. * This function scans for possible matches of user-def'd commands from the --- 1494,1500 ---- /** Would the scan command find an matching attribute on x for player p? */ #define ScanFind(p,x) \ (Can_Examine(p,x) && \ ! ((num = atr_comm_match(x, p, '$', ':', command, 1, atrname, &ptr, NULL)) != 0)) /** Scan for matches of $commands. * This function scans for possible matches of user-def'd commands from the *************** *** 1482,1488 **** } } ptr = atrname; ! if ((Zone(player) != NOTHING) && (Zone(player) != Zone(Location(player)))) { /* check the player's personal zone */ if (IsRoom(Zone(player))) { if (Location(player) != Zone(player)) { --- 1567,1574 ---- } } ptr = atrname; ! if ((Zone(player) != NOTHING) ! && (Zone(player) != Zone(Location(player)))) { /* check the player's personal zone */ if (IsRoom(Zone(player))) { if (Location(player) != Zone(player)) { *************** *** 1553,1560 **** if (ScanFind(player, thing)) { *ptr = '\0'; notify_format(player, ! "%s [%d:%s]", unparse_object(player, thing), num, ! atrname); ptr = atrname; } } --- 1639,1646 ---- if (ScanFind(player, thing)) { *ptr = '\0'; notify_format(player, ! "%s [%d:%s]", unparse_object(player, thing), ! num, atrname); ptr = atrname; } } *************** *** 1610,1622 **** *ptr = '\0'; notify_format(player, T("Matched zone of location: %s [%d:%s]"), ! unparse_object(player, Zone(Location(player))), ! num, atrname); } } } ptr = atrname; ! if ((Zone(player) != NOTHING) && (Zone(player) != Zone(Location(player)))) { /* check the player's personal zone */ if (IsRoom(Zone(player))) { if (Location(player) != Zone(player)) { --- 1696,1709 ---- *ptr = '\0'; notify_format(player, T("Matched zone of location: %s [%d:%s]"), ! unparse_object(player, ! Zone(Location(player))), num, atrname); } } } ptr = atrname; ! if ((Zone(player) != NOTHING) ! && (Zone(player) != Zone(Location(player)))) { /* check the player's personal zone */ if (IsRoom(Zone(player))) { if (Location(player) != Zone(player)) { *************** *** 1731,1738 **** replace[0] = curr; replace[1] = placestr; ebufptr = ebuf = replace_string2(standard_tokens, replace, command); ! process_expression(outbuf, &bp, (char const **) &ebuf, ! player, cause, cause, PE_DEFAULT, PT_DEFAULT, NULL); mush_free(ebufptr, "replace_string.buff"); } } --- 1818,1825 ---- replace[0] = curr; replace[1] = placestr; ebufptr = ebuf = replace_string2(standard_tokens, replace, command); ! process_expression(outbuf, &bp, (char const **) &ebuf, player, ! cause, cause, PE_DEFAULT, PT_DEFAULT, NULL); mush_free(ebufptr, "replace_string.buff"); } } *************** *** 1911,1917 **** pid = getpid(); psize = getpagesize(); ! notify_format(player, T("\nProcess ID: %10u %10d bytes per page"), pid, psize); --- 1998,2005 ---- pid = getpid(); psize = getpagesize(); ! notify_format(player, ! T("\nProcess ID: %10u %10d bytes per page"), pid, psize); *************** *** 2040,2045 **** --- 2128,2136 ---- #else unix_uptime(player); #endif + + if (God(player)) + notify_activity(player, 0, 0); } *************** *** 2087,2099 **** /* Be safe in case our game directory was removed and restored, * in which case our inode is screwy */ if (getcwd(workdir, BUFFER_LEN)) { if (chdir(workdir) < 0) ! fprintf(stderr, "chdir to %s failed in db_open_write, errno %d (%s)\n", workdir, errno, strerror(errno)); } else { /* If this fails, we probably can't write to a log, either, though */ ! fprintf(stderr, "getcwd failed during db_open_write, errno %d (%s)\n", errno, strerror(errno)); } #ifndef macintosh --- 2178,2197 ---- /* Be safe in case our game directory was removed and restored, * in which case our inode is screwy */ + #ifdef WIN32 + if (GetCurrentDirectory(BUFFER_LEN, workdir)) { + if (SetCurrentDirectory(workdir) < 0) + #else if (getcwd(workdir, BUFFER_LEN)) { if (chdir(workdir) < 0) ! #endif ! fprintf(stderr, ! "chdir to %s failed in db_open_write, errno %d (%s)\n", workdir, errno, strerror(errno)); } else { /* If this fails, we probably can't write to a log, either, though */ ! fprintf(stderr, ! "getcwd failed during db_open_write, errno %d (%s)\n", errno, strerror(errno)); } #ifndef macintosh *************** *** 2249,2252 **** --- 2347,2380 ---- unlink(result); sprintf(result, "%s.#%d#", basename, the_epoch); return result; + } + + + /* Given a list of dbrefs on which a command has matched but been + * denied by a lock, queue up the COMMAND`*FAILURE attributes, if + * any. + */ + static int + fail_commands(dbref player) + { + dbref *obj = errdblist; + int size = errdbtail - errdblist; + int matched = 0; + while (size--) { + matched += fail_lock(player, *obj, Command_Lock, NULL, NOTHING); + obj++; + } + errdbtail = errdblist; + return (matched > 0); + } + + /* Increase the size of the errdblist - up to some maximum */ + static void + errdb_grow(void) + { + if (errdbsize >= 50) + return; /* That's it, no more, forget it */ + errdbsize++; + errdblist = realloc(errdblist, errdbsize * sizeof(dbref)); + errdbtail = errdblist + errdbsize - 1; } *** 1_7_7.977/src/funtime.c Tue, 02 Mar 2004 17:38:38 -0600 dunemush (pennmush/c/12_funtime.c 1.11.1.14.1.1.1.7 660) --- 1_7_7.1049(w)/src/funtime.c Mon, 31 May 2004 08:42:41 -0500 dunemush (pennmush/c/12_funtime.c 1.11.1.14.1.1.1.8 660) *************** *** 266,274 **** --- 266,276 ---- tc = getdate(str); if (tc == NULL) { + #ifdef NEVER if (getdate_err <= 7) do_rawlog(LT_ERR, "getdate returned error code %d for %s", getdate_err, str); + #endif return 0; } *** 1_7_7.977/src/funstr.c Tue, 11 May 2004 10:08:19 -0500 dunemush (pennmush/c/13_funstr.c 1.28.1.1.1.2.1.4.1.6.1.1.1.1.1.2.1.1.1.1.1.1.1.1.1.1.1.1.1.1.1.1.1.2.1.3.1.5.1.3.1.2.1.1.1.1.1.1.1.1.1.14.1.14 660) --- 1_7_7.1049(w)/src/funstr.c Mon, 31 May 2004 08:42:41 -0500 dunemush (pennmush/c/13_funstr.c 1.28.1.1.1.2.1.4.1.6.1.1.1.1.1.2.1.1.1.1.1.1.1.1.1.1.1.1.1.1.1.1.1.2.1.3.1.5.1.3.1.2.1.1.1.1.1.1.1.1.1.14.1.16 660) *************** *** 1045,1050 **** --- 1045,1052 ---- wenv[1] = tptr[1]; } + extern char escaped_chars[UCHAR_MAX + 1]; + /* ARGSUSED */ FUNCTION(fun_secure) { *************** *** 1052,1109 **** * "unsafe" characters are ( ) [ ] { } $ ^ % , ; \ * these characters get replaced by spaces */ ! char *p; ! p = args[0]; ! while (*p) { ! switch (*p) { ! case '(': ! case ')': ! case '[': ! case ']': ! case '{': ! case '}': ! case '$': ! case '^': ! case '%': ! case ',': ! case ';': ! case '\\': *p = ' '; ! break; ! } ! p++; ! } safe_strl(args[0], arglens[0], buff, bp); } /* ARGSUSED */ FUNCTION(fun_escape) { ! /* another function more or less right out of 2.0 code */ ! ! char *s; ! s = args[0]; ! while (*s) { ! switch (*s) { ! default: ! if (s != args[0]) ! break; ! case '%': ! case '\\': ! case '[': ! case ']': ! case '{': ! case '}': ! case '(': ! case ')': ! case ',': ! case ';': ! safe_chr('\\', buff, bp); } - safe_chr(*s, buff, bp); - s++; } } --- 1054,1080 ---- * "unsafe" characters are ( ) [ ] { } $ ^ % , ; \ * these characters get replaced by spaces */ ! unsigned char *p; ! for (p = (unsigned char *) args[0]; *p; p++) ! if (escaped_chars[*p]) *p = ' '; ! safe_strl(args[0], arglens[0], buff, bp); } /* ARGSUSED */ FUNCTION(fun_escape) { ! unsigned char *s; ! if (arglens[0]) { ! safe_chr('\\', buff, bp); ! for (s = (unsigned char *) args[0]; *s; s++) { ! if (escaped_chars[*s]) ! safe_chr('\\', buff, bp); ! safe_chr(*s, buff, bp); } } } *** 1_7_7.977/src/fundb.c Sun, 02 May 2004 16:46:16 -0500 dunemush (pennmush/c/17_fundb.c 1.1.1.1.1.1.1.1.1.1.1.1.1.3.1.1.1.1.1.7.1.3.1.3.1.3.1.2.1.2.1.3.2.1.2.1.2.1.1.1.1.4.1.1.1.1.1.1.1.1.1.1.1.3.1.1.2.2.2.1.1.1.1.1.1.36 660) --- 1_7_7.1049(w)/src/fundb.c Mon, 31 May 2004 08:42:41 -0500 dunemush (pennmush/c/17_fundb.c 1.1.1.1.1.1.1.1.1.1.1.1.1.3.1.1.1.1.1.7.1.3.1.3.1.3.1.2.1.2.1.3.2.1.2.1.2.1.1.1.1.4.1.1.1.1.1.1.1.1.1.1.1.3.1.1.2.2.2.1.1.1.1.1.1.38 660) *************** *** 11,18 **** #include "config.h" #include #include "conf.h" - #include "dbdefs.h" #include "externs.h" #include "flags.h" #include "match.h" --- 11,18 ---- #include "config.h" #include #include "conf.h" #include "externs.h" + #include "dbdefs.h" #include "flags.h" #include "match.h" *************** *** 1493,1499 **** { dbref looker; int pref_type; ! dbref item; char *p; int keys = 0; int ambig_ok = 0; --- 1493,1499 ---- { dbref looker; int pref_type; ! dbref item, loc; char *p; int keys = 0; int ambig_ok = 0; *************** *** 1587,1597 **** else item = last_match_result(looker, args[1], pref_type, match_flags); ! if (GoodObject(item) && (force_type && pref_type != NOTYPE ! && !(Typeof(item) == pref_type))) ! safe_dbref(NOTHING, buff, bp); ! else safe_dbref(item, buff, bp); } --- 1587,1621 ---- else item = last_match_result(looker, args[1], pref_type, match_flags); ! if (!GoodObject(item)) { safe_dbref(item, buff, bp); + return; + } + + if (force_type && pref_type != NOTYPE && !(Typeof(item) == pref_type)) { + safe_dbref(NOTHING, buff, bp); + return; + } + + /* To locate it, you must either be able to examine its location + * or be able to see the item. + */ + loc = Location(item); + if (GoodObject(loc)) { + if (Can_Examine(executor, loc)) + safe_dbref(item, buff, bp); + else if (can_interact(item, executor, INTERACT_SEE) + && (!DarkLegal(item) || (Dark(loc) && Light(item)))) + safe_dbref(item, buff, bp); + else + safe_dbref(NOTHING, buff, bp); + } else { + if (can_interact(item, executor, INTERACT_SEE) && !DarkLegal(item)) + safe_dbref(item, buff, bp); + else + safe_dbref(NOTHING, buff, bp); + } + return; } *** 1_7_7.977/src/function.c Sun, 02 May 2004 16:46:16 -0500 dunemush (pennmush/c/18_function.c 1.29.1.14.1.3.1.6.1.1.1.1.1.14.1.2.1.1.1.7.1.22.1.11.1.3.1.13 660) --- 1_7_7.1049(w)/src/function.c Mon, 31 May 2004 08:42:41 -0500 dunemush (pennmush/c/18_function.c 1.29.1.14.1.3.1.6.1.1.1.1.1.14.1.2.1.1.1.7.1.22.1.11.1.3.1.18 660) *************** *** 13,21 **** #include #include #include "conf.h" #include "attrib.h" #include "dbdefs.h" - #include "externs.h" #include "mushdb.h" #include "function.h" #include "match.h" --- 13,21 ---- #include #include #include "conf.h" + #include "externs.h" #include "attrib.h" #include "dbdefs.h" #include "mushdb.h" #include "function.h" #include "match.h" *************** *** 379,384 **** --- 379,385 ---- {"NEXT", fun_next, 1, 1, FN_REG}, {"NOR", fun_nor, 1, INT_MAX, FN_REG}, {"NOT", fun_not, 1, 1, FN_REG}, + {"NSCEMIT", fun_cemit, 2, 3, FN_REG}, {"NSEMIT", fun_emit, 1, -1, FN_REG}, {"NSLEMIT", fun_lemit, 1, -1, FN_REG}, {"NSOEMIT", fun_oemit, 2, -2, FN_REG}, *************** *** 472,477 **** --- 473,480 ---- {"SPACE", fun_space, 1, 1, FN_REG}, {"SPELLNUM", fun_spellnum, 1, 1, FN_REG}, {"SPLICE", fun_splice, 3, 4, FN_REG}, + {"SQL", fun_sql, 1, 3, FN_REG}, + {"SQLESCAPE", fun_sql_escape, 1, 1, FN_REG}, {"SQUISH", fun_squish, 1, 2, FN_REG}, {"SSL", fun_ssl, 1, 1, FN_REG}, {"STARTTIME", fun_starttime, 0, 0, FN_REG}, *** 1_7_7.977/src/flags.c Tue, 11 May 2004 10:52:49 -0500 dunemush (pennmush/c/20_flags.c 1.1.1.1.1.1.1.1.1.1.1.1.1.6.1.2.1.1.1.1.1.2.2.2.2.1.2.1.1.3.1.2.1.1.1.1.1.1.1.1.1.3.1.9.1.2.2.1.1.2.1.56.1.12.1.1.1.17 660) --- 1_7_7.1049(w)/src/flags.c Mon, 31 May 2004 08:42:41 -0500 dunemush (pennmush/c/20_flags.c 1.1.1.1.1.1.1.1.1.1.1.1.1.6.1.2.1.1.1.1.1.2.2.2.2.1.2.1.1.3.1.2.1.1.1.1.1.1.1.1.1.3.1.9.1.2.2.1.1.2.1.56.1.12.1.1.1.21 660) *************** *** 29,38 **** #include #include "conf.h" #include "command.h" #include "attrib.h" #include "mushdb.h" - #include "externs.h" #include "parse.h" #include "match.h" #include "ptab.h" --- 29,38 ---- #include #include "conf.h" + #include "externs.h" #include "command.h" #include "attrib.h" #include "mushdb.h" #include "parse.h" #include "match.h" #include "ptab.h" *************** *** 694,703 **** --- 694,706 ---- F_INHERIT); add_flag("ORPHAN", 'i', NOTYPE, F_ANY, F_ANY); add_flag("HEAVY", '\0', NOTYPE, F_ROYAL, F_ANY); + add_power("Sql_Ok", '\0', NOTYPE, F_WIZARD, F_ANY); if ((f = match_flag("TERSE"))) f->type |= TYPE_THING; if ((f = match_flag("PUPPET"))) f->type |= TYPE_ROOM; + if ((f = match_flag("SUSPECT"))) + f->type = NOTYPE; if ((f = match_flag("NOSPOOF"))) { f->type = NOTYPE; f->letter = '"'; *** 1_7_7.977/src/extmail.c Sat, 01 May 2004 14:18:30 -0500 dunemush (pennmush/c/22_extmail.c 1.44.1.7.1.5.1.9.1.1.1.1.1.15 660) --- 1_7_7.1049(w)/src/extmail.c Mon, 31 May 2004 08:42:41 -0500 dunemush (pennmush/c/22_extmail.c 1.44.1.7.1.5.1.9.1.1.1.1.1.16 660) *************** *** 73,81 **** #include #include "conf.h" #include "mushdb.h" #include "dbdefs.h" - #include "externs.h" #include "match.h" #include "extmail.h" #include "malias.h" --- 73,81 ---- #include #include "conf.h" + #include "externs.h" #include "mushdb.h" #include "dbdefs.h" #include "match.h" #include "extmail.h" #include "malias.h" *** 1_7_7.977/src/extchat.c Tue, 11 May 2004 10:08:19 -0500 dunemush (pennmush/c/23_extchat.c 1.1.1.1.1.1.1.1.1.2.1.1.1.3.1.1.1.5.1.1.1.1.1.5.1.2.1.3.1.3.1.1.1.4.1.2.1.6.1.2.1.1.2.4.2.9.1.2.1.2.1.3.1.2.1.2.1.1.1.1.1.1.1.1.1.1.1.1.1.1.1.1.1.3.1.2.1.1.2.1.1.2.1.1.1.1.1.1.1.1.1.16.1.13 660) --- 1_7_7.1049(w)/src/extchat.c Mon, 31 May 2004 08:42:41 -0500 dunemush (pennmush/c/23_extchat.c 1.1.1.1.1.1.1.1.1.2.1.1.1.3.1.1.1.5.1.1.1.1.1.5.1.2.1.3.1.3.1.1.1.4.1.2.1.6.1.2.1.1.2.4.2.9.1.2.1.2.1.3.1.2.1.2.1.1.1.1.1.1.1.1.1.1.1.1.1.1.1.1.1.3.1.2.1.1.2.1.1.2.1.1.1.1.1.1.1.1.1.16.1.21 660) *************** *** 17,26 **** #include #include #include "conf.h" #include "attrib.h" #include "mushdb.h" #include "match.h" - #include "externs.h" #include "flags.h" #include "extchat.h" #include "ansi.h" --- 17,26 ---- #include #include #include "conf.h" + #include "externs.h" #include "attrib.h" #include "mushdb.h" #include "match.h" #include "flags.h" #include "extchat.h" #include "ansi.h" *************** *** 30,35 **** --- 30,36 ---- #include "parse.h" #include "lock.h" #include "log.h" + #include "game.h" #include "dbdefs.h" #include "function.h" #include "command.h" *************** *** 73,84 **** static void do_channel_who(dbref player, CHAN *chan); void chat_player_announce(dbref player, char *msg, int ungag); static int ok_channel_name(const char *n); - static void channel_allocate_buffer(CHAN *c, int lines); - static void channel_reallocate_buffer(CHAN *c, int lines); - static void channel_free_buffer(CHAN *c); - static void channel_push_buffer(CHAN *c, char *tbuf1); - static void channel_shift_buffer(CHAN *c, int space_needed); - static int channel_buffer_lines(CHAN *c); static void format_channel_broadcast(CHAN *chan, CHANUSER *u, dbref victim, int flags, const char *msg, const char *extra); --- 74,79 ---- *************** *** 239,246 **** ChanNumUsers(ch) = 0; ChanMaxUsers(ch) = 0; ChanUsers(ch) = NULL; ! ChanBuffer(ch) = NULL; ! ChanBufferSize(ch) = 0; return ch; } --- 234,240 ---- ChanNumUsers(ch) = 0; ChanMaxUsers(ch) = 0; ChanUsers(ch) = NULL; ! ChanBufferQ(ch) = NULL; return ch; } *************** *** 1381,1390 **** * \param player the enactor. * \param name name of the channel. * \param msg message to emit. ! * \param noisy if 1, prepend the channel name to the message. */ void ! do_cemit(dbref player, const char *name, const char *msg, int noisy) { CHAN *chan = NULL; CHANUSER *u; --- 1375,1384 ---- * \param player the enactor. * \param name name of the channel. * \param msg message to emit. ! * \param flags PEMIT_* flags. */ void ! do_cemit(dbref player, const char *name, const char *msg, int flags) { CHAN *chan = NULL; CHANUSER *u; *************** *** 1437,1446 **** notify(player, T("What do you want to emit?")); return; } ! if (noisy) ! channel_broadcast(chan, player, CB_NOSPOOF, "<%s> %s", ChanName(chan), msg); else ! channel_broadcast(chan, player, CB_NOSPOOF, "%s", msg); if (!canhear) notify_format(player, T("Cemit to channel %s: %s"), ChanName(chan), msg); ChanNumMsgs(chan)++; --- 1431,1442 ---- notify(player, T("What do you want to emit?")); return; } ! if (!(flags & PEMIT_SILENT)) ! channel_broadcast(chan, player, (flags & PEMIT_SPOOF) ? 0 : CB_NOSPOOF, ! "<%s> %s", ChanName(chan), msg); else ! channel_broadcast(chan, player, (flags & PEMIT_SPOOF) ? 0 : CB_NOSPOOF, ! "%s", msg); if (!canhear) notify_format(player, T("Cemit to channel %s: %s"), ChanName(chan), msg); ChanNumMsgs(chan)++; *************** *** 1889,1895 **** u ? (Chanuser_Gag(u) ? "Gag" : "On") : "Off", (u &&Chanuser_Quiet(u)) ? 'Q' : ' ', (u &&Chanuser_Hide(u)) ? 'H' : ' ', ! channel_buffer_lines(c)); } } if (SUPPORT_PUEBLO) --- 1885,1891 ---- u ? (Chanuser_Gag(u) ? "Gag" : "On") : "Off", (u &&Chanuser_Quiet(u)) ? 'Q' : ' ', (u &&Chanuser_Hide(u)) ? 'H' : ' ', ! bufferq_lines(ChanBufferQ(c))); } } if (SUPPORT_PUEBLO) *************** *** 2306,2315 **** notify_format(player, T("Owner: %s"), Name(ChanCreator(c))); notify_format(player, T("Flags: %s"), privs_to_string(priv_table, ChanType(c))); ! if (ChanBuffer(c)) notify_format(player, T("Recall buffer: %dk, with %d lines stored."), ! channel_buffer_lines(c) * 8, ChanNumBuffered(c)); found++; } } --- 2302,2312 ---- notify_format(player, T("Owner: %s"), Name(ChanCreator(c))); notify_format(player, T("Flags: %s"), privs_to_string(priv_table, ChanType(c))); ! if (ChanBufferQ(c)) notify_format(player, T("Recall buffer: %dk, with %d lines stored."), ! BufferQSize(ChanBufferQ(c)), ! bufferq_lines(ChanBufferQ(c))); found++; } } *************** *** 2371,2379 **** if (ChanTitle(c)) notify_format(player, "@channel/desc %s = %s", ChanName(c), ChanTitle(c)); ! if (ChanBuffer(c)) notify_format(player, "@channel/buffer %s = %d", ChanName(c), ! channel_buffer_lines(c)); if (!brief) { for (u = ChanUsers(c); u; u = u->next) { if (!Chanuser_Hide(u) || Priv_Who(player)) --- 2368,2376 ---- if (ChanTitle(c)) notify_format(player, "@channel/desc %s = %s", ChanName(c), ChanTitle(c)); ! if (ChanBufferQ(c)) notify_format(player, "@channel/buffer %s = %d", ChanName(c), ! bufferq_lines(ChanBufferQ(c))); if (!brief) { for (u = ChanUsers(c); u; u = u->next) { if (!Chanuser_Hide(u) || Priv_Who(player)) *************** *** 2735,2754 **** /* ARGSUSED */ FUNCTION(fun_cemit) { ! int noisy = 0; ! ! if (!command_check_byname(executor, "@cemit") || fun->flags & FN_NOSIDEFX) { safe_str(T(e_perm), buff, bp); return; } if (nargs == 3 && parse_boolean(args[2])) ! noisy = 1; orator = executor; ! do_cemit(executor, args[0], args[1], noisy); } COMMAND (cmd_cemit) { ! do_cemit(player, arg_left, arg_right, SW_ISSET(sw, SWITCH_NOISY)); } COMMAND (cmd_channel) { --- 2732,2757 ---- /* ARGSUSED */ FUNCTION(fun_cemit) { ! int ns = string_prefix(called_as, "NS"); ! int flags = PEMIT_SILENT; ! flags |= (ns ? PEMIT_SPOOF : 0); ! if (!command_check_byname(executor, ns ? "@nsemit" : "@emit") || ! fun->flags & FN_NOSIDEFX) { safe_str(T(e_perm), buff, bp); return; } if (nargs == 3 && parse_boolean(args[2])) ! flags &= ~PEMIT_SILENT; orator = executor; ! do_cemit(executor, args[0], args[1], flags); } COMMAND (cmd_cemit) { ! int spflags = !strcmp(cmd->name, "@NSCEMIT") ? PEMIT_SPOOF : 0; ! SPOOF(player, cause, sw); ! if (!SW_ISSET(sw, SWITCH_NOISY)) ! spflags |= PEMIT_SILENT; ! do_cemit(player, arg_left, arg_right, spflags); } COMMAND (cmd_channel) { *************** *** 2880,3012 **** nac.u = ChanUsers(channel); nac.checkquiet = (flags & CB_CHECKQUIET) ? 1 : 0; ! notify_anything(player, na_channel, &nac, ! (flags & CB_NOSPOOF) ? ns_esnotify : NULL, ! (flags & CB_PRESENCE) ? NA_INTER_PRESENCE : NA_INTER_HEAR, ! tbuf1); ! channel_push_buffer(channel, tbuf1); ! } ! ! static void ! channel_push_buffer(CHAN *c, char *tbuf1) ! { ! int len = strlen(tbuf1); ! int room = len + sizeof(len) + sizeof(time_t) + 1; ! if (!ChanBuffer(c)) ! return; ! if (room > ChanBufferSize(c)) ! return; ! if ((ChanBufferEnd(c) > ChanBuffer(c)) && ! ((ChanBufferSize(c) - (ChanBufferEnd(c) - ChanBuffer(c))) < room)) ! channel_shift_buffer(c, room); ! memcpy(ChanBufferEnd(c), &len, sizeof(len)); ! ChanBufferEnd(c) += sizeof(len); ! memcpy(ChanBufferEnd(c), &mudtime, sizeof(time_t)); ! ChanBufferEnd(c) += sizeof(time_t); ! memcpy(ChanBufferEnd(c), tbuf1, len + 1); ! ChanBufferEnd(c) += len + 1; ! ChanNumBuffered(c)++; ! } ! ! static void ! channel_shift_buffer(CHAN *c, int space_needed) ! { ! char *p = ChanBuffer(c); ! int size, jump; ! int skipped = 0; ! ! while ((space_needed > 0) && (p < ChanBufferEnd(c))) { ! /* First 4 bytes is the size of the first string, not including \0 */ ! memcpy(&size, p, sizeof(size)); ! /* Jump to the start of the next string */ ! jump = size + sizeof(size) + sizeof(time_t) + 1; ! p += jump; ! space_needed -= jump; ! skipped++; ! } ! ! if ((p != ChanBufferEnd(c)) && (space_needed > 0)) { ! /* Not good. We couldn't get the space we needed even after we ! * emptied the buffer. This should never happen, but if it does, ! * we'll just log a fault and do nothing. ! */ ! do_rawlog(LT_ERR, "Unable to get enough buffer space on channel %s", ! ChanName(c)); ! return; ! } ! ! /* Shift everything here and after up to the front ! * At this point, p may be pointing at the very end of the buffer, ! * in which case, we just move it to the front with no shifting. ! */ ! if (p < ChanBufferEnd(c)) ! memmove(ChanBuffer(c), p, ChanBufferEnd(c) - p); ! ChanBufferEnd(c) -= (p - ChanBuffer(c)); ! ChanNumBuffered(c) -= skipped; ! } ! ! /* Size of buffer in lines */ ! static int ! channel_buffer_lines(CHAN *c) ! { ! if (ChanBuffer(c)) ! return ChanBufferSize(c) / (BUFFER_LEN + sizeof(int) + sizeof(time_t)); ! else ! return 0; ! } ! ! /* Allocate a channel buffer and return the size in bytes. ! * The channel buffer should hold enough space for the given ! * number of lines (in full) plus an initial int for each line ! * giving its size ! */ ! static void ! channel_allocate_buffer(CHAN *c, int lines) ! { ! int bytes = lines * (BUFFER_LEN + sizeof(int) + sizeof(time_t)); ! ChanBuffer(c) = mush_malloc(bytes, "channel.buffer"); ! *ChanBuffer(c) = '\0'; ! ChanBufferEnd(c) = ChanBuffer(c); ! ChanNumBuffered(c) = 0; ! ChanBufferSize(c) = bytes; ! } ! ! static void ! channel_reallocate_buffer(CHAN *c, int lines) ! { ! char *newbuff; ! ptrdiff_t bufflen; ! int bytes = lines * (BUFFER_LEN + sizeof(int) + sizeof(time_t)); ! /* If we were accidentally called without a buffer, deal */ ! if (!ChanBuffer(c)) { ! channel_allocate_buffer(c, lines); ! return; ! } ! /* Are we not changing size? */ ! if (ChanBufferSize(c) == bytes) ! return; ! if (ChanBufferSize(c) > bytes) { ! /* Shrinking the buffer */ ! if ((ChanBufferEnd(c) - ChanBuffer(c)) >= bytes) ! channel_shift_buffer(c, ChanBufferEnd(c) - ChanBuffer(c) - bytes); ! } ! bufflen = ChanBufferEnd(c) - ChanBuffer(c); ! newbuff = realloc(ChanBuffer(c), bytes); ! if (newbuff) { ! ChanBuffer(c) = newbuff; ! ChanBufferEnd(c) = ChanBuffer(c) + bufflen; ! ChanBufferSize(c) = bytes; ! } ! } ! ! static void ! channel_free_buffer(CHAN *c) ! { ! if (ChanBuffer(c)) ! mush_free(ChanBuffer(c), "channel.buffer"); ! ChanBuffer(c) = ChanBufferEnd(c) = NULL; ! ChanBufferSize(c) = 0; ! ChanNumBuffered(c) = 0; } --- 2883,2894 ---- nac.u = ChanUsers(channel); nac.checkquiet = (flags & CB_CHECKQUIET) ? 1 : 0; ! notify_anything(player, na_channel, &nac, ns_esnotify, ! ((flags & CB_PRESENCE) ? NA_INTER_PRESENCE : NA_INTER_HEAR) | ! ((flags & CB_NOSPOOF) ? 0 : NA_SPOOF), tbuf1); ! if (ChanBufferQ(channel)) ! add_to_bufferq(ChanBufferQ(channel), 0, ! (flags & CB_NOSPOOF) ? player : NOTHING, tbuf1); } *************** *** 3027,3036 **** CHAN *chan; CHANUSER *u; int num_lines = 10; /* Default if none is given */ ! char *p; ! int size; time_t timestamp; ! char tbuf1[BUFFER_LEN], *stamp; if (!name || !*name) { notify(player, T("You need to specify a channel.")); --- 2909,2920 ---- CHAN *chan; CHANUSER *u; int num_lines = 10; /* Default if none is given */ ! char *p = NULL, *buf; time_t timestamp; ! char *stamp; ! int skip; ! dbref speaker; ! int type; if (!name || !*name) { notify(player, T("You need to specify a channel.")); *************** *** 3066,3106 **** notify(player, T("CHAT: You must join a channel to recall from it.")); return; } ! if (!ChanBuffer(chan)) { notify(player, T("CHAT: That channel doesn't have a recall buffer.")); return; } ! if (ChanBuffer(chan) == ChanBufferEnd(chan)) { notify(player, T("CHAT: Nothing to recall.")); return; } ! p = ChanBuffer(chan); ! /* Do we need to skip any lines? */ ! if (num_lines < ChanNumBuffered(chan)) { ! int skip = ChanNumBuffered(chan) - num_lines; ! while (skip) { ! memcpy(&size, p, sizeof(size)); ! p += sizeof(size) + sizeof(time_t) + size + 1; ! skip--; ! } ! } ! /* Now show everything from this point on */ notify_format(player, T("CHAT: Recall from channel <%s>"), ChanName(chan)); ! while (p < ChanBufferEnd(chan)) { ! memcpy(&size, p, sizeof size); ! p += sizeof size; ! memcpy(×tamp, p, sizeof timestamp); ! p += sizeof timestamp; ! memcpy(tbuf1, p, size + 1); ! if (quiet) { ! notify(player, tbuf1); ! } else { ! stamp = show_time(timestamp, 0); ! notify_format(player, "[%s] %s", stamp, tbuf1); } ! p += size + 1; ! } notify(player, T("CHAT: End recall")); if (!lines || !*lines) notify_format(player, --- 2950,2995 ---- notify(player, T("CHAT: You must join a channel to recall from it.")); return; } ! if (!ChanBufferQ(chan)) { notify(player, T("CHAT: That channel doesn't have a recall buffer.")); return; } ! if (isempty_bufferq(ChanBufferQ(chan))) { notify(player, T("CHAT: Nothing to recall.")); return; } ! skip = BufferQNum(ChanBufferQ(chan)) - num_lines; notify_format(player, T("CHAT: Recall from channel <%s>"), ChanName(chan)); ! ! do { ! buf = iter_bufferq(ChanBufferQ(chan), &p, &speaker, &type, ×tamp); ! if (skip <= 0) { ! if (buf) { ! if (Nospoof(player) && GoodObject(speaker)) { ! char *nsmsg = ! ns_esnotify(speaker, na_one, &player, Paranoid(player) ? 1 : 0); ! if (quiet) ! notify_format(player, "%s %s", nsmsg, buf); ! else { ! stamp = show_time(timestamp, 0); ! notify_format(player, "[%s] %s %s", stamp, nsmsg, buf); ! } ! mush_free(nsmsg, "string"); ! } else { ! if (quiet) ! notify(player, buf); ! else { ! stamp = show_time(timestamp, 0); ! notify_format(player, "[%s] %s", stamp, buf); ! } ! } ! } } ! skip--; ! } while (buf); ! ! notify(player, T("CHAT: End recall")); if (!lines || !*lines) notify_format(player, *************** *** 3143,3150 **** } if (!size) { /* Remove a channel's buffer */ ! if (ChanBuffer(chan)) { ! channel_free_buffer(chan); notify_format(player, T("CHAT: Channel buffering disabled for channel <%s>."), ChanName(chan)); --- 3032,3040 ---- } if (!size) { /* Remove a channel's buffer */ ! if (ChanBufferQ(chan)) { ! free_bufferq(ChanBufferQ(chan)); ! ChanBufferQ(chan) = NULL; notify_format(player, T("CHAT: Channel buffering disabled for channel <%s>."), ChanName(chan)); *************** *** 3155,3168 **** ChanName(chan)); } } else { ! if (ChanBuffer(chan)) { /* Resize a buffer */ ! channel_reallocate_buffer(chan, size); notify_format(player, T("CHAT: Resizing buffer of channel <%s>"), ChanName(chan)); } else { /* Start a new buffer */ ! channel_allocate_buffer(chan, size); notify_format(player, T("CHAT: Buffering enabled on channel <%s>."), ChanName(chan)); --- 3045,3058 ---- ChanName(chan)); } } else { ! if (ChanBufferQ(chan)) { /* Resize a buffer */ ! ChanBufferQ(chan) = reallocate_bufferq(ChanBufferQ(chan), size); notify_format(player, T("CHAT: Resizing buffer of channel <%s>"), ChanName(chan)); } else { /* Start a new buffer */ ! ChanBufferQ(chan) = allocate_bufferq(size); notify_format(player, T("CHAT: Buffering enabled on channel <%s>."), ChanName(chan)); *** 1_7_7.977/src/db.c Sat, 01 May 2004 13:51:07 -0500 dunemush (pennmush/c/25_db.c 1.26.1.1.1.1.1.6.1.1.1.20 660) --- 1_7_7.1049(w)/src/db.c Mon, 31 May 2004 08:42:41 -0500 dunemush (pennmush/c/25_db.c 1.26.1.1.1.1.1.6.1.1.1.21 660) *************** *** 20,28 **** #include #include #include "conf.h" #include "mushdb.h" #include "attrib.h" - #include "externs.h" #include "mymalloc.h" #include "game.h" #include "flags.h" --- 20,28 ---- #include #include #include "conf.h" + #include "externs.h" #include "mushdb.h" #include "attrib.h" #include "mymalloc.h" #include "game.h" #include "flags.h" *** 1_7_7.977/src/csrimalloc.c Wed, 30 Apr 2003 12:36:53 -0500 dunemush (pennmush/c/26_csrimalloc 1.23.1.7 660) --- 1_7_7.1049(w)/src/csrimalloc.c Mon, 31 May 2004 08:42:41 -0500 dunemush (pennmush/c/26_csrimalloc 1.23.1.8 660) *************** *** 55,63 **** */ #include - #ifndef errno - extern int errno; /* Some errno.h don't declare this */ - #endif #ifndef REGISTER #ifdef __GNUC__ --- 55,60 ---- *** 1_7_7.977/src/create.c Tue, 11 May 2004 10:52:49 -0500 dunemush (pennmush/c/27_create.c 1.27.1.3.1.1.1.1.1.1.1.2.1.1.1.1.1.25 660) --- 1_7_7.1049(w)/src/create.c Mon, 31 May 2004 08:42:41 -0500 dunemush (pennmush/c/27_create.c 1.27.1.3.1.1.1.1.1.1.1.2.1.1.1.1.1.26 660) *************** *** 10,18 **** #include "config.h" #include #include "conf.h" #include "mushdb.h" #include "attrib.h" - #include "externs.h" #include "match.h" #include "extchat.h" #include "log.h" --- 10,18 ---- #include "config.h" #include #include "conf.h" + #include "externs.h" #include "mushdb.h" #include "attrib.h" #include "match.h" #include "extchat.h" #include "log.h" *** 1_7_7.977/src/conf.c Thu, 06 May 2004 00:31:00 -0500 dunemush (pennmush/c/31_conf.c 1.41.2.3.1.3.1.2.1.15.1.1.1.1.1.1.1.33 660) --- 1_7_7.1049(w)/src/conf.c Mon, 31 May 2004 08:42:41 -0500 dunemush (pennmush/c/31_conf.c 1.41.2.3.1.3.1.2.1.15.1.1.1.1.1.1.1.37 660) *************** *** 195,200 **** --- 195,216 ---- , {"pueblo", cf_bool, &options.support_pueblo, 2, 0, "net"} , + #ifdef HAS_MYSQL + {"sql_platform", cf_str, options.sql_platform, sizeof options.sql_platform, 0, + "net"} + , + {"sql_host", cf_str, options.sql_host, sizeof options.sql_host, 0, "net"} + , + {"sql_username", cf_str, options.sql_username, sizeof options.sql_username, 0, + NULL} + , + {"sql_password", cf_str, options.sql_password, sizeof options.sql_password, 0, + NULL} + , + {"sql_database", cf_str, options.sql_database, sizeof options.sql_database, 0, + NULL} + , + #endif {"forking_dump", cf_bool, &options.forking_dump, 2, 0, "dump"} , *************** *** 344,349 **** --- 360,368 ---- , {"log_forces", cf_bool, &options.log_forces, 2, 0, "log"} , + {"error_log", cf_str, options.error_log, sizeof options.error_log, 0, + "log"} + , {"command_log", cf_str, options.command_log, sizeof options.command_log, 0, "log"} , *************** *** 1061,1066 **** --- 1080,1086 ---- strcpy(options.down_file[0], "txt/down.txt"); strcpy(options.full_file[0], "txt/full.txt"); strcpy(options.guest_file[0], "txt/guest.txt"); + strcpy(options.error_log, ""); strcpy(options.connect_log, ""); strcpy(options.command_log, ""); strcpy(options.trace_log, ""); *************** *** 1163,1168 **** --- 1183,1195 ---- options.ssl_require_client_cert = 0; #endif options.mem_check = 0; + #ifdef HAS_MYSQL + strcpy(options.sql_platform, "disabled"); + strcpy(options.sql_database, ""); + strcpy(options.sql_username, ""); + strcpy(options.sql_password, ""); + strcpy(options.sql_host, "127.0.0.1"); + #endif } /* Limit how many files we can nest */ *** 1_7_7.977/src/command.c Tue, 11 May 2004 10:52:49 -0500 dunemush (pennmush/c/36_command.c 1.56.1.1.1.1.1.1.1.2.1.1.1.1.1.5.1.2.1.1.1.1.1.2.1.3.1.10.1.1.3.54 660) --- 1_7_7.1049(w)/src/command.c Mon, 31 May 2004 08:42:41 -0500 dunemush (pennmush/c/36_command.c 1.56.1.1.1.1.1.1.1.2.1.1.1.1.1.5.1.2.1.1.1.1.1.2.1.3.1.10.1.1.3.58 660) *************** *** 15,24 **** #include #include "conf.h" #include "dbdefs.h" #include "mushdb.h" #include "game.h" - #include "externs.h" #include "match.h" #include "attrib.h" #include "extmail.h" --- 15,24 ---- #include #include "conf.h" + #include "externs.h" #include "dbdefs.h" #include "mushdb.h" #include "game.h" #include "match.h" #include "attrib.h" #include "extmail.h" *************** *** 72,78 **** CMD_T_ANY | CMD_T_EQSPLIT, "WIZARD", 0}, {"@BOOT", "PORT ME", cmd_boot, CMD_T_ANY, 0, 0}, {"@BREAK", NULL, cmd_break, CMD_T_ANY, 0, 0}, ! {"@CEMIT", "NOEVAL NOISY", cmd_cemit, CMD_T_ANY | CMD_T_EQSPLIT | CMD_T_NOGAGGED, 0, 0}, {"@CHANNEL", "LIST ADD DELETE RENAME NAME PRIVS QUIET NOISY DECOMPILE DESCRIBE CHOWN WIPE MUTE UNMUTE GAG UNGAG HIDE UNHIDE WHAT TITLE BRIEF RECALL BUFFER SET", --- 72,78 ---- CMD_T_ANY | CMD_T_EQSPLIT, "WIZARD", 0}, {"@BOOT", "PORT ME", cmd_boot, CMD_T_ANY, 0, 0}, {"@BREAK", NULL, cmd_break, CMD_T_ANY, 0, 0}, ! {"@CEMIT", "NOEVAL NOISY SPOOF", cmd_cemit, CMD_T_ANY | CMD_T_EQSPLIT | CMD_T_NOGAGGED, 0, 0}, {"@CHANNEL", "LIST ADD DELETE RENAME NAME PRIVS QUIET NOISY DECOMPILE DESCRIBE CHOWN WIPE MUTE UNMUTE GAG UNGAG HIDE UNHIDE WHAT TITLE BRIEF RECALL BUFFER SET", *************** *** 185,190 **** --- 185,192 ---- {"@NEWPASSWORD", NULL, cmd_newpassword, CMD_T_ANY | CMD_T_EQSPLIT, "WIZARD", 0}, {"@NOTIFY", "ALL ANY", cmd_notify_drain, CMD_T_ANY | CMD_T_EQSPLIT, 0, 0}, + {"@NSCEMIT", "NOEVAL NOISY SPOOF", cmd_cemit, + CMD_T_ANY | CMD_T_EQSPLIT | CMD_T_NOGAGGED, "WIZARD", "CAN_NSPEMIT"}, {"@NSEMIT", "ROOM NOEVAL SILENT SPOOF", cmd_emit, CMD_T_ANY | CMD_T_NOGAGGED, "WIZARD", "CAN_NSPEMIT"}, {"@NSLEMIT", "NOEVAL SILENT SPOOF", cmd_lemit, *************** *** 233,238 **** --- 235,245 ---- CMD_T_ANY | CMD_T_EQSPLIT | CMD_T_RS_ARGS | CMD_T_RS_NOPARSE, 0, 0}, {"@SET", NULL, cmd_set, CMD_T_ANY | CMD_T_EQSPLIT | CMD_T_NOGAGGED, 0, 0}, {"@SHUTDOWN", "PANIC REBOOT PARANOID", cmd_shutdown, CMD_T_ANY, "WIZARD", 0}, + #ifdef HAS_MYSQL + {"@SQL", NULL, cmd_sql, CMD_T_ANY, "WIZARD", "SQL_OK"}, + #else + {"@SQL", NULL, cmd_unimplemented, CMD_T_ANY, "WIZARD", "SQL_OK"}, + #endif {"@SITELOCK", "BAN CHECK REGISTER REMOVE NAME", cmd_sitelock, CMD_T_ANY | CMD_T_EQSPLIT | CMD_T_RS_ARGS, "WIZARD", 0}, {"@STATS", "CHUNKS FREESPACE PAGING REGIONS TABLES", cmd_stats, *************** *** 278,283 **** --- 285,291 ---- {"DISMISS", NULL, cmd_dismiss, CMD_T_PLAYER | CMD_T_THING, 0, 0}, {"DROP", NULL, cmd_drop, CMD_T_PLAYER | CMD_T_THING, 0, 0}, {"EXAMINE", "ALL BRIEF DEBUG MORTAL", cmd_examine, CMD_T_ANY, 0, 0}, + {"EMPTY", NULL, cmd_empty, CMD_T_PLAYER | CMD_T_THING | CMD_T_NOGAGGED, 0, 0}, {"ENTER", NULL, cmd_enter, CMD_T_ANY, 0, 0}, {"FOLLOW", NULL, cmd_follow, *** 1_7_7.977/src/cmds.c Sat, 01 May 2004 14:18:30 -0500 dunemush (pennmush/c/37_cmds.c 1.33.1.1.1.2.1.2.2.3.1.1.1.2.1.1.1.3.1.8.1.1.2.2.2.20.1.3.1.7.1.2.1.9 660) --- 1_7_7.1049(w)/src/cmds.c Mon, 31 May 2004 08:42:40 -0500 dunemush (pennmush/c/37_cmds.c 1.33.1.1.1.2.1.2.2.3.1.1.1.2.1.1.1.3.1.8.1.1.2.2.2.20.1.3.1.7.1.2.1.12 660) *************** *** 14,22 **** #include #include "conf.h" #include "dbdefs.h" #include "mushdb.h" - #include "externs.h" #include "match.h" #include "game.h" #include "attrib.h" --- 14,22 ---- #include #include "conf.h" + #include "externs.h" #include "dbdefs.h" #include "mushdb.h" #include "match.h" #include "game.h" #include "attrib.h" *************** *** 756,771 **** } COMMAND (cmd_shutdown) { ! int paranoid; if (!Wizard(player)) { notify(player, T("You don't have the authority to do that!")); return; } ! paranoid = (SW_ISSET(sw, SWITCH_PARANOID)) ? 1 : 0; if (SW_ISSET(sw, SWITCH_REBOOT)) ! do_reboot(player, paranoid); else if (SW_ISSET(sw, SWITCH_PANIC)) ! do_shutdown(player, -1); else do_shutdown(player, paranoid); } --- 756,771 ---- } COMMAND (cmd_shutdown) { ! enum shutdown_type paranoid; if (!Wizard(player)) { notify(player, T("You don't have the authority to do that!")); return; } ! paranoid = SW_ISSET(sw, SWITCH_PARANOID) ? SHUT_PARANOID : SHUT_NORMAL; if (SW_ISSET(sw, SWITCH_REBOOT)) ! do_reboot(player, paranoid == SHUT_PARANOID); else if (SW_ISSET(sw, SWITCH_PANIC)) ! do_shutdown(player, SHUT_PANIC); else do_shutdown(player, paranoid); } *************** *** 935,940 **** --- 935,944 ---- do_examine(player, arg_left, 2, all); else do_examine(player, arg_left, 0, all); + } + + COMMAND (cmd_empty) { + do_empty(player, arg_left); } COMMAND (cmd_enter) { *** 1_7_7.977/src/bsd.c Tue, 11 May 2004 10:52:49 -0500 dunemush (pennmush/c/38_bsd.c 1.58.1.11.1.2.1.5.1.7.1.14.1.13.1.9.1.4.1.2.1.12.1.1.1.1.1.2.1.1.1.13.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.1.1.3.1.8.2.1.1.1.1.1.1.1.1.2.1.1.1.1.1.1.1.1.1.1.1.1.1.9.1.1.1.27 660) --- 1_7_7.1049(w)/src/bsd.c Mon, 31 May 2004 08:42:40 -0500 dunemush (pennmush/c/38_bsd.c 1.58.1.11.1.2.1.5.1.7.1.14.1.13.1.9.1.4.1.2.1.12.1.1.1.1.1.2.1.1.1.13.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.1.1.3.1.8.2.1.1.1.1.1.1.1.1.2.1.1.1.1.1.1.1.1.1.1.1.1.1.9.1.1.1.32 660) *************** *** 95,103 **** #include #endif #include "chunk.h" #include "mushdb.h" - #include "externs.h" #include "dbdefs.h" #include "flags.h" #include "lock.h" --- 95,103 ---- #include #endif + #include "externs.h" #include "chunk.h" #include "mushdb.h" #include "dbdefs.h" #include "flags.h" #include "lock.h" *************** *** 161,171 **** extern time_t start_time; /**< When was the mush last rebooted? */ extern time_t first_start_time; /**< When was the mush first started? */ extern int reboot_count; /**< How many times have we been rebooted? */ ! #ifndef WIN32 ! #ifndef errno ! extern int errno; /**< Error number for routines that use it */ ! #endif ! #endif static int extrafd; int shutdown_flag = 0; /**< Is it time to shut down? */ extern int paranoid_dump; /**< Are we doing a paranoid dump? */ --- 161,167 ---- extern time_t start_time; /**< When was the mush last rebooted? */ extern time_t first_start_time; /**< When was the mush first started? */ extern int reboot_count; /**< How many times have we been rebooted? */ ! extern int database_loaded; /* From game.c */ static int extrafd; int shutdown_flag = 0; /**< Is it time to shut down? */ extern int paranoid_dump; /**< Are we doing a paranoid dump? */ *************** *** 537,544 **** #ifndef macintosh /* read the configuration file */ ! if (argc < 3) { ! fprintf(stderr, "ERROR: Usage: %s config_file error_log_file\n", argv[0]); exit(2); } #endif --- 533,540 ---- #ifndef macintosh /* read the configuration file */ ! if (argc < 2) { ! fprintf(stderr, "ERROR: Usage: %s /path/to/config_file\n", argv[0]); exit(2); } #endif *************** *** 585,608 **** fpsetmask(0L); #endif - /* open the log files */ - #ifndef macintosh - strncpy(errlog, argv[2], BUFFER_LEN - 1); - errlog[BUFFER_LEN - 1] = '\0'; - newerr = fopen(errlog, "a"); - if (!newerr) { - fprintf(stderr, T("Unable to open %s. Error output to stderr.\n"), errlog); - } else { - fprintf(stderr, T("Redirecting output to: %s\n"), errlog); - if (!freopen(errlog, "a", stderr)) { - printf(T("Ack! Failed reopening stderr!")); - exit(1); - } - setvbuf(stderr, NULL, _IOLBF, BUFSIZ); - fclose(newerr); - } - #endif - time(&mudtime); /* If we have setlocale, call it to set locale info --- 581,586 ---- *************** *** 654,661 **** confname[BUFFER_LEN - 1] = '\0';