# HG changeset patch # User Mychaela Falconia # Date 1584129416 0 # Node ID f89a20e7adc706cfddd266f8a48639459b47f35e # Parent 3aecf9bc1bf323513806a5ec03e227e6deb6a441 fluid-mnf: helper files sought in proper install location diff -r 3aecf9bc1bf3 -r f89a20e7adc7 fluid-mnf/fileio.c --- 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); diff -r 3aecf9bc1bf3 -r f89a20e7adc7 fluid-mnf/flash.c --- 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); diff -r 3aecf9bc1bf3 -r f89a20e7adc7 fluid-mnf/misc.c --- 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 diff -r 3aecf9bc1bf3 -r f89a20e7adc7 fluid-mnf/misc.h --- 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);