* texi2mdoc: Don't print out defindex tokens--just save them.
@ 2015-03-05 8:19 kristaps
0 siblings, 0 replies; only message in thread
From: kristaps @ 2015-03-05 8:19 UTC (permalink / raw)
To: source
Log Message:
-----------
Don't print out defindex tokens--just save them.
Modified Files:
--------------
texi2mdoc:
main.c
Revision Data
-------------
Index: main.c
===================================================================
RCS file: /home/cvs/mdocml/texi2mdoc/main.c,v
retrieving revision 1.59
retrieving revision 1.60
diff -Lmain.c -Lmain.c -u -p -r1.59 -r1.60
--- main.c
+++ main.c
@@ -342,6 +342,12 @@ static const struct texitok __texitoks[T
const struct texitok *const texitoks = __texitoks;
+/*
+ * Texinfo has lots of indexes.
+ * You can add new ones in a variety of ways.
+ * We maintain an array of all of these index names (usually a few
+ * letters) and pass unknown commands through the array list.
+ */
static void
dodefindex(struct texi *p, enum texicmd cmd, size_t *pos)
{
@@ -350,7 +356,6 @@ dodefindex(struct texi *p, enum texicmd
while (*pos < BUFSZ(p) && isws(BUF(p)[*pos]))
advance(p, pos);
-
start = end = *pos;
while (end < BUFSZ(p) && ! ismspace(BUF(p)[end]))
end++;
@@ -358,18 +363,21 @@ dodefindex(struct texi *p, enum texicmd
if (start == end) {
advanceeoln(p, pos, 1);
return;
- } else if (NULL == (cp = malloc(end - start + 1)))
+ }
+
+ if (NULL == (cp = malloc(end - start + 1)))
texiabort(p, NULL);
-
memcpy(cp, &BUF(p)[start], end - start);
cp[end - start] = '\0';
+ /* FIXME: use reallocarray(). */
p->indexs = realloc(p->indexs,
sizeof(char *) * (p->indexsz + 1));
-
if (NULL == p->indexs)
texiabort(p, NULL);
p->indexs[p->indexsz++] = cp;
+
+ advanceeoln(p, pos, 1);
}
static void
--
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:[~2015-03-05 8:19 UTC | newest]
Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2015-03-05 8:19 texi2mdoc: Don't print out defindex tokens--just save them kristaps
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).