From d09da0eb6b6959403e0344907cdc99e74d5e4ddc Mon Sep 17 00:00:00 2001 From: "W. Eric Norum" Date: Wed, 23 Aug 2000 22:31:39 +0000 Subject: [PATCH] Use a special RTEMS-specific version of fopen to add the RTEMS TFTP prefix to path names. This is a cleaner solution since it requires no changes to any other EPICS code and works for all places that files are opened. --- configure/os/CONFIG.Common.RTEMS | 2 +- src/libCom/osi/os/RTEMS/rtems_init.c | 37 +++++++--------------------- 2 files changed, 10 insertions(+), 29 deletions(-) diff --git a/configure/os/CONFIG.Common.RTEMS b/configure/os/CONFIG.Common.RTEMS index a07d2efc0..0ed068ed1 100644 --- a/configure/os/CONFIG.Common.RTEMS +++ b/configure/os/CONFIG.Common.RTEMS @@ -62,7 +62,7 @@ OS_CLASS = RTEMS #-------------------------------------------------- # Operating system flags -OP_SYS_CPPFLAGS = -Dmain=rtems_main -DIOCSH_USE_READLINE +OP_SYS_CPPFLAGS = -Dfopen=rtems_fopen -Dmain=rtems_main -DIOCSH_USE_READLINE OP_SYS_LDLIBS = -lreadline -lcurses OP_SYS_LDFLAGS = $(CPU_CFLAGS) -u Init -lCom \ $(PROJECT_RELEASE)/lib/no-dpmem.rel \ diff --git a/src/libCom/osi/os/RTEMS/rtems_init.c b/src/libCom/osi/os/RTEMS/rtems_init.c index 51cdce393..be8d931ae 100644 --- a/src/libCom/osi/os/RTEMS/rtems_init.c +++ b/src/libCom/osi/os/RTEMS/rtems_init.c @@ -276,40 +276,21 @@ static void ioccrfRegisterRTEMS (void) } /* - * Wrappers for EPICS routines which refer to file names. * Since RTEMS doesn't have NFS we fake it by making sure that * all paths refer to files in the TFTP area. */ -long -dbLoadDatabaseRTEMS (char *name) +#ifdef fopen +# undef fopen + extern FILE *fopen (const char *, const char *); +#endif +FILE *rtems_fopen (const char *name, const char *mode) { + FILE *fp; char *cp = rtems_tftp_path (name); - int dbLoadDatabase (char *filename, char *path, char *substitutions); - dbLoadDatabase (cp, "/", NULL); - free (cp); - return 0; -} - -long -dbLoadRecordsRTEMS (char *name, char *substitutions) -{ - char *cp = rtems_tftp_path (name); - int dbLoadRecords (char* pfilename, char* substitutions); - - dbLoadRecords (cp, substitutions); - free (cp); - return 0; -} - -void -runScriptRTEMS (const char *name) -{ - char *cp; - - cp = rtems_tftp_path (name); - ioccrf (cp); + fp = fopen (cp, mode); free (cp); + return fp; } void @@ -383,7 +364,7 @@ Init (rtems_task_argument ignored) ioccrfRegisterCommon (); ioccrfRegisterRTEMS (); registerRecordDeviceDriverRegister (); - runScriptRTEMS ("st.cmd"); + ioccrf ("st.cmd"); /* * Everything's running!