diff options
author | Colin Kuskie <ckuskie@cadence.com> | 1998-07-07 02:44:33 -0700 |
---|---|---|
committer | Gurusamy Sarathy <gsar@cpan.org> | 1998-07-08 03:58:19 +0000 |
commit | 2d259d9294e79c03b1a69d3eaac3d6e5647468d7 (patch) | |
tree | 6d9fee2ffac45928e6e7211e6e579e238a84d8e1 /doio.c | |
parent | d426b052dee31c20224ef2893d5c969ad5a2c617 (diff) | |
download | perl-2d259d9294e79c03b1a69d3eaac3d6e5647468d7.tar.gz |
added patch for -i'foo*bar', made code somewhat simpler, tweaked doc
Message-ID: <Pine.GSO.3.96.980707093457.28681A-100000@pdxue150.cadence.com>
Subject: Corrected -i prefix patch
p4raw-id: //depot/perl@1368
Diffstat (limited to 'doio.c')
-rw-r--r-- | doio.c | 18 |
1 files changed, 13 insertions, 5 deletions
@@ -421,11 +421,19 @@ nextargv(register GV *gv) continue; } if (*inplace) { -#ifdef SUFFIX - add_suffix(sv,inplace); -#else - sv_catpv(sv,inplace); -#endif + char *star = strchr(inplace, '*'); + if (star) { + char *begin = inplace; + sv_setpvn(sv, "", 0); + do { + sv_catpvn(sv, begin, star - begin); + sv_catpvn(sv, oldname, oldlen); + begin = ++star; + } while ((star = strchr(begin, '*'))); + } + else { + sv_catpv(sv,inplace); + } #ifndef FLEXFILENAMES if (PerlLIO_stat(SvPVX(sv),&statbuf) >= 0 && statbuf.st_dev == filedev |