Merge branch 'master' into kaizen/reformatting-and-linting
# Conflicts: # src/act.comm.c # src/act.informative.c # src/aedit.c # src/comm.c # src/comm.h # src/dg_olc.h
This commit is contained in:
70
src/comm.c
70
src/comm.c
@@ -101,8 +101,7 @@ unsigned long pulse = 0; /* number of pulses since game start */
|
||||
ush_int port;
|
||||
socket_t mother_desc;
|
||||
int next_tick = SECS_PER_MUD_HOUR; /* Tick countdown */
|
||||
/* used with do_tell and handle_webster_file utility */
|
||||
long last_webster_teller = -1L;
|
||||
|
||||
|
||||
/* static local global variable declarations (current file scope only) */
|
||||
static struct txt_block *bufpool = 0; /* pool of large output buffers */
|
||||
@@ -110,14 +109,11 @@ static unsigned long max_players = 0; /* max descriptors available */
|
||||
static int tics_passed = 0; /* for extern checkpointing */
|
||||
static struct timeval null_time; /* zero-valued time structure */
|
||||
static byte reread_wizlist; /* signal: SIGUSR1 */
|
||||
/* normally signal SIGUSR2, currently orphaned in favor of Webster dictionary
|
||||
* lookup
|
||||
static byte emergency_unban;
|
||||
*/
|
||||
static byte emergency_unban; /* signal: SIGUSR2 */
|
||||
|
||||
static int dg_act_check; /* toggle for act_trigger */
|
||||
static bool fCopyOver; /* Are we booting in copyover mode? */
|
||||
static char *last_act_message = NULL;
|
||||
static byte webster_file_ready = FALSE;/* signal: SIGUSR2 */
|
||||
|
||||
/* static local function prototypes (current file scope only) */
|
||||
static RETSIGTYPE reread_wizlists(int sig);
|
||||
@@ -157,9 +153,6 @@ static int open_logfile(const char *filename, FILE *stderr_fp);
|
||||
#if defined(POSIX)
|
||||
static sigfunc *my_signal(int signo, sigfunc *func);
|
||||
#endif
|
||||
/* Webster Dictionary Lookup functions */
|
||||
static RETSIGTYPE websterlink(int sig);
|
||||
static void handle_webster_file(void);
|
||||
|
||||
static void msdp_update(void); /* KaVir plugin*/
|
||||
|
||||
@@ -958,7 +951,7 @@ void game_loop(socket_t local_mother_desc)
|
||||
mudlog(CMP, LVL_IMMORT, TRUE, "Signal received - rereading wizlists.");
|
||||
reboot_wizlists();
|
||||
}
|
||||
/* Orphaned right now as signal trapping is used for Webster lookup
|
||||
|
||||
if (emergency_unban) {
|
||||
emergency_unban = FALSE;
|
||||
mudlog(BRF, LVL_IMMORT, TRUE, "Received SIGUSR2 - completely unrestricting game (emergent)");
|
||||
@@ -966,11 +959,7 @@ void game_loop(socket_t local_mother_desc)
|
||||
circle_restrict = 0;
|
||||
num_invalid = 0;
|
||||
}
|
||||
*/
|
||||
if (webster_file_ready) {
|
||||
webster_file_ready = FALSE;
|
||||
handle_webster_file();
|
||||
}
|
||||
|
||||
|
||||
#ifdef CIRCLE_UNIX
|
||||
/* Update tics_passed for deadlock protection (UNIX only) */
|
||||
@@ -2230,18 +2219,10 @@ static RETSIGTYPE reread_wizlists(int sig)
|
||||
reread_wizlist = TRUE;
|
||||
}
|
||||
|
||||
/* Orphaned right now in place of Webster ...
|
||||
static RETSIGTYPE unrestrict_game(int sig)
|
||||
{
|
||||
emergency_unban = TRUE;
|
||||
}
|
||||
*/
|
||||
|
||||
static RETSIGTYPE websterlink(int sig)
|
||||
{
|
||||
webster_file_ready = TRUE;
|
||||
}
|
||||
|
||||
|
||||
#ifdef CIRCLE_UNIX
|
||||
|
||||
@@ -2317,7 +2298,7 @@ static void signal_setup(void)
|
||||
|
||||
/* user signal 2: unrestrict game. Used for emergencies if you lock
|
||||
* yourself out of the MUD somehow. */
|
||||
my_signal(SIGUSR2, websterlink);
|
||||
my_signal(SIGUSR2, unrestrict_game);
|
||||
|
||||
/* set up the deadlock-protection so that the MUD aborts itself if it gets
|
||||
* caught in an infinite loop for more than 3 minutes. */
|
||||
@@ -2784,45 +2765,6 @@ static void circle_sleep(struct timeval *timeout)
|
||||
|
||||
#endif /* CIRCLE_WINDOWS */
|
||||
|
||||
static void handle_webster_file(void) {
|
||||
FILE *fl;
|
||||
char_data *ch = find_char(last_webster_teller);
|
||||
char retval[MAX_STRING_LENGTH], line[READ_SIZE];
|
||||
size_t len = 0, nlen = 0;
|
||||
|
||||
last_webster_teller = -1L;
|
||||
|
||||
if (!ch) /* they quit ? */
|
||||
return;
|
||||
|
||||
fl = fopen("websterinfo", "r");
|
||||
if (!fl) {
|
||||
send_to_char(ch, "It seems the dictionary is offline..\r\n");
|
||||
return;
|
||||
}
|
||||
|
||||
unlink("websterinfo");
|
||||
|
||||
get_line(fl, line);
|
||||
while (!feof(fl)) {
|
||||
nlen = snprintf(retval + len, sizeof(retval) - len, "%s\r\n", line);
|
||||
if (len + nlen >= sizeof(retval))
|
||||
break;
|
||||
len += nlen;
|
||||
get_line(fl, line);
|
||||
}
|
||||
|
||||
if (len >= sizeof(retval)) {
|
||||
const char *overflow = "\r\n**OVERFLOW**\r\n";
|
||||
strcpy(retval + sizeof(retval) - strlen(overflow) - 1, overflow); /* strcpy: OK */
|
||||
}
|
||||
fclose(fl);
|
||||
|
||||
send_to_char(ch, "You get this feedback from Merriam-Webster:\r\n");
|
||||
page_string(ch->desc, retval, 1);
|
||||
}
|
||||
|
||||
|
||||
/* KaVir's plugin*/
|
||||
static void msdp_update( void )
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user