summaryrefslogtreecommitdiff
path: root/perl.c
diff options
context:
space:
mode:
authorNicholas Clark <nick@ccl4.org>2021-09-28 09:57:03 +0000
committerNicholas Clark <nick@ccl4.org>2021-09-28 10:04:59 +0000
commitf48aa24d4a3e93ace72b85f2af901c136ea3a77a (patch)
treee6e80cddd5326ff8f6589e138c6f256e4dc7b1a9 /perl.c
parentc4b4be2cfc289c0436bba84d524b6c81b8e3948d (diff)
downloadperl-f48aa24d4a3e93ace72b85f2af901c136ea3a77a.tar.gz
Replace "Grandfather" with a description of the relevant heuristic
In April 2003 commit f2095865e3489f4e: Noted by Nat: -0 didn't work that well with Unicode. added support for passing hexadecimal to the -0 option. As '-0' has an optional argument, the chosen syntax for hex was ambiguous with '-0' clustered with an '-x' option with an argument, so the heuristic described here was implemented.
Diffstat (limited to 'perl.c')
-rw-r--r--perl.c11
1 files changed, 10 insertions, 1 deletions
diff --git a/perl.c b/perl.c
index 8beb5d0622..637e6b4196 100644
--- a/perl.c
+++ b/perl.c
@@ -3447,7 +3447,16 @@ Perl_moreswitches(pTHX_ const char *s)
flags = PERL_SCAN_SILENT_ILLDIGIT;
rschar = (U32)grok_hex(s, &numlen, &flags, NULL);
if (s + numlen < e) {
- rschar = 0; /* Grandfather -0xFOO as -0 -xFOO. */
+ /* Continue to treat -0xFOO as -0 -xFOO
+ * (ie NUL as the input record separator, and -x with FOO
+ * as the directory argument)
+ *
+ * hex support for -0 was only added in 5.8.1, hence this
+ * heuristic to distinguish between it and '-0' clustered with
+ * '-x' with an argument. The text following '-0x' is only
+ * processed as the IRS specified in hexadecimal if all
+ * characters are valid hex digits. */
+ rschar = 0;
numlen = 0;
s--;
}