PennMUSH Community
Show
Ignore:
Timestamp:
12/28/07 19:57:17 (1 year ago)
Author:
shawnw
Message:

Merge devel into trunk for p6 release

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • 1.8.3/trunk/src/bsd.c

    r1117 r1167  
    113113#include "strtree.h" 
    114114#include "log.h" 
    115 #include "pcre.h" 
     115#include "mypcre.h" 
    116116#ifdef HAS_OPENSSL 
    117117#include "myssl.h" 
     
    160160static int under_limit = 1; 
    161161 
    162 char cf_motd_msg[BUFFER_LEN] /**< The message of the day */ 
    163 char cf_wizmotd_msg[BUFFER_LEN]      /**< The wizard motd */ 
    164 char cf_downmotd_msg[BUFFER_LEN]     /**< The down message */ 
    165 char cf_fullmotd_msg[BUFFER_LEN]     /**< The 'mush full' message */ 
    166 static char poll_msg[DOING_LEN]
    167 char confname[BUFFER_LEN]    /**< Name of the config file */ 
    168 char errlog[BUFFER_LEN]      /**< Name of the error log file */ 
     162char cf_motd_msg[BUFFER_LEN] = { '\0' }; /**< The message of the day */ 
     163char cf_wizmotd_msg[BUFFER_LEN] = { '\0' };      /**< The wizard motd */ 
     164char cf_downmotd_msg[BUFFER_LEN] = { '\0' };     /**< The down message */ 
     165char cf_fullmotd_msg[BUFFER_LEN] = { '\0' };     /**< The 'mush full' message */ 
     166static char poll_msg[DOING_LEN] = { '\0' }
     167char confname[BUFFER_LEN] = { '\0' };    /**< Name of the config file */ 
     168char errlog[BUFFER_LEN] = { '\0' };      /**< Name of the error log file */ 
    169169 
    170170/** Is this descriptor connected to a telnet-compatible terminal? */ 
     
    469469    if (child < 0) { 
    470470      /* Print a warning and continue */ 
    471       perror("fork"); 
     471      penn_perror("fork"); 
    472472    } else if (child > 0) { 
    473473      /* Parent process of a successful fork() */ 
     
    476476      /* Child process */ 
    477477      if (new_process_session() < 0) 
    478         perror("Couldn't create a new process session"); 
     478        penn_perror("Couldn't create a new process session"); 
    479479    } 
    480480  } 
     
    10111011#endif 
    10121012      { 
    1013         perror("select"); 
     1013        penn_perror("select"); 
    10141014        return; 
    10151015      } 
     
    11171117#endif 
    11181118  { 
    1119     perror("test_connection"); 
     1119    penn_perror("test_connection"); 
    11201120    return -1; 
    11211121  } 
     
    15881588    if (input_ready < 0) { 
    15891589      /* Well, shoot, we have no idea. Guess and proceed. */ 
    1590       perror("select in process_output"); 
     1590      penn_perror("select in process_output"); 
    15911591      input_ready = 0; 
    15921592    } 
     
    21012101{ 
    21022102  if (*userstring) { 
    2103     mush_free((Malloc_t) * userstring, "userstring"); 
     2103    mush_free((Malloc_t) *userstring, "userstring"); 
    21042104    *userstring = NULL; 
    21052105  } 
     
    22892289    if (!options.login_allow) { 
    22902290      fcache_dump(d, fcache.down_fcache, NULL); 
    2291       if (cf_downmotd_msg && *cf_downmotd_msg) 
     2291      if (*cf_downmotd_msg) 
    22922292        raw_notify(player, cf_downmotd_msg); 
    22932293    } else if (MAX_LOGINS && !under_limit) { 
    22942294      fcache_dump(d, fcache.full_fcache, NULL); 
    2295       if (cf_fullmotd_msg && *cf_fullmotd_msg) 
     2295      if (*cf_fullmotd_msg) 
    22962296        raw_notify(player, cf_fullmotd_msg); 
    22972297    } 
     
    26062606#endif 
    26072607    if (shutdown(d->descriptor, 2) < 0) 
    2608       perror("shutdown"); 
     2608      penn_perror("shutdown"); 
    26092609    closesocket(d->descriptor); 
    26102610  } 
     
    31723172  orator = player; 
    31733173 
    3174   if (cf_motd_msg && *cf_motd_msg) { 
     3174  if (*cf_motd_msg) { 
    31753175    raw_notify(player, cf_motd_msg); 
    31763176  } 
    31773177  raw_notify(player, " "); 
    3178   if (Hasprivs(player) && cf_wizmotd_msg && *cf_wizmotd_msg) { 
    3179     if (cf_motd_msg && *cf_motd_msg) 
     3178  if (Hasprivs(player) && *cf_wizmotd_msg) { 
     3179    if (*cf_motd_msg) 
    31803180      raw_notify(player, asterisk_line); 
    31813181    raw_notify(player, cf_wizmotd_msg); 
     
    33953395do_motd(dbref player, enum motd_type key, const char *message) 
    33963396{ 
    3397  
    3398   if (!Wizard(player) && key != MOTD_LIST) { 
     3397  const char *what; 
     3398 
     3399  if (key != MOTD_LIST && !Can_Announce(player)) { 
    33993400    notify(player, 
    34003401           T 
     
    34023403    return; 
    34033404  } 
     3405 
     3406  if (!message || !*message) 
     3407    what = T("cleared"); 
     3408  else 
     3409    what = T("set"); 
     3410 
    34043411  switch (key) { 
    34053412  case MOTD_MOTD: 
    3406     strcpy(cf_motd_msg, message); 
    3407     notify(player, T("Motd set.")); 
     3413    mush_strncpy(cf_motd_msg, message, BUFFER_LEN); 
     3414    notify_format(player, T("Motd %s."), what); 
    34083415    break; 
    34093416  case MOTD_WIZ: 
    3410     strcpy(cf_wizmotd_msg, message); 
    3411     notify(player, T("Wizard motd set.")); 
     3417    mush_strncpy(cf_wizmotd_msg, message, BUFFER_LEN); 
     3418    notify_format(player, T("Wizard motd %s."), what); 
    34123419    break; 
    34133420  case MOTD_DOWN: 
    3414     strcpy(cf_downmotd_msg, message); 
    3415     notify(player, T("Down motd set.")); 
     3421    mush_strncpy(cf_downmotd_msg, message, BUFFER_LEN); 
     3422    notify_format(player, T("Down motd %s."), what); 
    34163423    break; 
    34173424  case MOTD_FULL: 
    3418     strcpy(cf_fullmotd_msg, message); 
    3419     notify(player, T("Full motd set.")); 
     3425    mush_strncpy(cf_fullmotd_msg, message, BUFFER_LEN); 
     3426    notify_format(player, T("Full motd %s."), what); 
    34203427    break; 
    34213428  case MOTD_LIST: 
    3422     notify_format(player, "MOTD: %s", cf_motd_msg); 
     3429    notify_format(player, T("MOTD: %s"), cf_motd_msg); 
    34233430    if (Hasprivs(player)) { 
    34243431      notify_format(player, T("Wiz MOTD: %s"), cf_wizmotd_msg); 
     
    40444051  if (!*args[0]) 
    40454052    safe_str(T("#-1 FUNCTION REQUIRES ONE ARGUMENT"), buff, bp); 
    4046   else if ((match = lookup_desc(executor, args[0]))
     4053  else if ((match = lookup_desc(executor, args[0])) && match->width > 0
    40474054    safe_integer(match->width, buff, bp); 
    40484055  else if (args[1]) 
     
    40574064  if (!*args[0]) 
    40584065    safe_str(T("#-1 FUNCTION REQUIRES ONE ARGUMENT"), buff, bp); 
    4059   else if ((match = lookup_desc(executor, args[0]))
     4066  else if ((match = lookup_desc(executor, args[0])) && match->height > 0
    40604067    safe_integer(match->height, buff, bp); 
    40614068  else if (args[1]) 
     
    41224129  DESC *d; 
    41234130  int first = 1; 
     4131  dbref victim; 
     4132  int powered = 1; 
    41244133 
    41254134  if (!Priv_Who(executor)) { 
     
    41284137  } 
    41294138 
     4139  if (nargs && args[0] && *args[0]) { 
     4140    /* An argument was given. Find the victim and adjust perms */ 
     4141    if ((victim = noisy_match_result(executor, args[0], NOTYPE, 
     4142                                     MAT_EVERYTHING)) == NOTHING) { 
     4143      safe_str(T(e_notvis), buff, bp); 
     4144      return; 
     4145    } 
     4146    if (!Priv_Who(victim)) 
     4147      powered = 0; 
     4148  } 
     4149 
    41304150  DESC_ITER_CONN(d) { 
    4131     if (first) 
    4132       first = 0; 
    4133     else 
    4134       safe_chr(' ', buff, bp); 
    4135     safe_integer(d->descriptor, buff, bp); 
     4151    if (powered || !Hidden(d)) { 
     4152      if (first) 
     4153        first = 0; 
     4154      else 
     4155        safe_chr(' ', buff, bp); 
     4156      safe_integer(d->descriptor, buff, bp); 
     4157    } 
    41364158  } 
    41374159}