summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--mdocterm.16
-rw-r--r--mdocterm.c61
-rw-r--r--term.h14
3 files changed, 8 insertions, 73 deletions
diff --git a/mdocterm.1 b/mdocterm.1
index 914f4447..b2637314 100644
--- a/mdocterm.1
+++ b/mdocterm.1
@@ -60,7 +60,7 @@ Override default compiler behaviour. See
for details.
.\" ITEM
.It Fl O Ns Ar option...
-Terminal-encoding options. See
+Front-end options. See
.Sx Front-end Options
for details.
.\" ITEM
@@ -139,8 +139,6 @@ Don't punt to
if
.Ar infile
may not be parsed.
-.It Fl O Ns Ar ansi
-Use ANSI/VT100 output encoding instead of backspaces.
.El
.\" SUB-SECTION
.Ss Compiler Options
@@ -296,7 +294,7 @@ Special symbols:
the more general syntax.
.\" SECTION
.Sh EXAMPLES
-To display this manual page on ANSI-capable terminal:
+To display this manual page:
.\" PARAGRAPH
.Pp
.D1 % mdocterm \-Wall,error mdocterm.1
diff --git a/mdocterm.c b/mdocterm.c
index 645af35a..30e85da5 100644
--- a/mdocterm.c
+++ b/mdocterm.c
@@ -203,7 +203,6 @@ main(int argc, char *argv[])
termp.offset = termp.col = 0;
termp.flags = TERMP_NOSPACE;
termp.symtab = termsym_ascii;
- termp.enc = TERMENC_NROFF;
nroff.termp = &termp;
@@ -247,14 +246,11 @@ static int
optsopt(struct termp *p, char *arg)
{
char *v;
- char *toks[] = { "ansi", "nopunt", NULL };
+ char *toks[] = { "nopunt", NULL };
while (*arg)
switch (getsubopt(&arg, toks, &v)) {
case (0):
- p->enc = TERMENC_ANSI;
- break;
- case (1):
p->iflags |= TERMP_NOPUNT;
break;
default:
@@ -378,17 +374,11 @@ flushln(struct termp *p)
/* LINTED */
for (j = i, vsz = 0; j < p->col; j++) {
- if (isspace((u_char)p->buf[j])) {
+ if (isspace((u_char)p->buf[j]))
break;
- } else if (27 == p->buf[j]) {
- assert(TERMENC_ANSI == p->enc);
- assert(j + 5 <= p->col);
- j += 4;
- } else if (8 == p->buf[j]) {
- assert(TERMENC_NROFF == p->enc);
- assert(j + 2 <= p->col);
+ else if (8 == p->buf[j])
j += 1;
- } else
+ else
vsz++;
}
@@ -858,49 +848,13 @@ pword(struct termp *p, const char *word, size_t len)
* before the word.
*/
- if (TERMENC_ANSI == p->enc && TERMP_STYLE & p->flags) {
- if (TERMP_BOLD & p->flags) {
- chara(p, 27);
- stringa(p, "[01m", 4);
- }
- if (TERMP_UNDER & p->flags) {
- chara(p, 27);
- stringa(p, "[04m", 4);
- }
- if (TERMP_RED & p->flags) {
- chara(p, 27);
- stringa(p, "[31m", 4);
- }
- if (TERMP_GREEN & p->flags) {
- chara(p, 27);
- stringa(p, "[32m", 4);
- }
- if (TERMP_YELLOW & p->flags) {
- chara(p, 27);
- stringa(p, "[33m", 4);
- }
- if (TERMP_BLUE & p->flags) {
- chara(p, 27);
- stringa(p, "[34m", 4);
- }
- if (TERMP_MAGENTA & p->flags) {
- chara(p, 27);
- stringa(p, "[35m", 4);
- }
- if (TERMP_CYAN & p->flags) {
- chara(p, 27);
- stringa(p, "[36m", 4);
- }
- }
-
for (i = 0; i < len; i++) {
if ('\\' == word[i]) {
pescape(p, word, &i, len);
continue;
}
- if (TERMENC_NROFF == p->enc &&
- TERMP_STYLE & p->flags) {
+ if (TERMP_STYLE & p->flags) {
if (TERMP_BOLD & p->flags) {
chara(p, word[i]);
chara(p, 8);
@@ -913,11 +867,6 @@ pword(struct termp *p, const char *word, size_t len)
chara(p, word[i]);
}
-
- if (TERMENC_ANSI == p->enc && TERMP_STYLE & p->flags) {
- chara(p, 27);
- stringa(p, "[00m", 4);
- }
}
diff --git a/term.h b/term.h
index a5ee7675..6fe37bc4 100644
--- a/term.h
+++ b/term.h
@@ -70,11 +70,6 @@ enum tsym {
TERMSYM_MAX = 41
};
-enum termenc {
- TERMENC_ANSI,
- TERMENC_NROFF
-};
-
struct termsym {
const char *sym;
size_t sz;
@@ -96,18 +91,11 @@ struct termp {
#define TERMP_IGNDELIM (1 << 4) /* Delims like regulars. */
#define TERMP_NONOSPACE (1 << 5) /* No space (no autounset). */
#define TERMP_NONOBREAK (1 << 7) /* Don't newln NOBREAK. */
-#define TERMP_STYLE 0xff00 /* Style mask. */
+#define TERMP_STYLE 0x0300 /* Style mask. */
#define TERMP_BOLD (1 << 8) /* Styles... */
#define TERMP_UNDER (1 << 9)
-#define TERMP_BLUE (1 << 10)
-#define TERMP_RED (1 << 11)
-#define TERMP_YELLOW (1 << 12)
-#define TERMP_MAGENTA (1 << 13)
-#define TERMP_CYAN (1 << 14)
-#define TERMP_GREEN (1 << 15)
char *buf;
struct termsym *symtab; /* Special-symbol table. */
- enum termenc enc; /* Encoding. */
};
struct termpair {