summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--share/man/man7/roff.732
-rw-r--r--usr.bin/mandoc/main.c3
-rw-r--r--usr.bin/mandoc/man.c4
-rw-r--r--usr.bin/mandoc/man.h3
-rw-r--r--usr.bin/mandoc/man_action.c3
-rw-r--r--usr.bin/mandoc/man_html.c47
-rw-r--r--usr.bin/mandoc/man_macro.c3
-rw-r--r--usr.bin/mandoc/man_term.c47
-rw-r--r--usr.bin/mandoc/man_validate.c59
-rw-r--r--usr.bin/mandoc/mandoc.h3
10 files changed, 192 insertions, 12 deletions
diff --git a/share/man/man7/roff.7 b/share/man/man7/roff.7
index 7bbaefefd4f..2f9bf259ce3 100644
--- a/share/man/man7/roff.7
+++ b/share/man/man7/roff.7
@@ -1,4 +1,4 @@
-.\" $Id: roff.7,v 1.2 2010/11/28 01:00:41 schwarze Exp $
+.\" $Id: roff.7,v 1.3 2010/11/29 00:12:02 schwarze Exp $
.\"
.\" Copyright (c) 2010 Kristaps Dzonsons <kristaps@bsd.lv>
.\" Copyright (c) 2010 Ingo Schwarze <schwarze@openbsd.org>
@@ -15,7 +15,7 @@
.\" ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
.\" OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
.\"
-.Dd $Mdocdate: November 28 2010 $
+.Dd $Mdocdate: November 29 2010 $
.Dt ROFF 7
.Os
.Sh NAME
@@ -289,6 +289,34 @@ then false is assumed.
The syntax of this macro is similar to
.Sx \&if
except that the conditional is missing.
+.Ss \&ft
+Change the font.
+Its syntax is as follows:
+.Pp
+.D1 Pf . Cm \&ft Op Ar font
+.Pp
+The following
+.Ar font
+arguments are supported:
+.Bl -tag -width 4n -offset indent
+.It Cm B , BI , 3 , 4
+switches to
+.Sy bold
+font
+.It Cm I , 2
+switches to
+.Em underlined
+font
+.It Cm R , CW , 1
+switches to normal font
+.It Cm P No "or no argument"
+switches back to the previous font
+.El
+.Pp
+This request takes effect only locally, may be overridden by macros
+and escape sequences, and is only supported in
+.Xr man 7
+for now.
.Ss \&hy
Set automatic hyphenation mode.
This line-scoped request is currently ignored.
diff --git a/usr.bin/mandoc/main.c b/usr.bin/mandoc/main.c
index 499d5a9425c..f30f9f7dfc7 100644
--- a/usr.bin/mandoc/main.c
+++ b/usr.bin/mandoc/main.c
@@ -1,4 +1,4 @@
-/* $Id: main.c,v 1.56 2010/11/28 19:35:33 schwarze Exp $ */
+/* $Id: main.c,v 1.57 2010/11/29 00:12:02 schwarze Exp $ */
/*
* Copyright (c) 2008, 2009, 2010 Kristaps Dzonsons <kristaps@bsd.lv>
* Copyright (c) 2010 Ingo Schwarze <schwarze@openbsd.org>
@@ -146,6 +146,7 @@ static const char * const mandocerrs[MANDOCERR_MAX] = {
"duplicate list type",
"unknown AT&T UNIX version",
"bad Boolean value",
+ "unknown font",
"unknown library specifier",
"unknown standard specifier",
"bad width argument",
diff --git a/usr.bin/mandoc/man.c b/usr.bin/mandoc/man.c
index b032524de7b..20b5bd8266d 100644
--- a/usr.bin/mandoc/man.c
+++ b/usr.bin/mandoc/man.c
@@ -1,4 +1,4 @@
-/* $Id: man.c,v 1.44 2010/11/28 19:35:33 schwarze Exp $ */
+/* $Id: man.c,v 1.45 2010/11/29 00:12:02 schwarze Exp $ */
/*
* Copyright (c) 2008, 2009, 2010 Kristaps Dzonsons <kristaps@bsd.lv>
*
@@ -40,7 +40,7 @@ const char *const __man_macronames[MAN_MAX] = {
"nf", "fi", "r", "RE",
"RS", "DT", "UC", "PD",
"Sp", "Vb", "Ve", "AT",
- "in", "TS", "TE"
+ "in", "TS", "TE", "ft",
};
const char * const *man_macronames = __man_macronames;
diff --git a/usr.bin/mandoc/man.h b/usr.bin/mandoc/man.h
index 9bf9556f8c4..2f4bd8eb941 100644
--- a/usr.bin/mandoc/man.h
+++ b/usr.bin/mandoc/man.h
@@ -1,4 +1,4 @@
-/* $Id: man.h,v 1.28 2010/10/23 15:49:30 schwarze Exp $ */
+/* $Id: man.h,v 1.29 2010/11/29 00:12:02 schwarze Exp $ */
/*
* Copyright (c) 2009, 2010 Kristaps Dzonsons <kristaps@bsd.lv>
*
@@ -60,6 +60,7 @@ enum mant {
MAN_in,
MAN_TS,
MAN_TE,
+ MAN_ft,
MAN_MAX
};
diff --git a/usr.bin/mandoc/man_action.c b/usr.bin/mandoc/man_action.c
index a4a488ec05c..c8a23b79ceb 100644
--- a/usr.bin/mandoc/man_action.c
+++ b/usr.bin/mandoc/man_action.c
@@ -1,4 +1,4 @@
-/* $Id: man_action.c,v 1.26 2010/10/15 21:33:47 schwarze Exp $ */
+/* $Id: man_action.c,v 1.27 2010/11/29 00:12:02 schwarze Exp $ */
/*
* Copyright (c) 2008, 2009, 2010 Kristaps Dzonsons <kristaps@bsd.lv>
*
@@ -78,6 +78,7 @@ const struct actions man_actions[MAN_MAX] = {
{ NULL }, /* in */
{ post_TS }, /* TS */
{ NULL }, /* TE */
+ { NULL }, /* ft */
};
diff --git a/usr.bin/mandoc/man_html.c b/usr.bin/mandoc/man_html.c
index c2852273b81..22d544b6231 100644
--- a/usr.bin/mandoc/man_html.c
+++ b/usr.bin/mandoc/man_html.c
@@ -1,6 +1,7 @@
-/* $Id: man_html.c,v 1.19 2010/10/15 20:45:03 schwarze Exp $ */
+/* $Id: man_html.c,v 1.20 2010/11/29 00:12:02 schwarze Exp $ */
/*
* Copyright (c) 2008, 2009, 2010 Kristaps Dzonsons <kristaps@bsd.lv>
+ * Copyright (c) 2010 Ingo Schwarze <schwarze@openbsd.org>
*
* Permission to use, copy, modify, and distribute this software for any
* purpose with or without fee is hereby granted, provided that the above
@@ -60,6 +61,7 @@ static int a2width(const struct man_node *,
static int man_alt_pre(MAN_ARGS);
static int man_br_pre(MAN_ARGS);
static int man_ign_pre(MAN_ARGS);
+static int man_ft_pre(MAN_ARGS);
static int man_in_pre(MAN_ARGS);
static int man_literal_pre(MAN_ARGS);
static void man_root_post(MAN_ARGS);
@@ -115,6 +117,7 @@ static const struct htmlman mans[MAN_MAX] = {
{ man_in_pre, NULL }, /* in */
{ NULL, NULL }, /* TS */
{ NULL, NULL }, /* TE */
+ { man_ft_pre, NULL }, /* ft */
};
@@ -731,6 +734,48 @@ man_I_pre(MAN_ARGS)
/* ARGSUSED */
static int
+man_ft_pre(MAN_ARGS)
+{
+ const char *cp;
+
+ if (NULL == n->child) {
+ print_ofont(h, h->metal);
+ return(0);
+ }
+
+ cp = n->child->string;
+ switch (*cp) {
+ case ('4'):
+ /* FALLTHROUGH */
+ case ('3'):
+ /* FALLTHROUGH */
+ case ('B'):
+ print_ofont(h, HTMLFONT_BOLD);
+ break;
+ case ('2'):
+ /* FALLTHROUGH */
+ case ('I'):
+ print_ofont(h, HTMLFONT_ITALIC);
+ break;
+ case ('P'):
+ print_ofont(h, h->metal);
+ break;
+ case ('1'):
+ /* FALLTHROUGH */
+ case ('C'):
+ /* FALLTHROUGH */
+ case ('R'):
+ print_ofont(h, HTMLFONT_NONE);
+ break;
+ default:
+ break;
+ }
+ return(0);
+}
+
+
+/* ARGSUSED */
+static int
man_literal_pre(MAN_ARGS)
{
diff --git a/usr.bin/mandoc/man_macro.c b/usr.bin/mandoc/man_macro.c
index 70c0123cfed..e1a1c752ee2 100644
--- a/usr.bin/mandoc/man_macro.c
+++ b/usr.bin/mandoc/man_macro.c
@@ -1,4 +1,4 @@
-/* $Id: man_macro.c,v 1.21 2010/10/15 20:45:03 schwarze Exp $ */
+/* $Id: man_macro.c,v 1.22 2010/11/29 00:12:02 schwarze Exp $ */
/*
* Copyright (c) 2008, 2009, 2010 Kristaps Dzonsons <kristaps@bsd.lv>
*
@@ -82,6 +82,7 @@ const struct man_macro __man_macros[MAN_MAX] = {
{ in_line_eoln, 0 }, /* in */
{ blk_exp, MAN_EXPLICIT }, /* TS */
{ blk_close, 0 }, /* TE */
+ { in_line_eoln, 0 }, /* ft */
};
const struct man_macro * const man_macros = __man_macros;
diff --git a/usr.bin/mandoc/man_term.c b/usr.bin/mandoc/man_term.c
index 2bc05baadd3..4490c78a042 100644
--- a/usr.bin/mandoc/man_term.c
+++ b/usr.bin/mandoc/man_term.c
@@ -1,6 +1,7 @@
-/* $Id: man_term.c,v 1.51 2010/10/28 10:42:39 schwarze Exp $ */
+/* $Id: man_term.c,v 1.52 2010/11/29 00:12:02 schwarze Exp $ */
/*
* Copyright (c) 2008, 2009, 2010 Kristaps Dzonsons <kristaps@bsd.lv>
+ * Copyright (c) 2010 Ingo Schwarze <schwarze@openbsd.org>
*
* Permission to use, copy, modify, and distribute this software for any
* purpose with or without fee is hereby granted, provided that the above
@@ -92,6 +93,7 @@ static int pre_in(DECL_ARGS);
static int pre_literal(DECL_ARGS);
static int pre_sp(DECL_ARGS);
static int pre_TS(DECL_ARGS);
+static int pre_ft(DECL_ARGS);
static void post_IP(DECL_ARGS);
static void post_HP(DECL_ARGS);
@@ -140,6 +142,7 @@ static const struct termact termacts[MAN_MAX] = {
{ pre_in, NULL, MAN_NOTEXT }, /* in */
{ pre_TS, NULL, 0 }, /* TS */
{ NULL, NULL, 0 }, /* TE */
+ { pre_ft, NULL, MAN_NOTEXT }, /* ft */
};
@@ -331,6 +334,48 @@ pre_B(DECL_ARGS)
/* ARGSUSED */
static int
+pre_ft(DECL_ARGS)
+{
+ const char *cp;
+
+ if (NULL == n->child) {
+ term_fontlast(p);
+ return(0);
+ }
+
+ cp = n->child->string;
+ switch (*cp) {
+ case ('4'):
+ /* FALLTHROUGH */
+ case ('3'):
+ /* FALLTHROUGH */
+ case ('B'):
+ term_fontrepl(p, TERMFONT_BOLD);
+ break;
+ case ('2'):
+ /* FALLTHROUGH */
+ case ('I'):
+ term_fontrepl(p, TERMFONT_UNDER);
+ break;
+ case ('P'):
+ term_fontlast(p);
+ break;
+ case ('1'):
+ /* FALLTHROUGH */
+ case ('C'):
+ /* FALLTHROUGH */
+ case ('R'):
+ term_fontrepl(p, TERMFONT_NONE);
+ break;
+ default:
+ break;
+ }
+ return(0);
+}
+
+
+/* ARGSUSED */
+static int
pre_in(DECL_ARGS)
{
int len, less;
diff --git a/usr.bin/mandoc/man_validate.c b/usr.bin/mandoc/man_validate.c
index c59d9e0bdff..f3967085186 100644
--- a/usr.bin/mandoc/man_validate.c
+++ b/usr.bin/mandoc/man_validate.c
@@ -1,6 +1,7 @@
-/* $Id: man_validate.c,v 1.31 2010/10/27 10:17:45 schwarze Exp $ */
+/* $Id: man_validate.c,v 1.32 2010/11/29 00:12:02 schwarze Exp $ */
/*
* Copyright (c) 2008, 2009, 2010 Kristaps Dzonsons <kristaps@bsd.lv>
+ * Copyright (c) 2010 Ingo Schwarze <schwarze@openbsd.org>
*
* Permission to use, copy, modify, and distribute this software for any
* purpose with or without fee is hereby granted, provided that the above
@@ -42,6 +43,7 @@ static int check_eq0(CHKARGS);
static int check_le1(CHKARGS);
static int check_ge2(CHKARGS);
static int check_le5(CHKARGS);
+static int check_ft(CHKARGS);
static int check_par(CHKARGS);
static int check_part(CHKARGS);
static int check_root(CHKARGS);
@@ -50,6 +52,7 @@ static int check_text(CHKARGS);
static int check_title(CHKARGS);
static v_check posts_eq0[] = { check_eq0, NULL };
+static v_check posts_ft[] = { check_ft, NULL };
static v_check posts_th[] = { check_ge2, check_le5, check_title, NULL };
static v_check posts_par[] = { check_par, NULL };
static v_check posts_part[] = { check_part, NULL };
@@ -97,6 +100,7 @@ static const struct man_valid man_valids[MAN_MAX] = {
{ NULL, NULL }, /* in */
{ NULL, NULL }, /* TS */
{ NULL, NULL }, /* TE */
+ { NULL, posts_ft }, /* ft */
};
@@ -258,6 +262,59 @@ INEQ_DEFINE(5, <=, le5)
static int
+check_ft(CHKARGS)
+{
+ char *cp;
+ int ok;
+
+ if (0 == n->nchild)
+ return(1);
+
+ ok = 0;
+ cp = n->child->string;
+ switch (*cp) {
+ case ('1'):
+ /* FALLTHROUGH */
+ case ('2'):
+ /* FALLTHROUGH */
+ case ('3'):
+ /* FALLTHROUGH */
+ case ('4'):
+ /* FALLTHROUGH */
+ case ('I'):
+ /* FALLTHROUGH */
+ case ('P'):
+ /* FALLTHROUGH */
+ case ('R'):
+ if ('\0' == cp[1])
+ ok = 1;
+ break;
+ case ('B'):
+ if ('\0' == cp[1] || ('I' == cp[1] && '\0' == cp[2]))
+ ok = 1;
+ break;
+ case ('C'):
+ if ('W' == cp[1] && '\0' == cp[2])
+ ok = 1;
+ break;
+ default:
+ break;
+ }
+
+ if (0 == ok) {
+ man_vmsg(m, MANDOCERR_BADFONT, n->line, n->pos, "%s", cp);
+ *cp = '\0';
+ }
+
+ if (1 < n->nchild)
+ man_vmsg(m, MANDOCERR_ARGCOUNT, n->line, n->pos,
+ "want one child (have %d)", n->nchild);
+
+ return(1);
+}
+
+
+static int
check_sec(CHKARGS)
{
diff --git a/usr.bin/mandoc/mandoc.h b/usr.bin/mandoc/mandoc.h
index 46d683489db..446341aebf0 100644
--- a/usr.bin/mandoc/mandoc.h
+++ b/usr.bin/mandoc/mandoc.h
@@ -1,4 +1,4 @@
-/* $Id: mandoc.h,v 1.21 2010/11/28 19:35:33 schwarze Exp $ */
+/* $Id: mandoc.h,v 1.22 2010/11/29 00:12:02 schwarze Exp $ */
/*
* Copyright (c) 2010 Kristaps Dzonsons <kristaps@bsd.lv>
*
@@ -87,6 +87,7 @@ enum mandocerr {
MANDOCERR_LISTREP, /* duplicate list type */
MANDOCERR_BADATT, /* unknown AT&T UNIX version */
MANDOCERR_BADBOOL, /* bad Boolean value */
+ MANDOCERR_BADFONT, /* unknown font */
MANDOCERR_BADLIB, /* unknown library specifier */
MANDOCERR_BADSTANDARD, /* unknown standard specifier */
MANDOCERR_BADWIDTH, /* bad width argument */