dTHR;
register char *s;
- scriptname = find_script(scriptname, dosearch, NULL, 0);
+ /* scriptname will be non-NULL if find_script() returns */
+ scriptname = find_script(scriptname, dosearch, NULL, 1);
if (strnEQ(scriptname, "/dev/fd/", 8) && isDIGIT(scriptname[8]) ) {
char *s = scriptname + 8;
}
else
*fdscript = -1;
- origfilename = savepv(e_script ? "-e" : scriptname);
+ origfilename = (e_script ? savepv("-e") : scriptname);
curcop->cop_filegv = gv_fetchfile(origfilename);
if (strEQ(origfilename,"-"))
scriptname = "";
if (!xfound && !seen_dot && !xfailed && (PerlLIO_stat(scriptname,&statbuf) < 0))
#endif
seen_dot = 1; /* Disable message. */
- if (!xfound)
- scriptname = NULL;
-/* croak("Can't %s %s%s%s",
- (xfailed ? "execute" : "find"),
- (xfailed ? xfailed : scriptname),
- (xfailed ? "" : " on PATH"),
- (xfailed || seen_dot) ? "" : ", '.' not in PATH"); */
+ if (!xfound) {
+ if (flags & 1) { /* do or die? */
+ croak("Can't %s %s%s%s",
+ (xfailed ? "execute" : "find"),
+ (xfailed ? xfailed : scriptname),
+ (xfailed ? "" : " on PATH"),
+ (xfailed || seen_dot) ? "" : ", '.' not in PATH");
+ }
+ scriptname = Nullch;
+ }
if (xfailed)
Safefree(xfailed);
scriptname = xfound;
}
- return scriptname;
+ return (scriptname ? savepv(scriptname) : Nullch);
}