version 1.5, 2003/04/13 18:26:25 |
version 1.6, 2003/04/17 20:00:56 |
|
|
|
|
public int utf_mode = 0; |
public int utf_mode = 0; |
|
|
|
#if !SMALL |
/* |
/* |
* Predefined character sets, |
* Predefined character sets, |
* selected by the LESSCHARSET environment variable. |
* selected by the LESSCHARSET environment variable. |
|
|
snprintf(buf, sizeof(buf), binfmt, c); |
snprintf(buf, sizeof(buf), binfmt, c); |
return (buf); |
return (buf); |
} |
} |
|
|
|
#else /* SMALL */ |
|
|
|
public int binattr = AT_STANDOUT; |
|
|
|
public void |
|
init_charset() |
|
{ |
|
return; |
|
} |
|
|
|
/* |
|
* Is a given character a "binary" character? |
|
*/ |
|
public int |
|
binary_char(c) |
|
unsigned char c; |
|
{ |
|
return (!isprint(c)); |
|
} |
|
|
|
/* |
|
* Is a given character a "control" character? |
|
*/ |
|
public int |
|
control_char(c) |
|
int c; |
|
{ |
|
return (iscntrl(c)); |
|
} |
|
|
|
/* |
|
* Return the printable form of a character. |
|
* For example, in the "ascii" charset '\3' is printed as "^C". |
|
*/ |
|
public char * |
|
prchar(c) |
|
int c; |
|
{ |
|
static char buf[8]; |
|
|
|
c &= 0377; |
|
if (!iscntrl(c)) |
|
snprintf(buf, sizeof(buf), "%c", c); |
|
else if (c == ESC) |
|
snprintf(buf, sizeof(buf), "ESC"); |
|
else if (c < 128 && !iscntrl(c ^ 0100)) |
|
snprintf(buf, sizeof(buf), "^%c", c ^ 0100); |
|
else |
|
snprintf(buf, sizeof(buf), "*s<%X>", c); |
|
return (buf); |
|
} |
|
#endif /* SMALL */ |