FreeCalypso > hg > freecalypso-reveng
changeset 354:f89a20e7adc7
fluid-mnf: helper files sought in proper install location
author | Mychaela Falconia <falcon@freecalypso.org> |
---|---|
date | Fri, 13 Mar 2020 19:56:56 +0000 |
parents | 3aecf9bc1bf3 |
children | e77d478e3724 |
files | fluid-mnf/fileio.c fluid-mnf/flash.c fluid-mnf/misc.c fluid-mnf/misc.h |
diffstat | 4 files changed, 31 insertions(+), 4 deletions(-) [+] |
line wrap: on
line diff
--- a/fluid-mnf/fileio.c Fri Mar 13 19:41:17 2020 +0000 +++ b/fluid-mnf/fileio.c Fri Mar 13 19:56:56 2020 +0000 @@ -219,7 +219,7 @@ flowf(DEBUG, "(oops) "); - if (pathname_make(buf, sizeof(buf), argv_0, filename) < 0) + if (pathname_make_instdir(buf, sizeof(buf), filename) < 0) return E_BUFFER; flowf(DEBUG, "(looking for '%s') ", buf);
--- a/fluid-mnf/flash.c Fri Mar 13 19:41:17 2020 +0000 +++ b/fluid-mnf/flash.c Fri Mar 13 19:56:56 2020 +0000 @@ -180,7 +180,7 @@ { char buf[256]; - if (pathname_make(buf, sizeof(buf), argv_0, filename) < 0) + if (pathname_make_instdir(buf, sizeof(buf), filename) < 0) main_fatal(E_BUFFER); flowf(DEBUG, "(looking for '%s') ", buf);
--- a/fluid-mnf/misc.c Fri Mar 13 19:41:17 2020 +0000 +++ b/fluid-mnf/misc.c Fri Mar 13 19:56:56 2020 +0000 @@ -27,6 +27,8 @@ * File And Path Name Functions ******************************************************************************/ +static char helpers_install_dir[] = "/opt/freecalypso/fluid/"; + // Return the length of the directory name preceding the leafname. The // terminating slash is included in the length. Length can be zero, if there // is no dirname. @@ -44,7 +46,7 @@ tr(TrUtility, "{ %d }\n", len); - while (*p != '/' && *p != '\\' && len-- > 1) + while (*p != '/' && len-- > 1) p--; return len; @@ -66,7 +68,7 @@ dir_len = dirname_len(dirname); leaf_len = strlen(leafname); - if (dir_len > size - leaf_len - 1) + if (dir_len + leaf_len > size - 1) result = E_BUFFER; else { memcpy(buf, dirname, dir_len); @@ -79,6 +81,30 @@ return result; } +/* New version for fluid-mnf port */ +int pathname_make_instdir(char *buf, int size, const char *leafname) +{ + int dir_len, leaf_len, result; + + tr(TrBegin|TrUtility, "pathname_make(*, %d, '%s', '%s') {\n", + size, helpers_install_dir, leafname); + + dir_len = strlen(helpers_install_dir); + leaf_len = strlen(leafname); + + if (dir_len + leaf_len > size - 1) + result = E_BUFFER; + else { + strcpy(buf, helpers_install_dir); + strcpy(buf + dir_len, leafname); + result = dir_len + leaf_len; + } + + tr(TrEnd|TrUtility, "} %d\n", result); + + return result; +} + /****************************************************************************** * Utility Funcions
--- a/fluid-mnf/misc.h Fri Mar 13 19:41:17 2020 +0000 +++ b/fluid-mnf/misc.h Fri Mar 13 19:56:56 2020 +0000 @@ -12,6 +12,7 @@ int dirname_len(const char *pathname); int pathname_make(char *buf, int size, const char *dirname, const char *leafname); +int pathname_make_instdir(char *buf, int size, const char *leafname); void progress_begin(int n); void progress_update_simple(int n);