1
0
mirror of https://github.com/rcornwell/sims.git synced 2026-04-17 16:43:47 +00:00

SCP: Updated to current.

This commit is contained in:
Richard Cornwell
2019-07-07 12:57:48 -04:00
parent f0d96fd3ff
commit d1a24a5d44
3 changed files with 13 additions and 11 deletions

View File

@@ -2202,13 +2202,14 @@ sim_set_logoff (0, NULL); /* close cur log */
r = sim_open_logfile (gbuf, FALSE, &sim_log, &sim_log_ref); /* open log */
if (r != SCPE_OK) /* error? */
return r;
if (!sim_quiet)
if ((!sim_quiet) && (!(sim_switches & SWMASK ('Q'))))
fprintf (stdout, "Logging to file \"%s\"\n",
sim_logfile_name (sim_log, sim_log_ref));
fprintf (sim_log, "Logging to file \"%s\"\n",
sim_logfile_name (sim_log, sim_log_ref)); /* start of log */
time(&now);
fprintf (sim_log, "Logging to file \"%s\" at %s", sim_logfile_name (sim_log, sim_log_ref), ctime(&now));
if ((!sim_quiet) && (!(sim_switches & SWMASK ('Q'))))
fprintf (sim_log, "Logging to file \"%s\" at %s", sim_logfile_name (sim_log, sim_log_ref), ctime(&now));
return SCPE_OK;
}
@@ -2220,7 +2221,7 @@ if (cptr && (*cptr != 0)) /* now eol? */
return SCPE_2MARG;
if (sim_log == NULL) /* no log? */
return SCPE_OK;
if (!sim_quiet)
if ((!sim_quiet) && (!(sim_switches & SWMASK ('Q'))))
fprintf (stdout, "Log file closed\n");
fprintf (sim_log, "Log file closed\n");
sim_close_logfile (&sim_log_ref); /* close log */

View File

@@ -1005,6 +1005,7 @@ char *address;
char msg[512];
uint32 poll_time = sim_os_msec ();
memset (msg, 0, sizeof (msg));
if (mp->last_poll_time == 0) { /* first poll initializations */
UNIT *uptr = mp->uptr;
@@ -1063,7 +1064,7 @@ if (mp->master) {
newsock = sim_accept_conn_ex (mp->master, &address, (mp->packet ? SIM_SOCK_OPT_NODELAY : 0));/* poll connect */
if (newsock != INVALID_SOCKET) { /* got a live one? */
sprintf (msg, "tmxr_poll_conn() - Connection from %s", address);
snprintf (msg, sizeof (msg) - 1, "tmxr_poll_conn() - Connection from %s", address);
tmxr_debug_connect (mp, msg);
op = mp->lnorder; /* get line connection order list pointer */
i = mp->lines; /* play it safe in case lines == 0 */
@@ -1199,7 +1200,7 @@ for (i = 0; i < mp->lines; i++) { /* check each line in se
strcpy (lp->ipad, lp->destination);
lp->cnms = sim_os_msec ();
sim_getnames_sock (lp->sock, &sockname, &peername);
sprintf (msg, "tmxr_poll_conn() - Outgoing Line Connection to %s (%s->%s) established", lp->destination, sockname, peername);
snprintf (msg, sizeof (msg) -1, "tmxr_poll_conn() - Outgoing Line Connection to %s (%s->%s) established", lp->destination, sockname, peername);
tmxr_debug_connect_line (lp, msg);
free (sockname);
free (peername);
@@ -1211,7 +1212,7 @@ for (i = 0; i < mp->lines; i++) { /* check each line in se
}
return i;
case -1: /* failed connection */
sprintf (msg, "tmxr_poll_conn() - Outgoing Line Connection to %s failed", lp->destination);
snprintf (msg, sizeof (msg) -1, "tmxr_poll_conn() - Outgoing Line Connection to %s failed", lp->destination);
tmxr_debug_connect_line (lp, msg);
tmxr_reset_ln (lp); /* retry */
break;
@@ -1224,7 +1225,7 @@ for (i = 0; i < mp->lines; i++) { /* check each line in se
char *sockname, *peername;
sim_getnames_sock (newsock, &sockname, &peername);
sprintf (msg, "tmxr_poll_conn() - Incoming Line Connection from %s (%s->%s)", address, peername, sockname);
snprintf (msg, sizeof (msg) -1, "tmxr_poll_conn() - Incoming Line Connection from %s (%s->%s)", address, peername, sockname);
tmxr_debug_connect_line (lp, msg);
free (sockname);
free (peername);
@@ -1235,14 +1236,14 @@ for (i = 0; i < mp->lines; i++) { /* check each line in se
if (sim_parse_addr (lp->destination, host, sizeof(host), NULL, NULL, 0, NULL, address)) {
tmxr_msg (newsock, "Rejecting connection from unexpected source\r\n");
sprintf (msg, "tmxr_poll_conn() - Rejecting line connection from: %s, Expected: %s", address, host);
snprintf (msg, sizeof (msg) -1, "tmxr_poll_conn() - Rejecting line connection from: %s, Expected: %s", address, host);
tmxr_debug_connect_line (lp, msg);
sim_close_sock (newsock);
free (address);
continue; /* Try for another connection */
}
if (lp->connecting) {
sprintf (msg, "tmxr_poll_conn() - aborting outgoing line connection attempt to: %s", lp->destination);
snprintf (msg, sizeof (msg) -1, "tmxr_poll_conn() - aborting outgoing line connection attempt to: %s", lp->destination);
tmxr_debug_connect_line (lp, msg);
sim_close_sock (lp->connecting); /* abort our as yet unconnnected socket */
lp->connecting = 0;
@@ -1286,7 +1287,7 @@ for (i = 0; i < mp->lines; i++) { /* check each line in se
if (lp->destination && (!lp->sock) && (!lp->connecting) && (!lp->serport) &&
(!lp->modem_control || (lp->modembits & TMXR_MDM_DTR))) {
sprintf (msg, "tmxr_poll_conn() - establishing outgoing connection to: %s", lp->destination);
snprintf (msg, sizeof (msg) - 1, "tmxr_poll_conn() - establishing outgoing connection to: %s", lp->destination);
tmxr_debug_connect_line (lp, msg);
lp->connecting = sim_connect_sock_ex (lp->datagram ? lp->port : NULL, lp->destination, "localhost", NULL, (lp->datagram ? SIM_SOCK_OPT_DATAGRAM : 0) | (lp->mp->packet ? SIM_SOCK_OPT_NODELAY : 0));
}

View File

@@ -2159,7 +2159,7 @@ if (!vid_active) {
return SCPE_UDIS | SCPE_NOMESSAGE;
}
fullname = (char *)malloc (strlen(filename) + 5);
if (!filename)
if (!fullname)
return SCPE_MEM;
#if SDL_MAJOR_VERSION == 1
#if defined(HAVE_LIBPNG)