diff --git a/scp.c b/scp.c index 39b440a..7032540 100644 --- a/scp.c +++ b/scp.c @@ -3510,7 +3510,7 @@ static char *do_position(void) { static char cbuf[CBUFSIZE]; -sprintf (cbuf, "%s%s%s-%d", sim_do_filename[sim_do_depth], sim_do_label[sim_do_depth] ? "::" : "", sim_do_label[sim_do_depth] ? sim_do_label[sim_do_depth] : "", sim_goto_line[sim_do_depth]); +snprintf (cbuf, sizeof (cbuf), "%s%s%s-%d", sim_do_filename[sim_do_depth], sim_do_label[sim_do_depth] ? "::" : "", sim_do_label[sim_do_depth] ? sim_do_label[sim_do_depth] : "", sim_goto_line[sim_do_depth]); return cbuf; } @@ -4952,7 +4952,7 @@ const char *cptr; if (NULL == sim_gotofile) return SCPE_UNK; /* only valid inside of do_cmd */ cptr = get_glyph (fcptr, gbuf, 0); if ('\0' == gbuf[0]) return SCPE_ARG; /* unspecified goto target */ -sprintf(cbuf, "%s %s", sim_do_filename[sim_do_depth], cptr); +snprintf(cbuf, sizeof (cbuf), "%s %s", sim_do_filename[sim_do_depth], cptr); sim_switches |= SWMASK ('O'); /* inherit ON state and actions */ return do_cmd_label (flag, cbuf, gbuf); } @@ -5866,6 +5866,9 @@ if (flag) { #endif fprintf (st, "\n OS clock resolution: %dms", os_tick_size); fprintf (st, "\n Time taken by msleep(1): %dms", os_ms_sleep_1); + if (eth_version ()) + fprintf (st, "\n Ethernet packet info: %s", eth_version()); + fprintf (st, "\n Time taken by msleep(1): %dms", os_ms_sleep_1); #if defined(__VMS) if (1) { char *arch = diff --git a/sim_ether.c b/sim_ether.c index b1675f0..916769c 100644 --- a/sim_ether.c +++ b/sim_ether.c @@ -750,7 +750,6 @@ static char* (*p_pcap_lib_version) (void); static ETH_DEV **eth_open_devices = NULL; static int eth_open_device_count = 0; -static t_bool eth_show_active = FALSE; #if defined (USE_NETWORK) || defined (USE_SHARED) static void _eth_add_to_open_list (ETH_DEV* dev) @@ -778,7 +777,6 @@ t_stat eth_show (FILE* st, UNIT* uptr, int32 val, CONST void* desc) ETH_LIST list[ETH_MAX_DEVICE]; int number; - eth_show_active = TRUE; number = eth_devices(ETH_MAX_DEVICE, list); fprintf(st, "ETH devices:\n"); if (number == -1) @@ -794,9 +792,6 @@ t_stat eth_show (FILE* st, UNIT* uptr, int32 val, CONST void* desc) for (i=0; idbit, dev->dptr, "Writer Thread Starting\n"); pthread_mutex_lock (&dev->writer_lock); while (dev->handle) { pthread_cond_wait (&dev->writer_cond, &dev->writer_lock); + if (dev->handle == NULL) /* Shutting down? */ + break; while (NULL != (request = dev->write_requests)) { /* Pull buffer off request list */ dev->write_requests = request->next; @@ -2437,6 +2438,11 @@ _eth_remove_from_open_list (dev); return SCPE_OK; } +const char *eth_version (void) +{ +return pcap_lib_version(); +} + t_stat eth_attach_help(FILE *st, DEVICE *dptr, UNIT *uptr, int32 flag, const char *cptr) { fprintf (st, "%s attach help\n\n", dptr->name); diff --git a/sim_ether.h b/sim_ether.h index 2c95ff8..02c84ce 100644 --- a/sim_ether.h +++ b/sim_ether.h @@ -349,6 +349,7 @@ t_stat eth_filter_hash (ETH_DEV* dev, int addr_count, /* set filter on incomin ETH_MULTIHASH* const hash); t_stat eth_check_address_conflict (ETH_DEV* dev, ETH_MAC* const address); +const char *eth_version (void); /* Version of dynamically loaded library (pcap) */ int eth_devices (int max, ETH_LIST* dev); /* get ethernet devices on host */ void eth_setcrc (ETH_DEV* dev, int need_crc); /* enable/disable CRC mode */ t_stat eth_set_async (ETH_DEV* dev, int latency); /* set read behavior to be async */