diff options
author | Joerg Sonnenberger <joerg@netbsd.org> | 2010-05-15 16:18:23 +0000 |
---|---|---|
committer | Joerg Sonnenberger <joerg@netbsd.org> | 2010-05-15 16:18:23 +0000 |
commit | 435e0fb79416aa764cb4f1b197ecbe24887f3de4 (patch) | |
tree | db54c83ce33284706e8ee9dbf8c04c6ede4465ab /term.c | |
parent | b9297c29623c1e4db9a654cff80d1ac016fdbaee (diff) | |
download | mandoc-435e0fb79416aa764cb4f1b197ecbe24887f3de4.tar.gz |
Make the output width an option for ascii_alloc and use that to compute
the default margin. Hard-code 80 chars/line for now.
Diffstat (limited to 'term.c')
-rw-r--r-- | term.c | 12 |
1 files changed, 8 insertions, 4 deletions
@@ -34,7 +34,7 @@ #include "mdoc.h" #include "main.h" -static struct termp *term_alloc(enum termenc); +static struct termp *term_alloc(enum termenc, size_t); static void term_free(struct termp *); static void spec(struct termp *, const char *, size_t); static void res(struct termp *, const char *, size_t); @@ -45,10 +45,10 @@ static void encode(struct termp *, const char *, size_t); void * -ascii_alloc(void) +ascii_alloc(size_t width) { - return(term_alloc(TERMENC_ASCII)); + return(term_alloc(TERMENC_ASCII, width)); } @@ -74,7 +74,7 @@ term_free(struct termp *p) static struct termp * -term_alloc(enum termenc enc) +term_alloc(enum termenc enc, size_t width) { struct termp *p; @@ -84,6 +84,10 @@ term_alloc(enum termenc enc) exit(EXIT_FAILURE); } p->enc = enc; + /* Enforce some lower boundary. */ + if (width < 60) + width = 60; + p->defrmargin = width - 2; return(p); } |