1
0
mirror of https://github.com/rcornwell/sims.git synced 2026-04-14 15:55:33 +00:00

SCP: Updated to current.

This commit is contained in:
Richard Cornwell
2022-10-22 22:06:09 -04:00
parent d73fd8ae68
commit 7578f0d436
5 changed files with 48 additions and 69 deletions

View File

@@ -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

59
scp.c
View File

@@ -242,8 +242,8 @@
#endif
#include <setjmp.h>
#if defined(SIM_HAVE_DLOPEN) /* Dynamic Readline support */
#include <dlfcn.h>
#if defined(HAVE_EDITLINE) /* Editline command line editing */
#include <editline/readline.h>
#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;

View File

@@ -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)

View File

@@ -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. *
* *
*************************************************************************/

View File

@@ -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. *
* *
*************************************************************************/