summaryrefslogtreecommitdiff
path: root/usr/src/cmd/mandoc/tbl_layout.c
diff options
context:
space:
mode:
authorJerry Jelinek <jerry.jelinek@joyent.com>2017-08-14 11:53:49 +0000
committerJerry Jelinek <jerry.jelinek@joyent.com>2017-08-14 11:53:49 +0000
commitf3156461964256d1c034e49b880a19bc94c1c281 (patch)
tree14cb627993b9ee1af94fa83fbf8c41cf227c3189 /usr/src/cmd/mandoc/tbl_layout.c
parentaea86460f0918659f2a8637f97b2055272a86c98 (diff)
parent5e9f42abf61392dc608a661563fb49e7707f0478 (diff)
downloadillumos-joyent-f3156461964256d1c034e49b880a19bc94c1c281.tar.gz
[illumos-gate merge]
commit 5e9f42abf61392dc608a661563fb49e7707f0478 8559 Add EFI utility functions to libefi commit c66b8046543352459a11a51501b628d1c98a8c44 8547 update mandoc to 1.14.3 commit 12014b724f98604d61f9756b7e199416475d7396 8573 cmd/krb5: dmake should build 'all' as default target
Diffstat (limited to 'usr/src/cmd/mandoc/tbl_layout.c')
-rw-r--r--usr/src/cmd/mandoc/tbl_layout.c26
1 files changed, 23 insertions, 3 deletions
diff --git a/usr/src/cmd/mandoc/tbl_layout.c b/usr/src/cmd/mandoc/tbl_layout.c
index c0eafbddbf..42fc0e8296 100644
--- a/usr/src/cmd/mandoc/tbl_layout.c
+++ b/usr/src/cmd/mandoc/tbl_layout.c
@@ -1,7 +1,7 @@
-/* $Id: tbl_layout.c,v 1.41 2015/10/12 00:08:16 schwarze Exp $ */
+/* $Id: tbl_layout.c,v 1.44 2017/06/27 18:25:02 schwarze Exp $ */
/*
* Copyright (c) 2009, 2010, 2011 Kristaps Dzonsons <kristaps@bsd.lv>
- * Copyright (c) 2012, 2014, 2015 Ingo Schwarze <schwarze@openbsd.org>
+ * Copyright (c) 2012, 2014, 2015, 2017 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
@@ -20,6 +20,7 @@
#include <sys/types.h>
#include <ctype.h>
+#include <stdint.h>
#include <stdlib.h>
#include <string.h>
#include <time.h>
@@ -62,6 +63,7 @@ mods(struct tbl_node *tbl, struct tbl_cell *cp,
int ln, const char *p, int *pos)
{
char *endptr;
+ size_t sz;
mod:
while (p[*pos] == ' ' || p[*pos] == '\t')
@@ -127,7 +129,22 @@ mod:
case 'u':
cp->flags |= TBL_CELL_UP;
goto mod;
- case 'w': /* XXX for now, ignore minimal column width */
+ case 'w':
+ sz = 0;
+ if (p[*pos] == '(') {
+ (*pos)++;
+ while (p[*pos + sz] != '\0' && p[*pos + sz] != ')')
+ sz++;
+ } else
+ while (isdigit((unsigned char)p[*pos + sz]))
+ sz++;
+ if (sz) {
+ free(cp->wstr);
+ cp->wstr = mandoc_strndup(p + *pos, sz);
+ *pos += sz;
+ if (p[*pos] == ')')
+ (*pos)++;
+ }
goto mod;
case 'x':
cp->flags |= TBL_CELL_WMAX;
@@ -282,6 +299,8 @@ tbl_layout(struct tbl_node *tbl, int ln, const char *p, int pos)
tbl->parse, ln, pos, NULL);
cell_alloc(tbl, tbl->first_row,
TBL_CELL_LEFT);
+ if (tbl->opts.lvert < tbl->first_row->vert)
+ tbl->opts.lvert = tbl->first_row->vert;
return;
}
@@ -339,6 +358,7 @@ cell_alloc(struct tbl_node *tbl, struct tbl_row *rp, enum tbl_cellt pos)
struct tbl_cell *p, *pp;
p = mandoc_calloc(1, sizeof(*p));
+ p->spacing = SIZE_MAX;
p->pos = pos;
if ((pp = rp->last) != NULL) {