source@mandoc.bsd.lv
 help / color / mirror / Atom feed
* mdocml: mdoc(7) already uses the mandoc(1) -Ios argument in the footer
@ 2014-12-28 14:42 schwarze
  0 siblings, 0 replies; only message in thread
From: schwarze @ 2014-12-28 14:42 UTC (permalink / raw)
  To: source

Log Message:
-----------
mdoc(7) already uses the mandoc(1) -Ios argument in the footer line
when .Os has no argument, so do the same for man(7) when .TH has less
than four arguments; there is no reason to treat both differently.
Issue found following a question from Thomas Klausner <wiz at NetBSD>.

Modified Files:
--------------
    mdocml:
        libman.h
        libmandoc.h
        man.1
        man.c
        man_validate.c
        mandoc.1
        read.c

Revision Data
-------------
Index: libmandoc.h
===================================================================
RCS file: /home/cvs/mdocml/mdocml/libmandoc.h,v
retrieving revision 1.52
retrieving revision 1.53
diff -Llibmandoc.h -Llibmandoc.h -u -p -r1.52 -r1.53
--- libmandoc.h
+++ libmandoc.h
@@ -66,7 +66,8 @@ void		 mdoc_addspan(struct mdoc *, const
 void		 mdoc_addeqn(struct mdoc *, const struct eqn *);
 
 void		 man_free(struct man *);
-struct	man	*man_alloc(struct roff *, struct mparse *, int);
+struct	man	*man_alloc(struct roff *, struct mparse *,
+			const char *, int);
 void		 man_reset(struct man *);
 int		 man_parseln(struct man *, int, char *, int);
 int		 man_endparse(struct man *);
Index: read.c
===================================================================
RCS file: /home/cvs/mdocml/mdocml/read.c,v
retrieving revision 1.105
retrieving revision 1.106
diff -Lread.c -Lread.c -u -p -r1.105 -r1.106
--- read.c
+++ read.c
@@ -298,7 +298,8 @@ choose_parser(struct mparse *curp)
 	/* Fall back to man(7) as a last resort. */
 
 	if (NULL == curp->pman)
-		curp->pman = man_alloc(curp->roff, curp,
+		curp->pman = man_alloc(
+		    curp->roff, curp, curp->defos,
 		    MPARSE_QUICK & curp->options ? 1 : 0);
 	assert(curp->pman);
 	curp->man = curp->pman;
@@ -696,7 +697,8 @@ mparse_end(struct mparse *curp)
 			curp->mdoc = curp->pmdoc;
 		else {
 			if (curp->pman == NULL)
-				curp->pman = man_alloc(curp->roff, curp,
+				curp->pman = man_alloc(
+				    curp->roff, curp, curp->defos,
 				    curp->options & MPARSE_QUICK ? 1 : 0);
 			curp->man = curp->pman;
 		}
@@ -940,7 +942,8 @@ mparse_alloc(int options, enum mandoclev
 		    curp->roff, curp, curp->defos,
 		    curp->options & MPARSE_QUICK ? 1 : 0);
 	if (curp->options & MPARSE_MAN)
-		curp->pman = man_alloc(curp->roff, curp,
+		curp->pman = man_alloc(
+		    curp->roff, curp, curp->defos,
 		    curp->options & MPARSE_QUICK ? 1 : 0);
 
 	return(curp);
Index: libman.h
===================================================================
RCS file: /home/cvs/mdocml/mdocml/libman.h,v
retrieving revision 1.66
retrieving revision 1.67
diff -Llibman.h -Llibman.h -u -p -r1.66 -r1.67
--- libman.h
+++ libman.h
@@ -23,6 +23,7 @@ enum	man_next {
 
 struct	man {
 	struct mparse	*parse; /* parse pointer */
+	const char	*defos; /* default OS argument for .TH */
 	int		 quick; /* abort parse early */
 	int		 flags; /* parse flags */
 #define	MAN_ELINE	(1 << 1) /* Next-line element scope. */
Index: man.c
===================================================================
RCS file: /home/cvs/mdocml/mdocml/man.c,v
retrieving revision 1.145
retrieving revision 1.146
diff -Lman.c -Lman.c -u -p -r1.145 -r1.146
--- man.c
+++ man.c
@@ -92,7 +92,8 @@ man_free(struct man *man)
 }
 
 struct man *
-man_alloc(struct roff *roff, struct mparse *parse, int quick)
+man_alloc(struct roff *roff, struct mparse *parse,
+	const char *defos, int quick)
 {
 	struct man	*p;
 
@@ -100,6 +101,7 @@ man_alloc(struct roff *roff, struct mpar
 
 	man_hash_init();
 	p->parse = parse;
+	p->defos = defos;
 	p->quick = quick;
 	p->roff = roff;
 
Index: man_validate.c
===================================================================
RCS file: /home/cvs/mdocml/mdocml/man_validate.c,v
retrieving revision 1.107
retrieving revision 1.108
diff -Lman_validate.c -Lman_validate.c -u -p -r1.107 -r1.108
--- man_validate.c
+++ man_validate.c
@@ -379,6 +379,8 @@ post_TH(CHKARGS)
 
 	if (n && (n = n->next))
 		man->meta.source = mandoc_strdup(n->string);
+	else if (man->defos != NULL)
+		man->meta.source = mandoc_strdup(man->defos);
 
 	/* TITLE MSEC DATE SOURCE ->VOL<- */
 	/* If missing, use the default VOL name for MSEC. */
Index: man.1
===================================================================
RCS file: /home/cvs/mdocml/mdocml/man.1,v
retrieving revision 1.9
retrieving revision 1.10
diff -Lman.1 -Lman.1 -u -p -r1.9 -r1.10
--- man.1
+++ man.1
@@ -106,6 +106,9 @@ Override the default operating system
 for the
 .Xr mdoc 7
 .Ic \&Os
+and for the
+.Xr man 7
+.Ic \&TH
 macro.
 .It Fl h
 Display only the SYNOPSIS lines of the requested manual pages.
Index: mandoc.1
===================================================================
RCS file: /home/cvs/mdocml/mdocml/mandoc.1,v
retrieving revision 1.129
retrieving revision 1.130
diff -Lmandoc.1 -Lmandoc.1 -u -p -r1.129 -r1.130
--- mandoc.1
+++ mandoc.1
@@ -85,6 +85,9 @@ Override the default operating system
 for the
 .Xr mdoc 7
 .Sq \&Os
+and for the
+.Xr man 7
+.Sq \&TH
 macro.
 .It Fl h
 Display only the SYNOPSIS lines.
--
 To unsubscribe send an email to source+unsubscribe@mdocml.bsd.lv

^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2014-12-28 14:42 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2014-12-28 14:42 mdocml: mdoc(7) already uses the mandoc(1) -Ios argument in the footer schwarze

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).