Skip to content

Commit

Permalink
Merge pull request iraf-community#388 from olebole/fix-empty-irafarch
Browse files Browse the repository at this point in the history
Allow empty IRAFARCH in irafpath()
  • Loading branch information
olebole authored Apr 3, 2024
2 parents 1850274 + 9c5a6a1 commit 1b10824
Showing 1 changed file with 27 additions and 15 deletions.
42 changes: 27 additions & 15 deletions unix/os/irafpath.c
Original file line number Diff line number Diff line change
Expand Up @@ -66,16 +66,21 @@ irafpath (char *fname)
if (x_status <= 0)
return (fname);

/* Look first in HBIN.
* Use IRAFARCH if defined.
*/
strcpy (pathname, (char *)hostdir);
strcat (pathname, "bin");
if ( (irafarch = getenv("IRAFARCH")) ) {
strcat (pathname, ".");
strcat (pathname, irafarch);
/* Look first in HBIN. Use IRAFARCH if defined. */
if ( (irafarch = getenv("IRAFARCH"))
&& (strlen(irafarch) > 0) ) {
strcpy (pathname, (char *)hostdir);
strcat (pathname, "bin.");
strcat (pathname, irafarch);
strcat (pathname, "/");
strcat (pathname, fname);
if (access (pathname, 0) == 0)
return (pathname);
}
strcat (pathname, "/");

/* Look in HBIN. */
strcpy (pathname, (char *)hostdir);
strcat (pathname, "bin/");
strcat (pathname, fname);
if (access (pathname, 0) == 0)
return (pathname);
Expand All @@ -88,13 +93,20 @@ irafpath (char *fname)
return (pathname);

/* Try BIN - use IRAFARCH if defined. */
strcpy (pathname, (char *)irafdir);
strcat (pathname, "bin");
if ( (irafarch = getenv("IRAFARCH")) ) {
strcat (pathname, ".");
strcat (pathname, irafarch);
if ( (irafarch = getenv("IRAFARCH"))
&& (strlen(irafarch) > 0) ) {
strcpy (pathname, (char *)irafdir);
strcat (pathname, "bin.");
strcat (pathname, irafarch);
strcat (pathname, "/");
strcat (pathname, fname);
if (access (pathname, 0) == 0)
return (pathname);
}
strcat (pathname, "/");

/* Try BIN. */
strcpy (pathname, (char *)irafdir);
strcat (pathname, "bin/");
strcat (pathname, fname);
if (access (pathname, 0) == 0)
return (pathname);
Expand Down

0 comments on commit 1b10824

Please sign in to comment.