diff --git a/makefile b/makefile index c8fcc0a..354d382 100644 --- a/makefile +++ b/makefile @@ -603,6 +603,18 @@ ifeq (${WIN32},) #*nix Environments (&& cygwin) endif endif endif + ifneq (,$(call find_include,editline/readline)) + OS_CCDEFS += -DHAVE_EDITLINE + OS_LDFLAGS += -ledit + ifneq (Darwin,$(OSTYPE)) + # The doc says termcap is needed, though reality suggests + # otherwise. Put it in anyway, it can't hurt. + ifneq (,$(call find_lib,termcap)) + OS_LDFLAGS += -ltermcap + endif + endif + $(info using libedit: $(call find_include,editline/readline)) + endif ifneq (,$(call find_include,utime)) OS_CCDEFS += -DHAVE_UTIME endif diff --git a/scp.c b/scp.c index 9a58658..92c8f90 100644 --- a/scp.c +++ b/scp.c @@ -242,8 +242,8 @@ #endif #include -#if defined(SIM_HAVE_DLOPEN) /* Dynamic Readline support */ -#include +#if defined(HAVE_EDITLINE) /* Editline command line editing */ +#include #endif #ifndef MAX @@ -10273,51 +10273,16 @@ return read_line_p (NULL, cptr, size, stream); char *read_line_p (const char *prompt, char *cptr, int32 size, FILE *stream) { char *tptr; -#if defined(SIM_HAVE_DLOPEN) -static int initialized = 0; -typedef char *(*readline_func)(const char *); -static readline_func p_readline = NULL; -typedef void (*add_history_func)(const char *); -static add_history_func p_add_history = NULL; - -if (prompt && (!initialized)) { - initialized = 1; - void *handle; - -#define S__STR_QUOTE(tok) #tok -#define S__STR(tok) S__STR_QUOTE(tok) - handle = dlopen("libncurses." S__STR(SIM_HAVE_DLOPEN), RTLD_NOW|RTLD_GLOBAL); - handle = dlopen("libcurses." S__STR(SIM_HAVE_DLOPEN), RTLD_NOW|RTLD_GLOBAL); - handle = dlopen("libreadline." S__STR(SIM_HAVE_DLOPEN), RTLD_NOW|RTLD_GLOBAL); - if (!handle) - handle = dlopen("libreadline." S__STR(SIM_HAVE_DLOPEN) ".8", RTLD_NOW|RTLD_GLOBAL); - if (!handle) - handle = dlopen("libreadline." S__STR(SIM_HAVE_DLOPEN) ".7", RTLD_NOW|RTLD_GLOBAL); - if (!handle) - handle = dlopen("libreadline." S__STR(SIM_HAVE_DLOPEN) ".6", RTLD_NOW|RTLD_GLOBAL); - if (!handle) - handle = dlopen("libreadline." S__STR(SIM_HAVE_DLOPEN) ".5", RTLD_NOW|RTLD_GLOBAL); - if (handle) { - p_readline = (readline_func)((size_t)dlsym(handle, "readline")); - p_add_history = (add_history_func)((size_t)dlsym(handle, "add_history")); - } - } +#if defined(HAVE_EDITLINE) if (prompt) { /* interactive? */ - if (p_readline) { - char *tmpc = p_readline (prompt); /* get cmd line */ - if (tmpc == NULL) /* bad result? */ - cptr = NULL; - else { - strlcpy (cptr, tmpc, size); /* copy result */ - free (tmpc) ; /* free temp */ - } - } + char *tmpc = readline (prompt); /* get cmd line */ + if (tmpc == NULL) /* bad result? */ + cptr = NULL; else { - printf ("%s", prompt); /* display prompt */ - fflush (stdout); - cptr = fgets (cptr, size, stream); /* get cmd line */ - } + strlcpy (cptr, tmpc, size); /* copy result */ + free (tmpc) ; /* free temp */ } +} else cptr = fgets (cptr, size, stream); /* get cmd line */ #else if (prompt) { /* interactive? */ @@ -10349,9 +10314,9 @@ if ((*cptr == ';') || (*cptr == '#')) { /* ignore comment */ *cptr = 0; } -#if defined (SIM_HAVE_DLOPEN) -if (prompt && p_add_history && *cptr) /* Save non blank lines in history */ - p_add_history (cptr); +#if defined (HAVE_EDITLINE) +if (prompt && *cptr) /* Save non blank lines in history */ + add_history (cptr); #endif return cptr; diff --git a/sim_ether.c b/sim_ether.c index 83ebe66..3d4ca07 100644 --- a/sim_ether.c +++ b/sim_ether.c @@ -964,6 +964,10 @@ t_stat eth_filter (ETH_DEV* dev, int addr_count, ETH_MAC* const addresses, t_stat eth_filter_hash (ETH_DEV* dev, int addr_count, ETH_MAC* const addresses, ETH_BOOL all_multicast, ETH_BOOL promiscuous, ETH_MULTIHASH* const hash) {return SCPE_NOFNC;} +t_stat eth_filter_hash_ex(ETH_DEV* dev, int addr_count, ETH_MAC* const addresses, + ETH_BOOL all_multicast, ETH_BOOL promiscuous, + ETH_BOOL match_broadcast, ETH_MULTIHASH* const hash) + {return SCPE_NOFNC;} const char *eth_version (void) {return NULL;} int eth_devices(int max, ETH_LIST* list, ETH_BOOL framers) diff --git a/sim_imd.c b/sim_imd.c index b5943ac..bb3f00d 100644 --- a/sim_imd.c +++ b/sim_imd.c @@ -16,22 +16,21 @@ * * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, * * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF * - * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND * - * NONINFRINGEMENT. IN NO EVENT SHALL HOWARD M. HARTE BE LIABLE FOR ANY * - * CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, * - * TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE * - * SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. * + * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON- * + * INFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE * + * LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN * + * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN * + * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE * + * SOFTWARE. * * * - * Except as contained in this notice, the name of Howard M. Harte shall * + * Except as contained in this notice, the names of The Authors shall * * not be used in advertising or otherwise to promote the sale, use or * * other dealings in this Software without prior written authorization * - * Howard M. Harte. * - * * - * SIMH Interface based on altairz80_hdsk.c, by Peter Schorn. * + * from the Authors. * * * * Module Description: * - * ImageDisk (IMD) Disk Image File access module for SIMH. * - * see: http://www.classiccmp.org/dunfield/img/index.htm * + * ImageDisk Disk Image File access module for SIMH, definitions. * + * See: http://dunfield.classiccmp.org/img/index.htm * * for details on the ImageDisk format and other utilities. * * * *************************************************************************/ diff --git a/sim_imd.h b/sim_imd.h index 0b311bf..88a5183 100644 --- a/sim_imd.h +++ b/sim_imd.h @@ -1,6 +1,6 @@ /************************************************************************* * * - * Copyright (c) 2007-2020 Howard M. Harte. * + * Copyright (c) 2007-2022 Howard M. Harte. * * https://github.com/hharte * * * * Permission is hereby granted, free of charge, to any person obtaining * @@ -16,22 +16,21 @@ * * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, * * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF * - * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND * - * NONINFRINGEMENT. IN NO EVENT SHALL HOWARD M. HARTE BE LIABLE FOR ANY * - * CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, * - * TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE * - * SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. * + * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON- * + * INFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE * + * LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN * + * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN * + * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE * + * SOFTWARE. * * * - * Except as contained in this notice, the name of Howard M. Harte shall * + * Except as contained in this notice, the names of The Authors shall * * not be used in advertising or otherwise to promote the sale, use or * * other dealings in this Software without prior written authorization * - * Howard M. Harte. * - * * - * SIMH Interface based on altairz80_hdsk.c, by Peter Schorn. * + * from the Authors. * * * * Module Description: * * ImageDisk Disk Image File access module for SIMH, definitions. * - * See: http://www.classiccmp.org/dunfield/img/index.htm * + * See: http://dunfield.classiccmp.org/img/index.htm * * for details on the ImageDisk format and other utilities. * * * *************************************************************************/