Changeset 431
- Timestamp:
- 08/12/06 18:14:26 (2 years ago)
- Files:
-
- 1.7.7/CHANGES.176 (modified) (1 diff)
- 1.7.7/CHANGES.177 (modified) (1 diff)
- 1.7.7/INSTALL (modified) (1 diff)
- 1.7.7/MANIFEST (modified) (2 diffs)
- 1.7.7/Patchlevel (modified) (1 diff)
- 1.7.7/game/txt/hlp/penncmd.hlp (modified) (2 diffs)
- 1.7.7/game/txt/hlp/pennfunc.hlp (modified) (10 diffs)
- 1.7.7/game/txt/hlp/pennv176.hlp (modified) (1 diff)
- 1.7.7/game/txt/hlp/pennv177.hlp (modified) (2 diffs)
- 1.7.7/game/txt/hlp/pennvOLD.hlp (modified) (1 diff)
- 1.7.7/hdrs/attrib.h (modified) (2 diffs)
- 1.7.7/hdrs/dbdefs.h (modified) (2 diffs)
- 1.7.7/hdrs/externs.h (modified) (1 diff)
- 1.7.7/hdrs/mushdb.h (modified) (1 diff)
- 1.7.7/hdrs/mushtype.h (modified) (1 diff)
- 1.7.7/hdrs/version.h (modified) (1 diff)
- 1.7.7/src/access.c (modified) (2 diffs)
- 1.7.7/src/bsd.c (modified) (17 diffs)
- 1.7.7/src/chunk.c (modified) (20 diffs)
- 1.7.7/src/cmds.c (modified) (1 diff)
- 1.7.7/src/command.c (modified) (1 diff)
- 1.7.7/src/conf.c (modified) (1 diff)
- 1.7.7/src/extchat.c (modified) (8 diffs)
- 1.7.7/src/extmail.c (modified) (17 diffs)
- 1.7.7/src/function.c (modified) (2 diffs)
- 1.7.7/src/fundb.c (modified) (2 diffs)
- 1.7.7/src/funmisc.c (modified) (2 diffs)
- 1.7.7/src/funtime.c (modified) (8 diffs)
- 1.7.7/src/game.c (modified) (5 diffs)
- 1.7.7/src/lock.c (modified) (2 diffs)
- 1.7.7/src/look.c (modified) (1 diff)
- 1.7.7/src/player.c (modified) (5 diffs)
- 1.7.7/src/set.c (modified) (1 diff)
- 1.7.7/src/strutil.c (modified) (1 diff)
- 1.7.7/src/switchinc.c (modified) (1 diff)
- 1.7.7/utils/mkcmds.sh.SH (modified) (1 diff)
- 1.7.7/win32/funs.h (modified) (2 diffs)
Legend:
- Unmodified
- Added
- Removed
- Modified
- Copied
- Moved
1.7.7/CHANGES.176
r429 r431 13 13 14 14 ========================================================================== 15 16 Version 1.7.6 patchlevel 12 June 23, 2003 17 18 Minor changes: 19 * Users no longer see last connection information when they 20 connect to Guests. Suggested by Jules@M*U*S*H. 21 Fixes: 22 * Potential problem with ambigious names in the information functions 23 fixed. [SW] 24 * The 'chat' config group is no longer displayed when CHAT_SYSTEM 25 isn't defined. Report by Mike Griffiths. [SW] 26 * cygwin install instructions changed to remove obsolete exim 27 version information. Suggested by Cheetah@M*U*S*H. 28 * Objects with user-defined locks had problems with finding built-in locks 29 on the object. Reported by Walker@M*U*S*H. [SW] 30 15 31 16 32 Version 1.7.6 patchlevel 11 June 1, 2003 1.7.7/CHANGES.177
r429 r431 18 18 19 19 ========================================================================== 20 21 Version 1.7.7 patchlevel 16 June 23, 2003 22 23 Commands: 24 * New switch /room for 'with' to run a $command available in a remote 25 location. Suggested by Mike Griffiths. [SW] 26 Functions: 27 * Added the terminfo() function, which returns information about a 28 client's name and capabilities for a particular connection. [SW] 29 * New lports() function. Like lwho() but returns port descriptors. 30 For mux2 compatibility. [SW] 31 * Functions that return information about a connected player now treat 32 integer arguments as a port descriptor to look up, rather than using 33 the least-idle connection of a player. To force a player name to 34 be treated as such even when it's a number, prefix it with a * in 35 softcode. For mux2 compatibility. [SW] 36 * Players can use ports() on themselves and use the descriptors 37 they're connected to as arguments to the information functions. 38 For mux2 compatibility. [SW] 39 Minor Changes: 40 * Compute various chunk stats (total used, total free space, etc.) 41 on demand instead of keeping running totals. [TAP] 42 * @chan/what displays information about a channel's recall buffer, if any. 43 [SW] 44 * @chan/recall'ed lines are more clearly marked as such. Suggested by 45 Oriens@Alexandria. [SW] 46 * Consolidation of a common idiom used to format times throughout the source 47 into a simple function call. [SW] 48 * The time a @mail was sent was stored, unusually, as a string. 49 No longer. Now it's handled the same way as all other times. [SW] 50 Fixes: 51 * Bug in resizing @chan/recall buffers fixed. Reported by Oriens@Alexandria. 52 [SW] 53 * Objects with user-defined locks had problems with finding built-in locks 54 on the object. Reported by Walker@M*U*S*H. [SW] 55 * Unregistered() macro was checking wrong flag name. Report by 56 Matt Kirby. 57 * Help fix by Adu@M*U*S*H. 58 * Potential problem with ambigious names in the information functions fixed. 59 20 60 21 61 Version 1.7.7 patchlevel 15 June 1, 2003 1.7.7/INSTALL
r403 r431 101 101 b. Compile with the Cygwin unix emulation tools (http://www.cygwin.com) 102 102 In addition to the base cygwin stuff, you'll want the following packages: 103 binutils, gcc, make, patch, perl, exim-4.10-1 source code 103 binutils, gcc, make, patch, perl, exim (the latest *source* code 104 package, not the binary) 104 105 (gcc 3.2 is recommended.) 105 106 These are also recommended: 1.7.7/MANIFEST
r427 r431 124 124 src/wild.c 125 125 src/wiz.c 126 src/SWITCHES127 126 src/cmdlocal.dst 128 127 src/funlocal.dst … … 229 228 win32/pennmush.vcproj 230 229 win32/pennmush.sln 230 src/SWITCHES 1.7.7/Patchlevel
r429 r431 1 1 Do not edit this file. It is maintained by the official PennMUSH patches. 2 This is PennMUSH 1.7.7p1 52 This is PennMUSH 1.7.7p16 1.7.7/game/txt/hlp/penncmd.hlp
r427 r431 2487 2487 See also: @inprefix, AUDIBLE, @listen 2488 2488 & @ps 2489 @ps[/<switch>] [*<player> | all]2489 @ps[/<switch>] [*<player>] 2490 2490 2491 2491 @ps is a useful command for MUSHers. It lists all commands currently on … … 3789 3789 See also: @doing, @poll, DOING 3790 3790 & with 3791 with <obj>=<command>3791 with[/room] <obj>=<command> 3792 3792 3793 3793 Attempts to run a user-defined command on a specific object. 3794 If the /room switch is given, <obj> must be a room, and its contents 3795 are checked for commands as if it was a master room. 3794 3796 3795 3797 See 'help USER-DEFINED COMMANDS'. 1.7.7/game/txt/hlp/pennfunc.hlp
r429 r431 45 45 Channel functions: Get information about channels (CTITLE, CWHO) 46 46 Communication functions: Send messages to objects (PEMIT, OEMIT) 47 Connection functions: Get information about a player's connection (CONN) 47 48 Dbref functions: return dbref info related to objects (LOC, LEXITS) 48 49 Global functions: local MUSH-specific functions defined with @function … … 105 106 cemit() emit() lemit() nspemit() oemit() 106 107 pemit() remit() zemit() 108 & Connection functions 109 Connection functions return information about the connections open 110 on a game, or about specific connections. 111 112 conn() doing() height() hidden() idle() 113 lports() lwho() mwho() ports() pueblo() 114 terminfo() width() 107 115 & Dbref functions 108 116 Dbref functions return a dbref or list of dbrefs related to some value … … 120 128 Information functions return values related to objects. 121 129 122 andflags() andlflags() config() conn() controls() 123 ctime() doing() elock() findable() flags() 124 fullname() hasattr() hasattrp() hasflag() haspower() 125 hastype() height() hidden() idle() iname() 126 lflags() lock() lstats() lwho() money() 127 mtime() mwho() name() nattr() nearby() 128 objmem() orflags() orlflags() playermem() poll() 129 ports() powers() quota() type() visible() 130 width() 130 andflags() andlflags() config() controls() ctime() 131 elock() findable() flags() fullname() hasattr() 132 hasattrp() hasflag() haspower() hastype() iname() 133 lflags() lock() lstats() money() mtime() 134 name() nattr() nearby() objmem() orflags() 135 orlflags() playermem() poll() powers() quota() 136 type() visible() 131 137 132 138 & Mail functions … … 657 663 658 664 & CONN() 659 conn(<player name>)665 conn(<player|descriptor>) 660 666 661 667 This function returns the number of seconds a player has been connected. … … 892 898 See also: MODULO 893 899 & DOING() 894 doing(<player >)900 doing(<player|descriptor>) 895 901 896 902 Given the name of a connected player, returns that player's @doing … … 1429 1435 If an invalid type is given, #-1 is returned. 1430 1436 & HIDDEN() 1431 hidden(<player >)1437 hidden(<player|descriptor>) 1432 1438 1433 1439 Returns 1 if the player is hidden, otherwise 0. … … 1441 1447 & IDLE() 1442 1448 & IDLESECS() 1443 idle(<player name>)1444 idlesecs(<player name>)1449 idle(<player|descriptor>) 1450 idlesecs(<player|descriptor>) 1445 1451 1446 1452 This function returns the number of seconds a player has been idle, … … 2559 2565 2560 2566 See also: @poll, doing(), @doing 2567 & LPORTS() 2561 2568 & PORTS() 2569 lports() 2562 2570 ports(<player name>) 2563 2571 2564 This function returns the list of descriptors ("ports") that a player, 2565 specified by full player name, or by dbref, is connected to. Only players 2566 who are See_All or privileged may use this function; in other cases, 2567 an empty list is returned. Otherwise, a list of ports is returned in 2568 order of most recent connection to least recent connection. 2572 These function returns the list of descriptors ("ports") that are used by 2573 connected players. lports() returns all ports, in the same order as 2574 lwho() returns dbrefs, and ports() returns those a specific player 2575 is connected to, from most recent to least recent. Only players who 2576 are See_All or privileged may use these functions; in other cases, 2577 lports() returns #-1, and ports() an empty list. As an exception, 2578 players can use ports() on themselves. 2579 2580 These port numbers also appear in the wizard WHO, and can be used 2581 with @boot/port, page/port, and the functions that return information 2582 about a connection to make them use a specific connection rather than the 2583 least-idle one when a player has multiple connections open. Players can 2584 get information about their own connections. See_all is needed to use 2585 them to get information about other people's ports. 2569 2586 & POS() 2570 2587 pos(<string1>,<string2>) … … 3357 3374 3358 3375 See also: @tel 3376 & TERMINFO() 3377 terminfo(<player|descriptor>) 3378 3379 Returns a list with at least one element - the type of client used 3380 by the player, or "unknown" if the client being used doesn't support 3381 being asked to identify itself using RFC 1091. 3382 3383 Other elements in the list describe client capabilities, and 3384 currently include: 3385 pueblo present if the client is in Pueblo mode. 3386 telnet present if the client understands the telnet protocol. 3387 3388 Other fields may be added in the future, if, for example, MXP support 3389 is ever added. 3390 3391 Players can use terminfo() on their own connections. Using it on 3392 other players is restricted to see_all objects. 3359 3393 & TEXTFILE() 3360 3394 & dynhelp() … … 3764 3798 & SCREENWIDTH 3765 3799 & SCREENHEIGHT 3766 width(<player >)3767 height(<player >)3800 width(<player|descriptor>) 3801 height(<player|descriptor>) 3768 3802 3769 3803 These two functions return the screen width and height for a connected 1.7.7/game/txt/hlp/pennv176.hlp
r429 r431 1 & 1.7.6p12 2 Version 1.7.6 patchlevel 12 June 23, 2003 3 4 Minor changes: 5 * Users no longer see last connection information when they 6 connect to Guests. Suggested by Jules@M*U*S*H. 7 Fixes: 8 * Potential problem with ambigious names in the information functions 9 fixed. [SW] 10 * The 'chat' config group is no longer displayed when CHAT_SYSTEM 11 isn't defined. Report by Mike Griffiths. [SW] 12 * cygwin install instructions changed to remove obsolete exim 13 version information. Suggested by Cheetah@M*U*S*H. 14 * Objects with user-defined locks had problems with finding built-in locks 15 on the object. Reported by Walker@M*U*S*H. [SW] 16 17 1 18 & 1.7.6p11 2 19 Version 1.7.6 patchlevel 11 June 1, 2003 1.7.7/game/txt/hlp/pennv177.hlp
r429 r431 1 & 1.7.7p1 51 & 1.7.7p16 2 2 & changes 3 3 This is a list of changes in this patchlevel which are probably of … … 12 12 be read in 'help patchlevels'. 13 13 14 Version 1.7.7 patchlevel 16 June 23, 2003 15 16 Commands: 17 * New switch /room for 'with' to run a $command available in a remote 18 location. Suggested by Mike Griffiths. [SW] 19 Functions: 20 * Added the terminfo() function, which returns information about a 21 client's name and capabilities for a particular connection. [SW] 22 * New lports() function. Like lwho() but returns port descriptors. 23 For mux2 compatibility. [SW] 24 * Functions that return information about a connected player now treat 25 integer arguments as a port descriptor to look up, rather than using 26 the least-idle connection of a player. To force a player name to 27 be treated as such even when it's a number, prefix it with a * in 28 softcode. For mux2 compatibility. [SW] 29 * Players can use ports() on themselves and use the descriptors 30 they're connected to as arguments to the information functions. 31 For mux2 compatibility. [SW] 32 Minor Changes: 33 * Compute various chunk stats (total used, total free space, etc.) 34 on demand instead of keeping running totals. [TAP] 35 * @chan/what displays information about a channel's recall buffer, if any. 36 [SW] 37 * @chan/recall'ed lines are more clearly marked as such. Suggested by 38 Oriens@Alexandria. [SW] 39 * Consolidation of a common idiom used to format times throughout the source 40 into a simple function call. [SW] 41 * The time a @mail was sent was stored, unusually, as a string. 42 No longer. Now it's handled the same way as all other times. [SW] 43 Fixes: 44 * Bug in resizing @chan/recall buffers fixed. Reported by Oriens@Alexandria. 45 [SW] 46 * Objects with user-defined locks had problems with finding built-in locks 47 on the object. Reported by Walker@M*U*S*H. [SW] 48 * Unregistered() macro was checking wrong flag name. Report by 49 Matt Kirby. 50 * Help fix by Adu@M*U*S*H. 51 * Potential problem with ambigious names in the information functions fixed. 52 53 54 & 1.7.7p15 14 55 Version 1.7.7 patchlevel 15 June 1, 2003 15 56 1.7.7/game/txt/hlp/pennvOLD.hlp
r429 r431 4418 4418 type 'help <version>p<patchlevel>'. For example, 'help 1.7.2p3' 4419 4419 4420 1.7.7: 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15 4421 1.7.6: 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11 4420 1.7.7: 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16 4421 1.7.6: 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12 4422 4422 1.7.5: 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12 4423 4423 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/hdrs/attrib.h
r429 r431 58 58 extern unsigned const char *atr_get_compressed_data(ATTR *atr); 59 59 extern char *atr_value(ATTR *atr); 60 extern char *safe_atr_value(ATTR *atr); 61 extern void atr_migrate(int amount); 62 60 extern char * 61 safe_atr_value(ATTR *atr) 62 __attribute_malloc__; 63 extern void atr_migrate(int amount); 63 64 64 65 /* possible attribute flags */ … … 85 86 86 87 /* external predefined attributes. */ 87 extern ATTR attr[];88 extern ATTR attr[]; 88 89 89 90 #define AL_ATTR(alist) (alist) 1.7.7/hdrs/dbdefs.h
r427 r431 79 79 #define Connected(x) (IS(x, TYPE_PLAYER, "CONNECTED")) /* 0x200 */ 80 80 #define ZMaster(x) (IS(x, TYPE_PLAYER, "ZONE")) /* 0x800 */ 81 #define Unregistered(x) (IS(x, TYPE_PLAYER, "UNREGISTER D"))81 #define Unregistered(x) (IS(x, TYPE_PLAYER, "UNREGISTERED")) 82 82 #define Fixed(x) (IS(Owner(x), TYPE_PLAYER, "FIXED")) 83 83 … … 277 277 time_t from_ctime; /**< Sender's creation time */ 278 278 unsigned char *message; /**< Message text, compressed */ 279 unsigned char *time; /**< Message date/time, compressed*/279 time_t time; /**< Message date/time */ 280 280 unsigned char *subject; /**< Message subject, compressed */ 281 281 int read; /**< Bitflags of message status */ 1.7.7/hdrs/externs.h
r427 r431 392 392 const char *conjoin, const char *space, 393 393 char *buff, char **bp); 394 extern char *show_time(time_t t, int utc); 395 extern char *show_tm(struct tm *t); 396 394 397 395 398 /** This structure associates html entities and base ascii representations */ 1.7.7/hdrs/mushdb.h
r417 r431 151 151 */ 152 152 #define RDBF_SCREENSIZE 0x01 153 #define RDBF_TTYPE 0x02 153 154 154 155 #endif /* __DB_H */ 1.7.7/hdrs/mushtype.h
r427 r431 121 121 int width; /**< Screen width */ 122 122 int height; /**< Screen height */ 123 char *ttype; /**< Terminal type */ 123 124 #ifdef HAS_OPENSSL 124 125 BIO *bio; 1.7.7/hdrs/version.h
r429 r431 1 #define VERSION "PennMUSH version 1.7.7 patchlevel 1 5 [06/01/2003]"2 #define SHORTVN "PennMUSH 1.7.7p1 5"3 #define NUMVERSION 00100700701 51 #define VERSION "PennMUSH version 1.7.7 patchlevel 16 [06/23/2003]" 2 #define SHORTVN "PennMUSH 1.7.7p16" 3 #define NUMVERSION 001007007016 1.7.7/src/access.c
r427 r431 485 485 struct access *end; 486 486 struct access *tmp; 487 char *date;488 487 489 488 tmp = (struct access *) mush_malloc(sizeof(struct access), "struct_access"); … … 495 494 tmp->cant = cant; 496 495 strcpy(tmp->host, host); 497 date = (char *) ctime(&mudtime); 498 date[strlen(date) - 1] = '\0'; 499 sprintf(tmp->comment, "By %s(#%d) on %s", Name(player), player, date); 496 sprintf(tmp->comment, "By %s(#%d) on %s", Name(player), player, 497 show_time(mudtime, 0)); 500 498 tmp->next = NULL; 501 499 1.7.7/src/bsd.c
r429 r431 225 225 #define TN_LINEMODE 34 /**< Line mode */ 226 226 #define TN_NAWS 31 /**< Negotiate About Window Size */ 227 #define TN_TTYPE 24 /**< Ask for termial type information */ 227 228 static void test_telnet(DESC *d); 228 229 static void setup_telnet(DESC *d); … … 1641 1642 { 1642 1643 freeqs(d); 1644 mush_free(d->ttype, "terminal description"); 1643 1645 mush_free((Malloc_t) d, "descriptor"); 1644 1646 } … … 1684 1686 d->input_chars = 0; 1685 1687 d->output_chars = 0; 1688 d->width = 78; 1689 d->height = 24; 1690 d->ttype = mush_strdup("unknown", "terminal description"); 1686 1691 #ifdef HAS_OPENSSL 1687 1692 d->bio = NULL; … … 1714 1719 d->bConnectionDropped = FALSE; /* not dropped yet */ 1715 1720 #else 1716 d->width = 78;1717 d->height = 24;1718 1721 test_telnet(d); 1719 1722 welcome_user(d); … … 2187 2190 d->conn_flags |= CONN_TELNET; 2188 2191 if (d->conn_flags & CONN_TELNET_QUERY) { 2189 /* IAC DO NAWS */2190 unsigned char extra_options[ 3] = "\xFF\xFD\x1F";2192 /* IAC DO NAWS IAC DO TERMINAL-TYPE */ 2193 unsigned char extra_options[6] = "\xFF\xFD\x1F" "\xFF\xFD\x18"; 2191 2194 d->conn_flags &= ~CONN_TELNET_QUERY; 2192 2195 do_log(LT_CONN, 0, 0, T("[%d/%s/%s] Switching to Telnet mode."), 2193 2196 d->descriptor, d->addr, d->ip); 2194 queue_newwrite(d, extra_options, 3);2197 queue_newwrite(d, extra_options, 6); 2195 2198 process_output(d); 2196 2199 } … … 2274 2277 return -1; 2275 2278 (*q)++; 2279 } else if (**q == TN_TTYPE) { 2280 /* Read the terminal type: TERMINAL-TYPE IS blah IAC SE */ 2281 char tbuf[BUFFER_LEN], *bp = tbuf; 2282 if (*q >= qend) 2283 return -1; 2284 (*q)++; 2285 /* Skip IS */ 2286 if (*q >= qend) 2287 return -1; 2288 (*q)++; 2289 2290 /* Read up to IAC SE */ 2291 while (1) { 2292 if (*q >= qend) 2293 return -1; 2294 if (**q == IAC) { 2295 if (*q + 1 >= qend) 2296 return -1; 2297 if (*(*q + 1) == IAC) { 2298 safe_chr(IAC, tbuf, &bp); 2299 (*q)++; 2300 } else 2301 break; 2302 } else 2303 safe_chr(**q, tbuf, &bp); 2304 (*q)++; 2305 } 2306 while (*q < qend && **q != SE) 2307 (*q)++; 2308 *bp = '\0'; 2309 mush_free(d->ttype, "terminal description"); 2310 d->ttype = mush_strdup(tbuf, "terminal description"); 2276 2311 } else { 2277 2312 while (*q < qend && **q != SE) … … 2293 2328 fprintf(stderr, "Setting linemode options.\n"); 2294 2329 #endif 2330 } else if (**q == TN_TTYPE) { 2331 /* Ask for terminal type id: IAC SB TERMINAL-TYPE SEND IAC SEC */ 2332 unsigned char reply[6] = "\xFF\xFA\x18\x01\xFF\xF0"; 2333 queue_newwrite(d, reply, 6); 2295 2334 } else if (**q == TN_SGA || **q == TN_NAWS) { 2296 2335 /* This is good to be at. */ … … 3157 3196 } 3158 3197 queue_string_eol(call_by, tprintf("Name: %s", options.mud_name)); 3159 queue_string(call_by, tprintf("Uptime: %s", ctime(&first_start_time)));3198 queue_string(call_by, tprintf("Uptime: %s", show_time(first_start_time, 0))); 3160 3199 queue_string_eol(call_by, tprintf("Connected: %d", count)); 3161 3200 queue_string_eol(call_by, tprintf("Size: %d", db_top)); … … 3519 3558 char tbuf1[BUFFER_LEN]; 3520 3559 dbref zone, obj; 3521 char *p;3522 3560 int j; 3523 3524 p = ctime(&mudtime);3525 p[strlen(p) - 1] = '\0';3526 if (p[8] == ' ')3527 p[8] = '0';3528 3561 3529 3562 loc = Location(player); … … 3578 3611 } 3579 3612 clear_flag_internal(player, "CONNECTED"); 3580 (void) atr_add(player, "LASTLOGOUT", p, GOD, NOTHING);3613 (void) atr_add(player, "LASTLOGOUT", show_time(mudtime, 0), GOD, NOTHING); 3581 3614 } else { 3582 3615 /* note: when you partially disconnect, ADISCONNECTS are not executed */ … … 3811 3844 3812 3845 3846 /** Look up a DESC by character name or file descriptor. 3847 * \param executor the dbref of the object calling the function calling this. 3848 * \param name the name or descriptor to look up. 3849 * \retval a pointer to the proper DESC, or NULL 3850 */ 3813 3851 static DESC * 3814 3852 lookup_desc(dbref executor, const char *name) 3815 3853 { 3816 DESC *d, *match; 3817 dbref target; 3818 3819 target = lookup_player(name); 3820 if (target == NOTHING) { 3821 target = match_result(executor, name, TYPE_PLAYER, 3822 MAT_ABSOLUTE | MAT_PLAYER | MAT_ME); 3823 } 3824 if ((target == NOTHING) || !Connected(target)) { 3854 DESC *d; 3855 3856 /* Given a file descriptor. See-all only. */ 3857 if (is_strict_integer(name)) { 3858 int fd = parse_integer(name); 3859 DESC_ITER_CONN(d) { 3860 if (d->descriptor == fd) { 3861 if (Priv_Who(executor) || d->player == executor) 3862 return d; 3863 else 3864 return NULL; 3865 } 3866 } 3825 3867 return NULL; 3826 } 3827 /* else walk the descriptor list looking for a match */ 3828 match = NULL; 3829 DESC_ITER_CONN(d) { 3830 if ((d->player == target) && 3831 (!Hidden(d) || Priv_Who(executor)) && 3832 (!match || (d->last_time > match->last_time))) 3833 match = d; 3834 } 3835 return match; 3868 } else { /* Look up player name */ 3869 DESC *match = NULL; 3870 dbref target = lookup_player(name); 3871 if (target == NOTHING) { 3872 target = match_result(executor, name, TYPE_PLAYER, 3873 MAT_ABSOLUTE | MAT_PLAYER | MAT_ME); 3874 } 3875 if (!GoodObject(target) || !Connected(target)) 3876 return NULL; 3877 else { 3878 /* walk the descriptor list looking for a match of a dbref */ 3879 DESC_ITER_CONN(d) { 3880 if ((d->player == target) && 3881 (!Hidden(d) || Priv_Who(executor)) && 3882 (!match || (d->last_time > match->last_time))) 3883 match = d; 3884 } 3885 return match; 3886 } 3887 } 3836 3888 } 3837 3889 … … 3890 3942 } 3891 3943 3944 FUNCTION(fun_terminfo) 3945 { 3946 DESC *match; 3947 if (!*args[0]) 3948 safe_str(T("#-1 FUNCTION REQUIRES ONE ARGUMENT"), buff, bp); 3949 else if ((match = lookup_desc(executor, args[0]))) { 3950 safe_str(match->ttype, buff, bp); 3951 if (match->conn_flags & CONN_HTML) 3952 safe_str(" pueblo", buff, bp); 3953 if (match->conn_flags & CONN_TELNET) 3954 safe_str(" telnet", buff, bp); 3955 } else 3956 safe_str(T(e_perm), buff, bp); 3957 } 3892 3958 3893 3959 /* ARGSUSED */ … … 3920 3986 3921 3987 /* ARGSUSED */ 3988 FUNCTION(fun_lports) 3989 { 3990 DESC *d; 3991 int first = 1; 3992 3993 if (!Priv_Who(executor)) { 3994 safe_str(T(e_perm), buff, bp); 3995 return; 3996 } 3997 3998 DESC_ITER_CONN(d) { 3999 if (first) 4000 first = 0; 4001 else 4002 safe_chr(' ', buff, bp); 4003 safe_integer(d->descriptor, buff, bp); 4004 } 4005 } 4006 4007 /* ARGSUSED */ 3922 4008 FUNCTION(fun_ports) 3923 4009 { … … 3930 4016 int first; 3931 4017 3932 if (!Priv_Who(executor)) {3933 notify(executor, T("Permission denied."));3934 return;3935 }3936 4018 target = lookup_player(args[0]); 3937 4019 if (target == NOTHING) { 3938 4020 target = match_result(executor, args[0], TYPE_PLAYER, 3939 MAT_ABSOLUTE | MAT_PLAYER); 3940 } 3941 if ((target == NOTHING) || !Connected(target)) { 4021 MAT_ABSOLUTE | MAT_PLAYER | MAT_ME); 4022 } 4023 if (target != executor && !Priv_Who(executor)) { 4024 /* This should probably be a safe_str */ 4025 notify(executor, T("Permission denied.")); 3942 4026 return; 3943 4027 } 3944 /* Walk descriptor chain. Don't worry about buffer length limits. */ 4028 if (!GoodObject(target) || !Connected(target)) { 4029 return; 4030 } 4031 /* Walk descriptor chain. */ 3945 4032 first = 1; 3946 4033 DESC_ITER_CONN(d) { … … 4264 4351 FILE *f; 4265 4352 DESC *d; 4266 long flags = RDBF_SCREENSIZE ;4353 long flags = RDBF_SCREENSIZE | RDBF_TTYPE; 4267 4354 if (setjmp(db_err)) { 4268 4355 flag_broadcast(0, 0, T("GAME: Error writing reboot database!")); … … 4312 4399 putref(f, d->width); 4313 4400 putref(f, d->height); 4401 putstring(f, d->ttype); 4314 4402 } /* for loop */ 4315 4403 … … 4378 4466 d->width = getref(f); 4379 4467 d->height = getref(f); 4380 } 4468 } else { 4469 d->width = 78; 4470 d->height = 24; 4471 } 4472 if (flags & RDBF_TTYPE) 4473 d->ttype = mush_strdup(getstring_noalloc(f), "terminal description"); 4474 else 4475 d->ttype = mush_strdup("unknown", "terminal description"); 4381 4476 d->input_chars = 0; 4382 4477 d->output_chars = 0; 1.7.7/src/chunk.c
r429 r431 278 278 #define REGION_SIZE 65500 279 279 280 /** Region capacity. 281 * This is the size minus the fixed region overhead. 282 */ 283 #define REGION_CAPACITY (REGION_SIZE - FIRST_CHUNK_OFFSET_IN_REGION) 284 280 285 /** Maximum chunk length. 281 286 * This is fairly arbitrary, but must be less than 282 * REGION_ SIZE - FIRST_CHUNK_OFFSET_IN_REGION(it must fit in a region).287 * REGION_CAPACITY (it must fit in a region). 283 288 */ 284 289 #define MAX_CHUNK_LEN (16384-1) … … 299 304 * Details in the migration discussion. */ 300 305 #define UNHAPPINESS_HARD 0 301 #define UNHAPPINESS_SOFT 16306 #define UNHAPPINESS_SOFT 4 302 307 #define UNHAPPINESS_MAYBE 32 303 308 #define UNHAPPINESS_TWO 0 304 #define UNHAPPINESS_ONE 16309 #define UNHAPPINESS_ONE 2 305 310 #define UNHAPPINESS_ZERO 24 306 311 #define UNHAPPINESS_SPACE_DIVISOR 1024 … … 424 429 ((CHUNK_MEDIUM_LEN_MSB_MASK << 8) | CHUNK_MEDIUM_LEN_LSB_MASK) 425 430 #define MAX_LONG_CHUNK_LEN \ 426 (REGION_ SIZE - FIRST_CHUNK_OFFSET_IN_REGION- CHUNK_LONG_DATA_OFFSET)431 (REGION_CAPACITY - CHUNK_LONG_DATA_OFFSET) 427 432 428 433 #define LenToFullLen(len) \ … … 556 561 * statistics 557 562 */ 558 static int stat_used_count; /**< How many chunks are used? */559 static int stat_used_bytes; /**< How much chunk space is used,560 including the headers? */561 563 static int stat_used_short_count; /**< How many short chunks? */ 562 564 static int stat_used_short_bytes; /**< How much space in short chunks? */ … … 565 567 static int stat_used_long_count; /**< How many long chunks? */ 566 568 static int stat_used_long_bytes; /**< How much space in long chunks? */ 567 static int stat_free_count; /**< How many chunks are free? */568 static int stat_free_bytes; /**< How many bytes in free chunks? */569 static int stat_free_fragmented; /**< How much not in largest hole? */570 569 static int stat_deref_count; /**< Dereferences this period */ 571 570 static int stat_deref_maxxed; /**< Number of chunks with max derefs */ … … 958 957 write_free_chunk(region, offset, full_len, next); 959 958 rp->free_count--; 960 stat_free_count--;961 stat_free_fragmented -= rp->free_bytes - rp->largest_free_chunk;962 959 if (rp->largest_free_chunk < full_len) 963 960 rp->largest_free_chunk = full_len; 964 stat_free_fragmented += rp->free_bytes - rp->largest_free_chunk;965 961 } 966 962 } … … 980 976 rp->used_count--; 981 977 rp->free_count++; 982 stat_free_fragmented -= rp->free_bytes - rp->largest_free_chunk;983 978 rp->free_bytes += full_len; 984 979 if (rp->largest_free_chunk < full_len) 985 980 rp->largest_free_chunk = full_len; 986 stat_free_fragmented += rp->free_bytes - rp->largest_free_chunk; 987 988 stat_used_count--; 989 stat_used_bytes -= full_len; 981 990 982 if (ChunkIsShort(region, offset)) { 991 983 /* chunk is short */ … … 1001 993 stat_used_long_bytes -= full_len; 1002 994 } 1003 stat_free_count++;1004 stat_free_bytes += full_len;1005 995 1006 996 left = rp->in_memory->first_free; … … 1074 1064 stat_used_long_bytes += full_len; 1075 1065 } 1076 stat_used_count++;1077 stat_used_bytes += full_len;1078 1066 1079 1067 if (hole_len == full_len) { 1080 1068 rp->free_count--; 1081 stat_free_fragmented -= rp->free_bytes - rp->largest_free_chunk;1082 1069 rp->free_bytes -= full_len; 1083 stat_free_count--;1084 stat_free_bytes -= full_len;1085 1070 if (rp->in_memory->first_free == offset) 1086 1071 rp->in_memory->first_free = ChunkNextFree(region, offset); … … 1096 1081 if (rp->largest_free_chunk == hole_len) 1097 1082 rp->largest_free_chunk = largest_hole(region); 1098 stat_free_fragmented += rp->free_bytes - rp->largest_free_chunk;1099 1083 return offset; 1100 1084 } … … 1102 1086 ASSERT(hole_len >= full_len + MIN_REMNANT_LEN); 1103 1087 if (rp->in_memory->first_free == offset) { 1104 stat_free_fragmented -= rp->free_bytes - rp->largest_free_chunk;1105 1088 rp->free_bytes -= full_len; 1106 stat_free_bytes -= full_len;1107 1089 rp->in_memory->first_free += full_len; 1108 1090 write_free_chunk(region, offset + full_len, … … 1110 1092 if (rp->largest_free_chunk == hole_len) 1111 1093 rp->largest_free_chunk = largest_hole(region); 1112 stat_free_fragmented += rp->free_bytes - rp->largest_free_chunk;1113 1094 return offset; 1114 1095 } else { 1115 stat_free_fragmented -= rp->free_bytes - rp->largest_free_chunk;1116 1096 rp->free_bytes -= full_len; 1117 stat_free_bytes -= full_len;1118 1097 write_free_chunk(region, offset, 1119 1098 hole_len - full_len, ChunkNextFree(region, offset)); 1120 1099 if (rp->largest_free_chunk == hole_len) 1121 1100 rp->largest_free_chunk = largest_hole(region); 1122 stat_free_fragmented += rp->free_bytes - rp->largest_free_chunk;1123 1101 return offset + hole_len - full_len; 1124 1102 } … … 1311 1289 regions[region].used_count = 0; 1312 1290 regions[region].free_count = 1; 1313 regions[region].free_bytes = REGION_ SIZE - FIRST_CHUNK_OFFSET_IN_REGION;1291 regions[region].free_bytes = REGION_CAPACITY; 1314 1292 regions[region].largest_free_chunk = regions[region].free_bytes; 1315 1293 regions[region].total_derefs = 0; … … 1321 1299 write_free_chunk(region, FIRST_CHUNK_OFFSET_IN_REGION, 1322 1300 regions[region].free_bytes, 0); 1323 1324 stat_free_count++;1325 stat_free_bytes += REGION_SIZE - FIRST_CHUNK_OFFSET_IN_REGION;1326 1301 1327 1302 touch_cache_region(regions[region].in_memory); … … 2037 2012 const char *s; 2038 2013 int overhead; 2014 int free_count = 0; 2015 int free_bytes = 0; 2016 int free_large = 0; 2017 int used_count = 0; 2018 int used_bytes = 0; 2019 u_int_16 rid; 2020 2021 for (rid = 0; rid < region_count; rid++) { 2022 free_count += regions[rid].free_count; 2023 free_bytes += regions[rid].free_bytes; 2024 free_large += regions[rid].largest_free_chunk; 2025 used_count += regions[rid].used_count; 2026 } 2027 used_bytes = (REGION_CAPACITY * region_count) - free_bytes; 2039 2028 2040 2029 if (!GoodObject(player)) { … … 2046 2035 STAT_OUT(tprintf 2047 2036 ("Chunks: %10d allocated (%10d bytes, %10d (%2d%%) overhead)", 2048 stat_used_count, stat_used_bytes, overhead,2049 stat_used_bytes ? overhead * 100 / stat_used_bytes : 0));2037 used_count, used_bytes, overhead, 2038 used_bytes ? overhead * 100 / used_bytes : 0)); 2050 2039 overhead = stat_used_short_count * CHUNK_SHORT_DATA_OFFSET; 2051 2040 STAT_OUT(tprintf … … 2067 2056 STAT_OUT(tprintf 2068 2057 (" %10d free (%10d bytes, %10d (%2d%%) fragmented)", 2069 stat_free_count, stat_free_bytes, stat_free_fragmented, 2070 stat_free_bytes ? stat_free_fragmented * 100 / 2071 stat_free_bytes : 0)); 2058 free_count, free_bytes, free_bytes - free_large, 2059 free_bytes ? (free_bytes - free_large) * 100 / free_bytes : 0)); 2072 2060 STAT_OUT(tprintf("Regions: %10d total, %8d cached", 2073 2061 region_count, cached_region_count)); 2074 2062 overhead = region_count * REGION_SIZE + region_array_len * sizeof(Region); 2075 2063 STAT_OUT(tprintf("Storage: %10d total (%2d%% saturation)", 2076 overhead, stat_used_bytes * 100 / overhead));2064 overhead, used_bytes * 100 / overhead)); 2077 2065 STAT_OUT(tprintf("Paging: %10d out, %10d in", 2078 2066 stat_page_out, stat_page_in)); … … 2088 2076 STAT_OUT(tprintf(" %10d fill inexact", 2089 2077 stat_migrate_fill_inexact)); <
