summaryrefslogtreecommitdiff
path: root/util.c
diff options
context:
space:
mode:
authorJarkko Hietaniemi <jhi@iki.fi>2001-02-13 02:22:36 +0000
committerJarkko Hietaniemi <jhi@iki.fi>2001-02-13 02:22:36 +0000
commita926ef6bf408292b4a3963e296e2683a36825a5e (patch)
tree8df4df0b82f79849f41ac091d67892c1bc4d50a9 /util.c
parentf49d4d0f1aad3e3c7e34453d2bac9954bf237486 (diff)
downloadperl-a926ef6bf408292b4a3963e296e2683a36825a5e.tar.gz
Merge ebcdic.c (only one function, ebcdic_control()) into util.c.
p4raw-id: //depot/perl@8783
Diffstat (limited to 'util.c')
-rw-r--r--util.c37
1 files changed, 37 insertions, 0 deletions
diff --git a/util.c b/util.c
index 1fb9ef2f38..d603e82c8b 100644
--- a/util.c
+++ b/util.c
@@ -3997,3 +3997,40 @@ Perl_report_evil_fh(pTHX_ GV *gv, IO *io, I32 op)
func, pars);
}
}
+
+#ifdef EBCDIC
+int
+Perl_ebcdic_control(pTHX_ int ch)
+{
+ if (ch > 'a') {
+ char *ctlp;
+
+ if (islower(ch))
+ ch = toupper(ch);
+
+ if ((ctlp = strchr(controllablechars, ch)) == 0) {
+ Perl_die(aTHX_ "unrecognised control character '%c'\n", ch);
+ }
+
+ if (ctlp == controllablechars)
+ return('\177'); /* DEL */
+ else
+ return((unsigned char)(ctlp - controllablechars - 1));
+ } else { /* Want uncontrol */
+ if (ch == '\177' || ch == -1)
+ return('?');
+ else if (ch == '\157')
+ return('\177');
+ else if (ch == '\174')
+ return('\000');
+ else if (ch == '^') /* '\137' in 1047, '\260' in 819 */
+ return('\036');
+ else if (ch == '\155')
+ return('\037');
+ else if (0 < ch && ch < (sizeof(controllablechars) - 1))
+ return(controllablechars[ch+1]);
+ else
+ Perl_die(aTHX_ "invalid control request: '\\%03o'\n", ch & 0xFF);
+ }
+}
+#endif