mirror of
https://github.com/open-simh/simtools.git
synced 2026-02-27 17:13:52 +00:00
Add default extensions to .include, .library
This commit is contained in:
@@ -502,6 +502,7 @@ O 75 .endc
|
||||
return 0;
|
||||
}
|
||||
|
||||
name = defext (name, "MAC");
|
||||
my_searchenv(name, "INCLUDE", hitfile, sizeof(hitfile));
|
||||
|
||||
if (hitfile[0] == '\0') {
|
||||
@@ -569,6 +570,7 @@ O 75 .endc
|
||||
char hitfile[FILENAME_MAX];
|
||||
char *name = getstring_fn(cp, &cp);
|
||||
|
||||
name = defext (name, "MLB");
|
||||
my_searchenv(name, "MCALL", hitfile, sizeof(hitfile));
|
||||
|
||||
if (hitfile[0]) {
|
||||
|
||||
18
util.c
18
util.c
@@ -314,3 +314,21 @@ void padto(
|
||||
*str++ = ' ', needspace--;
|
||||
*str = 0;
|
||||
}
|
||||
|
||||
/* defext adds the supplied extension to the file name if it doesn't
|
||||
already have one. "ext" is the desired extension, without the
|
||||
period. The file name must be in a malloc'ed buffer. The
|
||||
resulting string address is returned. */
|
||||
char *defext (char *fn, const char *ext)
|
||||
{
|
||||
char *ret;
|
||||
|
||||
if (strchr (fn, '.'))
|
||||
return fn;
|
||||
ret = realloc (fn, strlen (fn) + strlen (ext) + 2);
|
||||
if (ret == NULL)
|
||||
return ret;
|
||||
strcat (ret, ".");
|
||||
strcat (ret, ext);
|
||||
return ret;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user