From: Stephen Potter Date: Wed, 18 Mar 1998 10:06:55 +0000 (-0600) Subject: Re: doc: perlrun typo X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=commitdiff_plain;h=c6ed36e16dcdd4c25349e4f9d5c84061095ccffb;p=p5sagit%2Fp5-mst-13.2.git Re: doc: perlrun typo Date: Wed, 18 Mar 1998 10:06:55 -0600 Subject: Re: [PATCH 5.004_63] PerlLIO abstraction cleanup Date: Tue, 24 Mar 1998 21:20:51 -0600 p4raw-id: //depot/perl@842 --- diff --git a/mg.c b/mg.c index 71cfa36..4a8b88c 100644 --- a/mg.c +++ b/mg.c @@ -684,7 +684,7 @@ magic_setenv(SV *sv, MAGIC *mg) s++; if (i >= sizeof tmpbuf /* too long -- assume the worst */ || *tmpbuf != '/' - || (Stat(tmpbuf, &st) == 0 && (st.st_mode & 2)) ) { + || (PerlLIO_stat(tmpbuf, &st) == 0 && (st.st_mode & 2)) ) { MgTAINTEDDIR_on(mg); return 0; } diff --git a/perl.c b/perl.c index 326ad0d..f8217ff 100644 --- a/perl.c +++ b/perl.c @@ -1861,7 +1861,7 @@ open_script(char *scriptname, bool dosearch, SV *sv) #endif DEBUG_p(PerlIO_printf(Perl_debug_log, "Looking for %s\n",cur)); - if (Stat(cur,&statbuf) >= 0) { + if (PerlLIO_stat(cur,&statbuf) >= 0) { dosearch = 0; scriptname = cur; #ifdef SEARCH_EXTS @@ -1929,7 +1929,7 @@ open_script(char *scriptname, bool dosearch, SV *sv) do { #endif DEBUG_p(PerlIO_printf(Perl_debug_log, "Looking for %s\n",tokenbuf)); - retval = Stat(tokenbuf,&statbuf); + retval = PerlLIO_stat(tokenbuf,&statbuf); #ifdef SEARCH_EXTS } while ( retval < 0 /* not there */ && extidx>=0 && ext[extidx] /* try an extension? */ @@ -1952,7 +1952,7 @@ open_script(char *scriptname, bool dosearch, SV *sv) xfailed = savepv(tokenbuf); } #ifndef DOSISH - if (!xfound && !seen_dot && !xfailed && (Stat(scriptname,&statbuf) < 0)) + if (!xfound && !seen_dot && !xfailed && (PerlLIO_stat(scriptname,&statbuf) < 0)) #endif seen_dot = 1; /* Disable message. */ if (!xfound) @@ -2077,7 +2077,7 @@ sed %s -e \"/^[^#]/b\" \ if (!rsfp) { #ifdef DOSUID #ifndef IAMSUID /* in case script is not readable before setuid */ - if (euid && Stat(SvPVX(GvSV(curcop->cop_filegv)),&statbuf) >= 0 && + if (euid && PerlLIO_stat(SvPVX(GvSV(curcop->cop_filegv)),&statbuf) >= 0 && statbuf.st_mode & (S_ISUID|S_ISGID)) { /* try again */ PerlProc_execv(form("%s/sperl%s", BIN_EXP, patchlevel), origargv); @@ -2155,7 +2155,7 @@ validate_suid(char *validarg, char *scriptname) #endif || getuid() != euid || geteuid() != uid) croak("Can't swap uid and euid"); /* really paranoid */ - if (Stat(SvPVX(GvSV(curcop->cop_filegv)),&tmpstatbuf) < 0) + if (PerlLIO_stat(SvPVX(GvSV(curcop->cop_filegv)),&tmpstatbuf) < 0) croak("Permission denied"); /* testing full pathname here */ if (tmpstatbuf.st_dev != statbuf.st_dev || tmpstatbuf.st_ino != statbuf.st_ino) { @@ -2749,7 +2749,7 @@ incpush(char *p, int addsubdirs) /* .../archname/version if -d .../archname/version/auto */ sv_setsv(subdir, libdir); sv_catpv(subdir, archpat_auto); - if (Stat(SvPVX(subdir), &tmpstatbuf) >= 0 && + if (PerlLIO_stat(SvPVX(subdir), &tmpstatbuf) >= 0 && S_ISDIR(tmpstatbuf.st_mode)) av_push(GvAVn(incgv), newSVpv(SvPVX(subdir), SvCUR(subdir) - sizeof "auto")); @@ -2757,7 +2757,7 @@ incpush(char *p, int addsubdirs) /* .../archname if -d .../archname/auto */ sv_insert(subdir, SvCUR(libdir) + sizeof(ARCHNAME), strlen(patchlevel) + 1, "", 0); - if (Stat(SvPVX(subdir), &tmpstatbuf) >= 0 && + if (PerlLIO_stat(SvPVX(subdir), &tmpstatbuf) >= 0 && S_ISDIR(tmpstatbuf.st_mode)) av_push(GvAVn(incgv), newSVpv(SvPVX(subdir), SvCUR(subdir) - sizeof "auto")); diff --git a/pod/perlrun.pod b/pod/perlrun.pod index 01ad167..534146a 100644 --- a/pod/perlrun.pod +++ b/pod/perlrun.pod @@ -72,7 +72,7 @@ The sequences "-*" and "- " are specifically ignored so that you could, if you were so inclined, say #!/bin/sh -- # -*- perl -*- -p - eval 'exec /usr/bin/perl $0 -S ${1+"$@"}' + eval 'exec /usr/bin/perl -S $0 ${1+"$@"}' if $running_under_some_shell; to let Perl see the B<-p> switch. diff --git a/pp_hot.c b/pp_hot.c index fe1e41e..1d8ef68 100644 --- a/pp_hot.c +++ b/pp_hot.c @@ -1078,7 +1078,7 @@ do_readline(void) } if ((tmpfp = PerlIO_open(tmpfnam,"w+","fop=dlt")) != NULL) { Stat_t st; - if (!Stat(SvPVX(tmpglob),&st) && S_ISDIR(st.st_mode)) + if (!PerlLIO_stat(SvPVX(tmpglob),&st) && S_ISDIR(st.st_mode)) ok = ((wilddsc.dsc$a_pointer = tovmspath(SvPVX(tmpglob),vmsspec)) != NULL); else ok = ((wilddsc.dsc$a_pointer = tovmsspec(SvPVX(tmpglob),vmsspec)) != NULL); if (ok) wilddsc.dsc$w_length = (unsigned short int) strlen(wilddsc.dsc$a_pointer); @@ -1227,7 +1227,7 @@ do_readline(void) if (!isALPHA(*tmps) && !isDIGIT(*tmps) && strchr("$&*(){}[]'\";\\|?<>~`", *tmps)) break; - if (*tmps && Stat(SvPVX(sv), &statbuf) < 0) { + if (*tmps && PerlLIO_stat(SvPVX(sv), &statbuf) < 0) { (void)POPs; /* Unmatched wildcard? Chuck it... */ continue; } diff --git a/pp_sys.c b/pp_sys.c index bf8785e..c2fcb6f 100644 --- a/pp_sys.c +++ b/pp_sys.c @@ -2093,7 +2093,7 @@ PP(pp_stat) laststatval = PerlLIO_lstat(SvPV(statname, na), &statcache); else #endif - laststatval = Stat(SvPV(statname, na), &statcache); + laststatval = PerlLIO_stat(SvPV(statname, na), &statcache); if (laststatval < 0) { if (dowarn && strchr(SvPV(statname, na), '\n')) warn(warn_nl, "stat"); @@ -2664,11 +2664,11 @@ PP(pp_rename) #ifdef HAS_RENAME anum = rename(tmps, tmps2); #else - if (!(anum = Stat(tmps, &statbuf))) { + if (!(anum = PerlLIO_stat(tmps, &statbuf))) { if (same_dirent(tmps2, tmps)) /* can always rename to same name */ anum = 1; else { - if (euid || Stat(tmps2, &statbuf) < 0 || !S_ISDIR(statbuf.st_mode)) + if (euid || PerlLIO_stat(tmps2, &statbuf) < 0 || !S_ISDIR(statbuf.st_mode)) (void)UNLINK(tmps2); if (!(anum = link(tmps, tmps2))) anum = UNLINK(tmps); @@ -2805,7 +2805,7 @@ char *filename; return 0; } else { /* some mkdirs return no failure indication */ - anum = (Stat(save_filename, &statbuf) >= 0); + anum = (PerlLIO_stat(save_filename, &statbuf) >= 0); if (op->op_type == OP_RMDIR) anum = !anum; if (anum) diff --git a/util.c b/util.c index e27f8c8..6e17ff8 100644 --- a/util.c +++ b/util.c @@ -2352,13 +2352,13 @@ char *b; sv_setpv(tmpsv, "."); else sv_setpvn(tmpsv, a, fa - a); - if (Stat(SvPVX(tmpsv), &tmpstatbuf1) < 0) + if (PerlLIO_stat(SvPVX(tmpsv), &tmpstatbuf1) < 0) return FALSE; if (fb == b) sv_setpv(tmpsv, "."); else sv_setpvn(tmpsv, b, fb - b); - if (Stat(SvPVX(tmpsv), &tmpstatbuf2) < 0) + if (PerlLIO_stat(SvPVX(tmpsv), &tmpstatbuf2) < 0) return FALSE; return tmpstatbuf1.st_dev == tmpstatbuf2.st_dev && tmpstatbuf1.st_ino == tmpstatbuf2.st_ino;