-/* $Id: term.c,v 1.133 2010/05/12 16:01:01 kristaps Exp $ */
+/* $Id: term.c,v 1.135 2010/05/16 01:35:37 schwarze Exp $ */
/*
* Copyright (c) 2008, 2009 Kristaps Dzonsons <kristaps@kth.se>
*
#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);
void *
-ascii_alloc(void)
+ascii_alloc(size_t width)
{
- return(term_alloc(TERMENC_ASCII));
+ return(term_alloc(TERMENC_ASCII, width));
}
static struct termp *
-term_alloc(enum termenc enc)
+term_alloc(enum termenc enc, size_t width)
{
struct termp *p;
exit(EXIT_FAILURE);
}
p->enc = enc;
+ /* Enforce some lower boundary. */
+ if (width < 60)
+ width = 60;
+ p->defrmargin = width - 2;
return(p);
}
for ( ; i < (int)p->col; i++)
if (' ' == p->buf[i])
break;
- else if (31 == p->buf[i])
+ else if (ASCII_NBRSP == p->buf[i])
putchar(' ');
else
putchar(p->buf[i]);