diff options
author | Jarkko Hietaniemi <jhi@iki.fi> | 2001-02-13 02:22:36 +0000 |
---|---|---|
committer | Jarkko Hietaniemi <jhi@iki.fi> | 2001-02-13 02:22:36 +0000 |
commit | a926ef6bf408292b4a3963e296e2683a36825a5e (patch) | |
tree | 8df4df0b82f79849f41ac091d67892c1bc4d50a9 /util.c | |
parent | f49d4d0f1aad3e3c7e34453d2bac9954bf237486 (diff) | |
download | perl-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.c | 37 |
1 files changed, 37 insertions, 0 deletions
@@ -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 |