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'; init_game_config(confname); - start_all_logs(); - /* save a file descriptor */ reserve_fd(); #ifndef macintosh --- 632,637 ---- *************** *** 679,684 **** --- 655,662 ---- init_game_postdb(confname); + database_loaded = 1; + set_signals(); #ifdef INFO_SLAVE *************** *** 780,785 **** --- 758,764 ---- #endif close_sockets(); + sql_shutdown(); #ifdef INFO_SLAVE kill_info_slave(); *************** *** 3337,3346 **** void bailout(int sig) { ! char tbuf1[BUFFER_LEN]; ! sprintf(tbuf1, T("BAILOUT: caught signal %d"), sig); ! mush_panic(tbuf1); ! _exit(7); } /* To-do: What about OS X? */ --- 3316,3322 ---- void bailout(int sig) { ! mush_panicf(T("BAILOUT: caught signal %d"), sig); } /* To-do: What about OS X? */ *** 1_7_7.977/src/boolexp.c Tue, 11 May 2004 10:08:19 -0500 dunemush (pennmush/c/39_boolexp.c 1.1.1.17.1.1.1.13.1.2.1.19 660) --- 1_7_7.1049(w)/src/boolexp.c Mon, 31 May 2004 08:42:40 -0500 dunemush (pennmush/c/39_boolexp.c 1.1.1.17.1.1.1.13.1.2.1.21 660) *************** *** 181,186 **** --- 181,187 ---- OP_TCHANNEL, /**< Tests CHANNEL^ARG */ OP_TIP, /**< Tests IP^ARG */ OP_THOSTNAME, /**< Tests HOSTNAME^ARG */ + OP_TOBJID, /**< Tests OBJID^ARG */ OP_LOADS, /**< Load ARG into S */ OP_LOADR, /**< Load ARG into R */ OP_NEGR, /**< Negate R */ *************** *** 236,241 **** --- 237,243 ---- {"POWER", OP_TPOWER}, {"TYPE", OP_TTYPE}, {"CHANNEL", OP_TCHANNEL}, + {"OBJID", OP_TOBJID}, {"IP", OP_TIP}, {"HOSTNAME", OP_THOSTNAME}, {NULL, 0} *************** *** 506,511 **** --- 508,520 ---- else r = 0; break; + case OP_TOBJID: + { + dbref d; + d = parse_objid(bytecode + arg); + r = (player == d); + break; + } case OP_TCHANNEL: { CHAN *chan; *************** *** 716,721 **** --- 725,733 ---- case OP_TPOWER: safe_format(boolexp_buf, &buftop, "POWER^%s", bytecode + arg); break; + case OP_TOBJID: + safe_format(boolexp_buf, &buftop, "OBJID^%s", bytecode + arg); + break; case OP_TCHANNEL: safe_format(boolexp_buf, &buftop, "CHANNEL^%s", bytecode + arg); break; *************** *** 1562,1567 **** --- 1574,1580 ---- case OP_TATR: case OP_TFLAG: case OP_TPOWER: + case OP_TOBJID: case OP_TTYPE: case OP_TCHANNEL: case OP_TIP: *************** *** 1767,1772 **** --- 1780,1788 ---- break; case OP_TPOWER: printf("TPOWER \"%s\"\n", bytecode + arg); + break; + case OP_TOBJID: + printf("TOBJID \"%s\"\n", bytecode + arg); break; case OP_TTYPE: printf("TTYPE \"%s\"\n", bytecode + arg); *** 1_7_7.977/src/attrib.c Tue, 11 May 2004 10:08:19 -0500 dunemush (pennmush/c/40_attrib.c 1.15.1.2.1.5.1.1.1.3.1.3.1.2.1.2.1.2.2.1.1.2.1.2.1.2.1.1.1.3.1.1.1.1.1.1.3.43.1.4 660) --- 1_7_7.1049(w)/src/attrib.c Mon, 31 May 2004 08:42:40 -0500 dunemush (pennmush/c/40_attrib.c 1.15.1.2.1.5.1.1.1.3.1.3.1.2.1.2.1.2.2.1.1.2.1.2.1.2.1.1.1.3.1.1.1.1.1.1.3.43.1.9 660) *************** *** 11,20 **** #include #include #include "conf.h" #include "chunk.h" #include "attrib.h" #include "dbdefs.h" - #include "externs.h" #include "match.h" #include "parse.h" #include "htab.h" --- 11,20 ---- #include #include #include "conf.h" + #include "externs.h" #include "chunk.h" #include "attrib.h" #include "dbdefs.h" #include "match.h" #include "parse.h" #include "htab.h" *************** *** 31,41 **** #pragma warning( disable : 4761) /* disable warning re conversion */ #endif - - /** A string tree that temporarily stores matching attributes from current - * and parent objects when we're searching for commands on attributes - */ - StrTree temp_attrib; /** A string tree of attribute names in use, to save us memory since * many are duplicated. */ --- 31,36 ---- *************** *** 45,51 **** /** A flag to show if we're in the middle of a @wipe (this changes * behaviour for atr_clr()). Yes, this is gross and ugly, but it ! * seemed like a better idea than propogating a signature changes * for atr_clr() and do_set_atr() through the entire codebase. If * you come up with a better way, PLEASE fix this... */ --- 40,46 ---- /** A flag to show if we're in the middle of a @wipe (this changes * behaviour for atr_clr()). Yes, this is gross and ugly, but it ! * seemed like a better idea than propogating signature changes * for atr_clr() and do_set_atr() through the entire codebase. If * you come up with a better way, PLEASE fix this... */ *************** *** 72,77 **** --- 67,76 ---- static ATTR *atr_free_list; static ATTR *get_atr_free_list(void); + static ATTR *find_atr_pos_in_list(ATTR ***pos, char const *name); + static int can_create_attr(dbref player, dbref obj, char const *atr_name, + int flags); + static ATTR *find_atr_in_list(ATTR *atr, char const *name); /*======================================================================*/ *************** *** 147,152 **** --- 146,196 ---- return NULL; } + /** Scan an attribute list for an attribute with the specified name. + * This continues from whatever start point is passed in. + * \param atr the start of the list to search from + * \param name the attribute name to look for + * \return the matching attribute, or NULL + */ + static ATTR * + find_atr_in_list(ATTR *atr, char const *name) + { + int comp; + + while (atr) { + comp = strcoll(name, AL_NAME(atr)); + if (comp < 0) + return NULL; + if (comp == 0) + return atr; + atr = AL_NEXT(atr); + } + + return NULL; + } + + /** Find the place to insert/delete an attribute with the specified name. + * \param pos a pointer to the ATTR ** holding the list position + * \param name the attribute name to look for + * \return the matching attribute, or NULL if no matching attribute + */ + static ATTR * + find_atr_pos_in_list(ATTR ***pos, char const *name) + { + int comp; + + while (**pos) { + comp = strcoll(name, AL_NAME(**pos)); + if (comp < 0) + return NULL; + if (comp == 0) + return **pos; + *pos = &AL_NEXT(**pos); + } + + return NULL; + } + /** Convert a string of attribute flags to a bitmask. * Given a space-separated string of attribute flags, look them up * and return a bitmask of them if player is permitted to use *************** *** 180,185 **** --- 224,483 ---- return privs_to_string(attr_privs, mask); } + /*======================================================================*/ + + /** Traversal routine for Can_Read_Attr. + * This function determines if an attribute can be read by examining + * the tree path to the attribute. This is not the full Can_Read_Attr + * check; only the stuff after See_All (just to avoid function calls + * when the answer is trivialized by special powers). If the specified + * player is NOTHING, then we're doing a generic mortal visibility check. + * \param player the player trying to do the read. + * \param obj the object targetted for the read (may be a child of a parent!). + * \param atr the attribute being interrogated. + * \retval 0 if the player cannot read the attribute. + * \retval 1 if the player can read the attribute. + */ + int + can_read_attr_internal(dbref player, dbref obj, ATTR *atr) + { + static char name[ATTRIBUTE_NAME_LIMIT + 1]; + char *p; + int control; + int exam; + int canlook; + dbref target; + dbref ancestor; + int visible; + int parent_depth; + visible = (player == NOTHING); + if (visible) { + control = 0; + exam = (Visual(obj) && + eval_lock(PLAYER_START, obj, Examine_Lock) && + eval_lock(MASTER_ROOM, obj, Examine_Lock)); + canlook = 0; + } else { + control = controls(player, obj); + exam = (Visual(obj) && eval_lock(player, obj, Examine_Lock)); + canlook = can_look_at(player, obj); + } + + /* Take an easy out if there is one... */ + /* If we can't see the attribute itself, then that's easy. */ + if (AF_Internal(atr) || AF_Mdark(atr) || + !(control || exam || + (AF_Visual(atr) && (!AF_Nearby(atr) || canlook)) || + (!visible && !Mistrust(player) && + (Owner(AL_CREATOR(atr)) == Owner(player))))) + return 0; + /* If the attribute isn't on a branch, then that's also easy. */ + if (!strchr(AL_NAME(atr), '`')) + return 1; + /* Nope, we actually have to go looking for the attribute in a tree. */ + strcpy(name, AL_NAME(atr)); + ancestor = Ancestor_Parent(obj); + target = obj; + parent_depth = 0; + while (parent_depth < MAX_PARENTS && GoodObject(target)) { + /* If the ancestor of the object is in its explict parent chain, + * we use it there, and don't check the ancestor later. + */ + if (target == ancestor) + ancestor = NOTHING; + atr = List(target); + /* Check along the branch for permissions... */ + for (p = strchr(name, '`'); p; p = strchr(p + 1, '`')) { + *p = '\0'; + atr = find_atr_in_list(atr, name); + if (!atr || (target != obj && AF_Private(atr))) { + *p = '`'; + goto continue_target; + } + if (AF_Internal(atr) || AF_Mdark(atr) || + !(control || exam || + (AF_Visual(atr) && (!AF_Nearby(atr) || canlook)) || + (!visible && !Mistrust(player) && + (Owner(AL_CREATOR(atr)) == Owner(player))))) + return 0; + *p = '`'; + } + + /* Now actually find the attribute. */ + atr = find_atr_in_list(atr, name); + if (atr) + return 1; + + continue_target: + + /* Attribute wasn't on this object. Check a parent or ancestor. */ + parent_depth++; + target = Parent(target); + if (!GoodObject(target)) { + parent_depth = 0; + target = ancestor; + } + } + + return 0; + } + + /** Utility define for can_write_attr_internal and can_create_attr. + * \param p the player trying to write + * \param a the attribute to be written + * \param s obey the safe flag? + */ + #define Cannot_Write_This_Attr(p,a,s) \ + (!God((p)) && \ + (AF_Internal((a)) || \ + ((s) && AF_Safe((a))) || \ + !(Wizard((p)) || \ + (!AF_Wizard((a)) && \ + (!AF_Locked((a)) || (AL_CREATOR((a)) == Owner((p)))))))) + + /** Traversal routine for Can_Write_Attr. + * This function determines if an attribute can be written by examining + * the tree path to the attribute. As a side effect, missing_name is + * set to the name of a missing prefix branch, if any. Yes, side effects + * are evil. Please fix if you can. + * \param player the player trying to do the write. + * \param obj the object targetted for the write. + * \param atr the attribute being interrogated. + * \param safe whether to check the safe attribute flag. + * \retval 0 if the player cannot write the attribute. + * \retval 1 if the player can write the attribute. + */ + int + can_write_attr_internal(dbref player, dbref obj, ATTR *atr, int safe) + { + char *p; + missing_name[0] = '\0'; + if (Cannot_Write_This_Attr(player, atr, safe)) + return 0; + strcpy(missing_name, AL_NAME(atr)); + atr = List(obj); + for (p = strchr(missing_name, '`'); p; p = strchr(p + 1, '`')) { + *p = '\0'; + atr = find_atr_in_list(atr, missing_name); + if (!atr) + return 0; + if (Cannot_Write_This_Attr(player, atr, safe)) { + missing_name[0] = '\0'; + return 0; + } + *p = '`'; + } + + return 1; + } + + /** Utility define for atr_add and can_create_attr */ + #define set_default_flags(atr,flags) \ + do { \ + ATTR *std = atr_match(AL_NAME((atr))); \ + if (std && !strcmp(AL_NAME(std), AL_NAME((atr)))) { \ + AL_FLAGS(atr) = AL_FLAGS(std); \ + } else { \ + AL_FLAGS(atr) = 0; \ + if (flags != NOTHING) \ + AL_FLAGS(atr) |= flags; \ + } \ + } while (0) + + /** Can an attribute of specified name be created? + * This function determines if an attribute can be created by examining + * the tree path to the attribute, and the standard attribute flags for + * those parts of the path that don't exist yet. + * \param player the player trying to do the write. + * \param obj the object targetted for the write. + * \param atr the attribute being interrogated. + * \param flags the default flags to add to the attribute. + * \retval 0 if the player cannot write the attribute. + * \retval 1 if the player can write the attribute. + */ + static int + can_create_attr(dbref player, dbref obj, char const *atr_name, int flags) + { + char *p; + ATTR tmpatr, *atr; + int num_new = 1; + missing_name[0] = '\0'; + + atr = &tmpatr; + AL_CREATOR(atr) = player; + AL_NAME(atr) = atr_name; + set_default_flags(atr, flags); + if (Cannot_Write_This_Attr(player, atr, 1)) + return 0; + + strcpy(missing_name, atr_name); + atr = List(obj); + for (p = strchr(missing_name, '`'); p; p = strchr(p + 1, '`')) { + *p = '\0'; + if (atr != &tmpatr) + atr = find_atr_in_list(atr, missing_name); + if (!atr) { + atr = &tmpatr; + AL_CREATOR(atr) = Owner(player); + } + if (atr == &tmpatr) { + AL_NAME(atr) = missing_name; + set_default_flags(atr, flags); + num_new++; + } + if (Cannot_Write_This_Attr(player, atr, 1)) { + missing_name[0] = '\0'; + return 0; + } + *p = '`'; + } + + if (AttrCount(obj) + num_new > MAX_ATTRCOUNT) { + do_log(LT_ERR, player, obj, + T("Attempt by %s(%d) to create too many attributes on %s(%d)"), + Name(player), player, Name(obj), obj); + return 0; + } + + return 1; + } + + /*======================================================================*/ + + /** Do the work of creating the attribute entry on an object. + * This doesn't do any permissions checking. You should do that yourself. + * \param thing the object to hold the attribute + * \param atr_name the name for the attribute + */ + static ATTR * + create_atr(dbref thing, char const *atr_name) + { + ATTR *ptr, **ins; + char const *name; + + /* put the name in the string table */ + name = st_insert(atr_name, &atr_names); + if (!name) + return NULL; + + /* allocate a new page, if needed */ + ptr = get_atr_free_list(); + atr_free_list = AL_NEXT(ptr); + + /* initialize atr */ + AL_NAME(ptr) = name; + ptr->data = NULL_CHUNK_REFERENCE; + + /* link it in */ + ins = &List(thing); + (void) find_atr_pos_in_list(&ins, AL_NAME(ptr)); + AL_NEXT(ptr) = *ins; + *ins = ptr; + AttrCount(thing)++; + + return ptr; + } + /** Add an attribute to an object, dangerously. * This is a stripped down version of atr_add, without duplicate checking, * permissions checking, attribute count checking, or auto-ODARKing. *************** *** 197,236 **** dbref player, int flags, unsigned char derefs) { ATTR *ptr; - char const *name; - ATTR **ins; if (!EMPTY_ATTRS && !*s) return; - ptr = get_atr_free_list(); - atr_free_list = AL_NEXT(ptr); - /* Don't fail on a bad name, but do log it */ if (!good_atr_name(atr)) do_rawlog(LT_ERR, T("Bad attribute name %s on object %s"), atr, unparse_dbref(thing)); ! /* put the name in the string table */ ! name = st_insert(atr, &atr_names); ! if (!name) { ! AL_NEXT(ptr) = atr_free_list; ! atr_free_list = ptr; return; ! } ! /* initialize atr */ ! AL_NAME(ptr) = name; AL_FLAGS(ptr) = (flags != NOTHING) ? flags : 0; AL_FLAGS(ptr) &= ~AF_COMMAND & ~AF_LISTEN; AL_CREATOR(ptr) = player; - ptr->data = NULL_CHUNK_REFERENCE; - - /* link it in */ - ins = &List(thing); - while (*ins && strcoll(AL_NAME(*ins), AL_NAME(ptr)) < 0) - ins = &AL_NEXT(*ins); - AL_NEXT(ptr) = *ins; - *ins = ptr; /* replace string with new string */ if (!s || !*s) { --- 495,516 ---- dbref player, int flags, unsigned char derefs) { ATTR *ptr; if (!EMPTY_ATTRS && !*s) return; /* Don't fail on a bad name, but do log it */ if (!good_atr_name(atr)) do_rawlog(LT_ERR, T("Bad attribute name %s on object %s"), atr, unparse_dbref(thing)); ! ptr = create_atr(thing, atr); ! if (!ptr) return; ! AL_FLAGS(ptr) = (flags != NOTHING) ? flags : 0; AL_FLAGS(ptr) &= ~AF_COMMAND & ~AF_LISTEN; AL_CREATOR(ptr) = player; /* replace string with new string */ if (!s || !*s) { *************** *** 241,251 **** return; ptr->data = chunk_create(t, u_strlen(t), derefs); free(t); } - if (*s == '$') - AL_FLAGS(ptr) |= AF_COMMAND; - if (*s == '^') - AL_FLAGS(ptr) |= AF_LISTEN; } /** Attribute error - invalid name */ --- 521,532 ---- return; ptr->data = chunk_create(t, u_strlen(t), derefs); free(t); + + if (*s == '$') + AL_FLAGS(ptr) |= AF_COMMAND; + if (*s == '^') + AL_FLAGS(ptr) |= AF_LISTEN; } } /** Attribute error - invalid name */ *************** *** 275,300 **** atr_add(dbref thing, const char *RESTRICT atr, const char *RESTRICT s, dbref player, int flags) { ! ATTR *ptr, *std; ! char const *name; ! ATTR **ins; ! int comp = 0; ! ! if (!s) ! return atr_clr(thing, atr, player); ! if (!EMPTY_ATTRS && !*s) return atr_clr(thing, atr, player); if (!good_atr_name(atr)) return AE_BADNAME; /* walk the list, looking for a preexisting value */ ! ptr = List(thing); ! while (ptr && (comp = strcoll(atr, AL_NAME(ptr))) > 0) ! ptr = AL_NEXT(ptr); ! if (comp) ! ptr = NULL; /* check for permission to modify existing atr */ if (ptr && AF_Safe(ptr)) --- 556,572 ---- atr_add(dbref thing, const char *RESTRICT atr, const char *RESTRICT s, dbref player, int flags) { ! ATTR *ptr; ! char *p; ! if (!s || (!EMPTY_ATTRS && !*s)) return atr_clr(thing, atr, player); if (!good_atr_name(atr)) return AE_BADNAME; /* walk the list, looking for a preexisting value */ ! ptr = find_atr_in_list(List(thing), atr); /* check for permission to modify existing atr */ if (ptr && AF_Safe(ptr)) *************** *** 304,352 **** /* make a new atr, if needed */ if (!ptr) { ! /* allocate a new page, if needed */ ! ptr = get_atr_free_list(); ! atr_free_list = AL_NEXT(ptr); ! ! /* put the name in the string table */ ! name = st_insert(atr, &atr_names); ! if (!name) { ! AL_NEXT(ptr) = atr_free_list; ! atr_free_list = ptr; return AE_ERROR; } - /* initialize atr */ - AL_NAME(ptr) = name; - std = atr_match(atr); - if (std && !strcmp(AL_NAME(std), atr)) { - AL_FLAGS(ptr) = AL_FLAGS(std); - } else { - AL_FLAGS(ptr) = 0; - if (flags != NOTHING) - AL_FLAGS(ptr) |= flags; - } - AL_CREATOR(ptr) = player; - ptr->data = NULL_CHUNK_REFERENCE; ! /* check for permission to create atr */ ! if (!Can_Write_Attr(player, thing, ptr) || ! (AttrCount(thing) >= MAX_ATTRCOUNT)) { ! st_delete(AL_NAME(ptr), &atr_names); ! AL_NEXT(ptr) = atr_free_list; ! atr_free_list = ptr; ! if (AttrCount(thing) >= MAX_ATTRCOUNT) ! do_log(LT_ERR, player, thing, ! T("Attempt by %s(%d) to create too many attributes on %s(%d)"), ! Name(player), player, Name(thing), thing); return AE_ERROR; ! } ! /* link it in */ ! ins = &List(thing); ! while (*ins && strcoll(AL_NAME(*ins), AL_NAME(ptr)) < 0) ! ins = &AL_NEXT(*ins); ! AL_NEXT(ptr) = *ins; ! *ins = ptr; ! AttrCount(thing)++; } /* update modification time here, because from now on, * we modify even if we fail */ --- 576,621 ---- /* make a new atr, if needed */ if (!ptr) { ! if (!can_create_attr(player, thing, atr, flags)) return AE_ERROR; + + strcpy(missing_name, atr); + ptr = List(thing); + for (p = strchr(missing_name, '`'); p; p = strchr(p + 1, '`')) { + *p = '\0'; + + ptr = find_atr_in_list(ptr, missing_name); + + if (!ptr) { + ptr = create_atr(thing, missing_name); + if (!ptr) + return AE_ERROR; + + /* update modification time here, because from now on, + * we modify even if we fail */ + if (!IsPlayer(thing) && !AF_Nodump(ptr)) + ModTime(thing) = mudtime; + + set_default_flags(ptr, flags); + AL_FLAGS(ptr) &= ~AF_COMMAND & ~AF_LISTEN; + AL_CREATOR(ptr) = Owner(player); + if (!EMPTY_ATTRS) { + unsigned char *t = compress(" "); + if (!t) + return AE_ERROR; + ptr->data = chunk_create(t, u_strlen(t), 0); + free(t); + } + } + + *p = '`'; } ! ptr = create_atr(thing, atr); ! if (!ptr) return AE_ERROR; ! ! set_default_flags(ptr, flags); } /* update modification time here, because from now on, * we modify even if we fail */ *************** *** 371,381 **** } ptr->data = chunk_create(t, u_strlen(t), 0); free(t); } - if (*s == '$') - AL_FLAGS(ptr) |= AF_COMMAND; - if (*s == '^') - AL_FLAGS(ptr) |= AF_LISTEN; return 1; } --- 640,651 ---- } ptr->data = chunk_create(t, u_strlen(t), 0); free(t); + + if (*s == '$') + AL_FLAGS(ptr) |= AF_COMMAND; + if (*s == '^') + AL_FLAGS(ptr) |= AF_LISTEN; } return 1; } *************** *** 394,410 **** atr_clr(dbref thing, char const *atr, dbref player) { ATTR *ptr, **prev, *sub; - int comp = 0; size_t len; prev = &List(thing); ! ptr = *prev; ! while (ptr && (comp = strcoll(atr, AL_NAME(ptr))) > 0) { ! prev = &AL_NEXT(ptr); ! ptr = *prev; ! } ! if (comp) ! ptr = NULL; if (!ptr) return 0; --- 664,673 ---- atr_clr(dbref thing, char const *atr, dbref player) { ATTR *ptr, **prev, *sub; size_t len; prev = &List(thing); ! ptr = find_atr_pos_in_list(&prev, atr); if (!ptr) return 0; *************** *** 414,420 **** if (!Can_Write_Attr(player, thing, ptr)) return AE_ERROR; - len = strlen(AL_NAME(ptr)); sub = atr_sub_branch(ptr); if (!we_are_wiping && sub) return AE_ERROR; --- 677,682 ---- *************** *** 426,431 **** --- 688,695 ---- if (ptr->data) chunk_delete(ptr->data); + + len = strlen(AL_NAME(ptr)); st_delete(AL_NAME(ptr), &atr_names); AL_NEXT(ptr) = atr_free_list; *************** *** 474,480 **** int parent_depth; dbref target; dbref ancestor; - int comp; if (obj == NOTHING || !good_atr_name(atrname)) return NULL; --- 738,743 ---- *************** *** 499,514 **** if (target != obj) { for (p = strchr(name, '`'); p; p = strchr(p + 1, '`')) { *p = '\0'; ! while (atr) { ! comp = strcoll(name, AL_NAME(atr)); ! if (comp < 0) { ! *p = '`'; ! goto continue_target; ! } ! if (comp == 0) ! break; ! atr = AL_NEXT(atr); ! } if (!atr || AF_Private(atr)) { *p = '`'; goto continue_target; --- 762,768 ---- if (target != obj) { for (p = strchr(name, '`'); p; p = strchr(p + 1, '`')) { *p = '\0'; ! atr = find_atr_in_list(atr, name); if (!atr || AF_Private(atr)) { *p = '`'; goto continue_target; *************** *** 518,535 **** } /* Now actually find the attribute. */ ! while (atr) { ! comp = strcoll(name, AL_NAME(atr)); ! if (comp < 0) ! break; ! if (comp == 0) { ! if (target == obj || !AF_Private(atr)) ! return atr; ! else ! break; ! } ! atr = AL_NEXT(atr); ! } continue_target: /* Attribute wasn't on this object. Check a parent or ancestor. */ --- 772,780 ---- } /* Now actually find the attribute. */ ! atr = find_atr_in_list(atr, name); ! if (atr && (target == obj || !AF_Private(atr))) ! return atr; continue_target: /* Attribute wasn't on this object. Check a parent or ancestor. */ *************** *** 566,584 **** atr_get_noparent(dbref thing, char const *atr) { ATTR *ptr; - int comp; if (thing == NOTHING || !good_atr_name(atr)) return NULL; /* try real name */ ! for (ptr = List(thing); ptr; ptr = AL_NEXT(ptr)) { ! comp = strcoll(atr, AL_NAME(ptr)); ! if (comp < 0) ! break; ! if (comp == 0) ! return ptr; ! } ptr = atr_match(atr); if (!ptr || !strcmp(atr, AL_NAME(ptr))) --- 811,824 ---- atr_get_noparent(dbref thing, char const *atr) { ATTR *ptr; if (thing == NOTHING || !good_atr_name(atr)) return NULL; /* try real name */ ! ptr = find_atr_in_list(List(thing), atr); ! if (ptr) ! return ptr; ptr = atr_match(atr); if (!ptr || !strcmp(atr, AL_NAME(ptr))) *************** *** 586,598 **** atr = AL_NAME(ptr); /* try alias */ ! for (ptr = List(thing); ptr; ptr = AL_NEXT(ptr)) { ! comp = strcoll(atr, AL_NAME(ptr)); ! if (comp < 0) ! break; ! if (comp == 0) ! return ptr; ! } return NULL; } --- 826,834 ---- atr = AL_NAME(ptr); /* try alias */ ! ptr = find_atr_in_list(List(thing), atr); ! if (ptr) ! return ptr; return NULL; } *************** *** 780,790 **** * \param just_match if true, return match without executing code. * \param atrname used to return the list of matching object/attributes. * \param abp pointer to end of atrname. * \return number of attributes that matched, or 0 */ int atr_comm_match(dbref thing, dbref player, int type, int end, char const *str, ! int just_match, char *atrname, char **abp) { int flag_mask; ATTR *ptr; --- 1016,1028 ---- * \param just_match if true, return match without executing code. * \param atrname used to return the list of matching object/attributes. * \param abp pointer to end of atrname. + * \param errobj if an attribute matches, but the lock fails, this pointer + * is used to return the failing dbref. If NULL, we don't bother. * \return number of attributes that matched, or 0 */ int atr_comm_match(dbref thing, dbref player, int type, int end, char const *str, ! int just_match, char *atrname, char **abp, dbref *errobj) { int flag_mask; ATTR *ptr; *************** *** 797,802 **** --- 1035,1041 ---- UsedAttr *used_list, **prev; ATTR *skip[ATTRIBUTE_NAME_LIMIT / 2]; int skipcount; + int lock_checked = 0; /* check for lots of easy ways out */ if ((type != '$' && type != '^') || !GoodObject(thing) || Halted(thing) *************** *** 877,887 **** } } if (match_found) { ! if ((type == '$' && !eval_lock(player, thing, Command_Lock)) ! || (type == '^' && !eval_lock(player, thing, Listen_Lock)) ! || !eval_lock(player, thing, Use_Lock)) { ! match--; ! continue; } if (atrname && abp) { safe_chr(' ', atrname, abp); --- 1116,1137 ---- } } if (match_found) { ! /* We only want to do the lock check once, so that any side ! * effects in the lock are only performed once per utterance. ! * Thus, '$foo *r:' and '$foo b*:' on the same object will only ! * run the lock once for 'foo bar'. ! */ ! if (!lock_checked) { ! lock_checked = 1; ! if ((type == '$' && !eval_lock(player, thing, Command_Lock)) ! || (type == '^' && !eval_lock(player, thing, Listen_Lock)) ! || !eval_lock(player, thing, Use_Lock)) { ! match--; ! if (errobj) ! *errobj = thing; ! /* If we failed the lock, there's no point in continuing at all. */ ! goto exit_sequence; ! } } if (atrname && abp) { safe_chr(' ', atrname, abp); *************** *** 894,899 **** --- 1144,1151 ---- } } + /* Don't need to free used_list here, because if !parent_depth, + * we would never have allocated it. */ if (!parent_depth) return match; *************** *** 976,990 **** } } if (match_found) { ! if ((type == '$' && !eval_lock(player, thing, Command_Lock)) ! || (type == '^' && !eval_lock(player, thing, Listen_Lock)) ! || !eval_lock(player, thing, Use_Lock)) { ! match--; ! continue; } if (atrname && abp) { safe_chr(' ', atrname, abp); ! safe_dbref(thing, atrname, abp); safe_chr('/', atrname, abp); safe_str(AL_NAME(ptr), atrname, abp); } --- 1228,1256 ---- } } if (match_found) { ! /* Since we're still checking the lock on the child, not the ! * parent, we don't actually want to reset lock_checked with ! * each parent checked. Sorry for the misdirection, Alan. ! * - Alex */ ! if (!lock_checked) { ! lock_checked = 1; ! if ((type == '$' && !eval_lock(player, thing, Command_Lock)) ! || (type == '^' && !eval_lock(player, thing, Listen_Lock)) ! || !eval_lock(player, thing, Use_Lock)) { ! match--; ! if (errobj) ! *errobj = thing; ! /* If we failed the lock, there's no point in continuing at all. */ ! goto exit_sequence; ! } } if (atrname && abp) { safe_chr(' ', atrname, abp); ! if (Can_Examine(player, parent)) ! safe_dbref(parent, atrname, abp); ! else ! safe_dbref(thing, atrname, abp); ! safe_chr('/', atrname, abp); safe_str(AL_NAME(ptr), atrname, abp); } *************** *** 995,1000 **** --- 1261,1269 ---- } } } + + /* This is where I wish for 'try {} finally {}'... */ + exit_sequence: while (used_list) { UsedAttr *temp = used_list->next; mush_free(used_list, "used_attr"); *************** *** 1361,1531 **** atr_free_list = page->atrs; } return atr_free_list; - } - - /** Traversal routine for Can_Read_Attr. - * This function determines if an attribute can be read by examining - * the tree path to the attribute. This is not the full Can_Read_Attr - * check; only the stuff after See_All (just to avoid function calls - * when the answer is trivialized by special powers). If the specified - * player is NOTHING, then we're doing a generic mortal visibility check. - * \param player the player trying to do the read. - * \param obj the object targetted for the read (may be a child of a parent!). - * \param atr the attribute being interrogated. - * \retval 0 if the player cannot read the attribute. - * \retval 1 if the player can read the attribute. - */ - int - can_read_attr_internal(dbref player, dbref obj, ATTR *atr) - { - static char name[ATTRIBUTE_NAME_LIMIT + 1]; - char *p; - int control; - int exam; - int canlook; - int comp; - dbref target; - dbref ancestor; - int visible; - int parent_depth; - visible = (player == NOTHING); - if (visible) { - control = 0; - exam = (Visual(obj) && - eval_lock(PLAYER_START, obj, Examine_Lock) && - eval_lock(MASTER_ROOM, obj, Examine_Lock)); - canlook = 0; - } else { - control = controls(player, obj); - exam = (Visual(obj) && eval_lock(player, obj, Examine_Lock)); - canlook = can_look_at(player, obj); - } - - /* Take an easy out if there is one... */ - /* If we can't see the attribute itself, then that's easy. */ - if (AF_Internal(atr) || AF_Mdark(atr) || - !(control || exam || - (AF_Visual(atr) && (!AF_Nearby(atr) || canlook)) || - (!visible && !Mistrust(player) && - (Owner(AL_CREATOR(atr)) == Owner(player))))) - return 0; - /* If the attribute isn't on a branch, then that's also easy. */ - if (!strchr(AL_NAME(atr), '`')) - return 1; - /* Nope, we actually have to go looking for the attribute in a tree. */ - strcpy(name, AL_NAME(atr)); - ancestor = Ancestor_Parent(obj); - target = obj; - parent_depth = 0; - while (parent_depth < MAX_PARENTS && GoodObject(target)) { - /* If the ancestor of the object is in its explict parent chain, - * we use it there, and don't check the ancestor later. - */ - if (target == ancestor) - ancestor = NOTHING; - atr = List(target); - /* Check along the branch for permissions... */ - for (p = strchr(name, '`'); p; p = strchr(p + 1, '`')) { - *p = '\0'; - while (atr) { - comp = strcoll(name, AL_NAME(atr)); - if (comp < 0) { - *p = '`'; - goto continue_target; - } - if (comp == 0) - break; - atr = AL_NEXT(atr); - } - if (!atr || (target != obj && AF_Private(atr))) { - *p = '`'; - goto continue_target; - } - if (AF_Internal(atr) || AF_Mdark(atr) || - !(control || exam || - (AF_Visual(atr) && (!AF_Nearby(atr) || canlook)) || - (!visible && !Mistrust(player) && - (Owner(AL_CREATOR(atr)) == Owner(player))))) - return 0; - *p = '`'; - } - - /* Now actually find the attribute. */ - while (atr) { - comp = strcoll(name, AL_NAME(atr)); - if (comp < 0) - break; - if (comp == 0) - return 1; - atr = AL_NEXT(atr); - } - - continue_target: - - /* Attribute wasn't on this object. Check a parent or ancestor. */ - parent_depth++; - target = Parent(target); - if (!GoodObject(target)) { - parent_depth = 0; - target = ancestor; - } - } - - return 0; - } - - /** Traversal routine for Can_Write_Attr. - * This function determines if an attribute can be written by examining - * the tree path to the attribute. As a side effect, missing_name is - * set to the name of a missing prefix branch, if any. Yes, side effects - * are evil. Please fix if you can. - * \param player the player trying to do the write. - * \param obj the object targetted for the write. - * \param atr the attribute being interrogated. - * \param safe whether to check the safe attribute flag. - * \retval 0 if the player cannot write the attribute. - * \retval 1 if the player can write the attribute. - */ - int - can_write_attr_internal(dbref player, dbref obj, ATTR *atr, int safe) - { - char *p; - int comp; - missing_name[0] = '\0'; - if (!God(player) && - (AF_Internal(atr) || - (safe && AF_Safe(atr)) || - !(Wizard(player) || - (!AF_Wizard(atr) && - (!AF_Locked(atr) || (AL_CREATOR(atr) == Owner(player))))))) - return 0; - strcpy(missing_name, AL_NAME(atr)); - atr = List(obj); - for (p = strchr(missing_name, '`'); p; p = strchr(p + 1, '`')) { - *p = '\0'; - while (atr) { - comp = strcoll(missing_name, AL_NAME(atr)); - if (comp < 0) - return 0; - if (comp == 0) - break; - atr = AL_NEXT(atr); - } - if (!atr) - return 0; - if (!God(player) && - (AF_Internal(atr) || - (safe && AF_Safe(atr)) || - !(Wizard(player) || - (!AF_Wizard(atr) && - (!AF_Locked(atr) || (AL_CREATOR(atr) == Owner(player))))))) { - missing_name[0] = '\0'; - return 0; - } - *p = '`'; - } - - return 1; } /** Return the compressed data for an attribute. --- 1630,1635 ---- *** 1_7_7.977/hdrs/version.h Tue, 11 May 2004 10:54:19 -0500 dunemush (pennmush/c/47_version.h 1.32.1.2.1.7.1.9.1.1.1.17.1.35 660) --- 1_7_7.1049(w)/hdrs/version.h Mon, 31 May 2004 08:42:43 -0500 dunemush (pennmush/c/47_version.h 1.32.1.2.1.7.1.9.1.1.1.17.1.36 660) *************** *** 1,3 **** ! #define VERSION "PennMUSH version 1.7.7 patchlevel 31 [05/11/2004]" ! #define SHORTVN "PennMUSH 1.7.7p31" ! #define NUMVERSION 001007007031 --- 1,3 ---- ! #define VERSION "PennMUSH version 1.7.7 patchlevel 31 [05/26/2004]" ! #define SHORTVN "PennMUSH 1.7.7p32" ! #define NUMVERSION 001007007032 *** 1_7_7.977/hdrs/mushdb.h Thu, 25 Mar 2004 16:01:22 -0600 dunemush (pennmush/d/2_mushdb.h 1.1.1.9.1.1.1.27 660) --- 1_7_7.1049(w)/hdrs/mushdb.h Mon, 31 May 2004 08:42:43 -0500 dunemush (pennmush/d/2_mushdb.h 1.1.1.9.1.1.1.30 660) *************** *** 1,6 **** /* mushdb.h */ ! #include "conf.h" #include "copyrite.h" #ifndef __DB_H --- 1,6 ---- /* mushdb.h */ ! #include "config.h" #include "copyrite.h" #ifndef __DB_H *************** *** 44,49 **** --- 44,50 ---- #define Can_Cemit(x) (command_check_byname(x, "@cemit")) #define Pemit_All(x) (Wizard(x) || has_power_by_name(x,"PEMIT_ALL",NOTYPE)) + #define Sql_Ok(x) (Wizard(x) || has_power_by_name(x, "SQL_OK", NOTYPE)) /* Permission macros */ #define Can_See_Flag(p,t,f) ((!(f->perms & (F_DARK | F_MDARK | F_ODARK | F_DISABLED)) || \ *** 1_7_7.977/hdrs/lock.h Sun, 15 Feb 2004 14:11:48 -0600 dunemush (pennmush/d/6_lock.h 1.23 660) --- 1_7_7.1049(w)/hdrs/lock.h Mon, 31 May 2004 08:42:43 -0500 dunemush (pennmush/d/6_lock.h 1.25 660) *************** *** 60,67 **** boolexp key, int flags); void free_locks(lock_list *ll); int eval_lock(dbref player, dbref thing, lock_type ltype); ! void fail_lock(dbref player, dbref thing, lock_type ltype, const char *def, ! dbref loc); void do_unlock(dbref player, const char *name, lock_type type); void do_lock(dbref player, const char *name, const char *keyname, lock_type type); --- 60,67 ---- boolexp key, int flags); void free_locks(lock_list *ll); int eval_lock(dbref player, dbref thing, lock_type ltype); ! int fail_lock(dbref player, dbref thing, lock_type ltype, const char *def, ! dbref loc); void do_unlock(dbref player, const char *name, lock_type type); void do_lock(dbref player, const char *name, const char *keyname, lock_type type); *** 1_7_7.977/hdrs/game.h Sat, 01 May 2004 14:18:30 -0500 dunemush (pennmush/d/12_game.h 1.28.1.2.1.1.1.1.1.1.1.7.1.17 660) --- 1_7_7.1049(w)/hdrs/game.h Mon, 31 May 2004 08:42:43 -0500 dunemush (pennmush/d/12_game.h 1.28.1.2.1.1.1.1.1.1.1.7.1.18 660) *************** *** 80,85 **** --- 80,86 ---- extern void do_drop(dbref player, const char *name); extern void do_enter(dbref player, const char *what); extern void do_leave(dbref player); + extern void do_empty(dbref player, const char *what); extern void do_firstexit(dbref player, const char *what); /* From player.c */ *** 1_7_7.977/hdrs/flags.h Sun, 21 Mar 2004 11:07:40 -0600 dunemush (pennmush/d/14_flags.h 1.1.1.1.1.1.1.1.1.2.1.3.2.1.1.4.1.1.1.1.2.1.1.35 660) --- 1_7_7.1049(w)/hdrs/flags.h Mon, 31 May 2004 08:42:43 -0500 dunemush (pennmush/d/14_flags.h 1.1.1.1.1.1.1.1.1.2.1.3.2.1.1.4.1.1.1.1.2.1.1.36 660) *************** *** 5,11 **** #ifndef __FLAGS_H #define __FLAGS_H ! #include "conf.h" #include "ptab.h" typedef struct flag_info FLAG; --- 5,11 ---- #ifndef __FLAGS_H #define __FLAGS_H ! #include "mushtype.h" #include "ptab.h" typedef struct flag_info FLAG; *** 1_7_7.977/hdrs/externs.h Tue, 11 May 2004 10:52:49 -0500 dunemush (pennmush/d/16_externs.h 1.1.1.53.1.2.1.8.2.1.1.2.1.1.1.1.1.2.1.6.1.3.1.4.3.1.1.1.1.18.1.8.1.1.1.12 660) --- 1_7_7.1049(w)/hdrs/externs.h Mon, 31 May 2004 08:42:43 -0500 dunemush (pennmush/d/16_externs.h 1.1.1.53.1.2.1.8.2.1.1.2.1.1.1.1.1.2.1.6.1.3.1.4.3.1.1.1.1.18.1.8.1.1.1.19 660) *************** *** 6,12 **** * */ - #include "dbdefs.h" #ifndef __EXTERNS_H #define __EXTERNS_H --- 6,11 ---- *************** *** 26,32 **** #endif #include "config.h" #include "copyrite.h" ! #include "conf.h" #include "confmagic.h" #ifndef HAS_STRCASECMP #ifdef WIN32 --- 25,33 ---- #endif #include "config.h" #include "copyrite.h" ! #include "compile.h" ! #include "mushtype.h" ! #include "dbdefs.h" #include "confmagic.h" #ifndef HAS_STRCASECMP #ifdef WIN32 *************** *** 69,74 **** --- 70,77 ---- extern void init_game_config(const char *conf); extern void dump_database(void); extern void NORETURN mush_panic(const char *message); + extern void NORETURN mush_panicf(const char *fmt, ...) + __attribute__ ((__format__(__printf__, 1, 2))); extern char *scan_list(dbref player, char *command); *************** *** 96,101 **** --- 99,107 ---- char *least_idle_ip(dbref player); char *least_idle_hostname(dbref player); + /* sql.c */ + extern void sql_shutdown(void); + /* The #defs for our notify_anything hacks.. Errr. Functions */ #define NA_NORELAY 0x0001 /**< Don't relay sound */ #define NA_NOENTER 0x0002 /**< No newline at end */ *************** *** 122,127 **** --- 128,140 ---- na_lookup func, void *, int), int flags, const char *message); + extern void notify_anything_format(dbref speaker, na_lookup func, + void *fdata, + char *(*nsfunc) (dbref, + na_lookup func, + void *, int), int flags, + const char *fmt, ...) + __attribute__ ((__format__(__printf__, 6, 7))); extern void notify_anything_loc(dbref speaker, na_lookup func, void *fdata, char *(*nsfunc) (dbref, *************** *** 136,141 **** --- 149,155 ---- extern dbref na_except2(dbref current, void *data); extern dbref na_exceptN(dbref current, void *data); extern dbref na_channel(dbref current, void *data); + extern char *ns_esnotify(dbref speaker, na_lookup func, void *fdata, int para); /** Basic 'notify player with message */ #define notify(p,m) notify_anything(orator, na_one, &(p), NULL, 0, m) *************** *** 273,289 **** __attribute__ ((__format__(__printf__, 1, 2))); extern int could_doit(dbref player, dbref thing); ! extern void did_it(dbref player, dbref thing, const char *what, ! const char *def, const char *owhat, const char *odef, ! const char *awhat, dbref loc); ! extern 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); ! extern 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); extern int can_see(dbref player, dbref thing, int can_see_loc); extern int controls(dbref who, dbref what); extern int can_pay_fees(dbref who, int pennies); --- 287,303 ---- __attribute__ ((__format__(__printf__, 1, 2))); extern int could_doit(dbref player, dbref thing); ! extern int did_it(dbref player, dbref thing, const char *what, ! const char *def, const char *owhat, const char *odef, ! const char *awhat, dbref loc); ! extern 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); ! extern 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); extern int can_see(dbref player, dbref thing, int can_see_loc); extern int controls(dbref who, dbref what); extern int can_pay_fees(dbref who, int pennies); *************** *** 311,317 **** int preserve); /* From speech.c */ ! extern char *ns_esnotify(dbref speaker, na_lookup func, void *fdata, int para); extern void notify_except(dbref first, dbref exception, const char *msg, int flags); extern void notify_except2(dbref first, dbref exc1, dbref exc2, --- 325,331 ---- int preserve); /* From speech.c */ ! const char *spname(dbref thing); extern void notify_except(dbref first, dbref exception, const char *msg, int flags); extern void notify_except2(dbref first, dbref exc1, dbref exc2, *** 1_7_7.977/hdrs/extchat.h Sat, 01 May 2004 13:10:31 -0500 dunemush (pennmush/d/17_extchat.h 1.1.1.1.1.1.1.1.1.1.1.1.1.1.1.1.2.3.1.1.1.1.2.2.1.9.1.1.1.5.1.2 660) --- 1_7_7.1049(w)/hdrs/extchat.h Mon, 31 May 2004 08:42:43 -0500 dunemush (pennmush/d/17_extchat.h 1.1.1.1.1.1.1.1.1.1.1.1.1.1.1.1.2.3.1.1.1.1.2.2.1.9.1.1.1.5.1.3 660) *************** *** 43,48 **** --- 43,49 ---- #include "boolexp.h" + #include "bufferq.h" #define CU_TITLE_LEN 80 *************** *** 99,108 **** boolexp seelock; /**< Who can see this in a list */ boolexp hidelock; /**< Who may hide from view */ struct channel *next; /**< Next channel in linked list */ ! char *buffer; /**< Pointer to channel recall buffer start */ ! char *buffer_end; /**< Pointer to channel recall buffer end */ ! int buffersize; /**< Size of channel recall buffer */ ! int num_buffered; /**< Number of lines in the buffer */ }; /** A list of channels on an object. --- 100,106 ---- boolexp seelock; /**< Who can see this in a list */ boolexp hidelock; /**< Who may hide from view */ struct channel *next; /**< Next channel in linked list */ ! BUFFERQ *bufferq; /**< Pointer to channel recall buffer queue */ }; /** A list of channels on an object. *************** *** 161,170 **** #define ChanModLock(c) ((c)->modifylock) #define ChanSeeLock(c) ((c)->seelock) #define ChanHideLock(c) ((c)->hidelock) ! #define ChanBuffer(c) ((c)->buffer) ! #define ChanBufferSize(c) ((c)->buffersize) ! #define ChanBufferEnd(c) ((c)->buffer_end) ! #define ChanNumBuffered(c) ((c)->num_buffered) #define Channel_Quiet(c) (ChanType(c) & CHANNEL_QUIET) #define Channel_Open(c) (ChanType(c) & CHANNEL_OPEN) #define Channel_Object(c) (ChanType(c) & CHANNEL_OBJECT) --- 159,165 ---- #define ChanModLock(c) ((c)->modifylock) #define ChanSeeLock(c) ((c)->seelock) #define ChanHideLock(c) ((c)->hidelock) ! #define ChanBufferQ(c) ((c)->bufferq) #define Channel_Quiet(c) (ChanType(c) & CHANNEL_QUIET) #define Channel_Open(c) (ChanType(c) & CHANNEL_OPEN) #define Channel_Object(c) (ChanType(c) & CHANNEL_OBJECT) *** 1_7_7.977/hdrs/dbdefs.h Tue, 11 May 2004 10:52:49 -0500 dunemush (pennmush/d/18_dbdefs.h 1.1.1.1.1.1.1.1.1.1.1.2.2.2.1.1.1.1.1.1.2.1.1.22.1.6.1.7 660) --- 1_7_7.1049(w)/hdrs/dbdefs.h Mon, 31 May 2004 08:42:43 -0500 dunemush (pennmush/d/18_dbdefs.h 1.1.1.1.1.1.1.1.1.1.1.2.2.2.1.1.1.1.1.1.2.1.1.22.1.6.1.10 660) *************** *** 1,6 **** /* dbdefs.h */ - #include "mushdb.h" #ifndef __DBDEFS_H #define __DBDEFS_H --- 1,5 ---- *************** *** 10,15 **** --- 9,15 ---- #include #endif #include + #include "mushdb.h" #include "htab.h" #include "chunk.h" *************** *** 78,89 **** /******* Player toggles */ ! #define Suspect(x) (IS(x, TYPE_PLAYER, "SUSPECT")) /* 0x40 */ ! #define Connected(x) (IS(x, TYPE_PLAYER, "CONNECTED")) /* 0x200 */ ! #define ZMaster(x) (IS(x, TYPE_PLAYER, "ZONE")) /* 0x800 */ #define Unregistered(x) (IS(x, TYPE_PLAYER, "UNREGISTERED")) #define Fixed(x) (IS(Owner(x), TYPE_PLAYER, "FIXED")) ! #define Vacation(x) (IS(x, TYPE_PLAYER, "ON-VACATION")) /* 0x10000 */ /* Flags that apply to players, and all their stuff, * so check the Owner() of the object. --- 78,88 ---- /******* Player toggles */ ! #define Connected(x) (IS(x, TYPE_PLAYER, "CONNECTED")) ! #define ZMaster(x) (IS(x, TYPE_PLAYER, "ZONE")) #define Unregistered(x) (IS(x, TYPE_PLAYER, "UNREGISTERED")) #define Fixed(x) (IS(Owner(x), TYPE_PLAYER, "FIXED")) ! #define Vacation(x) (IS(x, TYPE_PLAYER, "ON-VACATION")) /* Flags that apply to players, and all their stuff, * so check the Owner() of the object. *************** *** 146,151 **** --- 145,151 ---- #define Quiet(x) (has_flag_by_name(x, "QUIET", NOTYPE)) #define Safe(x) (has_flag_by_name(x, "SAFE", NOTYPE)) #define Sticky(x) (has_flag_by_name(x, "STICKY", NOTYPE)) + #define Suspect(x) (has_flag_by_name(x,"SUSPECT", NOTYPE)) #define Transparented(x) (has_flag_by_name(x, "TRANSPARENT", NOTYPE)) #define Unfind(x) (has_flag_by_name(x, "UNFINDABLE", NOTYPE)) #define Verbose(x) (has_flag_by_name(x, "VERBOSE", NOTYPE)) *** 1_7_7.977/hdrs/conf.h Thu, 06 May 2004 00:22:48 -0500 dunemush (pennmush/d/20_conf.h 1.1.1.1.1.1.1.1.1.1.1.1.1.2.1.5.1.1.1.1.1.1.1.1.1.2.1.1.2.1.2.13.1.4.1.20.1.15 660) --- 1_7_7.1049(w)/hdrs/conf.h Mon, 31 May 2004 08:42:43 -0500 dunemush (pennmush/d/20_conf.h 1.1.1.1.1.1.1.1.1.1.1.1.1.2.1.5.1.1.1.1.1.1.1.1.1.2.1.1.2.1.2.13.1.4.1.20.1.19 660) *************** *** 255,265 **** --- 255,273 ---- int use_quota; /**< Are quotas enabled? */ int empty_attrs; /**< Are empty attributes preserved? */ int function_side_effects; /**< Turn on side effect functions? */ + char error_log[256]; /**< File to log connections */ char connect_log[256]; /**< File to log connections */ char wizard_log[256]; /**< File to log wizard commands */ char command_log[256]; /**< File to log suspect commands */ char trace_log[256]; /**< File to log trace data */ char checkpt_log[256]; /**< File to log checkpoint data */ + #ifdef HAS_MYSQL + char sql_platform[256]; /**< Type of SQL server, or "disabled" */ + char sql_host[256]; /**< Hostname of sql server */ + char sql_username[256]; /**< Username for sql */ + char sql_password[256]; /**< Password for sql */ + char sql_database[256]; /**< Database for sql */ + #endif }; extern OPTTAB options; *************** *** 343,349 **** #define MAX_GUEST_PENNIES (options.max_guest_pennies) #define DBTOP_MAX (options.max_dbref) #define QUEUE_LOSS (options.queue_loss) - #define MAX_ARG 63 #define KILL_BONUS (options.kill_bonus) #define KILL_MIN_COST (options.kill_min_cost) #define KILL_BASE_COST (options.kill_default_cost) --- 351,356 ---- *************** *** 412,490 **** #define USE_QUOTA (options.use_quota) #define EMPTY_ATTRS (options.empty_attrs) #define FUNCTION_SIDE_EFFECTS (options.function_side_effects) #define CONNLOG (options.connect_log) #define WIZLOG (options.wizard_log) #define CMDLOG (options.command_log) #define TRACELOG (options.trace_log) #define CHECKLOG (options.checkpt_log) #define CHUNK_SWAP_FILE (options.chunk_swap_file) #define CHUNK_CACHE_MEMORY (options.chunk_cache_memory) #define CHUNK_MIGRATE_AMOUNT (options.chunk_migrate_amount) #define READ_REMOTE_DESC (options.read_remote_desc) - - /* Compiler-specific stuff. */ - - #ifndef __GNUC_PREREQ - #if defined __GNUC__ && defined __GNUC_MINOR__ - # define __GNUC_PREREQ(maj, min) \ - ((__GNUC__ << 16) + __GNUC_MINOR__ >= ((maj) << 16) + (min)) - #else - # define __GNUC_PREREQ(maj, min) 0 - #endif - #endif - - /* For gcc 3 and up, this attribute lets the compiler know that the - * function returns a newly allocated value, for pointer aliasing - * optimizations. - */ - #if !defined(__attribute_malloc__) && __GNUC_PREREQ(2, 96) - #define __attribute_malloc__ __attribute__ ((__malloc__)) - #elif !defined(__attribute_malloc__) - #define __attribute_malloc__ - #endif - - /* The C99 restrict keyword lets the compiler do some more pointer - * aliasing optimizations. Essentially, a RESTRICT pointer function - * argument can't share that pointer with ones passed via other - * arguments. - * This should be a Configure check sometime. - */ - #if __GNUC_PREREQ(2, 92) - #define RESTRICT __restrict - #elif defined(__STDC_VERSION__) && __STDC_VERSION__ >= 199901L - #define RESTRICT restrict - #else - #define RESTRICT - #endif - - /* If a compiler knows a function will never return, it can generate - slightly better code for calls to it. */ - #if defined(WIN32) && _MSC_VER >= 1200 - #define NORETURN __declspec(noreturn) - #elif defined(HASATTRIBUTE) - #define NORETURN __attribute__ ((__noreturn__)) - #else - #define NORETURN - #endif - - - #ifdef WIN32 - /* --------------- Stuff for Win32 services ------------------ */ - /* - - When "exit" is called to handle an error condition, we really want to - terminate the game thread, not the whole process. - MS VS.NET (_MSC_VER >= 1200) requires the weird noreturn stuff. - - */ - - #ifndef __MINGW32__ - #define exit(arg) Win32_Exit (arg) - #endif - void NORETURN WIN32_CDECL Win32_Exit(int exit_code); - #endif /* WIN32 */ - #endif /* __CONF_H */ --- 419,442 ---- #define USE_QUOTA (options.use_quota) #define EMPTY_ATTRS (options.empty_attrs) #define FUNCTION_SIDE_EFFECTS (options.function_side_effects) + #define ERRLOG (options.error_log) #define CONNLOG (options.connect_log) #define WIZLOG (options.wizard_log) #define CMDLOG (options.command_log) #define TRACELOG (options.trace_log) #define CHECKLOG (options.checkpt_log) + #ifdef HAS_MYSQL + #define SQL_PLATFORM (options.sql_platform) + #define SQL_HOST (options.sql_host) + #define SQL_DB (options.sql_database) + #define SQL_USER (options.sql_username) + #define SQL_PASS (options.sql_password) + #endif #define CHUNK_SWAP_FILE (options.chunk_swap_file) #define CHUNK_CACHE_MEMORY (options.chunk_cache_memory) #define CHUNK_MIGRATE_AMOUNT (options.chunk_migrate_amount) #define READ_REMOTE_DESC (options.read_remote_desc) #endif /* __CONF_H */ *** 1_7_7.977/hdrs/command.h Sun, 21 Mar 2004 11:07:40 -0600 dunemush (pennmush/d/24_command.h 1.31 660) --- 1_7_7.1049(w)/hdrs/command.h Mon, 31 May 2004 08:42:43 -0500 dunemush (pennmush/d/24_command.h 1.32 660) *************** *** 43,49 **** #define CMD_T_LOGNAME 0x00020000 #define CMD_T_LOGARGS 0x00010000 ! /* Split arguments at = */ #define CMD_T_EQSPLIT 0x0001 /* Split into argv[] at ,s */ --- 43,49 ---- #define CMD_T_LOGNAME 0x00020000 #define CMD_T_LOGARGS 0x00010000 ! /* Split arguments at =, but don't abort if there's no = */ #define CMD_T_EQSPLIT 0x0001 /* Split into argv[] at ,s */ *** 1_7_7.977/hdrs/attrib.h Sat, 27 Mar 2004 00:05:26 -0600 dunemush (pennmush/d/25_attrib.h 1.4.1.1.1.1.1.2.1.1.1.1.1.2.1.2.1.1.1.2.1.1.2.3.1.10.1.2.1.5.1.1 660) --- 1_7_7.1049(w)/hdrs/attrib.h Mon, 31 May 2004 08:42:43 -0500 dunemush (pennmush/d/25_attrib.h 1.4.1.1.1.1.1.2.1.1.1.1.1.2.1.2.1.1.1.2.1.1.2.3.1.10.1.2.1.5.1.1.1.2 660) *************** *** 1,6 **** --- 1,7 ---- #ifndef _ATTRIB_H #define _ATTRIB_H + #include "mushtype.h" #include "chunk.h" /** An attribute on an object. *************** *** 49,55 **** extern char const *convert_atr(int oldatr); extern int atr_comm_match(dbref thing, dbref player, int type, int end, char const *str, int just_match, char *atrname, ! char **abp); extern int one_comm_match(dbref thing, dbref player, const char *atr, const char *str); extern int do_set_atr(dbref thing, char const *RESTRICT atr, --- 50,56 ---- extern char const *convert_atr(int oldatr); extern int atr_comm_match(dbref thing, dbref player, int type, int end, char const *str, int just_match, char *atrname, ! char **abp, dbref *errobj); extern int one_comm_match(dbref thing, dbref player, const char *atr, const char *str); extern int do_set_atr(dbref thing, char const *RESTRICT atr, *** 1_7_7.977/Makefile.SH Mon, 12 Apr 2004 11:59:27 -0500 dunemush (pennmush/d/30_Makefile.S 1.14.1.1.1.7.1.1.1.15 700) --- 1_7_7.1049(w)/Makefile.SH Wed, 26 May 2004 09:51:09 -0500 dunemush (pennmush/d/30_Makefile.S 1.14.1.1.1.7.1.1.1.18 700) *************** *** 49,55 **** CC=$cc CCFLAGS=$optimize -I.. -I../hdrs $ccflags $warnings LDFLAGS=$ldflags ! CLIBS=$libs $cryptlib $libssl $libcrypto INSTALL=$install INSTALLDIR=$installdir CP=$cp --- 49,55 ---- CC=$cc CCFLAGS=$optimize -I.. -I../hdrs $ccflags $warnings LDFLAGS=$ldflags ! CLIBS=$libs $cryptlib $libssl $libcrypto $libmysqlclient INSTALL=$install INSTALLDIR=$installdir CP=$cp *************** *** 89,95 **** autogen: hdrs/cmds.h hdrs/funs.h hdrs/switches.h ! hdrs/cmds.h: src/cmds.c src/command.c src/cque.c src/help.c src/set.c Patchlevel (cd utils; sh mkcmds.sh commands) hdrs/switches.h: src/SWITCHES Patchlevel --- 89,95 ---- autogen: hdrs/cmds.h hdrs/funs.h hdrs/switches.h ! hdrs/cmds.h: src/cmds.c src/command.c src/cque.c src/help.c src/set.c src/sql.c Patchlevel (cd utils; sh mkcmds.sh commands) hdrs/switches.h: src/SWITCHES Patchlevel *************** *** 98,104 **** src/switchinc.c: src/SWITCHES Patchlevel (cd utils; sh mkcmds.sh switches) ! hdrs/funs.h: src/fun*.c src/bsd.c src/conf.c src/extmail.c src/help.c src/wiz.c Patchlevel (cd utils; sh mkcmds.sh functions) hdrs/patches.h: patches/* --- 98,104 ---- src/switchinc.c: src/SWITCHES Patchlevel (cd utils; sh mkcmds.sh switches) ! hdrs/funs.h: src/fun*.c src/bsd.c src/conf.c src/extmail.c src/help.c src/wiz.c src/sql.c Patchlevel (cd utils; sh mkcmds.sh functions) hdrs/patches.h: patches/* *************** *** 164,194 **** customize: update-conf -@$perl utils/customize.pl update-conf: game/mushcnf.dst game/aliascnf.dst game/restrictcnf.dst game/namescnf.dst -@$touch game/mushcnf.dst ! -@$perl utils/update-cnf.pl game/mush.cnf game/mushcnf.dst -@$touch game/aliascnf.dst ! -@$perl utils/update-cnf.pl game/alias.cnf game/aliascnf.dst -@$touch game/restrictcnf.dst ! -@$perl utils/update-cnf.pl game/restrict.cnf game/restrictcnf.dst ! -@if [ ! -f game/names.cnf ]; then \$(CP) game/namescnf.dst game/names.cnf; fi ! game/alias.cnf: game/aliascnf.dst -@$touch game/aliascnf.dst ! -@$perl utils/update-cnf.pl game/alias.cnf game/aliascnf.dst ! game/restrict.cnf: game/restrictcnf.dst -@$touch game/restrictcnf.dst ! -@$perl utils/update-cnf.pl game/restrict.cnf game/restrictcnf.dst ! game/names.cnf: game/namescnf.dst if [ ! -f game/names.cnf ]; then \ ! \$(CP) game/namescnf.dst game/names.cnf \ fi ! game/mush.cnf: game/mushcnf.dst -@$touch game/mushcnf.dst ! -@$perl utils/update-cnf.pl game/mush.cnf game/mushcnf.dst update: update-hdr update-conf --- 164,199 ---- customize: update-conf -@$perl utils/customize.pl + # The default place to find the runtime files is in this directory, + # but it can be overridden with env variables so people can use + # other game directories. + GAMEDIR=game + update-conf: game/mushcnf.dst game/aliascnf.dst game/restrictcnf.dst game/namescnf.dst -@$touch game/mushcnf.dst ! -@$perl utils/update-cnf.pl \$(GAMEDIR)/mush.cnf game/mushcnf.dst -@$touch game/aliascnf.dst ! -@$perl utils/update-cnf.pl \$(GAMEDIR)/alias.cnf game/aliascnf.dst -@$touch game/restrictcnf.dst ! -@$perl utils/update-cnf.pl \$(GAMEDIR)/restrict.cnf game/restrictcnf.dst ! -@if [ ! -f \$(GAMEDIR)/names.cnf ]; then \$(CP) game/namescnf.dst \$(GAMEDIR)/names.cnf; fi ! \$(GAMEDIR)/alias.cnf: game/aliascnf.dst -@$touch game/aliascnf.dst ! -@$perl utils/update-cnf.pl \$(GAMEDIR)/alias.cnf game/aliascnf.dst ! \$(GAMEDIR)/restrict.cnf: game/restrictcnf.dst -@$touch game/restrictcnf.dst ! -@$perl utils/update-cnf.pl \$(GAMEDIR)/restrict.cnf game/restrictcnf.dst ! \$(GAMEDIR)/names.cnf: game/namescnf.dst if [ ! -f game/names.cnf ]; then \ ! \$(CP) game/namescnf.dst \$(GAMEDIR)/names.cnf \ fi ! \$(GAMEDIR)/mush.cnf: game/mushcnf.dst -@$touch game/mushcnf.dst ! -@$perl utils/update-cnf.pl \$(GAMEDIR)/mush.cnf game/mushcnf.dst update: update-hdr update-conf *************** *** 290,295 **** --- 295,301 ---- debianinstall: install (cd game/txt; make clean compose.sh) $(INSTALLDIR) $(DEB_INSTALL) + $(INSTALLDIR) $(DEB_BIN) $(CP) -R game/* $(DEB_INSTALL) -rm -f $(DEB_INSTALL)/netmush $(DEB_INSTALL)/info_slave $(INSTALL) config.sh $(DEB_INSTALL)/config.sh *** 1_7_7.977/Configure Wed, 17 Mar 2004 16:02:04 -0600 dunemush (pennmush/d/32_Configure 1.21.1.4.1.1.1.1.1.1.1.7.1.10 710) --- 1_7_7.1049(w)/Configure Mon, 24 May 2004 11:39:51 -0500 dunemush (pennmush/d/32_Configure 1.21.1.4.1.1.1.1.1.1.1.7.1.11 710) *************** *** 20,26 **** # $Id$ # ! # Generated on Wed Mar 17 16:01:08 CST 2004 [metaconfig 3.0 PL70] cat >/tmp/c1$$ </tmp/c1$$ < test_mysql.c < + #include + #include + #include + + int main(int argc, char **argv) { + printf("Your mysql is version %s\n",mysql_get_client_info()); + exit(0); + } + EOM + + if $cc $ccflags $ldflags -o test_mysql test_mysql.c $libs $libmysqlclient >/dev/null 2>&1 ; + then + echo 'You have mysql...' >&4 + version=`./test_mysql` + if $test $? -eq 0; then + echo "$version" >&4 + d_mysql="$define" + else + echo "...but my test program didn't run correctly." >&4 + libmysqlclient='' + fi + else + echo "You don't seem to have mysql." >&4 + libmysqlclient='' + fi + $rm -f test_mysql* core + + else + + echo "Skipping mysql tests." >&4 + libmysqlclient='' + + fi + : check for a new-style definitions echo " " $cat >test_newstyle.c <<'EOCP' *************** *** 6929,6934 **** --- 6976,6982 ---- d_memmove='$d_memmove' d_memset='$d_memset' d_mymalloc='$d_mymalloc' + d_mysql='$d_mysql' d_newstyle='$d_newstyle' d_oldsock='$d_oldsock' d_open3='$d_open3' *************** *** 7055,7060 **** --- 7103,7109 ---- less='$less' libc='$libc' libcrypto='$libcrypto' + libmysqlclient='$libmysqlclient' libpth='$libpth' libs='$libs' libssl='$libssl' *** 1_7_7.977/MANIFEST Sat, 01 May 2004 13:41:05 -0500 dunemush (pennmush/d/34_MANIFEST 1.21.1.2.1.7.1.3.1.21 600) --- 1_7_7.1049(w)/MANIFEST Thu, 27 May 2004 14:08:05 -0500 dunemush (pennmush/d/34_MANIFEST 1.21.1.2.1.7.1.3.1.25 600) *************** *** 12,18 **** --- 12,20 ---- hdrs/atr_tab.h hdrs/attrib.h hdrs/boolexp.h + hdrs/bufferq.h hdrs/command.h + hdrs/compile.h hdrs/chunk.h hdrs/htab.h hdrs/privtab.h *************** *** 53,58 **** --- 55,61 ---- src/attrib.c src/boolexp.c src/bsd.c + src/bufferq.c src/chunk.c src/cmds.c src/command.c *************** *** 109,114 **** --- 112,118 ---- src/shs.c src/sig.c src/speech.c + src/sql.c src/switchinc.c src/strdup.c src/strtree.c *************** *** 212,217 **** --- 216,222 ---- FAQ README README.SSL + README.SQL INSTALL UPGRADING I18N *** 1_7_7.977/src/strtree.c Mon, 28 Apr 2003 22:03:14 -0500 dunemush (pennmush/d/35_strtree.c 1.14.1.9 660) --- 1_7_7.1049(w)/src/strtree.c Mon, 31 May 2004 08:42:42 -0500 dunemush (pennmush/d/35_strtree.c 1.14.1.10 660) *************** *** 39,44 **** --- 39,45 ---- #include #include #include + #include "conf.h" #include "externs.h" #include "strtree.h" *** 1_7_7.977/src/pcre.c Fri, 26 Mar 2004 16:34:46 -0600 dunemush (pennmush/d/36_pcre.c 1.4.1.3.1.3.1.1.1.1.1.1.1.7 660) --- 1_7_7.1049(w)/src/pcre.c Mon, 31 May 2004 08:42:42 -0500 dunemush (pennmush/d/36_pcre.c 1.4.1.3.1.3.1.1.1.1.1.1.1.8 660) *************** *** 47,53 **** #include #include "pcre.h" #include "confmagic.h" ! /* Bits of PCRE's conf.h */ #define NEWLINE '\n' --- 47,54 ---- #include #include "pcre.h" #include "confmagic.h" ! #undef min ! #undef max /* Bits of PCRE's conf.h */ #define NEWLINE '\n' *** 1_7_7.977/src/mysocket.c Tue, 11 May 2004 10:08:19 -0500 dunemush (pennmush/f/0_mysocket.c 1.16.1.1.1.1.1.1.1.4.1.4.1.16 660) --- 1_7_7.1049(w)/src/mysocket.c Mon, 31 May 2004 08:42:42 -0500 dunemush (pennmush/f/0_mysocket.c 1.16.1.1.1.1.1.1.1.4.1.4.1.17 660) *************** *** 89,101 **** #include #endif - #ifndef INFOSLAVE #include "conf.h" ! #endif #include "mymalloc.h" #include "mysocket.h" #include "ident.h" - #include "externs.h" #include "confmagic.h" #ifndef __ptr_t --- 89,99 ---- #include #endif #include "conf.h" ! #include "externs.h" #include "mymalloc.h" #include "mysocket.h" #include "ident.h" #include "confmagic.h" #ifndef __ptr_t *** 1_7_7.977/win32/pennmush.dsp Sun, 14 Mar 2004 19:56:40 -0600 dunemush (pennmush/f/9_pennmush.d 1.16 640) --- 1_7_7.1049(w)/win32/pennmush.dsp Wed, 26 May 2004 13:40:12 -0500 dunemush (pennmush/f/9_pennmush.d 1.17 640) *************** *** 53,58 **** --- 53,96 ---- LINK32=link.exe # ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:console /machine:I386 # ADD LINK32 user32.lib winmm.lib wsock32.lib /nologo /subsystem:console /machine:I386 + # Begin Custom Build - Copying Necessary Files + ProjDir=. + InputPath=.\game\pennmush.exe + SOURCE="$(InputPath)" + + BuildCmds= \ + IF NOT EXIST $(ProjDir)\src\cmdlocal.c copy $(ProjDir)\src\cmdlocal.dst $(ProjDir)\src\cmdlocal.c \ + IF NOT EXIST $(ProjDir)\src\flaglocal.c copy $(ProjDir)\src\flaglocal.dst $(ProjDir)\src\flaglocal.c \ + IF NOT EXIST $(ProjDir)\src\funlocal.c copy $(ProjDir)\src\funlocal.dst $(ProjDir)\src\funlocal.c \ + IF NOT EXIST $(ProjDir)\src\local.c copy $(ProjDir)\src\local.dst $(ProjDir)\src\local.c \ + IF NOT EXIST $(ProjDir)\game\mush.cnf echo Don't forget to customize mush.cnf! \ + IF NOT EXIST $(ProjDir)\game\mush.cnf copy $(ProjDir)\game\mushcnf.dst $(ProjDir)\game\mush.cnf \ + copy $(ProjDir)\win32\cmds.h $(ProjDir)\hdrs\cmds.h \ + copy $(ProjDir)\win32\funs.h $(ProjDir)\hdrs\funs.h \ + echo If any *local.c files failed to build, run build again. \ + + + "$(ProjDir)\src\cmdlocal.c" : $(SOURCE) "$(INTDIR)" "$(OUTDIR)" + $(BuildCmds) + + "$(ProjDir)\src\flaglocal.c" : $(SOURCE) "$(INTDIR)" "$(OUTDIR)" + $(BuildCmds) + + "$(ProjDir)\src\funlocal.c" : $(SOURCE) "$(INTDIR)" "$(OUTDIR)" + $(BuildCmds) + + "$(ProjDir)\src\local.c" : $(SOURCE) "$(INTDIR)" "$(OUTDIR)" + $(BuildCmds) + + "$(ProjDir)\game\mush.cnf" : $(SOURCE) "$(INTDIR)" "$(OUTDIR)" + $(BuildCmds) + + "$(ProjDir)\hdrs\cmds.h" : $(SOURCE) "$(INTDIR)" "$(OUTDIR)" + $(BuildCmds) + + "$(ProjDir)\hdrs\funs.h" : $(SOURCE) "$(INTDIR)" "$(OUTDIR)" + $(BuildCmds) + # End Custom Build !ELSEIF "$(CFG)" == "pennmush - Win32 Debug" *************** *** 78,83 **** --- 116,159 ---- LINK32=link.exe # ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:console /debug /machine:I386 /pdbtype:sept # ADD LINK32 kernel32.lib gdi32.lib winspool.lib comdlg32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib user32.lib winmm.lib wsock32.lib /nologo /subsystem:console /debug /machine:I386 /pdbtype:sept + # Begin Custom Build - Copying Necessary Files + ProjDir=. + InputPath=.\game\pennmush.exe + SOURCE="$(InputPath)" + + BuildCmds= \ + IF NOT EXIST $(ProjDir)\src\cmdlocal.c copy $(ProjDir)\src\cmdlocal.dst $(ProjDir)\src\cmdlocal.c \ + IF NOT EXIST $(ProjDir)\src\flaglocal.c copy $(ProjDir)\src\flaglocal.dst $(ProjDir)\src\flaglocal.c \ + IF NOT EXIST $(ProjDir)\src\funlocal.c copy $(ProjDir)\src\funlocal.dst $(ProjDir)\src\funlocal.c \ + IF NOT EXIST $(ProjDir)\src\local.c copy $(ProjDir)\src\local.dst $(ProjDir)\src\local.c \ + IF NOT EXIST $(ProjDir)\game\mush.cnf echo Don't forget to customize mush.cnf! \ + IF NOT EXIST $(ProjDir)\game\mush.cnf copy $(ProjDir)\game\mushcnf.dst $(ProjDir)\game\mush.cnf \ + copy $(ProjDir)\win32\cmds.h $(ProjDir)\hdrs\cmds.h \ + copy $(ProjDir)\win32\funs.h $(ProjDir)\hdrs\funs.h \ + echo If any *local.c files failed to build, run build again. \ + + + "$(ProjDir)\src\cmdlocal.c" : $(SOURCE) "$(INTDIR)" "$(OUTDIR)" + $(BuildCmds) + + "$(ProjDir)\src\flaglocal.c" : $(SOURCE) "$(INTDIR)" "$(OUTDIR)" + $(BuildCmds) + + "$(ProjDir)\src\funlocal.c" : $(SOURCE) "$(INTDIR)" "$(OUTDIR)" + $(BuildCmds) + + "$(ProjDir)\src\local.c" : $(SOURCE) "$(INTDIR)" "$(OUTDIR)" + $(BuildCmds) + + "$(ProjDir)\game\mush.cnf" : $(SOURCE) "$(INTDIR)" "$(OUTDIR)" + $(BuildCmds) + + "$(ProjDir)\hdrs\cmds.h" : $(SOURCE) "$(INTDIR)" "$(OUTDIR)" + $(BuildCmds) + + "$(ProjDir)\hdrs\funs.h" : $(SOURCE) "$(INTDIR)" "$(OUTDIR)" + $(BuildCmds) + # End Custom Build !ELSEIF "$(CFG)" == "pennmush - Win32 SSL Release" *************** *** 103,108 **** --- 179,223 ---- LINK32=link.exe # ADD BASE LINK32 user32.lib winmm.lib wsock32.lib /nologo /subsystem:console /machine:I386 # ADD LINK32 user32.lib winmm.lib wsock32.lib ssleay32.lib libeay32.lib /nologo /subsystem:console /pdb:"pennmush.pdb" /machine:I386 + # SUBTRACT LINK32 /pdb:none + # Begin Custom Build - Copying Necessary Files + ProjDir=. + InputPath=.\game\pennmush.exe + SOURCE="$(InputPath)" + + BuildCmds= \ + IF NOT EXIST $(ProjDir)\src\cmdlocal.c copy $(ProjDir)\src\cmdlocal.dst $(ProjDir)\src\cmdlocal.c \ + IF NOT EXIST $(ProjDir)\src\flaglocal.c copy $(ProjDir)\src\flaglocal.dst $(ProjDir)\src\flaglocal.c \ + IF NOT EXIST $(ProjDir)\src\funlocal.c copy $(ProjDir)\src\funlocal.dst $(ProjDir)\src\funlocal.c \ + IF NOT EXIST $(ProjDir)\src\local.c copy $(ProjDir)\src\local.dst $(ProjDir)\src\local.c \ + IF NOT EXIST $(ProjDir)\game\mush.cnf echo Don't forget to customize mush.cnf! \ + IF NOT EXIST $(ProjDir)\game\mush.cnf copy $(ProjDir)\game\mushcnf.dst $(ProjDir)\game\mush.cnf \ + copy $(ProjDir)\win32\cmds.h $(ProjDir)\hdrs\cmds.h \ + copy $(ProjDir)\win32\funs.h $(ProjDir)\hdrs\funs.h \ + echo If any *local.c files failed to build, run build again. \ + + + "$(ProjDir)\src\cmdlocal.c" : $(SOURCE) "$(INTDIR)" "$(OUTDIR)" + $(BuildCmds) + + "$(ProjDir)\src\flaglocal.c" : $(SOURCE) "$(INTDIR)" "$(OUTDIR)" + $(BuildCmds) + + "$(ProjDir)\src\funlocal.c" : $(SOURCE) "$(INTDIR)" "$(OUTDIR)" + $(BuildCmds) + + "$(ProjDir)\src\local.c" : $(SOURCE) "$(INTDIR)" "$(OUTDIR)" + $(BuildCmds) + + "$(ProjDir)\game\mush.cnf" : $(SOURCE) "$(INTDIR)" "$(OUTDIR)" + $(BuildCmds) + + "$(ProjDir)\hdrs\cmds.h" : $(SOURCE) "$(INTDIR)" "$(OUTDIR)" + $(BuildCmds) + + "$(ProjDir)\hdrs\funs.h" : $(SOURCE) "$(INTDIR)" "$(OUTDIR)" + $(BuildCmds) + # End Custom Build !ELSEIF "$(CFG)" == "pennmush - Win32 SSL Debug" *************** *** 130,135 **** --- 245,288 ---- LINK32=link.exe # ADD BASE LINK32 kernel32.lib gdi32.lib winspool.lib comdlg32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib user32.lib winmm.lib wsock32.lib /nologo /subsystem:console /debug /machine:I386 /pdbtype:sept # ADD LINK32 kernel32.lib gdi32.lib winspool.lib comdlg32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib user32.lib winmm.lib wsock32.lib ssleay32.lib libeay32.lib /nologo /subsystem:console /debug /machine:I386 /pdbtype:sept + # Begin Custom Build - Copying Necessary Files + ProjDir=. + InputPath=.\game\pennmush.exe + SOURCE="$(InputPath)" + + BuildCmds= \ + IF NOT EXIST $(ProjDir)\src\cmdlocal.c copy $(ProjDir)\src\cmdlocal.dst $(ProjDir)\src\cmdlocal.c \ + IF NOT EXIST $(ProjDir)\src\flaglocal.c copy $(ProjDir)\src\flaglocal.dst $(ProjDir)\src\flaglocal.c \ + IF NOT EXIST $(ProjDir)\src\funlocal.c copy $(ProjDir)\src\funlocal.dst $(ProjDir)\src\funlocal.c \ + IF NOT EXIST $(ProjDir)\src\local.c copy $(ProjDir)\src\local.dst $(ProjDir)\src\local.c \ + IF NOT EXIST $(ProjDir)\game\mush.cnf echo Don't forget to customize mush.cnf! \ + IF NOT EXIST $(ProjDir)\game\mush.cnf copy $(ProjDir)\game\mushcnf.dst $(ProjDir)\game\mush.cnf \ + copy $(ProjDir)\win32\cmds.h $(ProjDir)\hdrs\cmds.h \ + copy $(ProjDir)\win32\funs.h $(ProjDir)\hdrs\funs.h \ + echo If any *local.c files failed to build, run build again. \ + + + "$(ProjDir)\src\cmdlocal.c" : $(SOURCE) "$(INTDIR)" "$(OUTDIR)" + $(BuildCmds) + + "$(ProjDir)\src\flaglocal.c" : $(SOURCE) "$(INTDIR)" "$(OUTDIR)" + $(BuildCmds) + + "$(ProjDir)\src\funlocal.c" : $(SOURCE) "$(INTDIR)" "$(OUTDIR)" + $(BuildCmds) + + "$(ProjDir)\src\local.c" : $(SOURCE) "$(INTDIR)" "$(OUTDIR)" + $(BuildCmds) + + "$(ProjDir)\game\mush.cnf" : $(SOURCE) "$(INTDIR)" "$(OUTDIR)" + $(BuildCmds) + + "$(ProjDir)\hdrs\cmds.h" : $(SOURCE) "$(INTDIR)" "$(OUTDIR)" + $(BuildCmds) + + "$(ProjDir)\hdrs\funs.h" : $(SOURCE) "$(INTDIR)" "$(OUTDIR)" + $(BuildCmds) + # End Custom Build !ENDIF *************** *** 161,166 **** --- 314,323 ---- # End Source File # Begin Source File + SOURCE=F:\pennmush\src\bufferq.c + # End Source File + # Begin Source File + SOURCE=.\src\chunk.c # End Source File # Begin Source File *************** *** 378,383 **** --- 535,544 ---- # Begin Source File SOURCE=.\src\speech.c + # End Source File + # Begin Source File + + SOURCE=F:\pennmush\src\sql.c # End Source File # Begin Source File *** 1_7_7.977/win32/funs.h Mon, 29 Mar 2004 00:17:18 -0600 dunemush (pennmush/f/12_funs.h 1.11.1.9.2.8.2.1.1.1.1.2.1.1.1.1.1.1.1.1.1.1.1.1.1.1.1.1.1.1.1.8.1.3.1.7.1.1.1.1.1.1.1.1.1.1.1.1.1.1.1.1.1.1.1.1.1.10.1.1.1.4 640) --- 1_7_7.1049(w)/win32/funs.h Thu, 27 May 2004 14:04:27 -0500 dunemush (pennmush/f/12_funs.h 1.11.1.9.2.8.2.1.1.1.1.2.1.1.1.1.1.1.1.1.1.1.1.1.1.1.1.1.1.1.1.8.1.3.1.7.1.1.1.1.1.1.1.1.1.1.1.1.1.1.1.1.1.1.1.1.1.10.1.1.1.4.1.1 640) *************** *** 278,283 **** --- 278,285 ---- FUNCTION_PROTO(fun_space); FUNCTION_PROTO(fun_spellnum); FUNCTION_PROTO(fun_splice); + FUNCTION_PROTO(fun_sql); + FUNCTION_PROTO(fun_sql_escape); FUNCTION_PROTO(fun_sqrt); FUNCTION_PROTO(fun_squish); FUNCTION_PROTO(fun_ssl); *** 1_7_7.977/win32/config.h Sun, 29 Feb 2004 19:48:18 -0600 dunemush (pennmush/f/14_config.h 1.8 600) --- 1_7_7.1049(w)/win32/config.h Wed, 26 May 2004 13:41:00 -0500 dunemush (pennmush/f/14_config.h 1.9 600) *************** *** 1,794 **** ! /* ! * This file was produced by running the config_h.SH script, which ! * gets its values from config.sh, which is generally produced by ! * running Configure. ! * ! * Feel free to modify any of this as the need arises. Note, however, ! * that running config_h.SH again will wipe out any changes you've made. ! * For a more permanent change edit config.sh and rerun config_h.SH. ! * ! * $Id$ ! */ ! ! /* ! * Package name : pennmush ! * Source directory : . ! * Configuration time: Fri Nov 16 19:02:38 EST 2001 ! * Configured by : korongil ! * Target system : Win32 ! */ ! ! #ifndef _config_h_ ! #define _config_h_ ! ! /* getdtablesize: ! * This catches use of the getdtablesize() subroutine, and remaps it ! * to either ulimit(4,0) or NOFILE, if getdtablesize() isn't available. ! */ ! /*#define getdtablesize() / **/ ! ! /* HAS_BCOPY: ! * This symbol is defined if the bcopy() routine is available to ! * copy blocks of memory. ! */ ! /* #define HAS_BCOPY /**/ ! ! /* HAS_BZERO: ! * This symbol is defined if the bzero() routine is available to ! * set a memory block to 0. ! */ ! /* #define HAS_BZERO /**/ ! ! /* HASCONST: ! * This symbol, if defined, indicates that this C compiler knows about ! * the const type. There is no need to actually test for that symbol ! * within your programs. The mere use of the "const" keyword will ! * trigger the necessary tests. ! */ ! #define HASCONST /**/ ! #ifndef HASCONST ! #define const ! #endif ! ! /* HAS_GETPRIORITY: ! * This symbol, if defined, indicates that the getpriority routine is ! * available to get a process's priority. ! */ ! /* #define HAS_GETPRIORITY /**/ ! ! /* INTERNET: ! * This symbol, if defined, indicates that there is a mailer available ! * which supports internet-style addresses (user@site.domain). ! */ ! /* #define INTERNET /**/ ! ! /* HAS_MEMSET: ! * This symbol, if defined, indicates that the memset routine is available ! * to set blocks of memory. ! */ ! #define HAS_MEMSET /**/ ! ! /* HAS_RENAME: ! * This symbol, if defined, indicates that the rename routine is available ! * to rename files. Otherwise you should do the unlink(), link(), unlink() ! * trick. ! */ ! #define HAS_RENAME /**/ ! ! /* HAS_GETRUSAGE: ! * This symbol, if defined, indicates that the getrusage() routine is ! * available to get process statistics with a sub-second accuracy. ! * Inclusion of and may be necessary. ! */ ! /* #define HAS_GETRUSAGE /**/ ! ! /* HAS_SELECT: ! * This symbol, if defined, indicates that the select routine is ! * available to select active file descriptors. If the timeout field ! * is used, may need to be included. ! */ ! #define HAS_SELECT /**/ ! ! /* HAS_SETLOCALE: ! * This symbol, if defined, indicates that the setlocale routine is ! * available to handle locale-specific ctype implementations. ! */ ! #define HAS_SETLOCALE /**/ ! ! /* HAS_SETPGID: ! * This symbol, if defined, indicates that the setpgid(pid, gpid) ! * routine is available to set process group ID. ! */ ! /* #define HAS_SETPGID /**/ ! ! /* HAS_SETPGRP: ! * This symbol, if defined, indicates that the setpgrp routine is ! * available to set the current process group. ! */ ! /* USE_BSD_SETPGRP: ! * This symbol, if defined, indicates that setpgrp needs two ! * arguments whereas USG one needs none. See also HAS_SETPGID ! * for a POSIX interface. ! */ ! /*#define HAS_SETPGRP /**/ ! /*#define USE_BSD_SETPGRP / **/ ! ! /* HAS_SETPRIORITY: ! * This symbol, if defined, indicates that the setpriority routine is ! * available to set a process's priority. ! */ ! /*#define HAS_SETPRIORITY /**/ ! ! /* HAS_SIGACTION: ! * This symbol, if defined, indicates that Vr4's sigaction() routine ! * is available. ! */ ! /* #define HAS_SIGACTION /**/ ! ! /* HAS_SOCKET: ! * This symbol, if defined, indicates that the BSD socket interface is ! * supported. ! */ ! /* HAS_SOCKETPAIR: ! * This symbol, if defined, indicates that the BSD socketpair() call is ! * supported. ! */ ! /*#define HAS_SOCKET /**/ ! /*#define HAS_SOCKETPAIR /**/ ! ! /* HAS_STRCASECMP: ! * This symbol, if defined, indicates that the strcasecmp() routine is ! * available for case-insensitive string compares. ! */ ! /* #define HAS_STRCASECMP /**/ ! ! /* HAS_STRDUP: ! * This symbol, if defined, indicates that the strdup routine is ! * available to duplicate strings in memory. Otherwise, roll up ! * your own... ! */ ! #define HAS_STRDUP /**/ ! ! /* HAS_SYSCONF: ! * This symbol, if defined, indicates that sysconf() is available ! * to determine system related limits and options. ! */ ! /* #define HAS_SYSCONF /**/ ! ! /* VOIDSIG: ! * This symbol is defined if this system declares "void (*signal(...))()" in ! * signal.h. The old way was to declare it as "int (*signal(...))()". It ! * is up to the package author to declare things correctly based on the ! * symbol. ! */ ! /* Signal_t: ! * This symbol's value is either "void" or "int", corresponding to the ! * appropriate return type of a signal handler. Thus, you can declare ! * a signal handler using "Signal_t (*handler)()", and define the ! * handler using "Signal_t handler(sig)". ! */ ! #define VOIDSIG /**/ ! #define Signal_t void /* Signal handler's return type */ ! ! /* HASVOLATILE: ! * This symbol, if defined, indicates that this C compiler knows about ! * the volatile declaration. ! */ ! #define HASVOLATILE /**/ ! #ifndef HASVOLATILE ! #define volatile ! #endif ! ! /* HAS_WAITPID: ! * This symbol, if defined, indicates that the waitpid routine is ! * available to wait for child process. ! */ ! /* #define HAS_WAITPID /**/ ! ! /* I_ARPA_INET: ! * This symbol, if defined, indicates to the C program that it should ! * include to get inet_addr and friends declarations. ! */ ! /*#define I_ARPA_INET /**/ ! ! /* I_FCNTL: ! * This manifest constant tells the C program to include . ! */ ! #define I_FCNTL /**/ ! ! /* I_LIMITS: ! * This symbol, if defined, indicates to the C program that it should ! * include to get definition of symbols like WORD_BIT or ! * LONG_MAX, i.e. machine dependant limitations. ! */ ! #define I_LIMITS /**/ ! ! /* I_LOCALE: ! * This symbol, if defined, indicates to the C program that it should ! * include . ! */ ! #define I_LOCALE /**/ ! ! /* I_MALLOC: ! * This symbol, if defined, indicates to the C program that it should ! * include . ! */ ! #define I_MALLOC /**/ ! ! /* I_NETINET_IN: ! * This symbol, if defined, indicates to the C program that it should ! * include . Otherwise, you may try . ! */ ! /* I_SYS_IN: ! * This symbol, if defined, indicates to the C program that it should ! * include instead of . ! */ ! /*#define I_NETINET_IN /**/ ! /*#define I_SYS_IN / **/ ! ! /* I_STDDEF: ! * This symbol, if defined, indicates that exists and should ! * be included. ! */ ! #define I_STDDEF /**/ ! ! /* I_STDLIB: ! * This symbol, if defined, indicates that exists and should ! * be included. ! */ ! #define I_STDLIB /**/ ! ! /* I_STRING: ! * This symbol, if defined, indicates to the C program that it should ! * include (USG systems) instead of (BSD systems). ! */ ! #define I_STRING /**/ ! ! /* I_SYS_FILE: ! * This symbol, if defined, indicates to the C program that it should ! * include to get definition of R_OK and friends. ! */ ! /*#define I_SYS_FILE /**/ ! ! /* I_SYS_MMAN: ! * This symbol, if defined, indicates to the C program that it should ! * include . ! */ ! /*#define I_SYS_MMAN /**/ ! ! /* I_SYS_PARAM: ! * This symbol, if defined, indicates to the C program that it should ! * include . ! */ ! /*#define I_SYS_PARAM /**/ ! ! /* I_SYS_RESOURCE: ! * This symbol, if defined, indicates to the C program that it should ! * include . ! */ ! /* #define I_SYS_RESOURCE /**/ ! ! /* I_SYS_SELECT: ! * This symbol, if defined, indicates to the C program that it should ! * include in order to get definition of struct timeval. ! */ ! /* #define I_SYS_SELECT /**/ ! ! /* I_SYS_SOCKET: ! * This symbol, if defined, indicates to the C program that it should ! * include before performing socket calls. ! */ ! /*#define I_SYS_SOCKET /**/ ! ! /* I_SYS_STAT: ! * This symbol, if defined, indicates to the C program that it should ! * include . ! */ ! #define I_SYS_STAT /**/ ! ! /* I_SYS_TYPES: ! * This symbol, if defined, indicates to the C program that it should ! * include . ! */ ! #define I_SYS_TYPES /**/ ! ! /* I_SYS_WAIT: ! * This symbol, if defined, indicates to the C program that it should ! * include . ! */ ! /* #define I_SYS_WAIT /**/ ! ! /* I_TIME: ! * This symbol, if defined, indicates to the C program that it should ! * include . ! */ ! /* I_SYS_TIME: ! * This symbol, if defined, indicates to the C program that it should ! * include . ! */ ! #define I_TIME / **/ ! /* #define I_SYS_TIME /**/ ! ! /* I_UNISTD: ! * This symbol, if defined, indicates to the C program that it should ! * include . ! */ ! /* #define I_UNISTD /**/ ! ! /* I_VALUES: ! * This symbol, if defined, indicates to the C program that it should ! * include to get definition of symbols like MINFLOAT or ! * MAXLONG, i.e. machine dependant limitations. Probably, you ! * should use instead, if it is available. ! */ ! /*#define I_VALUES /**/ ! ! /* Free_t: ! * This variable contains the return type of free(). It is usually ! * void, but occasionally int. ! */ ! /* Malloc_t: ! * This symbol is the type of pointer returned by malloc and realloc. ! */ ! #define Malloc_t void * /**/ ! #define Free_t void /**/ ! ! /* Pid_t: ! * This symbol holds the type used to declare process ids in the kernel. ! * It can be int, uint, pid_t, etc... It may be necessary to include ! * to get any typedef'ed information. ! */ ! #define Pid_t unsigned long /* PID type */ ! ! /* CAN_PROTOTYPE: ! * If defined, this macro indicates that the C compiler can handle ! * function prototypes. ! */ ! /* _: ! * This macro is used to declare function parameters for folks who want ! * to make declarations with prototypes using a different style than ! * the above macros. Use double parentheses. For example: ! * ! * int main _((int argc, char *argv[])); ! */ ! #define CAN_PROTOTYPE /**/ ! #ifdef CAN_PROTOTYPE ! #define _(args) args ! #else ! #define _(args) () ! #endif ! ! /* Size_t: ! * This symbol holds the type used to declare length parameters ! * for string functions. It is usually size_t, but may be ! * unsigned long, int, etc. It may be necessary to include ! * to get any typedef'ed information. ! */ ! #define Size_t size_t /* length paramater for string functions */ ! ! /* VOIDFLAGS: ! * This symbol indicates how much support of the void type is given by this ! * compiler. What various bits mean: ! * ! * 1 = supports declaration of void ! * 2 = supports arrays of pointers to functions returning void ! * 4 = supports comparisons between pointers to void functions and ! * addresses of void functions ! * 8 = suports declaration of generic void pointers ! * ! * The package designer should define VOIDUSED to indicate the requirements ! * of the package. This can be done either by #defining VOIDUSED before ! * including config.h, or by defining defvoidused in Myinit.U. If the ! * latter approach is taken, only those flags will be tested. If the ! * level of void support necessary is not present, defines void to int. ! */ ! #ifndef VOIDUSED ! #define VOIDUSED 15 ! #endif ! #define VOIDFLAGS 15 ! #if (VOIDFLAGS & VOIDUSED) != VOIDUSED ! #define void int /* is void to be avoided? */ ! #define M_VOID /* Xenix strikes again */ ! #endif ! ! /* WIN32_CDECL: ! * Defined as __cdecl if the compiler can handle that keyword to specify ! * C-style argument passing conventions. This allows MS VC++ ! * on Win32 to use the __fastcall convention for everything else ! * and get a performance boost. Any compiler with a brain (read: ! * not MS VC) handles this optimization automatically without such a ! * kludge. On these systems, this is defined as nothing. ! */ ! #define WIN32_CDECL __cdecl ! ! /* CAN_TAKE_ARGS_IN_FP: ! * Defined if the compiler prefers that function pointer parameters ! * in prototypes include the function's arguments, rather than ! * nothing (that is, int (*fun)(int) rather than int(*fun)(). ! */ ! #define CAN_TAKE_ARGS_IN_FP /**/ ! ! /* HAS_ASSERT: ! * If defined, this system has the assert() macro. ! */ ! #define HAS_ASSERT /**/ ! ! /* HASATTRIBUTE: ! * This symbol indicates the C compiler can check for function attributes, ! * such as printf formats. This is normally only supported by GNU cc. ! */ ! /* #define HASATTRIBUTE /**/ ! #ifndef HASATTRIBUTE ! #define __attribute__(_arg_) ! #endif ! ! /* HAS_BINDTEXTDOMAIN: ! * Defined if bindtextdomain is available(). ! */ ! /*#define HAS_BINDTEXTDOMAIN /**/ ! ! /* HAS_CRYPT: ! * This symbol, if defined, indicates that the crypt routine is available ! * to encrypt passwords and the like. ! */ ! /* I_CRYPT: ! * This symbol, if defined, indicates that can be included. ! */ ! /* #define HAS_CRYPT /**/ ! ! /* #define I_CRYPT /**/ ! ! /* FORCE_IPV4: ! * If defined, this system will not use IPv6. Necessary for Openbsd. ! */ ! /*#define FORCE_IPV4 / **/ ! ! /* HAS_FPSETROUND: ! * This symbol, if defined, indicates that the crypt routine is available ! * to encrypt passwords and the like. ! */ ! /* I_FLOATINGPOINT: ! * This symbol, if defined, indicates that can be included. ! */ ! /*#define HAS_FPSETROUND / **/ ! ! /*#define HAS_FPSETMASK / **/ ! ! /*#define I_FLOATINGPOINT / **/ ! ! /* HAS_GAI_STRERROR: ! * This symbol, if defined, indicates that getaddrinfo()'s error cores ! * can be converted to strings for printing. ! */ ! /* #define HAS_GAI_STRERROR /**/ ! ! /* HAS_GETADDRINFO: ! * This symbol, if defined, indicates that the getaddrinfo() routine is ! * available to lookup internet addresses in some data base or other. ! */ ! /* #define HAS_GETADDRINFO /**/ ! ! /* HAS_GETDATE: ! * This symbol, if defined, indicates that the getdate() routine is ! * available to convert date strings into struct tm's. ! */ ! /*#define HAS_GETDATE /**/ ! ! /* HAS_GETHOSTBYNAME2: ! * This symbol, if defined, indicates that the gethostbyname2() ! * function is available to resolve hostnames. ! */ ! /*#define HAS_GETHOSTBYNAME2 /**/ ! ! /* HAS_GETNAMEINFO: ! * This symbol, if defined, indicates that the getnameinfo() routine is ! * available to lookup host names in some data base or other. ! */ ! /* #define HAS_GETNAMEINFO /**/ ! ! /* HAS_GETPAGESIZE: ! * This symbol, if defined, indicates that the getpagesize system call ! * is available to get system page size, which is the granularity of ! * many memory management calls. ! */ ! /* PAGESIZE_VALUE: ! * This symbol holds the size in bytes of a system page (obtained via ! * the getpagesize() system call at configuration time or asked to the ! * user if the system call is not available). ! */ ! /*#define HAS_GETPAGESIZE /**/ ! #define PAGESIZE_VALUE 4096 /* System page size, in bytes */ ! ! /* HAS_GETTEXT: ! * Defined if gettext is available(). ! */ ! /*#define HAS_GETTEXT /**/ ! ! /* HAS_HUGE_VAL: ! * If defined, this system has the HUGE_VAL constant. We like this, ! * and don't bother defining the other floats below if we find it. ! */ ! /* HAS_HUGE: ! * If defined, this system has the HUGE constant. We like this, and ! * don't bother defining the other floats below if we find it. ! */ ! /* HAS_INT_MAX: ! * If defined, this system has the INT_MAX constant. ! */ ! /* HAS_MAXINT: ! * If defined, this system has the MAXINT constant. ! */ ! /* HAS_MAXDOUBLE: ! * If defined, this system has the MAXDOUBLE constant. ! */ ! #define HAS_HUGE_VAL /**/ ! ! /*#define HAS_HUGE / **/ ! ! #define HAS_INT_MAX /**/ ! ! /*#define HAS_MAXINT / **/ ! ! /*#define HAS_MAXDOUBLE / **/ ! ! /* HAS_IEEE_MATH: ! * Defined if the machine supports IEEE math - that is, can safely ! * return NaN or Inf rather than crash on bad math. ! */ ! /* #define HAS_IEEE_MATH /**/ ! ! /* HAS_INET_PTON: ! * This symbol, if defined, indicates that the inet_pton() and ! * inet_ntop() routines are available to convert IP addresses.. ! */ ! /*#define HAS_INET_PTON /**/ ! ! /* HAS_IPV6: ! * If defined, this system has the sockaddr_in6 struct and AF_INET6. ! * We can't rely on just AF_INET6 being defined. ! */ ! /*#define HAS_IPV6 /**/ ! ! /* SIGNALS_KEPT: ! * This symbol is defined if signal handlers needn't be reinstated after ! * receipt of a signal. ! */ ! #define SIGNALS_KEPT /**/ ! ! /* HAS_MEMCPY: ! * This symbol, if defined, indicates that the memcpy routine is available ! * to copy blocks of memory. If not, it will be mapped to bcopy ! * in confmagic.h ! */ ! /* HAS_MEMMOVE: ! * This symbol, if defined, indicates that the memmove routine is available ! * to copy blocks of memory. If not, it will be mapped to bcopy ! */ ! #define HAS_MEMCPY /**/ ! ! #define HAS_MEMMOVE /**/ ! ! /* CAN_NEWSTYLE: ! * Defined if new-style function definitions are allowable. ! * If they are, we can avoid some warnings that you get if ! * you declare char arguments in a prototype and use old-style ! * function definitions, which implicitly promote them to ints. ! */ ! #define CAN_NEWSTYLE /**/ ! ! /* HAS_RANDOM: ! * Have we got random(), our first choice for number generation? ! */ ! /* HAS_LRAND48: ! * Have we got lrand48(), our second choice? ! */ ! /* HAS_RAND: ! * Have we got rand(), our last choice? ! */ ! /* #define HAS_RANDOM /**/ ! /* #define HAS_LRAND48 /**/ ! #define HAS_RAND /**/ ! ! /* HAS_GETRLIMIT: ! * This symbol, if defined, indicates that the getrlimit() routine is ! * available to get resource limits. Probably means setrlimit too. ! * Inclusion of and may be necessary. ! */ ! /* #define HAS_GETRLIMIT /**/ ! ! /* SENDMAIL: ! * This symbol contains the full pathname to sendmail. ! */ ! /* HAS_SENDMAIL: ! * If defined, we have sendmail. ! */ ! /* #define HAS_SENDMAIL /**/ ! #define SENDMAIL "/usr/sbin/sendmail" ! ! /* HAS_SIGCHLD: ! * If defined, this system has the SIGCHLD constant. ! */ ! /* HAS_SIGCLD: ! * If defined, this system has the SIGCLD constant (SysVish SIGCHLD). ! */ ! /*#define HAS_SIGCHLD /**/ ! ! /*#define HAS_SIGCLD /**/ ! ! /* CAN_PROTOTYPE_SIGNAL: ! * This symbol is defined if we can safely prototype our rewritten ! * signal() function as: ! * Signal_t(*Sigfunc) _((int)); ! * extern Sigfunc signal _((int signo, Sigfunc func)); ! */ ! /*#define CAN_PROTOTYPE_SIGNAL /**/ ! ! /* HAS_SIGPROCMASK: ! * This symbol, if defined, indicates that POSIX's sigprocmask() routine ! * is available. ! */ ! /*#define HAS_SIGPROCMASK /**/ ! ! /* HAS_SNPRINTF: ! * This symbol, if defined, indicates that the snprintf routine is ! * available. If not, we use sprintf, which is less safe. ! */ ! #define HAS_SNPRINTF /**/ ! ! /* HAS_SOCKLEN_T: ! * If defined, this system has the socklen_t type. ! */ ! /*#define HAS_SOCKLEN_T /**/ ! ! /* HAS_STRCHR: ! * This symbol is defined to indicate that the strchr()/strrchr() ! * functions are available for string searching. If not, try the ! * index()/rindex() pair. ! */ ! /* HAS_INDEX: ! * This symbol is defined to indicate that the index()/rindex() ! * functions are available for string searching. ! */ ! #define HAS_STRCHR /**/ ! /* #define HAS_INDEX /**/ ! ! /* HAS_STRCOLL: ! * This symbol, if defined, indicates that the strcoll routine is ! * available to compare strings using collating information. ! */ ! #define HAS_STRCOLL /**/ ! ! /* HAS_STRXFRM: ! * This symbol, if defined, indicates that the strxfrm routine is ! * available to transform strings using collating information. ! */ ! #define HAS_STRXFRM /**/ ! ! /* HAS_TCL: ! * This symbol, if defined, means we have the tcl library ! */ ! /*#define HAS_TCL / **/ ! ! /* I_TCL: ! * This symbol, if defined, means we have the include file ! */ ! /*#define I_TCL / **/ ! ! /* HAS_TEXTDOMAIN: ! * Defined if textdomain is available(). ! */ ! /*#define HAS_TEXTDOMAIN /**/ ! ! /* HAS_TIMELOCAL: ! * This symbol, if defined, indicates that the timelocal() routine is ! * available. ! */ ! /* #define HAS_TIMELOCAL /**/ ! ! /* HAS_SAFE_TOUPPER: ! * Defined if toupper() can operate safely on any ascii character. ! * Some systems only allow toupper() on lower-case ascii chars. ! */ ! #define HAS_SAFE_TOUPPER /**/ ! ! /* UPTIME_PATH: ! * This symbol gives the full path to the uptime(1) program if ! * it exists on the system. If not, this symbol is undefined. ! */ ! /* HAS_UPTIME: ! * This symbol is defined if uptime(1) is available. ! */ ! /* #define HAS_UPTIME /**/ ! #define UPTIME_PATH "/usr/bin/uptime" ! ! /* UNION_WAIT: ! * This symbol if defined indicates to the C program that the argument ! * for the wait() system call should be declared as 'union wait status' ! * instead of 'int status'. You probably need to include ! * in the former case (see I_SYSWAIT). ! */ ! #define UNION_WAIT / **/ ! ! /* HAS_VSNPRINTF: ! * This symbol, if defined, indicates that the vsnprintf routine is ! * available to printf with a pointer to an argument list. If not, you ! * may need to write your own, probably in terms of _doprnt(). ! */ ! /* #define HAS_VSNPRINTF /**/ ! ! /* I_ARPA_NAMESER: ! * This symbol, if defined, indicates to the C program that it should ! * include to get nameser_addr and friends declarations. ! */ ! /*#define I_ARPA_NAMESER /**/ ! ! /* I_ERRNO: ! * This symbol, if defined, indicates to the C program that it can ! * include . ! */ ! /* I_SYS_ERRNO: ! * This symbol, if defined, indicates to the C program that it can ! * include . ! */ ! #define I_ERRNO /**/ ! ! /*#define I_SYS_ERRNO /**/ ! ! /* I_LIBINTL: ! * This symbol, if defined, indicates to the C program that it can ! * include . ! */ ! /*#define I_LIBINTL /**/ ! ! /* I_MEMORY: ! * This symbol, if defined, indicates to the C program that it should ! * include . ! */ ! #define I_MEMORY / **/ ! ! /* I_NETDB: ! * This symbol, if defined, indicates to the C program that it can ! * include . ! */ ! /*#define I_NETDB /**/ ! ! /* I_SETJMP: ! * This symbol, if defined, indicates to the C program that it can ! * include and have things work right. ! */ ! #define I_SETJMP /**/ ! ! /* USE_TIOCNOTTY: ! * This symbol, if defined indicate to the C program that the ioctl() ! * call with TIOCNOTTY should be used to void tty association. ! * Otherwise (on USG probably), it is enough to close the standard file ! * decriptors and do a setpgrp(). ! */ ! /*#define USE_TIOCNOTTY /**/ ! ! /* I_SYS_PAGE: ! * This symbol, if defined, indicates to the C program that it should ! * include . ! */ ! /*#define I_SYS_PAGE / **/ ! ! /* I_SYS_VLIMIT: ! * This symbol, if defined, indicates to the C program that it should ! * include . ! */ ! /* #define I_SYS_VLIMIT /**/ ! ! /* I_STDARG: ! * This symbol, if defined, indicates that exists and should ! * be included. ! */ ! #define I_STDARG /**/ ! ! /* HAS_OPENSSL: ! * Defined if openssl 0.9.6+ is available. ! */ ! /* #define HAS_OPENSSL /**/ ! /* CAN_KEEPALIVE: * This symbol if defined indicates to the C program that the SO_KEEPALIVE --- 1,799 ---- ! /* ! * This file was produced by running the config_h.SH script, which ! * gets its values from config.sh, which is generally produced by ! * running Configure. ! * ! * Feel free to modify any of this as the need arises. Note, however, ! * that running config_h.SH again will wipe out any changes you've made. ! * For a more permanent change edit config.sh and rerun config_h.SH. ! * ! * $Id$ ! */ ! ! /* ! * Package name : pennmush ! * Source directory : . ! * Configuration time: Fri Nov 16 19:02:38 EST 2001 ! * Configured by : korongil ! * Target system : Win32 ! */ ! ! #ifndef _config_h_ ! #define _config_h_ ! ! /* getdtablesize: ! * This catches use of the getdtablesize() subroutine, and remaps it ! * to either ulimit(4,0) or NOFILE, if getdtablesize() isn't available. ! */ ! /*#define getdtablesize() / **/ ! ! /* HAS_BCOPY: ! * This symbol is defined if the bcopy() routine is available to ! * copy blocks of memory. ! */ ! /* #define HAS_BCOPY /**/ ! ! /* HAS_BZERO: ! * This symbol is defined if the bzero() routine is available to ! * set a memory block to 0. ! */ ! /* #define HAS_BZERO /**/ ! ! /* HASCONST: ! * This symbol, if defined, indicates that this C compiler knows about ! * the const type. There is no need to actually test for that symbol ! * within your programs. The mere use of the "const" keyword will ! * trigger the necessary tests. ! */ ! #define HASCONST /**/ ! #ifndef HASCONST ! #define const ! #endif ! ! /* HAS_GETPRIORITY: ! * This symbol, if defined, indicates that the getpriority routine is ! * available to get a process's priority. ! */ ! /* #define HAS_GETPRIORITY /**/ ! ! /* INTERNET: ! * This symbol, if defined, indicates that there is a mailer available ! * which supports internet-style addresses (user@site.domain). ! */ ! /* #define INTERNET /**/ ! ! /* HAS_MEMSET: ! * This symbol, if defined, indicates that the memset routine is available ! * to set blocks of memory. ! */ ! #define HAS_MEMSET /**/ ! ! /* HAS_RENAME: ! * This symbol, if defined, indicates that the rename routine is available ! * to rename files. Otherwise you should do the unlink(), link(), unlink() ! * trick. ! */ ! #define HAS_RENAME /**/ ! ! /* HAS_GETRUSAGE: ! * This symbol, if defined, indicates that the getrusage() routine is ! * available to get process statistics with a sub-second accuracy. ! * Inclusion of and may be necessary. ! */ ! /* #define HAS_GETRUSAGE /**/ ! ! /* HAS_SELECT: ! * This symbol, if defined, indicates that the select routine is ! * available to select active file descriptors. If the timeout field ! * is used, may need to be included. ! */ ! #define HAS_SELECT /**/ ! ! /* HAS_SETLOCALE: ! * This symbol, if defined, indicates that the setlocale routine is ! * available to handle locale-specific ctype implementations. ! */ ! #define HAS_SETLOCALE /**/ ! ! /* HAS_SETPGID: ! * This symbol, if defined, indicates that the setpgid(pid, gpid) ! * routine is available to set process group ID. ! */ ! /* #define HAS_SETPGID /**/ ! ! /* HAS_SETPGRP: ! * This symbol, if defined, indicates that the setpgrp routine is ! * available to set the current process group. ! */ ! /* USE_BSD_SETPGRP: ! * This symbol, if defined, indicates that setpgrp needs two ! * arguments whereas USG one needs none. See also HAS_SETPGID ! * for a POSIX interface. ! */ ! /*#define HAS_SETPGRP /**/ ! /*#define USE_BSD_SETPGRP / **/ ! ! /* HAS_SETPRIORITY: ! * This symbol, if defined, indicates that the setpriority routine is ! * available to set a process's priority. ! */ ! /*#define HAS_SETPRIORITY /**/ ! ! /* HAS_SIGACTION: ! * This symbol, if defined, indicates that Vr4's sigaction() routine ! * is available. ! */ ! /* #define HAS_SIGACTION /**/ ! ! /* HAS_SOCKET: ! * This symbol, if defined, indicates that the BSD socket interface is ! * supported. ! */ ! /* HAS_SOCKETPAIR: ! * This symbol, if defined, indicates that the BSD socketpair() call is ! * supported. ! */ ! /*#define HAS_SOCKET /**/ ! /*#define HAS_SOCKETPAIR /**/ ! ! /* HAS_STRCASECMP: ! * This symbol, if defined, indicates that the strcasecmp() routine is ! * available for case-insensitive string compares. ! */ ! /* #define HAS_STRCASECMP /**/ ! ! /* HAS_STRDUP: ! * This symbol, if defined, indicates that the strdup routine is ! * available to duplicate strings in memory. Otherwise, roll up ! * your own... ! */ ! #define HAS_STRDUP /**/ ! ! /* HAS_SYSCONF: ! * This symbol, if defined, indicates that sysconf() is available ! * to determine system related limits and options. ! */ ! /* #define HAS_SYSCONF /**/ ! ! /* VOIDSIG: ! * This symbol is defined if this system declares "void (*signal(...))()" in ! * signal.h. The old way was to declare it as "int (*signal(...))()". It ! * is up to the package author to declare things correctly based on the ! * symbol. ! */ ! /* Signal_t: ! * This symbol's value is either "void" or "int", corresponding to the ! * appropriate return type of a signal handler. Thus, you can declare ! * a signal handler using "Signal_t (*handler)()", and define the ! * handler using "Signal_t handler(sig)". ! */ ! #define VOIDSIG /**/ ! #define Signal_t void /* Signal handler's return type */ ! ! /* HASVOLATILE: ! * This symbol, if defined, indicates that this C compiler knows about ! * the volatile declaration. ! */ ! #define HASVOLATILE /**/ ! #ifndef HASVOLATILE ! #define volatile ! #endif ! ! /* HAS_WAITPID: ! * This symbol, if defined, indicates that the waitpid routine is ! * available to wait for child process. ! */ ! /* #define HAS_WAITPID /**/ ! ! /* I_ARPA_INET: ! * This symbol, if defined, indicates to the C program that it should ! * include to get inet_addr and friends declarations. ! */ ! /*#define I_ARPA_INET /**/ ! ! /* I_FCNTL: ! * This manifest constant tells the C program to include . ! */ ! #define I_FCNTL /**/ ! ! /* I_LIMITS: ! * This symbol, if defined, indicates to the C program that it should ! * include to get definition of symbols like WORD_BIT or ! * LONG_MAX, i.e. machine dependant limitations. ! */ ! #define I_LIMITS /**/ ! ! /* I_LOCALE: ! * This symbol, if defined, indicates to the C program that it should ! * include . ! */ ! #define I_LOCALE /**/ ! ! /* I_MALLOC: ! * This symbol, if defined, indicates to the C program that it should ! * include . ! */ ! #define I_MALLOC /**/ ! ! /* I_NETINET_IN: ! * This symbol, if defined, indicates to the C program that it should ! * include . Otherwise, you may try . ! */ ! /* I_SYS_IN: ! * This symbol, if defined, indicates to the C program that it should ! * include instead of . ! */ ! /*#define I_NETINET_IN /**/ ! /*#define I_SYS_IN / **/ ! ! /* I_STDDEF: ! * This symbol, if defined, indicates that exists and should ! * be included. ! */ ! #define I_STDDEF /**/ ! ! /* I_STDLIB: ! * This symbol, if defined, indicates that exists and should ! * be included. ! */ ! #define I_STDLIB /**/ ! ! /* I_STRING: ! * This symbol, if defined, indicates to the C program that it should ! * include (USG systems) instead of (BSD systems). ! */ ! #define I_STRING /**/ ! ! /* I_SYS_FILE: ! * This symbol, if defined, indicates to the C program that it should ! * include to get definition of R_OK and friends. ! */ ! /*#define I_SYS_FILE /**/ ! ! /* I_SYS_MMAN: ! * This symbol, if defined, indicates to the C program that it should ! * include . ! */ ! /*#define I_SYS_MMAN /**/ ! ! /* I_SYS_PARAM: ! * This symbol, if defined, indicates to the C program that it should ! * include . ! */ ! /*#define I_SYS_PARAM /**/ ! ! /* I_SYS_RESOURCE: ! * This symbol, if defined, indicates to the C program that it should ! * include . ! */ ! /* #define I_SYS_RESOURCE /**/ ! ! /* I_SYS_SELECT: ! * This symbol, if defined, indicates to the C program that it should ! * include in order to get definition of struct timeval. ! */ ! /* #define I_SYS_SELECT /**/ ! ! /* I_SYS_SOCKET: ! * This symbol, if defined, indicates to the C program that it should ! * include before performing socket calls. ! */ ! /*#define I_SYS_SOCKET /**/ ! ! /* I_SYS_STAT: ! * This symbol, if defined, indicates to the C program that it should ! * include . ! */ ! #define I_SYS_STAT /**/ ! ! /* I_SYS_TYPES: ! * This symbol, if defined, indicates to the C program that it should ! * include . ! */ ! #define I_SYS_TYPES /**/ ! ! /* I_SYS_WAIT: ! * This symbol, if defined, indicates to the C program that it should ! * include . ! */ ! /* #define I_SYS_WAIT /**/ ! ! /* I_TIME: ! * This symbol, if defined, indicates to the C program that it should ! * include . ! */ ! /* I_SYS_TIME: ! * This symbol, if defined, indicates to the C program that it should ! * include . ! */ ! #define I_TIME / **/ ! /* #define I_SYS_TIME /**/ ! ! /* I_UNISTD: ! * This symbol, if defined, indicates to the C program that it should ! * include . ! */ ! /* #define I_UNISTD /**/ ! ! /* I_VALUES: ! * This symbol, if defined, indicates to the C program that it should ! * include to get definition of symbols like MINFLOAT or ! * MAXLONG, i.e. machine dependant limitations. Probably, you ! * should use instead, if it is available. ! */ ! /*#define I_VALUES /**/ ! ! /* Free_t: ! * This variable contains the return type of free(). It is usually ! * void, but occasionally int. ! */ ! /* Malloc_t: ! * This symbol is the type of pointer returned by malloc and realloc. ! */ ! #define Malloc_t void * /**/ ! #define Free_t void /**/ ! ! /* Pid_t: ! * This symbol holds the type used to declare process ids in the kernel. ! * It can be int, uint, pid_t, etc... It may be necessary to include ! * to get any typedef'ed information. ! */ ! #define Pid_t unsigned long /* PID type */ ! ! /* CAN_PROTOTYPE: ! * If defined, this macro indicates that the C compiler can handle ! * function prototypes. ! */ ! /* _: ! * This macro is used to declare function parameters for folks who want ! * to make declarations with prototypes using a different style than ! * the above macros. Use double parentheses. For example: ! * ! * int main _((int argc, char *argv[])); ! */ ! #define CAN_PROTOTYPE /**/ ! #ifdef CAN_PROTOTYPE ! #define _(args) args ! #else ! #define _(args) () ! #endif ! ! /* Size_t: ! * This symbol holds the type used to declare length parameters ! * for string functions. It is usually size_t, but may be ! * unsigned long, int, etc. It may be necessary to include ! * to get any typedef'ed information. ! */ ! #define Size_t size_t /* length paramater for string functions */ ! ! /* VOIDFLAGS: ! * This symbol indicates how much support of the void type is given by this ! * compiler. What various bits mean: ! * ! * 1 = supports declaration of void ! * 2 = supports arrays of pointers to functions returning void ! * 4 = supports comparisons between pointers to void functions and ! * addresses of void functions ! * 8 = suports declaration of generic void pointers ! * ! * The package designer should define VOIDUSED to indicate the requirements ! * of the package. This can be done either by #defining VOIDUSED before ! * including config.h, or by defining defvoidused in Myinit.U. If the ! * latter approach is taken, only those flags will be tested. If the ! * level of void support necessary is not present, defines void to int. ! */ ! #ifndef VOIDUSED ! #define VOIDUSED 15 ! #endif ! #define VOIDFLAGS 15 ! #if (VOIDFLAGS & VOIDUSED) != VOIDUSED ! #define void int /* is void to be avoided? */ ! #define M_VOID /* Xenix strikes again */ ! #endif ! ! /* WIN32_CDECL: ! * Defined as __cdecl if the compiler can handle that keyword to specify ! * C-style argument passing conventions. This allows MS VC++ ! * on Win32 to use the __fastcall convention for everything else ! * and get a performance boost. Any compiler with a brain (read: ! * not MS VC) handles this optimization automatically without such a ! * kludge. On these systems, this is defined as nothing. ! */ ! #define WIN32_CDECL __cdecl ! ! /* CAN_TAKE_ARGS_IN_FP: ! * Defined if the compiler prefers that function pointer parameters ! * in prototypes include the function's arguments, rather than ! * nothing (that is, int (*fun)(int) rather than int(*fun)(). ! */ ! #define CAN_TAKE_ARGS_IN_FP /**/ ! ! /* HAS_ASSERT: ! * If defined, this system has the assert() macro. ! */ ! #define HAS_ASSERT /**/ ! ! /* HASATTRIBUTE: ! * This symbol indicates the C compiler can check for function attributes, ! * such as printf formats. This is normally only supported by GNU cc. ! */ ! /* #define HASATTRIBUTE /**/ ! #ifndef HASATTRIBUTE ! #define __attribute__(_arg_) ! #endif ! ! /* HAS_BINDTEXTDOMAIN: ! * Defined if bindtextdomain is available(). ! */ ! /*#define HAS_BINDTEXTDOMAIN /**/ ! ! /* HAS_CRYPT: ! * This symbol, if defined, indicates that the crypt routine is available ! * to encrypt passwords and the like. ! */ ! /* I_CRYPT: ! * This symbol, if defined, indicates that can be included. ! */ ! /* #define HAS_CRYPT /**/ ! ! /* #define I_CRYPT /**/ ! ! /* FORCE_IPV4: ! * If defined, this system will not use IPv6. Necessary for Openbsd. ! */ ! /*#define FORCE_IPV4 / **/ ! ! /* HAS_FPSETROUND: ! * This symbol, if defined, indicates that the crypt routine is available ! * to encrypt passwords and the like. ! */ ! /* I_FLOATINGPOINT: ! * This symbol, if defined, indicates that can be included. ! */ ! /*#define HAS_FPSETROUND / **/ ! ! /*#define HAS_FPSETMASK / **/ ! ! /*#define I_FLOATINGPOINT / **/ ! ! /* HAS_GAI_STRERROR: ! * This symbol, if defined, indicates that getaddrinfo()'s error cores ! * can be converted to strings for printing. ! */ ! /* #define HAS_GAI_STRERROR /**/ ! ! /* HAS_GETADDRINFO: ! * This symbol, if defined, indicates that the getaddrinfo() routine is ! * available to lookup internet addresses in some data base or other. ! */ ! /* #define HAS_GETADDRINFO /**/ ! ! /* HAS_GETDATE: ! * This symbol, if defined, indicates that the getdate() routine is ! * available to convert date strings into struct tm's. ! */ ! /*#define HAS_GETDATE /**/ ! ! /* HAS_GETHOSTBYNAME2: ! * This symbol, if defined, indicates that the gethostbyname2() ! * function is available to resolve hostnames. ! */ ! /*#define HAS_GETHOSTBYNAME2 /**/ ! ! /* HAS_GETNAMEINFO: ! * This symbol, if defined, indicates that the getnameinfo() routine is ! * available to lookup host names in some data base or other. ! */ ! /* #define HAS_GETNAMEINFO /**/ ! ! /* HAS_GETPAGESIZE: ! * This symbol, if defined, indicates that the getpagesize system call ! * is available to get system page size, which is the granularity of ! * many memory management calls. ! */ ! /* PAGESIZE_VALUE: ! * This symbol holds the size in bytes of a system page (obtained via ! * the getpagesize() system call at configuration time or asked to the ! * user if the system call is not available). ! */ ! /*#define HAS_GETPAGESIZE /**/ ! #define PAGESIZE_VALUE 4096 /* System page size, in bytes */ ! ! /* HAS_GETTEXT: ! * Defined if gettext is available(). ! */ ! /*#define HAS_GETTEXT /**/ ! ! /* HAS_HUGE_VAL: ! * If defined, this system has the HUGE_VAL constant. We like this, ! * and don't bother defining the other floats below if we find it. ! */ ! /* HAS_HUGE: ! * If defined, this system has the HUGE constant. We like this, and ! * don't bother defining the other floats below if we find it. ! */ ! /* HAS_INT_MAX: ! * If defined, this system has the INT_MAX constant. ! */ ! /* HAS_MAXINT: ! * If defined, this system has the MAXINT constant. ! */ ! /* HAS_MAXDOUBLE: ! * If defined, this system has the MAXDOUBLE constant. ! */ ! #define HAS_HUGE_VAL /**/ ! ! /*#define HAS_HUGE / **/ ! ! #define HAS_INT_MAX /**/ ! ! /*#define HAS_MAXINT / **/ ! ! /*#define HAS_MAXDOUBLE / **/ ! ! /* HAS_IEEE_MATH: ! * Defined if the machine supports IEEE math - that is, can safely ! * return NaN or Inf rather than crash on bad math. ! */ ! /* #define HAS_IEEE_MATH /**/ ! ! /* HAS_INET_PTON: ! * This symbol, if defined, indicates that the inet_pton() and ! * inet_ntop() routines are available to convert IP addresses.. ! */ ! /*#define HAS_INET_PTON /**/ ! ! /* HAS_IPV6: ! * If defined, this system has the sockaddr_in6 struct and AF_INET6. ! * We can't rely on just AF_INET6 being defined. ! */ ! /*#define HAS_IPV6 /**/ ! ! /* SIGNALS_KEPT: ! * This symbol is defined if signal handlers needn't be reinstated after ! * receipt of a signal. ! */ ! #define SIGNALS_KEPT /**/ ! ! /* HAS_MEMCPY: ! * This symbol, if defined, indicates that the memcpy routine is available ! * to copy blocks of memory. If not, it will be mapped to bcopy ! * in confmagic.h ! */ ! /* HAS_MEMMOVE: ! * This symbol, if defined, indicates that the memmove routine is available ! * to copy blocks of memory. If not, it will be mapped to bcopy ! */ ! #define HAS_MEMCPY /**/ ! ! #define HAS_MEMMOVE /**/ ! ! /* CAN_NEWSTYLE: ! * Defined if new-style function definitions are allowable. ! * If they are, we can avoid some warnings that you get if ! * you declare char arguments in a prototype and use old-style ! * function definitions, which implicitly promote them to ints. ! */ ! #define CAN_NEWSTYLE /**/ ! ! /* HAS_RANDOM: ! * Have we got random(), our first choice for number generation? ! */ ! /* HAS_LRAND48: ! * Have we got lrand48(), our second choice? ! */ ! /* HAS_RAND: ! * Have we got rand(), our last choice? ! */ ! /* #define HAS_RANDOM /**/ ! /* #define HAS_LRAND48 /**/ ! #define HAS_RAND /**/ ! ! /* HAS_GETRLIMIT: ! * This symbol, if defined, indicates that the getrlimit() routine is ! * available to get resource limits. Probably means setrlimit too. ! * Inclusion of and may be necessary. ! */ ! /* #define HAS_GETRLIMIT /**/ ! ! /* SENDMAIL: ! * This symbol contains the full pathname to sendmail. ! */ ! /* HAS_SENDMAIL: ! * If defined, we have sendmail. ! */ ! /* #define HAS_SENDMAIL /**/ ! #define SENDMAIL "/usr/sbin/sendmail" ! ! /* HAS_SIGCHLD: ! * If defined, this system has the SIGCHLD constant. ! */ ! /* HAS_SIGCLD: ! * If defined, this system has the SIGCLD constant (SysVish SIGCHLD). ! */ ! /*#define HAS_SIGCHLD /**/ ! ! /*#define HAS_SIGCLD /**/ ! ! /* CAN_PROTOTYPE_SIGNAL: ! * This symbol is defined if we can safely prototype our rewritten ! * signal() function as: ! * Signal_t(*Sigfunc) _((int)); ! * extern Sigfunc signal _((int signo, Sigfunc func)); ! */ ! /*#define CAN_PROTOTYPE_SIGNAL /**/ ! ! /* HAS_SIGPROCMASK: ! * This symbol, if defined, indicates that POSIX's sigprocmask() routine ! * is available. ! */ ! /*#define HAS_SIGPROCMASK /**/ ! ! /* HAS_SNPRINTF: ! * This symbol, if defined, indicates that the snprintf routine is ! * available. If not, we use sprintf, which is less safe. ! */ ! #define HAS_SNPRINTF /**/ ! ! /* HAS_SOCKLEN_T: ! * If defined, this system has the socklen_t type. ! */ ! /*#define HAS_SOCKLEN_T /**/ ! ! /* HAS_STRCHR: ! * This symbol is defined to indicate that the strchr()/strrchr() ! * functions are available for string searching. If not, try the ! * index()/rindex() pair. ! */ ! /* HAS_INDEX: ! * This symbol is defined to indicate that the index()/rindex() ! * functions are available for string searching. ! */ ! #define HAS_STRCHR /**/ ! /* #define HAS_INDEX /**/ ! ! /* HAS_STRCOLL: ! * This symbol, if defined, indicates that the strcoll routine is ! * available to compare strings using collating information. ! */ ! #define HAS_STRCOLL /**/ ! ! /* HAS_STRXFRM: ! * This symbol, if defined, indicates that the strxfrm routine is ! * available to transform strings using collating information. ! */ ! #define HAS_STRXFRM /**/ ! ! /* HAS_TCL: ! * This symbol, if defined, means we have the tcl library ! */ ! /*#define HAS_TCL / **/ ! ! /* I_TCL: ! * This symbol, if defined, means we have the include file ! */ ! /*#define I_TCL / **/ ! ! /* HAS_TEXTDOMAIN: ! * Defined if textdomain is available(). ! */ ! /*#define HAS_TEXTDOMAIN /**/ ! ! /* HAS_TIMELOCAL: ! * This symbol, if defined, indicates that the timelocal() routine is ! * available. ! */ ! /* #define HAS_TIMELOCAL /**/ ! ! /* HAS_SAFE_TOUPPER: ! * Defined if toupper() can operate safely on any ascii character. ! * Some systems only allow toupper() on lower-case ascii chars. ! */ ! #define HAS_SAFE_TOUPPER /**/ ! ! /* UPTIME_PATH: ! * This symbol gives the full path to the uptime(1) program if ! * it exists on the system. If not, this symbol is undefined. ! */ ! /* HAS_UPTIME: ! * This symbol is defined if uptime(1) is available. ! */ ! /* #define HAS_UPTIME /**/ ! #define UPTIME_PATH "/usr/bin/uptime" ! ! /* UNION_WAIT: ! * This symbol if defined indicates to the C program that the argument ! * for the wait() system call should be declared as 'union wait status' ! * instead of 'int status'. You probably need to include ! * in the former case (see I_SYSWAIT). ! */ ! #define UNION_WAIT / **/ ! ! /* HAS_VSNPRINTF: ! * This symbol, if defined, indicates that the vsnprintf routine is ! * available to printf with a pointer to an argument list. If not, you ! * may need to write your own, probably in terms of _doprnt(). ! */ ! /* #define HAS_VSNPRINTF /**/ ! ! /* I_ARPA_NAMESER: ! * This symbol, if defined, indicates to the C program that it should ! * include to get nameser_addr and friends declarations. ! */ ! /*#define I_ARPA_NAMESER /**/ ! ! /* I_ERRNO: ! * This symbol, if defined, indicates to the C program that it can ! * include . ! */ ! /* I_SYS_ERRNO: ! * This symbol, if defined, indicates to the C program that it can ! * include . ! */ ! #define I_ERRNO /**/ ! ! /*#define I_SYS_ERRNO /**/ ! ! /* I_LIBINTL: ! * This symbol, if defined, indicates to the C program that it can ! * include . ! */ ! /*#define I_LIBINTL /**/ ! ! /* I_MEMORY: ! * This symbol, if defined, indicates to the C program that it should ! * include . ! */ ! #define I_MEMORY / **/ ! ! /* I_NETDB: ! * This symbol, if defined, indicates to the C program that it can ! * include . ! */ ! /*#define I_NETDB /**/ ! ! /* I_SETJMP: ! * This symbol, if defined, indicates to the C program that it can ! * include and have things work right. ! */ ! #define I_SETJMP /**/ ! ! /* USE_TIOCNOTTY: ! * This symbol, if defined indicate to the C program that the ioctl() ! * call with TIOCNOTTY should be used to void tty association. ! * Otherwise (on USG probably), it is enough to close the standard file ! * decriptors and do a setpgrp(). ! */ ! /*#define USE_TIOCNOTTY /**/ ! ! /* I_SYS_PAGE: ! * This symbol, if defined, indicates to the C program that it should ! * include . ! */ ! /*#define I_SYS_PAGE / **/ ! ! /* I_SYS_VLIMIT: ! * This symbol, if defined, indicates to the C program that it should ! * include . ! */ ! /* #define I_SYS_VLIMIT /**/ ! ! /* I_STDARG: ! * This symbol, if defined, indicates that exists and should ! * be included. ! */ ! #define I_STDARG /**/ ! ! /* HAS_MYSQL: ! * Defined if mysql client libraries are available. ! */ ! /* #define HAS_MYSQL ! ! /* HAS_OPENSSL: ! * Defined if openssl 0.9.6+ is available. ! */ ! /* #define HAS_OPENSSL /**/ ! /* CAN_KEEPALIVE: * This symbol if defined indicates to the C program that the SO_KEEPALIVE *************** *** 798,805 **** * This symbol if defined indicates to the C program that the TCP_KEEPIDLE * option of setsockopt() will work as advertised in the manual. */ ! /* #define CAN_KEEPALIVE /**/ ! /* #define CAN_KEEPIDLE /**/ ! #endif --- 803,810 ---- * This symbol if defined indicates to the C program that the TCP_KEEPIDLE * option of setsockopt() will work as advertised in the manual. */ ! /* #define CAN_KEEPALIVE /**/ ! /* #define CAN_KEEPIDLE /**/ ! #endif *** 1_7_7.977/win32/cmds.h Tue, 27 Apr 2004 13:42:40 -0500 dunemush (pennmush/f/15_cmds.h 1.9.1.4.1.1.1.1.1.1.1.1.2.1.1.1.2.1.1.2.1.1.1.1.1.1.1.1.1.1.1.1.1.1.1.9.1.7.2.4.1.2.3.1.1.1.1.1.1.1.1.6 660) --- 1_7_7.1049(w)/win32/cmds.h Thu, 27 May 2004 14:04:26 -0500 dunemush (pennmush/f/15_cmds.h 1.9.1.4.1.1.1.1.1.1.1.1.2.1.1.1.2.1.1.2.1.1.1.1.1.1.1.1.1.1.1.1.1.1.1.9.1.7.2.4.1.2.3.1.1.1.1.1.1.1.1.8 660) *************** *** 34,39 **** --- 34,40 ---- COMMAND_PROTO(cmd_edit); COMMAND_PROTO(cmd_elock); COMMAND_PROTO(cmd_emit); + COMMAND_PROTO(cmd_empty); COMMAND_PROTO(cmd_enable); COMMAND_PROTO(cmd_enter); COMMAND_PROTO(cmd_entrances); *************** *** 106,111 **** --- 107,113 ---- COMMAND_PROTO(cmd_shutdown); COMMAND_PROTO(cmd_sitelock); COMMAND_PROTO(cmd_slay); + COMMAND_PROTO(cmd_sql); COMMAND_PROTO(cmd_squota); COMMAND_PROTO(cmd_stats); COMMAND_PROTO(cmd_sweep); *** 1_7_7.977/hdrs/mushtype.h Sat, 01 May 2004 13:20:55 -0500 dunemush (pennmush/f/20_mushtype.h 1.2.1.1.1.20 660) --- 1_7_7.1049(w)/hdrs/mushtype.h Mon, 31 May 2004 08:42:43 -0500 dunemush (pennmush/f/20_mushtype.h 1.2.1.1.1.21 660) *************** *** 133,138 **** --- 133,139 ---- /* max length of command argument to process_command */ #define MAX_COMMAND_LEN 4096 #define BUFFER_LEN ((MAX_COMMAND_LEN)*2) + #define MAX_ARG 63 /* Channel stuff */ typedef struct chanuser CHANUSER; *** 1_7_7.977/hdrs/log.h Fri, 05 Jul 2002 12:57:10 -0500 dunemush (pennmush/f/21_log.h 1.2 660) --- 1_7_7.1049(w)/hdrs/log.h Mon, 31 May 2004 08:42:43 -0500 dunemush (pennmush/f/21_log.h 1.6 660) *************** *** 14,19 **** --- 14,20 ---- /* From log.c */ extern void start_all_logs(void); extern void end_all_logs(void); + extern void redirect_stderr(void); extern void WIN32_CDECL do_log (int logtype, dbref player, dbref object, const char *fmt, ...) __attribute__ ((__format__(__printf__, 4, 5))); *************** *** 21,25 **** --- 22,35 ---- __attribute__ ((__format__(__printf__, 2, 3))); extern void do_logwipe(dbref player, int logtype, char *str); + /* Activity log types */ + #define LA_CMD 0 + #define LA_PE 1 + #define LA_LOCK 2 + #define ACTIVITY_LOG_SIZE 3 /* In BUFFER_LEN-size lines */ + extern void log_activity(int type, dbref player, const char *action); + extern void notify_activity(dbref player, int num_lines, int dump); + extern const char *last_activity(void); + extern int last_activity_type(void); #endif /* LOG_H */ *** 1_7_7.977/game/txt/hlp/pennconf.hlp Sat, 01 May 2004 14:18:30 -0500 dunemush (pennmush/f/43_pennconf.h 1.15 600) --- 1_7_7.1049(w)/game/txt/hlp/pennconf.hlp Mon, 24 May 2004 21:23:00 -0500 dunemush (pennmush/f/43_pennconf.h 1.16 600) *************** *** 217,222 **** --- 217,225 ---- player_creation=: Can CREATE be used from the login screen? guests=: Are guest logins allowed? pueblo=: Is Pueblo support turned on? + sql_platform=: What kind of SQL server are we using? + ("mysql" or "disabled") + sql_host=: What is the hostname or ip address of the SQL server & @config tiny Options that help control compability with TinyMUSH servers. *** 1_7_7.977/src/ptab.c Sat, 01 May 2004 13:51:07 -0500 dunemush (pennmush/g/8_ptab.c 1.10 660) --- 1_7_7.1049(w)/src/ptab.c Mon, 31 May 2004 08:42:42 -0500 dunemush (pennmush/g/8_ptab.c 1.11 660) *************** *** 10,15 **** --- 10,16 ---- #include #include #include + #include "conf.h" #include "externs.h" #include "ptab.h" #include "confmagic.h" *** 1_7_7.977/src/tables.c Sat, 11 Jan 2003 16:00:54 -0600 dunemush (pennmush/g/11_tables.c 1.7 660) --- 1_7_7.1049(w)/src/tables.c Mon, 31 May 2004 08:42:42 -0500 dunemush (pennmush/g/11_tables.c 1.8 660) *************** *** 1,4 **** ! /* This file was generated by running ./a.out compiled from * utils/gentables.c. Edit that file, not this one, when making changes. */ #include --- 1,4 ---- ! /* This file was generated by running ./gentables compiled from * utils/gentables.c. Edit that file, not this one, when making changes. */ #include *************** *** 68,73 **** --- 68,92 ---- 0, 0, 0, 1, 0, 1, 0, 1, 1, 1, 1, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 0, 0, 0, 0, 0, 1, 0, 0, 1, 0, 0, 1, 0, 0, 0, 0, 0, 0, 1, 1, 1, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 + }; + + char escaped_chars[256] = { + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 1, 1, 0, 0, 1, 1, 0, 0, 1, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, *** 1_7_7.977/utils/gentables.c Mon, 28 Apr 2003 22:03:14 -0500 dunemush (pennmush/g/12_gentables. 1.5 600) --- 1_7_7.1049(w)/utils/gentables.c Mon, 24 May 2004 21:12:12 -0500 dunemush (pennmush/g/12_gentables. 1.6 600) *************** *** 99,104 **** --- 99,112 ---- ['Z'] = 1, ['$'] = 1 }; + /* Special characters for escape() and secure() */ + char escaped_chars[UCHAR_MAX + 1] = { + ['('] = 1, [')'] = 1, ['['] = 1, [']'] = 1, ['{'] = 1, + ['}'] = 1, ['$'] = 1, ['^'] = 1, ['%'] = 1, [','] = 1, + [';'] = 1, ['\\'] = 1 + }; + + /** Accented characters * * The table is for ISO 8859-1 character set. *************** *** 123,135 **** [161] = {"!", "¡"}, [191] = {"?", "¿"}, // szlig ! [223] = {"ss", "ß"}, // thorn ! [222] = {"Th", "Þ"}, ! [254] = {"th", "þ:"}, // eth ! [208] = {"Th", "Ð"}, ! [240] = {"th", "ð"}, // Special symbols [169] = {"(c)", "©"}, [174] = {"(r)", "®"}, --- 131,143 ---- [161] = {"!", "¡"}, [191] = {"?", "¿"}, // szlig ! [223] = {"s", "ß"}, // thorn ! [222] = {"P", "Þ"}, ! [254] = {"p", "þ:"}, // eth ! [208] = {"D", "Ð"}, ! [240] = {"o", "ð"}, // Special symbols [169] = {"(c)", "©"}, [174] = {"(r)", "®"}, *************** *** 256,261 **** --- 264,270 ---- print_table_bool("char", "active_table", parse_interesting, 0); print_table_bool("char", "atr_name_table", attribute_names, 0); print_table_bool("char", "valid_timefmt_codes", valid_timefmt_codes, 0); + print_table_bool("char", "escaped_chars", escaped_chars, 0); print_entity_table("accent_table", entity_table); return EXIT_SUCCESS; } *** 1_7_7.977/game/README Thu, 04 Sep 2003 18:14:19 -0500 dunemush (pennmush/g/13_README 1.4 660) --- 1_7_7.1049(w)/game/README Thu, 13 May 2004 11:45:39 -0500 dunemush (pennmush/g/13_README 1.5 660) *************** *** 11,29 **** all need to be there. WIN32: ! Under win32 using the Microsoft compiler, DO NOT rename mush.cnf. ! Also, ignore the restart script. In the configuration file, turn off ! disk database compression; it is not supported. ! Then go to the game directory and run PennMUSH.exe. Poof, you're done. UNIX: ! On Unix or similar systems, you should link it to .cnf ! (if you don't have links, rename it to .cnf). ! Then edit the restart script. Change CONF_FILE to the new name of the ! configuration file. The restart script is written for sh, and assumes ! a fairly standard Berkeley UNIX setup. If you're on a HP-UX or SysV ! machine, for example, you may need to change the restart script a bit ! (the ps options, for example). Then run it. You should now be ready to start the game. This distribution can general a minimal database - a God character, starting room, and --- 11,28 ---- all need to be there. WIN32: ! Under win32 using the Microsoft compiler, ignore the restart script. ! In the configuration file, turn off disk database compression; it is ! not supported. Then go to the game directory and run PennMUSH.exe. ! Poof, you're done. UNIX: ! Edit the restart script. Change GAMEDIR to the path to the directory ! containing mush.cnf. Read about the optional settings in that file. ! The restart script is written for sh, and assumes a fairly standard ! Berkeley UNIX setup. If you're on a HP-UX or SysV machine, for example, ! you may need to change the restart script a bit (the ps options, ! for example). Then run it. You should now be ready to start the game. This distribution can general a minimal database - a God character, starting room, and *************** *** 39,47 **** .txt files in the game directory. The logfiles in the "log" directory generally contain useful ! information. You will probably want to read your main logfile (defined ! in the restart script) every time, since errors and other important ! messages get printed to that logfile. ============================================================================ --- 38,46 ---- .txt files in the game directory. The logfiles in the "log" directory generally contain useful ! information. You will probably want to read your error logfile (defined ! in mush.cnf) every time, since errors and other important messages get ! printed to that logfile. ============================================================================ *** 1_7_7.977/INSTALL Sat, 17 Jan 2004 13:58:58 -0600 dunemush (pennmush/g/20_INSTALL 1.6 600) --- 1_7_7.1049(w)/INSTALL Thu, 13 May 2004 11:44:18 -0500 dunemush (pennmush/g/20_INSTALL 1.7 600) *************** *** 161,172 **** customize" which will run a script to help set up a separate customized game subdirectory for each MUSH (run it once per MUSH you plan to run). Files in these subdirectories will already be customized in many ways, ! so what follows may be slightly different. :) 7. Read game/README and follow those instructions. - - On cygwin systems, you will likely have to edit the game/restart - script and explicitly set GAMEDIR (to /usr/src/pennmush/game) A final thing you may want to think about is compiling announce.c or portmsg.c. These are port announcers; if your MUSH ever goes down, you can --- 161,169 ---- customize" which will run a script to help set up a separate customized game subdirectory for each MUSH (run it once per MUSH you plan to run). Files in these subdirectories will already be customized in many ways, ! so what follows may be slightly different. :) This is probably broken. 7. Read game/README and follow those instructions. A final thing you may want to think about is compiling announce.c or portmsg.c. These are port announcers; if your MUSH ever goes down, you can *** 1_7_7.977/UPGRADING Wed, 10 Mar 2004 09:27:22 -0600 dunemush (pennmush/g/21_UPGRADING 1.3 600) --- 1_7_7.1049(w)/UPGRADING Thu, 13 May 2004 11:43:45 -0500 dunemush (pennmush/g/21_UPGRADING 1.4 600) *************** *** 76,82 **** If you've modified the restart script, you'll have to decide if your modified script is still appropriate, or modify the distributed ! game/restart script again as you like it. You can also copy your old game/access.cnf, game/sitelock.cnf, and game/txt/*.txt files into the appropriate locations. You may wish --- 76,82 ---- If you've modified the restart script, you'll have to decide if your modified script is still appropriate, or modify the distributed ! game/restart script again as you like it. The latter is encouraged. You can also copy your old game/access.cnf, game/sitelock.cnf, and game/txt/*.txt files into the appropriate locations. You may wish *** 1_7_7.977/src/flaglocal.dst Sun, 12 Jan 2003 00:01:09 -0600 dunemush (pennmush/g/27_flaglocal. 1.4 660) --- 1_7_7.1049(w)/src/flaglocal.dst Mon, 31 May 2004 08:42:40 -0500 dunemush (pennmush/g/27_flaglocal. 1.5 660) *************** *** 24,29 **** --- 24,30 ---- #include "copyrite.h" #include "config.h" #include + #include "conf.h" #include "externs.h" #include "flags.h" #include "confmagic.h" *** 1_7_7.977/game/txt/hlp/pennvOLD.hlp Sat, 08 May 2004 17:45:24 -0500 dunemush (pennmush/g/30_pennvOLD.h 1.1.1.1.1.1.1.1.1.1.1.1.1.1.1.1.1.4 660) --- 1_7_7.1049(w)/game/txt/hlp/pennvOLD.hlp Mon, 31 May 2004 08:42:43 -0500 dunemush (pennmush/g/30_pennvOLD.h 1.1.1.1.1.1.1.1.1.1.1.1.1.1.1.1.1.5 660) *************** *** 4418,4424 **** type 'help p'. For example, 'help 1.7.2p3' 1.7.7: 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, ! 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31 1.7.6: 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16 1.7.5: 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12 1.7.4: 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, --- 4418,4424 ---- type 'help p'. For example, 'help 1.7.2p3' 1.7.7: 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, ! 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32 1.7.6: 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16 1.7.5: 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12 1.7.4: 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, *** 1_7_7.977/game/txt/hlp/pennv177.hlp Tue, 11 May 2004 10:54:19 -0500 dunemush (pennmush/g/34_pennv177.h 1.226.1.14.1.77 660) --- 1_7_7.1049(w)/game/txt/hlp/pennv177.hlp Mon, 31 May 2004 08:42:43 -0500 dunemush (pennmush/g/34_pennv177.h 1.226.1.14.1.103 660) *************** *** 1,4 **** ! & 1.7.7p31 & changes This is a list of changes in this patchlevel which are probably of interest to players. More information about new commands and functions --- 1,4 ---- ! & 1.7.7p32 & changes This is a list of changes in this patchlevel which are probably of interest to players. More information about new commands and functions *************** *** 11,23 **** --- 11,100 ---- A list of the patchlevels associated with each release can be read in 'help patchlevels'. + 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. + + + & 1.7.7p31 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/src/notify.c Tue, 11 May 2004 10:08:19 -0500 dunemush (pennmush/g/35_notify.c 1.41.1.6 660) --- 1_7_7.1049(w)/src/notify.c Mon, 31 May 2004 08:42:42 -0500 dunemush (pennmush/g/35_notify.c 1.41.1.9 660) *************** *** 947,953 **** ) atr_comm_match(target, speaker, '^', ':', (char *) notify_makestring(msgbuf, messages, NA_ASCII), 0, ! NULL, NULL); /* If object is flagged AUDIBLE and has a @FORWARDLIST, send * stuff on */ --- 947,953 ---- ) atr_comm_match(target, speaker, '^', ':', (char *) notify_makestring(msgbuf, messages, NA_ASCII), 0, ! NULL, NULL, NULL); /* If object is flagged AUDIBLE and has a @FORWARDLIST, send * stuff on */ *************** *** 1005,1010 **** --- 1005,1077 ---- notify_anything_loc(speaker, func, fdata, nsfunc, flags, message, loc); } + /** Basic 'notify player with message */ + #define notify(p,m) notify_anything(orator, na_one, &(p), NULL, 0, m) + + /** Notify a player with a formatted string, easy version. + * This is a safer replacement for notify(player, tprintf(fmt, ...)) + * \param speaker dbref of object producing the message. + * \param func pointer to iterator function to look up each receiver. + * \param fdata initial data to pass to func. + * \param nsfunc function to call to do NOSPOOF formatting, or NULL. + * \param flags flags to pass in (such as NA_INTERACT) + * \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); + } + + + /** Notify a player with a formatted string, full version. + * This is a safer replacement for notify(player, tprintf(fmt, ...)) + * \param speaker dbref of object producing the message. + * \param func pointer to iterator function to look up each receiver. + * \param fdata initial data to pass to func. + * \param nsfunc function to call to do NOSPOOF formatting, or NULL. + * \param flags flags to pass in (such as NA_INTERACT) + * \param fmt format string. + */ + void WIN32_CDECL + notify_anything_format(dbref speaker, na_lookup func, + void *fdata, char *(*nsfunc) (dbref, na_lookup func, + void *, int), int flags, + 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_anything(speaker, func, fdata, nsfunc, flags, buff); + } + + + /** Send a message to a list of dbrefs on an attribute on an object. * Be sure we don't send a message to the object itself! * \param speaker message speaker *************** *** 1552,1555 **** --- 1619,1650 ---- } d->raw_input = 0; d->raw_input_at = 0; + } + + /** 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; } *** 1_7_7.977/src/chunk.c Mon, 10 Nov 2003 14:51:32 -0600 dunemush (pennmush/g/38_chunk.c 1.33 660) --- 1_7_7.1049(w)/src/chunk.c Mon, 31 May 2004 08:42:40 -0500 dunemush (pennmush/g/38_chunk.c 1.36 660) *************** *** 230,239 **** #endif #include #include "chunk.h" #include "command.h" #include "dbdefs.h" - #include "externs.h" #include "intrface.h" #include "log.h" #include "mymalloc.h" --- 230,239 ---- #endif #include + #include "externs.h" #include "chunk.h" #include "command.h" #include "dbdefs.h" #include "intrface.h" #include "log.h" #include "mymalloc.h" *************** *** 1143,1153 **** #endif if (j >= 3) #ifdef WIN32 ! mush_panic(tprintf ! ("chunk swap file seek, GetLastError %d", GetLastError())); #else ! mush_panic(tprintf("chunk swap file seek, errno %d: %s", ! errno, strerror(errno))); #endif pos = (char *) rhp; remaining = REGION_SIZE; --- 1143,1151 ---- #endif if (j >= 3) #ifdef WIN32 ! mush_panicf("chunk swap file seek, GetLastError %d", GetLastError()); #else ! mush_panicf("chunk swap file seek, errno %d: %s", errno, strerror(errno)); #endif pos = (char *) rhp; remaining = REGION_SIZE; *************** *** 1173,1183 **** #endif } #ifdef WIN32 ! mush_panic(tprintf("chunk swap file read, %d remaining, GetLastError %d", ! remaining, GetLastError())); #else ! mush_panic(tprintf("chunk swap file read, %d remaining, errno %d: %s", ! remaining, errno, strerror(errno))); #endif } --- 1171,1181 ---- #endif } #ifdef WIN32 ! mush_panicf("chunk swap file read, %d remaining, GetLastError %d", ! remaining, GetLastError()); #else ! mush_panicf("chunk swap file read, %d remaining, errno %d: %s", ! remaining, errno, strerror(errno)); #endif } *************** *** 1206,1216 **** #endif if (j >= 3) #ifdef WIN32 ! mush_panic(tprintf ! ("chunk swap file seek, GetLastError %d", GetLastError())); #else ! mush_panic(tprintf("chunk swap file seek, errno %d: %s", ! errno, strerror(errno))); #endif pos = (char *) rhp; remaining = REGION_SIZE; --- 1204,1212 ---- #endif if (j >= 3) #ifdef WIN32 ! mush_panicf("chunk swap file seek, GetLastError %d", GetLastError()); #else ! mush_panicf("chunk swap file seek, errno %d: %s", errno, strerror(errno)); #endif pos = (char *) rhp; remaining = REGION_SIZE; *************** *** 1238,1248 **** #endif } #ifdef WIN32 ! mush_panic(tprintf("chunk swap file write, %d remaining, GetLastError %d", ! remaining, GetLastError())); #else ! mush_panic(tprintf("chunk swap file write, %d remaining, errno %d: %s", ! remaining, errno, strerror(errno))); #endif } --- 1234,1244 ---- #endif } #ifdef WIN32 ! mush_panicf("chunk swap file write, %d remaining, GetLastError %d", ! remaining, GetLastError()); #else ! mush_panicf("chunk swap file write, %d remaining, errno %d: %s", ! remaining, errno, strerror(errno)); #endif } *************** *** 2371,2377 **** u_int_16 full_len, region, offset; if (len < MIN_CHUNK_LEN || len > MAX_CHUNK_LEN) ! mush_panic(tprintf("Illegal chunk length requested: %d bytes", len)); full_len = LenToFullLen(len); region = find_best_region(full_len, derefs, UNHAPPINESS_NEVER); --- 2367,2373 ---- u_int_16 full_len, region, offset; if (len < MIN_CHUNK_LEN || len > MAX_CHUNK_LEN) ! mush_panicf("Illegal chunk length requested: %d bytes", len); full_len = LenToFullLen(len); region = find_best_region(full_len, derefs, UNHAPPINESS_NEVER); *************** *** 2601,2611 **** swap_fd = CreateFile(CHUNK_SWAP_FILE, GENERIC_READ | GENERIC_WRITE, 0, NULL, CREATE_ALWAYS, FILE_FLAG_DELETE_ON_CLOSE, NULL); if (swap_fd == INVALID_HANDLE_VALUE) ! mush_panic(tprintf("Cannot open swap file: %d", GetLastError())); #else swap_fd = open(CHUNK_SWAP_FILE, O_RDWR | O_TRUNC | O_CREAT, 0600); if (swap_fd < 0) ! mush_panic(tprintf("Cannot open swap file: %s", strerror(errno))); #endif curr_period = 0; --- 2597,2607 ---- swap_fd = CreateFile(CHUNK_SWAP_FILE, GENERIC_READ | GENERIC_WRITE, 0, NULL, CREATE_ALWAYS, FILE_FLAG_DELETE_ON_CLOSE, NULL); if (swap_fd == INVALID_HANDLE_VALUE) ! mush_panicf("Cannot open swap file: %d", GetLastError()); #else swap_fd = open(CHUNK_SWAP_FILE, O_RDWR | O_TRUNC | O_CREAT, 0600); if (swap_fd < 0) ! mush_panicf("Cannot open swap file: %s", strerror(errno)); #endif curr_period = 0; *** 1_7_7.977/README.SSL Sun, 17 Aug 2003 15:38:47 -0500 dunemush (pennmush/g/41_README.SSL 1.7 660) --- 1_7_7.1049(w)/README.SSL Mon, 24 May 2004 11:40:51 -0500 dunemush (pennmush/g/41_README.SSL 1.8 660) *************** *** 1,5 **** Use SSL with PennMUSH ! Revised: 11 Auguest 2003 As of version 1.7.7p17, PennMUSH supports SSL connections when linked --- 1,5 ---- Use SSL with PennMUSH ! Revised: 11 August 2003 As of version 1.7.7p17, PennMUSH supports SSL connections when linked *** 1_7_7.977/test/testatree.pl Sat, 13 Sep 2003 16:59:28 -0500 dunemush (pennmush/g/42_testatree. 1.7 640) --- 1_7_7.1049(w)/test/testatree.pl Sat, 15 May 2004 16:55:41 -0500 dunemush (pennmush/g/42_testatree. 1.8 640) *************** *** 10,40 **** $god = $mush->loginGod(); # First, the basic tests enforcing tree-nature of the attributes. - # Must have a branch to make a leaf. - test("atree.basic.1", $god, "&foo`bar me=baz", "You must set FOO first"); # Attrs may not start or end in ` ! test("atree.basic.2", $god, "&foo` me=baz", "not a very good name"); ! test("atree.basic.3", $god, "&`bar me=baz", "not a very good name"); # Not even if there's a preexisting branch ! test("atree.basic.4", $god, "&foo me=baz", "Set"); ! test("atree.basic.5", $god, "&foo` me=baz", "not a very good name"); # You may not have two ` in a row ! test("atree.basic.6", $god, "&foo``bar me=baz", "not a very good name"); # Make a small tree ! test("atree.basic.7", $god, "&foo me=baz", "Set"); ! test("atree.basic.8", $god, "&foo`bar me=baz", "Set"); ! test("atree.basic.9", $god, "&foo`bar`baz me=baz", "Set"); # Cannot clear branches with leaves until the leaves are cleared ! test("atree.basic.10", $god, "&foo me", "!Cleared"); ! test("atree.basic.11", $god, "&foo`bar me", "!Cleared"); ! test("atree.basic.12", $god, "&foo`bar`baz me", "Cleared"); ! test("atree.basic.13", $god, "&foo`bar me", "Cleared"); ! test("atree.basic.14", $god, "&foo me", "Cleared"); # You can wipe, though. ! test("atree.basic.15", $god, "&foo me=baz", "Set"); ! test("atree.basic.16", $god, "&foo`bar me=baz", "Set"); ! test("atree.basic.17", $god, "&foo`bar`baz me=baz", "Set"); ! test("atree.basic.18", $god, '@wipe me/foo', "wiped"); # Wildcard attribute matching # Rebuild a tree --- 10,49 ---- $god = $mush->loginGod(); # First, the basic tests enforcing tree-nature of the attributes. # Attrs may not start or end in ` ! test("atree.basic.1", $god, "&foo` me=baz", "not a very good name"); ! test("atree.basic.2", $god, "&`bar me=baz", "not a very good name"); # Not even if there's a preexisting branch ! test("atree.basic.3", $god, "&foo me=baz", "Set"); ! test("atree.basic.4", $god, "&foo` me=baz", "not a very good name"); # You may not have two ` in a row ! test("atree.basic.5", $god, "&foo``bar me=baz", "not a very good name"); # Make a small tree ! test("atree.basic.6", $god, "&foo me=baz", "Set"); ! test("atree.basic.7", $god, "&foo`bar me=baz", "Set"); ! test("atree.basic.8", $god, "&foo`bar`baz me=baz", "Set"); # Cannot clear branches with leaves until the leaves are cleared ! test("atree.basic.9", $god, "&foo me", "!Cleared"); ! test("atree.basic.10", $god, "&foo`bar me", "!Cleared"); ! test("atree.basic.11", $god, "&foo`bar`baz me", "Cleared"); ! test("atree.basic.12", $god, "&foo`bar me", "Cleared"); ! test("atree.basic.13", $god, "&foo me", "Cleared"); # You can wipe, though. ! test("atree.basic.14", $god, "&foo me=baz", "Set"); ! test("atree.basic.15", $god, "&foo`bar me=baz", "Set"); ! test("atree.basic.16", $god, "&foo`bar`baz me=baz", "Set"); ! test("atree.basic.17", $god, '@wipe me/foo', "wiped"); ! ! # Branch permissions ! # May make a leaf without supporting branch ! test("atree.branch.1", $god, "&foo`bar me=baz", "!You must set FOO first"); ! # And it must make the branch ! test("atree.branch.2", $god, "think hasattr(me, foo)", "1"); ! # Another child should not wipe the previous values ! test("atree.branch.3", $god, "&foo`bar`baz me=baz", "!You must set FOO first"); ! test("atree.branch.4", $god, "think get(me/foo`bar)", "baz"); ! # Clean up again ! test("atree.branch.5", $god, '@wipe me/foo', "wiped"); # Wildcard attribute matching # Rebuild a tree *************** *** 134,148 **** # Can we see stuff from the parent? test('atree.parent.14', $mortal, '&foo parent=wibble', 'Set'); test('atree.parent.15', $mortal, '&foo`bar parent=gleep', 'Set'); ! test('atree.parent.16', $mortal, '&foo`bar`baz child=boom', '!Set'); ! test('atree.parent.17', $mortal, 'think get(child/foo)', 'wibble'); ! test('atree.parent.18', $mortal, 'think get(child/foo`bar)', 'gleep'); # Setting no_inherit puts it back to the ancestor ! test('atree.parent.19', $mortal, '@set parent/foo=no_inherit', 'set'); ! test('atree.parent.20', $mortal, 'think get(child/foo)', '!wibble'); ! test('atree.parent.21', $god, 'think get(child/foo`bar)', '!gleep'); ! test('atree.parent.22', $god, 'think get(child/foo)', 'urk'); ! test('atree.parent.23', $god, 'think get(child/foo`bar)', 'urk'); # Mix permissions and parents # If parent is inheritable again, and mortal_dark, --- 143,160 ---- # Can we see stuff from the parent? test('atree.parent.14', $mortal, '&foo parent=wibble', 'Set'); test('atree.parent.15', $mortal, '&foo`bar parent=gleep', 'Set'); ! test('atree.parent.16', $mortal, 'think get(child/foo)', 'wibble'); ! test('atree.parent.17', $mortal, 'think get(child/foo`bar)', 'gleep'); ! test('atree.parent.18', $mortal, '&foo`bar`baz child=boom', 'Set'); ! test('atree.parent.19', $mortal, 'think -[get(child/foo)]-', '--'); ! test('atree.parent.20', $mortal, 'think -[get(child/foo`bar)]-', '--'); ! test('atree.parent.21', $mortal, '@wipe child/foo', 'wiped'); # Setting no_inherit puts it back to the ancestor ! test('atree.parent.22', $mortal, '@set parent/foo=no_inherit', 'set'); ! test('atree.parent.23', $mortal, 'think get(child/foo)', '!wibble'); ! test('atree.parent.24', $god, 'think get(child/foo`bar)', '!gleep'); ! test('atree.parent.25', $god, 'think get(child/foo)', 'urk'); ! test('atree.parent.26', $god, 'think get(child/foo`bar)', 'urk'); # Mix permissions and parents # If parent is inheritable again, and mortal_dark, *** 1_7_7.977/game/txt/hlp/pennattr.hlp Sat, 13 Sep 2003 16:59:28 -0500 dunemush (pennmush/g/47_pennattr.h 1.4 600) --- 1_7_7.1049(w)/game/txt/hlp/pennattr.hlp Sat, 15 May 2004 16:55:41 -0500 dunemush (pennmush/g/47_pennattr.h 1.5 600) *************** *** 18,25 **** All attributes are either branch attributes or leaf attributes. A branch attribute is an attribute that has other branches or leaves beneath it; a leaf attribute is one that does not. Any attribute may ! act as a branch. Branch attributes must exist in order to create any ! leaf attributes from them. See help attribute trees2 for more information and examples. --- 18,25 ---- All attributes are either branch attributes or leaf attributes. A branch attribute is an attribute that has other branches or leaves beneath it; a leaf attribute is one that does not. Any attribute may ! act as a branch. If you try to create an unsupported leaf, branch ! attributes will be created as needed to support it. See help attribute trees2 for more information and examples. *************** *** 75,85 **** As usual, children inherit attributes from their parent unless the child has its own overriding attribute. However, children that wish to override a leaf attribute must also have their own (overriding) ! copy of all branches leading to that leaf. So this doesn't work: &BRANCH parent = a branch &BRANCH`LEAF parent = a leaf ! &BRANCH`LEAF child = a new leaf <--- No good until you add child/BRANCH If a branch on the parent is set no_inherit, it will not be inherited, regardless of any other flags that may be present. If a branch is --- 75,89 ---- As usual, children inherit attributes from their parent unless the child has its own overriding attribute. However, children that wish to override a leaf attribute must also have their own (overriding) ! copy of all branches leading to that leaf. This means that when you do: &BRANCH parent = a branch &BRANCH`LEAF parent = a leaf ! &BRANCH`LEAF child = a new leaf ! ! In this case, a new BRANCH attribute will be created on the child, ! so '-[get(child/BRANCH)]-' will return '--'. This may not be what ! you actually want. If a branch on the parent is set no_inherit, it will not be inherited, regardless of any other flags that may be present. If a branch is *************** *** 88,92 **** access restrictions to its own attributes on the same branch). The child object may impose stricter restrictions, however, and these may prevent access to inherited parent data. - --- 92,95 ---- *** 1_7_7.977/src/Makefile.SH Sun, 02 May 2004 11:47:30 -0500 dunemush (pennmush/h/7_Makefile.S 1.4 655) --- 1_7_7.1049(w)/src/Makefile.SH Mon, 24 May 2004 15:18:10 -0500 dunemush (pennmush/h/7_Makefile.S 1.8 655) *************** *** 58,64 **** # $(CC) $(CFLAGS) -aux-info $<.X -c $< # List of C files, used for make depend: ! C_FILES=access.c atr_tab.c attrib.c boolexp.c bsd.c chunk.c cmdlocal.c cmds.c \ command.c compress.c conf.c cque.c create.c db.c destroy.c extchat.c \ extmail.c filecopy.c flaglocal.c flags.c funcrypt.c function.c \ fundb.c funlist.c funlocal.c funmath.c funmisc.c funstr.c funtime.c \ --- 58,65 ---- # $(CC) $(CFLAGS) -aux-info $<.X -c $< # List of C files, used for make depend: ! C_FILES=access.c atr_tab.c attrib.c boolexp.c bsd.c bufferq.c \ ! chunk.c cmdlocal.c cmds.c \ command.c compress.c conf.c cque.c create.c db.c destroy.c extchat.c \ extmail.c filecopy.c flaglocal.c flags.c funcrypt.c function.c \ fundb.c funlist.c funlocal.c funmath.c funmisc.c funstr.c funtime.c \ *************** *** 66,77 **** malias.c match.c memcheck.c move.c mycrypt.c mymalloc.c mysocket.c \ myssl.c notify.c parse.c pcre.c player.c plyrlist.c \ predicat.c privtab.c \ ! ptab.c rob.c services.c set.c shs.c sig.c speech.c strdup.c strtree.c \ strutil.c tables.c timer.c unparse.c utils.c version.c warnings.c \ wild.c wiz.c H_FILES = ../config.h ../confmagic.h ../hdrs/ansi.h ../hdrs/atr_tab.h \ ! ../hdrs/attrib.h ../hdrs/boolexp.h ../hdrs/boolexp.h ../hdrs/case.h \ ../hdrs/case.h ../hdrs/chunk.h ../hdrs/command.h ../hdrs/conf.h \ ../hdrs/copyrite.h ../hdrs/dbdefs.h ../hdrs/extchat.h \ ../hdrs/externs.h ../hdrs/extmail.h ../hdrs/flags.h \ --- 67,79 ---- malias.c match.c memcheck.c move.c mycrypt.c mymalloc.c mysocket.c \ myssl.c notify.c parse.c pcre.c player.c plyrlist.c \ predicat.c privtab.c \ ! ptab.c rob.c services.c set.c shs.c sig.c speech.c sql.c \ ! strdup.c strtree.c \ strutil.c tables.c timer.c unparse.c utils.c version.c warnings.c \ wild.c wiz.c H_FILES = ../config.h ../confmagic.h ../hdrs/ansi.h ../hdrs/atr_tab.h \ ! ../hdrs/attrib.h ../hdrs/boolexp.h ../hdrs/bufferq.h ../hdrs/case.h \ ../hdrs/case.h ../hdrs/chunk.h ../hdrs/command.h ../hdrs/conf.h \ ../hdrs/copyrite.h ../hdrs/dbdefs.h ../hdrs/extchat.h \ ../hdrs/externs.h ../hdrs/extmail.h ../hdrs/flags.h \ *************** *** 84,90 **** ../hdrs/strtree.h ../hdrs/version.h ../options.h # .o versions of above - these are used in the build ! O_FILES=access.o atr_tab.o attrib.o boolexp.o bsd.o chunk.o cmdlocal.o cmds.o \ command.o compress.o conf.o cque.o create.o db.o destroy.o extchat.o \ extmail.o filecopy.o flaglocal.o flags.o funcrypt.o function.o \ fundb.o funlist.o funlocal.o funmath.o funmisc.o funstr.o funtime.o \ --- 86,93 ---- ../hdrs/strtree.h ../hdrs/version.h ../options.h # .o versions of above - these are used in the build ! O_FILES=access.o atr_tab.o attrib.o boolexp.o bsd.o bufferq.o \ ! chunk.o cmdlocal.o cmds.o \ command.o compress.o conf.o cque.o create.o db.o destroy.o extchat.o \ extmail.o filecopy.o flaglocal.o flags.o funcrypt.o function.o \ fundb.o funlist.o funlocal.o funmath.o funmisc.o funstr.o funtime.o \ *************** *** 92,98 **** malias.o match.o memcheck.o move.o mycrypt.o mymalloc.o mysocket.o \ myssl.o notify.o parse.o pcre.o player.o plyrlist.o \ predicat.o privtab.o \ ! ptab.o rob.o services.o set.o shs.o sig.o speech.o strdup.o strtree.o \ strutil.o tables.o timer.o unparse.o utils.o version.o warnings.o \ wild.o wiz.o --- 95,102 ---- malias.o match.o memcheck.o move.o mycrypt.o mymalloc.o mysocket.o \ myssl.o notify.o parse.o pcre.o player.o plyrlist.o \ predicat.o privtab.o \ ! ptab.o rob.o services.o set.o shs.o sig.o speech.o sql.o \ ! strdup.o strtree.o \ strutil.o tables.o timer.o unparse.o utils.o version.o warnings.o \ wild.o wiz.o *************** *** 313,318 **** --- 317,323 ---- boolexp.o: ../hdrs/parse.h boolexp.o: ../hdrs/log.h boolexp.o: ../hdrs/extchat.h + boolexp.o: ../hdrs/bufferq.h boolexp.o: ../hdrs/strtree.h bsd.o: ../hdrs/copyrite.h bsd.o: ../config.h *************** *** 349,354 **** --- 354,375 ---- bsd.o: ../hdrs/mymalloc.h bsd.o: ../hdrs/extmail.h bsd.o: ../hdrs/game.h + bufferq.o: ../hdrs/copyrite.h + bufferq.o: ../config.h + bufferq.o: ../hdrs/conf.h + bufferq.o: ../options.h + bufferq.o: ../hdrs/mushtype.h + bufferq.o: ../hdrs/htab.h + bufferq.o: ../hdrs/externs.h + bufferq.o: ../hdrs/dbdefs.h + bufferq.o: ../hdrs/mushdb.h + bufferq.o: ../hdrs/flags.h + bufferq.o: ../hdrs/ptab.h + bufferq.o: ../hdrs/chunk.h + bufferq.o: ../hdrs/attrib.h + bufferq.o: ../confmagic.h + bufferq.o: ../hdrs/bufferq.h + bufferq.o: ../hdrs/log.h chunk.o: ../hdrs/copyrite.h chunk.o: ../config.h chunk.o: ../hdrs/conf.h *************** *** 520,525 **** --- 541,547 ---- create.o: ../hdrs/match.h create.o: ../hdrs/extchat.h create.o: ../hdrs/boolexp.h + create.o: ../hdrs/bufferq.h create.o: ../hdrs/log.h create.o: ../hdrs/lock.h create.o: ../hdrs/parse.h *************** *** 586,591 **** --- 608,614 ---- extchat.o: ../confmagic.h extchat.o: ../hdrs/extchat.h extchat.o: ../hdrs/boolexp.h + extchat.o: ../hdrs/bufferq.h extchat.o: ../hdrs/ansi.h extchat.o: ../hdrs/privtab.h extchat.o: ../hdrs/mymalloc.h *************** *** 593,598 **** --- 616,622 ---- extchat.o: ../hdrs/parse.h extchat.o: ../hdrs/lock.h extchat.o: ../hdrs/log.h + extchat.o: ../hdrs/game.h extchat.o: ../hdrs/function.h extchat.o: ../hdrs/command.h extchat.o: ../hdrs/switches.h *************** *** 677,682 **** --- 701,707 ---- funcrypt.o: ../hdrs/version.h funcrypt.o: ../hdrs/extchat.h funcrypt.o: ../hdrs/boolexp.h + funcrypt.o: ../hdrs/bufferq.h funcrypt.o: ../hdrs/parse.h funcrypt.o: ../hdrs/function.h funcrypt.o: ../hdrs/command.h *************** *** 882,887 **** --- 907,913 ---- game.o: ../hdrs/extmail.h game.o: ../hdrs/extchat.h game.o: ../hdrs/boolexp.h + game.o: ../hdrs/bufferq.h game.o: ../hdrs/myssl.h game.o: ../hdrs/getpgsiz.h game.o: ../hdrs/parse.h *************** *** 1001,1006 **** --- 1027,1033 ---- log.o: ../hdrs/chunk.h log.o: ../hdrs/attrib.h log.o: ../confmagic.h + log.o: ../hdrs/bufferq.h log.o: ../hdrs/log.h look.o: ../config.h look.o: ../hdrs/copyrite.h *************** *** 1022,1027 **** --- 1049,1055 ---- look.o: ../hdrs/ansi.h look.o: ../hdrs/pueblo.h look.o: ../hdrs/extchat.h + look.o: ../hdrs/bufferq.h look.o: ../hdrs/game.h look.o: ../hdrs/command.h look.o: ../hdrs/switches.h *************** *** 1173,1178 **** --- 1201,1207 ---- notify.o: ../hdrs/log.h notify.o: ../hdrs/mymalloc.h notify.o: ../hdrs/extchat.h + notify.o: ../hdrs/bufferq.h notify.o: ../hdrs/extmail.h notify.o: ../hdrs/game.h parse.o: ../hdrs/copyrite.h *************** *** 1296,1304 **** rob.o: ../hdrs/attrib.h rob.o: ../hdrs/chunk.h rob.o: ../hdrs/match.h rob.o: ../hdrs/externs.h rob.o: ../hdrs/dbdefs.h - rob.o: ../confmagic.h rob.o: ../hdrs/log.h rob.o: ../hdrs/lock.h rob.o: ../hdrs/boolexp.h --- 1325,1334 ---- rob.o: ../hdrs/attrib.h rob.o: ../hdrs/chunk.h rob.o: ../hdrs/match.h + rob.o: ../hdrs/parse.h + rob.o: ../confmagic.h rob.o: ../hdrs/externs.h rob.o: ../hdrs/dbdefs.h rob.o: ../hdrs/log.h rob.o: ../hdrs/lock.h rob.o: ../hdrs/boolexp.h *************** *** 1363,1368 **** --- 1393,1417 ---- speech.o: ../hdrs/parse.h speech.o: ../hdrs/game.h speech.o: ../hdrs/pcre.h + sql.o: ../hdrs/copyrite.h + sql.o: ../config.h + sql.o: ../hdrs/externs.h + sql.o: ../hdrs/dbdefs.h + sql.o: ../hdrs/mushdb.h + sql.o: ../hdrs/conf.h + sql.o: ../options.h + sql.o: ../hdrs/mushtype.h + sql.o: ../hdrs/htab.h + sql.o: ../hdrs/flags.h + sql.o: ../hdrs/ptab.h + sql.o: ../hdrs/chunk.h + sql.o: ../hdrs/attrib.h + sql.o: ../confmagic.h + sql.o: ../hdrs/log.h + sql.o: ../hdrs/parse.h + sql.o: ../hdrs/command.h + sql.o: ../hdrs/switches.h + sql.o: ../hdrs/function.h strdup.o: ../config.h strdup.o: ../hdrs/conf.h strdup.o: ../hdrs/copyrite.h *************** *** 1551,1559 **** ../hdrs/boolexp.o: ../hdrs/copyrite.h ../hdrs/boolexp.o: ../hdrs/chunk.h ../hdrs/boolexp.o: ../hdrs/attrib.h - ../hdrs/boolexp.o: ../hdrs/copyrite.h - ../hdrs/boolexp.o: ../hdrs/chunk.h - ../hdrs/boolexp.o: ../hdrs/attrib.h ../hdrs/case.o: ../config.h ../hdrs/case.o: ../config.h ../hdrs/chunk.o: ../hdrs/attrib.h --- 1600,1605 ---- *************** *** 1577,1582 **** --- 1623,1629 ---- ../hdrs/extchat.o: ../hdrs/copyrite.h ../hdrs/extchat.o: ../hdrs/chunk.h ../hdrs/extchat.o: ../hdrs/attrib.h + ../hdrs/extchat.o: ../hdrs/bufferq.h ../hdrs/externs.o: ../hdrs/dbdefs.h ../hdrs/externs.o: ../hdrs/mushdb.h ../hdrs/externs.o: ../hdrs/conf.h *** 1_7_7.977/src/bufferq.c Mon, 31 May 2004 08:42:49 -0500 dunemush () --- 1_7_7.1049(w)/src/bufferq.c Mon, 31 May 2004 08:42:40 -0500 dunemush (pennmush/h/13_bufferq.c 1.6 660) *************** *** 0 **** --- 1,248 ---- + /** + * \file bufferq.c + * + * \brief Code for managing queues of buffers, a handy data structure. + * + * + */ + + #include "copyrite.h" + #include "config.h" + + #include + #ifdef I_UNISTD + #include + #endif + #include + #include + #include + #ifdef I_SYS_TIME + #include + #endif + #include + #ifdef I_SYS_TYPES + #include + #endif + #include + + #include "conf.h" + #include "externs.h" + #include "flags.h" + #include "dbdefs.h" + #include "bufferq.h" + #include "log.h" + #include "confmagic.h" + + #define BUFFERQLINEOVERHEAD (2*sizeof(int)+sizeof(time_t)+sizeof(dbref)) + + static void shift_bufferq(BUFFERQ * bq, int space_needed); + + /** Add data to a buffer queue. + * \param bq pointer to buffer queue. + * \param type caller-specific integer + * \param player caller-specific dbref + * \param msg caller-specific string to add. + */ + void + add_to_bufferq(BUFFERQ * bq, int type, dbref player, const char *msg) + { + int len = strlen(msg); + int room = len + 1 + BUFFERQLINEOVERHEAD; + if (!bq) + return; + if (room > bq->buffer_size) + return; + if ((bq->buffer_end > bq->buffer) && + ((bq->buffer_size - (bq->buffer_end - bq->buffer)) < room)) + shift_bufferq(bq, room); + memcpy(bq->buffer_end, &len, sizeof(len)); + bq->buffer_end += sizeof(len); + memcpy(bq->buffer_end, &player, sizeof(player)); + bq->buffer_end += sizeof(player); + memcpy(bq->buffer_end, &type, sizeof(type)); + bq->buffer_end += sizeof(type); + memcpy(bq->buffer_end, &mudtime, sizeof(time_t)); + bq->buffer_end += sizeof(time_t); + memcpy(bq->buffer_end, msg, len + 1); + bq->buffer_end += len + 1; + strcpy(bq->last_string, msg); + bq->last_type = type; + bq->num_buffered++; + } + + + static void + shift_bufferq(BUFFERQ * bq, int space_needed) + { + char *p = bq->buffer; + int size, jump; + int skipped = 0; + + while ((space_needed > 0) && (p < bq->buffer_end)) { + /* 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 + BUFFERQLINEOVERHEAD + 1; + p += jump; + space_needed -= jump; + skipped++; + } + + if ((p != bq->buffer_end) && (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 queue space"); + 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 < bq->buffer_end) + memmove(bq->buffer, p, bq->buffer_end - p); + bq->buffer_end -= (p - bq->buffer); + bq->num_buffered -= skipped; + } + + /** Allocate memory for a buffer queue to hold a given number of lines. + * \param bq pointer to buffer queue. + * \param lines lines to allocate for buffer queue. + * \retval address of allocated buffer queue. + */ + BUFFERQ * + allocate_bufferq(int lines) + { + BUFFERQ *bq; + int bytes = lines * (BUFFER_LEN + BUFFERQLINEOVERHEAD); + bq = mush_malloc(sizeof(BUFFERQ), "bufferq"); + bq->buffer = mush_malloc(bytes, "bufferq.buffer"); + *bq->buffer = '\0'; + bq->buffer_end = bq->buffer; + bq->num_buffered = 0; + bq->buffer_size = bytes; + strcpy(bq->last_string, ""); + bq->last_type = 0; + return bq; + } + + /** Free memory of a buffer queue. + * \param bq pointer to buffer queue. + */ + void + free_bufferq(BUFFERQ * bq) + { + if (!bq) + return; + if (bq->buffer) + mush_free(bq->buffer, "bufferq.buffer"); + mush_free(bq, "bufferq"); + } + + /** Reallocate a buffer queue (to change its size) + * \param bq pointer to buffer queue. + * \param lines new number of lines to store in buffer queue. + * \retval address of reallocated buffer queue. + */ + BUFFERQ * + reallocate_bufferq(BUFFERQ * bq, int lines) + { + char *newbuff; + ptrdiff_t bufflen; + int bytes = lines * (BUFFER_LEN + 2 * BUFFERQLINEOVERHEAD); + /* If we were accidentally called without a buffer, deal */ + if (!bq) { + return allocate_bufferq(lines); + } + /* Are we not changing size? */ + if (bq->buffer_size == bytes) + return bq; + if (bq->buffer_size > bytes) { + /* Shrinking the buffer */ + if ((bq->buffer_end - bq->buffer) >= bytes) + shift_bufferq(bq, bq->buffer_end - bq->buffer - bytes); + } + bufflen = bq->buffer_end - bq->buffer; + newbuff = realloc(bq->buffer, bytes); + if (newbuff) { + bq->buffer = newbuff; + bq->buffer_end = bq->buffer + bufflen; + bq->buffer_size = bytes; + } + return bq; + } + + + + /** Iterate through messages in a bufferq. + * This function returns the next message in a bufferq, given + * a pointer to the start of entry (which is modified). + * It returns NULL when there are no more messages to get. + * Call this in a loop to get all messages; do not intersperse + * with calls to insert messages! + * \param bq pointer to buffer queue structure. + * \param p address of pointer to track start of next entry. If that's + * the address of a null pointer, reset to beginning. + * \param player address of pointer to return player data in + * \param type address of pointer to return type value in. + * \param timestamp address of pointer to return timestamp in. + * \return next message text or NULL if no more. + */ + char * + iter_bufferq(BUFFERQ * bq, char **p, dbref *player, int *type, + time_t * timestamp) + { + static char tbuf1[BUFFER_LEN]; + int size; + + if (!p || !bq || !bq->buffer || (bq->buffer == bq->buffer_end)) + return NULL; + + if (*p == bq->buffer_end) + return NULL; + + if (!*p) + *p = bq->buffer; /* Reset to beginning */ + + memcpy(&size, *p, sizeof(size)); + *p += sizeof(size); + memcpy(player, *p, sizeof(dbref)); + *p += sizeof(dbref); + memcpy(type, *p, sizeof(int)); + *p += sizeof(int); + memcpy(timestamp, *p, sizeof(time_t)); + *p += sizeof(time_t); + memcpy(tbuf1, *p, size + 1); + *p += size + 1; + return tbuf1; + } + + /** Size of bufferq buffer in lines. + * \param bq pointer to buffer queue. + * \return size of buffer queue in lines + */ + int + bufferq_lines(BUFFERQ * bq) + { + if (bq && bq->buffer) + return bq->buffer_size / (BUFFER_LEN + BUFFERQLINEOVERHEAD); + else + return 0; + } + + /** Is a buffer queue empty? + * \param bq pointer to buffer queue. + * \retval 1 the buffer queue is empty (has no messages). + * \retval 0 the buffer queue is not empty (has messages). + */ + int + isempty_bufferq(BUFFERQ * bq) + { + if (!bq || !bq->buffer) + return 1; + if (bq->buffer == bq->buffer_end) + return 1; + return 0; + } *** 1_7_7.977/hdrs/bufferq.h Mon, 31 May 2004 08:42:49 -0500 dunemush () --- 1_7_7.1049(w)/hdrs/bufferq.h Mon, 31 May 2004 08:42:43 -0500 dunemush (pennmush/h/14_bufferq.h 1.4 660) *************** *** 0 **** --- 1,35 ---- + /** + * \file bufferq.h + * + * \brief Headers for managing queues of buffers, a handy data structure. + * + * + */ + + + + typedef struct bufferq BUFFERQ; + + struct bufferq { + char *buffer; /**< Pointer to start of buffer */ + char *buffer_end; /**< Pointer to insertion point in buffer */ + int buffer_size; /**< Size allocated to buffer, in bytes */ + int num_buffered; /**< Number of strings in the buffer */ + char last_string[BUFFER_LEN]; /**< Cache of last string inserted */ + char last_type; /**< Cache of type of last string inserted */ + }; + + #define BufferQSize(b) ((b)->buffer_size) + #define BufferQNum(b) ((b)->num_buffered) + #define BufferQLast(b) ((b)->last_string) + #define BufferQLastType(b) ((b)->last_type) + + extern BUFFERQ *allocate_bufferq(int lines); + extern BUFFERQ *reallocate_bufferq(BUFFERQ * bq, int lines); + extern void free_bufferq(BUFFERQ * bq); + extern void add_to_bufferq(BUFFERQ * bq, int type, dbref player, + const char *msg); + extern char *iter_bufferq(BUFFERQ * bq, char **p, dbref *player, int *type, + time_t * timestamp); + extern int bufferq_lines(BUFFERQ * bq); + extern int isempty_bufferq(BUFFERQ * bq); *** 1_7_7.977/README.SQL Mon, 31 May 2004 08:42:49 -0500 dunemush () --- 1_7_7.1049(w)/README.SQL Mon, 24 May 2004 12:05:04 -0500 dunemush (pennmush/h/15_README.SQL 1.1 660) *************** *** 0 **** --- 1,118 ---- + + Use SQL with PennMUSH + Revised: 24 May 2004 + + + As of version 1.7.7p32, PennMUSH includes functions and commands that + can access SQL databases. Currently, the following databases are + supported: + + * MySQL + + This document explains how to use (or avoid) SQL with PennMUSH, and covers + the following issues: + + I. Compiling with or without SQL + II. Mush configuration overview + III. SQL setup tips + + I. Compiling with OpenSSL + + The Configure script distributed with PennMUSH automatically detects + the MySQL client library (libmysqlclient) and attempts to link + them into the executable, defining HAS_MYSQL in config.h + + If you want to avoid linking these libraries on systems where they + are present, use the '-D no_mysql' switch to Configure. + + If you installed Mysql from a binary package (e.g. rpm or apt), + you should be sure that your system also has the development + package (usuallyl mysql-dev or mysql-devel). + + If you think you have mysql libraries and header files but Configure + isn't finding them, they may be in an unusual location on your system. + Creating symbolic links from the header directory to /usr/include/mysql + and from the libraries in /usr/lib (or adding the mysql library directory + to your /etc/ld.so.conf and running ldconfig) are the easiest ways + to fix this. + + II. Mush configuration overview + + mush.cnf includes these directives that configure the SQL support: + + sql_platform provides the name of the SQL database server software + that will be used for connections. It current takes one of two + values: "disabled" (no SQL) or "mysql". If not specified, it + defaults to disabled. + + sql_host gives the name of the host running the SQL server. + It defaults to 127.0.0.1, which makes a TCP connection to the + local host. The keyword "localhost" instead makes a domain socket + (Unix) or named pipe (Windows) connection. + + sql_database gives the name of the database that contains the + MUSH's tables. This must be specified and there is no default. + + sql_username provides a username to connect to the SQL server + with. If no specified, a null username will be used, which many + SQL servers treat as "the user running this (pennmush) process". + + sql_password provides the password for the user. It defaults to + no password. + + III. SQL setup tips + + You will have to set up the appropriate database on the SQL server, + and username permitted to perform operations in that database, + and a password for that username. This is a platform-specific process. + + A. MySQL platform + + Easiest way is: + + % mysql_setpermission --user root REQUIRED + --host --port OPTIONAL, OR: + --socket OPTIONAL + + ###################################################################### + ## Welcome to the permission setter 1.2 for MySQL. + ## made by Luuk de Boer + ###################################################################### + What would you like to do: + 1. Set password for a user. + 2. Add a database + user privilege for that database. + - user can do all except all admin functions + 3. Add user privilege for an existing database. + - user can do all except all admin functions + 4. Add user privilege for an existing database. + - user can do all except all admin functions + no create/drop + 5. Add user privilege for an existing database. + - user can do only selects (no update/delete/insert etc.) + 0. exit this program + + Make your choice [1,2,3,4,5,0]: 2 <========== + + Which database would you like to add: mush + The new database mush will be created + + What username is to be created: mush <========== + Username = mush + Would you like to set a password for [y/n]: y <========== + What password do you want to specify for : <========== + Type the password again: <========== + We now need to know from what host(s) the user will connect. + Keep in mind that % means 'from any host' ... + The host please: localhost <========== + Would you like to add another host [yes/no]: no <========== + Okay we keep it with this ... + The following host(s) will be used: localhost. + ###################################################################### + + That was it ... here is an overview of what you gave to me: + The database name : mush + The username : mush + The host(s) : localhost + ###################################################################### + + Are you pretty sure you would like to implement this [yes/no]: yes + *** 1_7_7.977/src/sql.c Mon, 31 May 2004 08:42:49 -0500 dunemush () --- 1_7_7.1049(w)/src/sql.c Mon, 31 May 2004 08:42:42 -0500 dunemush (pennmush/h/16_sql.c 1.6 660) *************** *** 0 **** --- 1,288 ---- + /** + * \file sql.c + * + * \brief Code to support PennMUSH connection to SQL databases. + * + * + */ + + #include "copyrite.h" + #include "config.h" + #ifdef I_UNISTD + #include + #endif + #include + #include "conf.h" + #ifdef HAS_MYSQL + #include + #include + #endif + #include "externs.h" + #include "log.h" + #include "parse.h" + #include "command.h" + #include "function.h" + #include "mushdb.h" + #include "dbdefs.h" + #include "conf.h" + #include "confmagic.h" + + #ifdef HAS_MYSQL + static MYSQL *mysql_struct = NULL; + #define MYSQL_RETRY_TIMES 3 + + static int safe_sql_query(dbref player, char *q_string, char row_delim, + char field_delim, char *buff, char **bp); + static int sql_init(void); + + void + sql_shutdown(void) + { + if (!mysql_struct) + return; + mysql_close(mysql_struct); + mysql_struct = NULL; + } + + static int + sql_init(void) + { + int retries = MYSQL_RETRY_TIMES; + + /* If we are already connected, drop and retry the connection, in + * case for some reason the server went away. + */ + if (mysql_struct) + sql_shutdown(); + + if (!strcasecmp(SQL_PLATFORM, "mysql")) { + while (retries && !mysql_struct) { + /* Try to connect to the database host. If we have specified + * localhost, use the Unix domain socket instead. + */ + mysql_struct = mysql_init(NULL); + + if (!mysql_real_connect + (mysql_struct, SQL_HOST, SQL_USER, SQL_PASS, SQL_DB, 3306, 0, 0)) { + do_rawlog(LT_ERR, "Failed mysql connection: %s\n", + mysql_error(mysql_struct)); + sql_shutdown(); + sleep(1); + } + retries--; + } + } + + if (mysql_struct) + return 1; + else + return 0; + } + + #define print_sep(s,b,p) if (s) safe_chr(s,b,p) + + static int + safe_sql_query(dbref player, char *q_string, char row_delim, char field_delim, + char *buff, char **bp) + { + MYSQL_RES *qres; + MYSQL_ROW row_p; + int num_rows, got_rows, got_fields; + int i, j; + + /* If we have no connection, and we don't have auto-reconnect on + * (or we try to auto-reconnect and we fail), this is an error + * generating a #-1. Notify the player, too, and set the return code. + */ + + if (!mysql_struct) { + sql_init(); + if (!mysql_struct) { + notify(player, "No SQL database connection."); + if (buff) + safe_str("#-1", buff, bp); + return -1; + } + } + if (!q_string || !*q_string) + return 0; + + /* Send the query. */ + got_rows = mysql_real_query(mysql_struct, q_string, strlen(q_string)); + if (got_rows && (mysql_errno(mysql_struct) == CR_SERVER_GONE_ERROR)) { + /* We got this error because the server died unexpectedly + * and it shouldn't have. Try repeatedly to reconnect before + * giving up and failing. This induces a few seconds of lag, + * depending on number of retries + */ + sql_init(); + if (mysql_struct) + got_rows = mysql_real_query(mysql_struct, q_string, strlen(q_string)); + } + if (got_rows) { + notify(player, mysql_error(mysql_struct)); + if (buff) + safe_str("#-1", buff, bp); + return -1; + } + + /* Get results. A silent query (INSERT, UPDATE, etc.) will return NULL */ + qres = mysql_store_result(mysql_struct); + if (!qres) { + if (!mysql_field_count(mysql_struct)) { + /* We didn't expect data back, so see if we modified anything */ + num_rows = mysql_affected_rows(mysql_struct); + notify_format(player, "SQL: %d rows affected.", num_rows); + return 0; + } else { + /* Oops, we should have had data! */ + notify_format(player, "SQL: Error: %s", mysql_error(mysql_struct)); + return -1; + } + } + + /* At this point, we know we've done something like SELECT and + * we got results. But just in case... + */ + got_rows = mysql_num_rows(qres); + if (!got_rows) + return 0; + got_fields = mysql_num_fields(qres); + + /* Construct properly-delimited data. */ + if (buff) { + for (i = 0; i < got_rows; i++) { + if (i > 0) { + print_sep(row_delim, buff, bp); + } + row_p = mysql_fetch_row(qres); + if (row_p) { + for (j = 0; j < got_fields; j++) { + if (j > 0) { + print_sep(field_delim, buff, bp); + } + if (row_p[j] && *row_p[j]) + if (safe_str(row_p[j], buff, bp)) + goto finished; /* We filled the buffer, best stop */ + } + } + } + } else { + for (i = 0; i < got_rows; i++) { + row_p = mysql_fetch_row(qres); + if (row_p) { + for (j = 0; j < got_fields; j++) { + if (row_p[j] && *row_p[j]) { + notify(player, tprintf("Row %d, Field %d: %s", + i + 1, j + 1, row_p[j])); + } else { + notify(player, tprintf("Row %d, Field %d: NULL", i + 1, j + 1)); + } + } + } else { + notify(player, tprintf("Row %d: NULL", i + 1)); + } + } + } + + finished: + mysql_free_result(qres); + return 0; + } + + + FUNCTION(fun_sql) + { + char row_delim, field_delim; + + if (!Sql_Ok(executor)) { + safe_str(T(e_perm), buff, bp); + return; + } + + if (nargs >= 2) { + /* we have a delimiter in args[2]. Got to parse it */ + char insep[BUFFER_LEN]; + char *isep = insep; + const char *arg2 = args[1]; + process_expression(insep, &isep, &arg2, executor, caller, enactor, + PE_DEFAULT, PT_DEFAULT, pe_info); + *isep = '\0'; + strcpy(args[1], insep); + } + + if (nargs >= 3) { + /* we have a delimiter in args[3]. Got to parse it */ + char insep[BUFFER_LEN]; + char *isep = insep; + const char *arg3 = args[2]; + process_expression(insep, &isep, &arg3, executor, caller, enactor, + PE_DEFAULT, PT_DEFAULT, pe_info); + *isep = '\0'; + strcpy(args[2], insep); + } + + if (!delim_check(buff, bp, nargs, args, 2, &row_delim)) + return; + if (nargs < 3) + field_delim = row_delim; + else if (!delim_check(buff, bp, nargs, args, 3, &field_delim)) + return; + + safe_sql_query(executor, args[0], row_delim, field_delim, buff, bp); + } + + + FUNCTION(fun_sql_escape) + { + char bigbuff[BUFFER_LEN * 2 + 1]; + + if (!Sql_Ok(executor)) { + safe_str(T(e_perm), buff, bp); + return; + } + + if (!args[0] || !*args[0]) + return; + + if (!mysql_struct) { + sql_init(); + if (!mysql_struct) { + notify(executor, "No SQL database connection."); + safe_str("#-1", buff, bp); + return; + } + } + if (mysql_real_escape_string(mysql_struct, bigbuff, args[0], strlen(args[0])) + < BUFFER_LEN) + safe_str(bigbuff, buff, bp); + else + safe_str("#-1 TOO LONG", buff, bp); + } + + + COMMAND (cmd_sql) { + safe_sql_query(player, arg_left, ' ', ' ', NULL, NULL); + } + + #else + + /* Oops, no SQL */ + + FUNCTION(fun_sql) + { + safe_str(T(e_disabled), buff, bp); + } + + FUNCTION(fun_sql_escape) + { + safe_str(T(e_disabled), buff, bp); + } + + void + sql_shutdown(void) + { + return; + } + + #endif *** 1_7_7.977/hdrs/compile.h Mon, 31 May 2004 08:42:49 -0500 dunemush () --- 1_7_7.1049(w)/hdrs/compile.h Mon, 31 May 2004 08:42:43 -0500 dunemush (pennmush/h/17_compile.h 1.1 660) *************** *** 0 **** --- 1,66 ---- + #ifndef __COMPILE_H + #define __COMPILE_H + + /* Compiler-specific stuff. */ + + #ifndef __GNUC_PREREQ + #if defined __GNUC__ && defined __GNUC_MINOR__ + # define __GNUC_PREREQ(maj, min) \ + ((__GNUC__ << 16) + __GNUC_MINOR__ >= ((maj) << 16) + (min)) + #else + # define __GNUC_PREREQ(maj, min) 0 + #endif + #endif + + /* For gcc 3 and up, this attribute lets the compiler know that the + * function returns a newly allocated value, for pointer aliasing + * optimizations. + */ + #if !defined(__attribute_malloc__) && __GNUC_PREREQ(2, 96) + #define __attribute_malloc__ __attribute__ ((__malloc__)) + #elif !defined(__attribute_malloc__) + #define __attribute_malloc__ + #endif + + /* The C99 restrict keyword lets the compiler do some more pointer + * aliasing optimizations. Essentially, a RESTRICT pointer function + * argument can't share that pointer with ones passed via other + * arguments. + * This should be a Configure check sometime. + */ + #if __GNUC_PREREQ(2, 92) + #define RESTRICT __restrict + #elif defined(__STDC_VERSION__) && __STDC_VERSION__ >= 199901L + #define RESTRICT restrict + #else + #define RESTRICT + #endif + + /* If a compiler knows a function will never return, it can generate + slightly better code for calls to it. */ + #if defined(WIN32) && _MSC_VER >= 1200 + #define NORETURN __declspec(noreturn) + #elif defined(HASATTRIBUTE) + #define NORETURN __attribute__ ((__noreturn__)) + #else + #define NORETURN + #endif + + + #ifdef WIN32 + /* --------------- Stuff for Win32 services ------------------ */ + /* + + When "exit" is called to handle an error condition, we really want to + terminate the game thread, not the whole process. + MS VS.NET (_MSC_VER >= 1200) requires the weird noreturn stuff. + + */ + + #ifndef __MINGW32__ + #define exit(arg) Win32_Exit (arg) + #endif + void NORETURN WIN32_CDECL Win32_Exit(int exit_code); + #endif /* WIN32 */ + + #endif /* __COMPILE_H */