FreeCalypso > hg > freecalypso-reveng
diff fluid-mnf/misc.c @ 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 | 1cd24530c0ae |
children | 00060bb8b240 |
line wrap: on
line diff
--- 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