summaryrefslogtreecommitdiff
path: root/doio.c
diff options
context:
space:
mode:
authorAbhijit Menon-Sen <ams@wiw.org>2001-11-08 11:22:12 +0000
committerAbhijit Menon-Sen <ams@wiw.org>2001-11-08 11:22:12 +0000
commit919024ad6840f7a57835eb85480456352e1e17bb (patch)
treecb0d23ea3f33d71f0ad0e1517d2fd7124dedcc45 /doio.c
parent8a383d4685b0885b0e57e997d206f33bc9d2d595 (diff)
downloadperl-919024ad6840f7a57835eb85480456352e1e17bb.tar.gz
open(FH, $file) should strip leading and trailing whitespace.
p4raw-id: //depot/perl@12896
Diffstat (limited to 'doio.c')
-rw-r--r--doio.c12
1 files changed, 7 insertions, 5 deletions
diff --git a/doio.c b/doio.c
index 47a5af6989..98ff640dad 100644
--- a/doio.c
+++ b/doio.c
@@ -176,9 +176,13 @@ Perl_do_openn(pTHX_ GV *gv, register char *name, I32 len, int as_raw,
type = savepvn(name, len);
tend = type+len;
SAVEFREEPV(type);
- /* Loose trailing white space */
- while (tend > type && isSPACE(tend[-1]))
- *tend-- = '\0';
+
+ /* Lose leading and trailing white space */
+ /*SUPPRESS 530*/
+ for (; isSPACE(*type); type++) ;
+ while (tend > type && isSPACE(tend[-1]))
+ *--tend = '\0';
+
if (num_svs) {
/* New style explict name, type is just mode and discipline/layer info */
STRLEN l = 0;
@@ -186,8 +190,6 @@ Perl_do_openn(pTHX_ GV *gv, register char *name, I32 len, int as_raw,
len = (I32)l;
name = savepvn(name, len);
SAVEFREEPV(name);
- /*SUPPRESS 530*/
- for (; isSPACE(*type); type++) ;
}
else {
name = type;