diff options
author | ache <ache@FreeBSD.org> | 1995-01-17 23:04:29 +0000 |
---|---|---|
committer | ache <ache@FreeBSD.org> | 1995-01-17 23:04:29 +0000 |
commit | 5887fd95f0ffa01086439978a56a7eb58559e155 (patch) | |
tree | fb4b35f3a016b981a646dda3ab14d18163ee3958 /bin/dd/dd.c | |
parent | eb022aca1e2e3c2aa6fe4143574d0e59c8b47073 (diff) | |
download | FreeBSD-src-5887fd95f0ffa01086439978a56a7eb58559e155.zip FreeBSD-src-5887fd95f0ffa01086439978a56a7eb58559e155.tar.gz |
More koshering [ul]case fix, don't use pre-initialized tables at all,
treat 0xFF as valid character.
Diffstat (limited to 'bin/dd/dd.c')
-rw-r--r-- | bin/dd/dd.c | 18 |
1 files changed, 11 insertions, 7 deletions
diff --git a/bin/dd/dd.c b/bin/dd/dd.c index dc55aed..d342870 100644 --- a/bin/dd/dd.c +++ b/bin/dd/dd.c @@ -34,7 +34,7 @@ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * SUCH DAMAGE. * - * $Id: dd.c,v 1.2 1994/09/24 02:54:52 davidg Exp $ + * $Id: dd.c,v 1.3 1995/01/17 22:55:59 ache Exp $ */ #ifndef lint @@ -177,34 +177,38 @@ setup() if (ddflags & (C_LCASE|C_UCASE)) if (ddflags & C_ASCII) if (ddflags & C_LCASE) { - for (cnt = 0; cnt < 0377; ++cnt) + for (cnt = 0; cnt <= 0377; ++cnt) if (isupper(ctab[cnt])) ctab[cnt] = tolower(ctab[cnt]); } else { - for (cnt = 0; cnt < 0377; ++cnt) + for (cnt = 0; cnt <= 0377; ++cnt) if (islower(ctab[cnt])) ctab[cnt] = toupper(ctab[cnt]); } else if (ddflags & C_EBCDIC) if (ddflags & C_LCASE) { - for (cnt = 0; cnt < 0377; ++cnt) + for (cnt = 0; cnt <= 0377; ++cnt) if (isupper(cnt)) ctab[cnt] = ctab[tolower(cnt)]; } else { - for (cnt = 0; cnt < 0377; ++cnt) + for (cnt = 0; cnt <= 0377; ++cnt) if (islower(cnt)) ctab[cnt] = ctab[toupper(cnt)]; } else { ctab = ddflags & C_LCASE ? u2l : l2u; if (ddflags & C_LCASE) { - for (cnt = 0; cnt < 0377; ++cnt) + for (cnt = 0; cnt <= 0377; ++cnt) if (isupper(cnt)) ctab[cnt] = tolower(cnt); + else + ctab[cnt] = cnt; } else { - for (cnt = 0; cnt < 0377; ++cnt) + for (cnt = 0; cnt <= 0377; ++cnt) if (islower(cnt)) ctab[cnt] = toupper(cnt); + else + ctab[cnt] = cnt; } } (void)time(&st.start); /* Statistics timestamp. */ |