From fe145d2365e72a35cd1641adcd3eb55ecf5e5f1d Mon Sep 17 00:00:00 2001 From: Kristaps Dzonsons Date: Wed, 29 Dec 2010 16:44:23 +0000 Subject: Initial check-in of table data-row processing. For the time being, this parses table data then throws it away immediately. It does not yet try to cross-check data rows against layout or anything. This copied more or less completely from tbl.bsd.lv. --- tbl.c | 17 +++++++++++++++-- 1 file changed, 15 insertions(+), 2 deletions(-) (limited to 'tbl.c') diff --git a/tbl.c b/tbl.c index 0d992f16..42e0f0a7 100644 --- a/tbl.c +++ b/tbl.c @@ -1,4 +1,4 @@ -/* $Id: tbl.c,v 1.7 2010/12/29 14:53:31 kristaps Exp $ */ +/* $Id: tbl.c,v 1.8 2010/12/29 16:44:23 kristaps Exp $ */ /* * Copyright (c) 2009, 2010 Kristaps Dzonsons * @@ -63,6 +63,8 @@ tbl_read(struct tbl *tbl, int ln, const char *p, int offs) { int len; const char *cp; + struct tbl_dat *dp; + struct tbl_span *sp; cp = &p[offs]; len = (int)strlen(cp); @@ -85,9 +87,20 @@ tbl_read(struct tbl *tbl, int ln, const char *p, int offs) return(tbl_option(tbl, ln, p) ? ROFF_IGN : ROFF_ERR); case (TBL_PART_LAYOUT): return(tbl_layout(tbl, ln, p) ? ROFF_IGN : ROFF_ERR); - default: + case (TBL_PART_DATA): break; } + + /* XXX: throw away data for now. */ + if (NULL != (sp = tbl_data(tbl, ln, p))) { + while (NULL != (dp = sp->first)) { + sp->first = sp->first->next; + if (dp->string) + free(dp->string); + free(dp); + } + free(sp); + } return(ROFF_CONT); } -- cgit v1.2.3-56-ge451