Deleted Added
full compact
charset.c (191930) charset.c (195941)
1/*
1/*
2 * Copyright (C) 1984-2008 Mark Nudelman
2 * Copyright (C) 1984-2009 Mark Nudelman
3 *
4 * You may distribute under the terms of either the GNU General Public
5 * License or the Less License, as specified in the README file.
6 *
7 * For more information about less, or for information on how to
8 * contact the author, see the README file.
9 */
10

--- 409 unchanged lines hidden (view full) ---

420prchar(c)
421 LWCHAR c;
422{
423 /* {{ This buffer can be overrun if LESSBINFMT is a long string. }} */
424 static char buf[32];
425
426 c &= 0377;
427 if ((c < 128 || !utf_mode) && !control_char(c))
3 *
4 * You may distribute under the terms of either the GNU General Public
5 * License or the Less License, as specified in the README file.
6 *
7 * For more information about less, or for information on how to
8 * contact the author, see the README file.
9 */
10

--- 409 unchanged lines hidden (view full) ---

420prchar(c)
421 LWCHAR c;
422{
423 /* {{ This buffer can be overrun if LESSBINFMT is a long string. }} */
424 static char buf[32];
425
426 c &= 0377;
427 if ((c < 128 || !utf_mode) && !control_char(c))
428 SNPRINTF1(buf, sizeof(buf), "%c", c);
428 SNPRINTF1(buf, sizeof(buf), "%c", (int) c);
429 else if (c == ESC)
430 strcpy(buf, "ESC");
431#if IS_EBCDIC_HOST
432 else if (!binary_char(c) && c < 64)
433 SNPRINTF1(buf, sizeof(buf), "^%c",
434 /*
435 * This array roughly inverts CONTROL() #defined in less.h,
436 * and should be kept in sync with CONTROL() and IBM-1047.
437 */
438 "@ABC.I.?...KLMNO"
439 "PQRS.JH.XY.."
440 "\\]^_"
441 "......W[.....EFG"
442 "..V....D....TU.Z"[c]);
443#else
444 else if (c < 128 && !control_char(c ^ 0100))
429 else if (c == ESC)
430 strcpy(buf, "ESC");
431#if IS_EBCDIC_HOST
432 else if (!binary_char(c) && c < 64)
433 SNPRINTF1(buf, sizeof(buf), "^%c",
434 /*
435 * This array roughly inverts CONTROL() #defined in less.h,
436 * and should be kept in sync with CONTROL() and IBM-1047.
437 */
438 "@ABC.I.?...KLMNO"
439 "PQRS.JH.XY.."
440 "\\]^_"
441 "......W[.....EFG"
442 "..V....D....TU.Z"[c]);
443#else
444 else if (c < 128 && !control_char(c ^ 0100))
445 SNPRINTF1(buf, sizeof(buf), "^%c", c ^ 0100);
445 SNPRINTF1(buf, sizeof(buf), "^%c", (int) (c ^ 0100));
446#endif
447 else
448 SNPRINTF1(buf, sizeof(buf), binfmt, c);
449 return (buf);
450}
451
452/*
453 * Return the printable form of a UTF-8 character.

--- 720 unchanged lines hidden ---
446#endif
447 else
448 SNPRINTF1(buf, sizeof(buf), binfmt, c);
449 return (buf);
450}
451
452/*
453 * Return the printable form of a UTF-8 character.

--- 720 unchanged lines hidden ---