PennMUSH Community

Changeset 431

Show
Ignore:
Timestamp:
08/12/06 18:14:26 (2 years ago)
Author:
pennmush
Message:

PennMUSH 1.7.7p16 Archival

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • 1.7.7/CHANGES.176

    r429 r431  
    1313 
    1414========================================================================== 
     15 
     16Version 1.7.6 patchlevel 12                     June 23, 2003 
     17 
     18Minor changes: 
     19   * Users no longer see last connection information when they  
     20     connect to Guests. Suggested by Jules@M*U*S*H. 
     21Fixes: 
     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 
    1531 
    1632Version 1.7.6 patchlevel 11                     June 1, 2003 
  • 1.7.7/CHANGES.177

    r429 r431  
    1818 
    1919========================================================================== 
     20 
     21Version 1.7.7 patchlevel 16                     June 23, 2003 
     22 
     23Commands: 
     24  * New switch /room for 'with' to run a $command available in a remote 
     25    location. Suggested by Mike Griffiths. [SW] 
     26Functions: 
     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] 
     39Minor 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] 
     50Fixes: 
     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 
    2060 
    2161Version 1.7.7 patchlevel 15                     June 1, 2003 
  • 1.7.7/INSTALL

    r403 r431  
    101101   b. Compile with the Cygwin unix emulation tools (http://www.cygwin.com) 
    102102      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) 
    104105      (gcc 3.2 is recommended.) 
    105106      These are also recommended: 
  • 1.7.7/MANIFEST

    r427 r431  
    124124src/wild.c 
    125125src/wiz.c 
    126 src/SWITCHES 
    127126src/cmdlocal.dst 
    128127src/funlocal.dst 
     
    229228win32/pennmush.vcproj 
    230229win32/pennmush.sln 
     230src/SWITCHES 
  • 1.7.7/Patchlevel

    r429 r431  
    11Do not edit this file. It is maintained by the official PennMUSH patches. 
    2 This is PennMUSH 1.7.7p15 
     2This is PennMUSH 1.7.7p16 
  • 1.7.7/game/txt/hlp/penncmd.hlp

    r427 r431  
    24872487See also: @inprefix, AUDIBLE, @listen 
    24882488& @ps 
    2489   @ps[/<switch>] [*<player> | all
     2489  @ps[/<switch>] [*<player>
    24902490   
    24912491  @ps is a useful command for MUSHers.  It lists all commands currently on 
     
    37893789See also: @doing, @poll, DOING 
    37903790& with 
    3791   with <obj>=<command> 
     3791  with[/room] <obj>=<command> 
    37923792 
    37933793  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. 
    37943796 
    37953797  See 'help USER-DEFINED COMMANDS'. 
  • 1.7.7/game/txt/hlp/pennfunc.hlp

    r429 r431  
    4545  Channel functions: Get information about channels (CTITLE, CWHO) 
    4646  Communication functions: Send messages to objects (PEMIT, OEMIT) 
     47  Connection functions: Get information about a player's connection (CONN) 
    4748  Dbref functions: return dbref info related to objects (LOC, LEXITS) 
    4849  Global functions: local MUSH-specific functions defined with @function 
     
    105106  cemit()       emit()        lemit()       nspemit()     oemit() 
    106107  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()  
    107115& Dbref functions 
    108116  Dbref functions return a dbref or list of dbrefs related to some value 
     
    120128  Information functions return values related to objects. 
    121129  
    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()      
    131137 
    132138& Mail functions 
     
    657663 
    658664& CONN() 
    659   conn(<player name>) 
     665  conn(<player|descriptor>) 
    660666  
    661667  This function returns the number of seconds a player has been connected. 
     
    892898  See also: MODULO 
    893899& DOING() 
    894   doing(<player>) 
     900  doing(<player|descriptor>) 
    895901 
    896902  Given the name of a connected player, returns that player's @doing 
     
    14291435  If an invalid type is given, #-1 is returned. 
    14301436& HIDDEN() 
    1431   hidden(<player>) 
     1437  hidden(<player|descriptor>) 
    14321438 
    14331439  Returns 1 if the player is hidden, otherwise 0. 
     
    14411447& IDLE() 
    14421448& IDLESECS() 
    1443   idle(<player name>) 
    1444   idlesecs(<player name>) 
     1449  idle(<player|descriptor>) 
     1450  idlesecs(<player|descriptor>) 
    14451451  
    14461452  This function returns the number of seconds a player has been idle, 
     
    25592565 
    25602566  See also: @poll, doing(), @doing  
     2567& LPORTS() 
    25612568& PORTS() 
     2569  lports() 
    25622570  ports(<player name>) 
    25632571  
    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. 
    25692586& POS() 
    25702587  pos(<string1>,<string2>) 
     
    33573374 
    33583375  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.   
    33593393& TEXTFILE() 
    33603394& dynhelp() 
     
    37643798& SCREENWIDTH 
    37653799& SCREENHEIGHT 
    3766   width(<player>) 
    3767   height(<player>) 
     3800  width(<player|descriptor>) 
     3801  height(<player|descriptor>) 
    37683802 
    37693803  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 
     2Version 1.7.6 patchlevel 12                     June 23, 2003 
     3 
     4Minor changes: 
     5   * Users no longer see last connection information when they  
     6     connect to Guests. Suggested by Jules@M*U*S*H. 
     7Fixes: 
     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 
    118& 1.7.6p11 
    219Version 1.7.6 patchlevel 11                     June 1, 2003 
  • 1.7.7/game/txt/hlp/pennv177.hlp

    r429 r431  
    1 & 1.7.7p15 
     1& 1.7.7p16 
    22& changes 
    33This is a list of changes in this patchlevel which are probably of 
     
    1212be read in 'help patchlevels'. 
    1313 
     14Version 1.7.7 patchlevel 16                     June 23, 2003 
     15 
     16Commands: 
     17  * New switch /room for 'with' to run a $command available in a remote 
     18    location. Suggested by Mike Griffiths. [SW] 
     19Functions: 
     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] 
     32Minor 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] 
     43Fixes: 
     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 
    1455Version 1.7.7 patchlevel 15                     June 1, 2003 
    1556 
  • 1.7.7/game/txt/hlp/pennvOLD.hlp

    r429 r431  
    44184418type 'help <version>p<patchlevel>'. For example, 'help 1.7.2p3' 
    44194419 
    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 
     44201.7.7: 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16 
     44211.7.6: 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12 
    442244221.7.5: 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12 
    442344231.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  
    5858extern unsigned const char *atr_get_compressed_data(ATTR *atr); 
    5959extern char *atr_value(ATTR *atr); 
    60 extern char *safe_atr_value(ATTR *atr); 
    61 extern void atr_migrate(int amount); 
    62  
     60extern char * 
     61safe_atr_value(ATTR *atr) 
     62  __attribute_malloc__; 
     63    extern void atr_migrate(int amount); 
    6364 
    6465/* possible attribute flags */ 
     
    8586 
    8687/* external predefined attributes. */ 
    87 extern ATTR attr[]; 
     88    extern ATTR attr[]; 
    8889 
    8990#define AL_ATTR(alist)          (alist) 
  • 1.7.7/hdrs/dbdefs.h

    r427 r431  
    7979#define Connected(x)    (IS(x, TYPE_PLAYER, "CONNECTED"))   /* 0x200 */ 
    8080#define ZMaster(x)      (IS(x, TYPE_PLAYER, "ZONE"))    /* 0x800 */ 
    81 #define Unregistered(x) (IS(x, TYPE_PLAYER, "UNREGISTERD")) 
     81#define Unregistered(x) (IS(x, TYPE_PLAYER, "UNREGISTERED")) 
    8282#define Fixed(x)        (IS(Owner(x), TYPE_PLAYER, "FIXED")) 
    8383 
     
    277277  time_t from_ctime;        /**< Sender's creation time */ 
    278278  unsigned char *message;   /**< Message text, compressed */ 
    279   unsigned char *time;     /**< Message date/time, compressed */ 
     279  time_t time;         /**< Message date/time */ 
    280280  unsigned char *subject;   /**< Message subject, compressed */ 
    281281  int read;         /**< Bitflags of message status */ 
  • 1.7.7/hdrs/externs.h

    r427 r431  
    392392                  const char *conjoin, const char *space, 
    393393                  char *buff, char **bp); 
     394    extern char *show_time(time_t t, int utc); 
     395    extern char *show_tm(struct tm *t); 
     396 
    394397 
    395398/** This structure associates html entities and base ascii representations */ 
  • 1.7.7/hdrs/mushdb.h

    r417 r431  
    151151 */ 
    152152#define RDBF_SCREENSIZE         0x01 
     153#define RDBF_TTYPE              0x02 
    153154 
    154155#endif              /* __DB_H */ 
  • 1.7.7/hdrs/mushtype.h

    r427 r431  
    121121  int width;            /**< Screen width */ 
    122122  int height;           /**< Screen height */ 
     123  char *ttype;          /**< Terminal type */ 
    123124#ifdef HAS_OPENSSL 
    124125  BIO *bio; 
  • 1.7.7/hdrs/version.h

    r429 r431  
    1 #define VERSION "PennMUSH version 1.7.7 patchlevel 15 [06/01/2003]" 
    2 #define SHORTVN "PennMUSH 1.7.7p15
    3 #define NUMVERSION 001007007015 
     1#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  
    485485  struct access *end; 
    486486  struct access *tmp; 
    487   char *date; 
    488487 
    489488  tmp = (struct access *) mush_malloc(sizeof(struct access), "struct_access"); 
     
    495494  tmp->cant = cant; 
    496495  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)); 
    500498  tmp->next = NULL; 
    501499 
  • 1.7.7/src/bsd.c

    r429 r431  
    225225#define TN_LINEMODE 34      /**< Line mode */ 
    226226#define TN_NAWS 31      /**< Negotiate About Window Size */ 
     227#define TN_TTYPE 24     /**< Ask for termial type information */ 
    227228static void test_telnet(DESC *d); 
    228229static void setup_telnet(DESC *d); 
     
    16411642  { 
    16421643    freeqs(d); 
     1644    mush_free(d->ttype, "terminal description"); 
    16431645    mush_free((Malloc_t) d, "descriptor"); 
    16441646  } 
     
    16841686  d->input_chars = 0; 
    16851687  d->output_chars = 0; 
     1688  d->width = 78; 
     1689  d->height = 24; 
     1690  d->ttype = mush_strdup("unknown", "terminal description"); 
    16861691#ifdef HAS_OPENSSL 
    16871692  d->bio = NULL; 
     
    17141719  d->bConnectionDropped = FALSE;    /* not dropped yet */ 
    17151720#else 
    1716   d->width = 78; 
    1717   d->height = 24; 
    17181721  test_telnet(d); 
    17191722  welcome_user(d); 
     
    21872190  d->conn_flags |= CONN_TELNET; 
    21882191  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"; 
    21912194    d->conn_flags &= ~CONN_TELNET_QUERY; 
    21922195    do_log(LT_CONN, 0, 0, T("[%d/%s/%s] Switching to Telnet mode."), 
    21932196       d->descriptor, d->addr, d->ip); 
    2194     queue_newwrite(d, extra_options, 3); 
     2197    queue_newwrite(d, extra_options, 6); 
    21952198    process_output(d); 
    21962199  } 
     
    22742277    return -1; 
    22752278      (*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"); 
    22762311    } else { 
    22772312      while (*q < qend && **q != SE) 
     
    22932328      fprintf(stderr, "Setting linemode options.\n"); 
    22942329#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); 
    22952334    } else if (**q == TN_SGA || **q == TN_NAWS) { 
    22962335      /* This is good to be at. */ 
     
    31573196  } 
    31583197  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))); 
    31603199  queue_string_eol(call_by, tprintf("Connected: %d", count)); 
    31613200  queue_string_eol(call_by, tprintf("Size: %d", db_top)); 
     
    35193558  char tbuf1[BUFFER_LEN]; 
    35203559  dbref zone, obj; 
    3521   char *p; 
    35223560  int j; 
    3523  
    3524   p = ctime(&mudtime); 
    3525   p[strlen(p) - 1] = '\0'; 
    3526   if (p[8] == ' ') 
    3527     p[8] = '0'; 
    35283561 
    35293562  loc = Location(player); 
     
    35783611    } 
    35793612    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); 
    35813614  } else { 
    35823615    /* note: when you partially disconnect, ADISCONNECTS are not executed */ 
     
    38113844 
    38123845 
     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 */ 
    38133851static DESC * 
    38143852lookup_desc(dbref executor, const char *name) 
    38153853{ 
    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    } 
    38253867    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  } 
    38363888} 
    38373889 
     
    38903942} 
    38913943 
     3944FUNCTION(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} 
    38923958 
    38933959/* ARGSUSED */ 
     
    39203986 
    39213987/* ARGSUSED */ 
     3988FUNCTION(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 */ 
    39224008FUNCTION(fun_ports) 
    39234009{ 
     
    39304016  int first; 
    39314017 
    3932   if (!Priv_Who(executor)) { 
    3933     notify(executor, T("Permission denied.")); 
    3934     return; 
    3935   } 
    39364018  target = lookup_player(args[0]); 
    39374019  if (target == NOTHING) { 
    39384020    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.")); 
    39424026    return; 
    39434027  } 
    3944   /* Walk descriptor chain. Don't worry about buffer length limits. */ 
     4028  if (!GoodObject(target) || !Connected(target)) { 
     4029    return; 
     4030  } 
     4031  /* Walk descriptor chain. */ 
    39454032  first = 1; 
    39464033  DESC_ITER_CONN(d) { 
     
    42644351  FILE *f; 
    42654352  DESC *d; 
    4266   long flags = RDBF_SCREENSIZE
     4353  long flags = RDBF_SCREENSIZE | RDBF_TTYPE
    42674354  if (setjmp(db_err)) { 
    42684355    flag_broadcast(0, 0, T("GAME: Error writing reboot database!")); 
     
    43124399      putref(f, d->width); 
    43134400      putref(f, d->height); 
     4401      putstring(f, d->ttype); 
    43144402    }               /* for loop */ 
    43154403 
     
    43784466      d->width = getref(f); 
    43794467      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"); 
    43814476    d->input_chars = 0; 
    43824477    d->output_chars = 0; 
  • 1.7.7/src/chunk.c

    r429 r431  
    278278#define REGION_SIZE 65500 
    279279 
     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 
    280285/** Maximum chunk length. 
    281286 * 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). 
    283288 */ 
    284289#define MAX_CHUNK_LEN (16384-1) 
     
    299304 * Details in the migration discussion. */ 
    300305#define UNHAPPINESS_HARD 0 
    301 #define UNHAPPINESS_SOFT 16 
     306#define UNHAPPINESS_SOFT 4 
    302307#define UNHAPPINESS_MAYBE 32 
    303308#define UNHAPPINESS_TWO 0 
    304 #define UNHAPPINESS_ONE 16 
     309#define UNHAPPINESS_ONE 2 
    305310#define UNHAPPINESS_ZERO 24 
    306311#define UNHAPPINESS_SPACE_DIVISOR 1024 
     
    424429        ((CHUNK_MEDIUM_LEN_MSB_MASK << 8) | CHUNK_MEDIUM_LEN_LSB_MASK) 
    425430#define MAX_LONG_CHUNK_LEN \ 
    426         (REGION_SIZE - FIRST_CHUNK_OFFSET_IN_REGION - CHUNK_LONG_DATA_OFFSET) 
     431        (REGION_CAPACITY - CHUNK_LONG_DATA_OFFSET) 
    427432 
    428433#define LenToFullLen(len) \ 
     
    556561 * statistics 
    557562 */ 
    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? */ 
    561563static int stat_used_short_count;   /**< How many short chunks? */ 
    562564static int stat_used_short_bytes;   /**< How much space in short chunks? */ 
     
    565567static int stat_used_long_count;    /**< How many long chunks? */ 
    566568static 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? */ 
    570569static int stat_deref_count;        /**< Dereferences this period */ 
    571570static int stat_deref_maxxed;       /**< Number of chunks with max derefs */ 
     
    958957    write_free_chunk(region, offset, full_len, next); 
    959958    rp->free_count--; 
    960     stat_free_count--; 
    961     stat_free_fragmented -= rp->free_bytes - rp->largest_free_chunk; 
    962959    if (rp->largest_free_chunk < full_len) 
    963960      rp->largest_free_chunk = full_len; 
    964     stat_free_fragmented += rp->free_bytes - rp->largest_free_chunk; 
    965961  } 
    966962} 
     
    980976  rp->used_count--; 
    981977  rp->free_count++; 
    982   stat_free_fragmented -= rp->free_bytes - rp->largest_free_chunk; 
    983978  rp->free_bytes += full_len; 
    984979  if (rp->largest_free_chunk < full_len) 
    985980    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 
    990982  if (ChunkIsShort(region, offset)) { 
    991983    /* chunk is short */ 
     
    1001993    stat_used_long_bytes -= full_len; 
    1002994  } 
    1003   stat_free_count++; 
    1004   stat_free_bytes += full_len; 
    1005995 
    1006996  left = rp->in_memory->first_free; 
     
    10741064    stat_used_long_bytes += full_len; 
    10751065  } 
    1076   stat_used_count++; 
    1077   stat_used_bytes += full_len; 
    10781066 
    10791067  if (hole_len == full_len) { 
    10801068    rp->free_count--; 
    1081     stat_free_fragmented -= rp->free_bytes - rp->largest_free_chunk; 
    10821069    rp->free_bytes -= full_len; 
    1083     stat_free_count--; 
    1084     stat_free_bytes -= full_len; 
    10851070    if (rp->in_memory->first_free == offset) 
    10861071      rp->in_memory->first_free = ChunkNextFree(region, offset); 
     
    10961081    if (rp->largest_free_chunk == hole_len) 
    10971082      rp->largest_free_chunk = largest_hole(region); 
    1098     stat_free_fragmented += rp->free_bytes - rp->largest_free_chunk; 
    10991083    return offset; 
    11001084  } 
     
    11021086  ASSERT(hole_len >= full_len + MIN_REMNANT_LEN); 
    11031087  if (rp->in_memory->first_free == offset) { 
    1104     stat_free_fragmented -= rp->free_bytes - rp->largest_free_chunk; 
    11051088    rp->free_bytes -= full_len; 
    1106     stat_free_bytes -= full_len; 
    11071089    rp->in_memory->first_free += full_len; 
    11081090    write_free_chunk(region, offset + full_len, 
     
    11101092    if (rp->largest_free_chunk == hole_len) 
    11111093      rp->largest_free_chunk = largest_hole(region); 
    1112     stat_free_fragmented += rp->free_bytes - rp->largest_free_chunk; 
    11131094    return offset; 
    11141095  } else { 
    1115     stat_free_fragmented -= rp->free_bytes - rp->largest_free_chunk; 
    11161096    rp->free_bytes -= full_len; 
    1117     stat_free_bytes -= full_len; 
    11181097    write_free_chunk(region, offset, 
    11191098             hole_len - full_len, ChunkNextFree(region, offset)); 
    11201099    if (rp->largest_free_chunk == hole_len) 
    11211100      rp->largest_free_chunk = largest_hole(region); 
    1122     stat_free_fragmented += rp->free_bytes - rp->largest_free_chunk; 
    11231101    return offset + hole_len - full_len; 
    11241102  } 
     
    13111289  regions[region].used_count = 0; 
    13121290  regions[region].free_count = 1; 
    1313   regions[region].free_bytes = REGION_SIZE - FIRST_CHUNK_OFFSET_IN_REGION
     1291  regions[region].free_bytes = REGION_CAPACITY
    13141292  regions[region].largest_free_chunk = regions[region].free_bytes; 
    13151293  regions[region].total_derefs = 0; 
     
    13211299  write_free_chunk(region, FIRST_CHUNK_OFFSET_IN_REGION, 
    13221300           regions[region].free_bytes, 0); 
    1323  
    1324   stat_free_count++; 
    1325   stat_free_bytes += REGION_SIZE - FIRST_CHUNK_OFFSET_IN_REGION; 
    13261301 
    13271302  touch_cache_region(regions[region].in_memory); 
     
    20372012  const char *s; 
    20382013  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; 
    20392028 
    20402029  if (!GoodObject(player)) { 
     
    20462035  STAT_OUT(tprintf 
    20472036       ("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)); 
    20502039  overhead = stat_used_short_count * CHUNK_SHORT_DATA_OFFSET; 
    20512040  STAT_OUT(tprintf 
     
    20672056  STAT_OUT(tprintf 
    20682057       ("           %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)); 
    20722060  STAT_OUT(tprintf("Regions:   %10d total, %8d cached", 
    20732061           region_count, cached_region_count)); 
    20742062  overhead = region_count * REGION_SIZE + region_array_len * sizeof(Region); 
    20752063  STAT_OUT(tprintf("Storage:   %10d total (%2d%% saturation)", 
    2076            overhead, stat_used_bytes * 100 / overhead)); 
     2064           overhead, used_bytes * 100 / overhead)); 
    20772065  STAT_OUT(tprintf("Paging:    %10d out, %10d in", 
    20782066           stat_page_out, stat_page_in)); 
     
    20882076  STAT_OUT(tprintf("             %10d fill inexact", 
    20892077           stat_migrate_fill_inexact)); 
     <