From: Gurusamy Sarathy Date: Fri, 26 Jun 1998 04:33:57 +0000 (+0000) Subject: make find_script() return saved string, reenable missing diagnostics X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=commitdiff_plain;h=9ccb31f93bbfdb2e29acd0451c7419410a8499b8;p=p5sagit%2Fp5-mst-13.2.git make find_script() return saved string, reenable missing diagnostics p4raw-id: //depot/perl@1219 --- diff --git a/perl.c b/perl.c index 6930a4f..fc231b1 100644 --- a/perl.c +++ b/perl.c @@ -1886,7 +1886,8 @@ open_script(char *scriptname, bool dosearch, SV *sv, int *fdscript) 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; @@ -1898,7 +1899,7 @@ open_script(char *scriptname, bool dosearch, SV *sv, int *fdscript) } 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 = ""; diff --git a/util.c b/util.c index eb51151..7a173ee 100644 --- a/util.c +++ b/util.c @@ -2562,18 +2562,21 @@ find_script(char *scriptname, bool dosearch, char **search_ext, I32 flags) 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); }