summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorschwarze <schwarze@openbsd.org>2015-03-27 21:17:16 +0000
committerschwarze <schwarze@openbsd.org>2015-03-27 21:17:16 +0000
commit2ccd0917d8aa8edf966212a16f61c691f5a2753f (patch)
treed7f1543e368d153aabe9b749f2dc10f288369851
parentin SEE ALSO, refer to the relevant phy rather than similar devices; (diff)
downloadwireguard-openbsd-2ccd0917d8aa8edf966212a16f61c691f5a2753f.tar.xz
wireguard-openbsd-2ccd0917d8aa8edf966212a16f61c691f5a2753f.zip
Actually use the new man.conf(5) "output" directive.
Additional functionality, yet minus 45 lines of code.
-rw-r--r--etc/examples/man.conf9
-rw-r--r--usr.bin/mandoc/cgi.c15
-rw-r--r--usr.bin/mandoc/html.c39
-rw-r--r--usr.bin/mandoc/main.c19
-rw-r--r--usr.bin/mandoc/main.h27
-rw-r--r--usr.bin/mandoc/man.conf.522
-rw-r--r--usr.bin/mandoc/term_ascii.c71
-rw-r--r--usr.bin/mandoc/term_ps.c33
8 files changed, 106 insertions, 129 deletions
diff --git a/etc/examples/man.conf b/etc/examples/man.conf
index 0eff88da9f6..1cddae796c4 100644
--- a/etc/examples/man.conf
+++ b/etc/examples/man.conf
@@ -1,4 +1,4 @@
-# $OpenBSD: man.conf,v 1.1 2015/03/27 18:49:50 schwarze Exp $
+# $OpenBSD: man.conf,v 1.2 2015/03/27 21:17:16 schwarze Exp $
# man(1)/apropos(1)/makewhatis(8) configuration, see man.conf(5).
# This sample file shows the default settings.
@@ -7,3 +7,10 @@
manpath /usr/share/man
manpath /usr/X11R6/man
manpath /usr/local/man
+
+# Options for terminal output.
+output width 78
+output indent 5
+
+# Option for PostScript and PDF output.
+output paper letter
diff --git a/usr.bin/mandoc/cgi.c b/usr.bin/mandoc/cgi.c
index 6ffc618dbbd..b26cc41d76e 100644
--- a/usr.bin/mandoc/cgi.c
+++ b/usr.bin/mandoc/cgi.c
@@ -1,7 +1,7 @@
-/* $OpenBSD: cgi.c,v 1.44 2015/03/27 17:36:56 schwarze Exp $ */
+/* $OpenBSD: cgi.c,v 1.45 2015/03/27 21:17:16 schwarze Exp $ */
/*
* Copyright (c) 2011, 2012 Kristaps Dzonsons <kristaps@bsd.lv>
- * Copyright (c) 2014 Ingo Schwarze <schwarze@usta.de>
+ * Copyright (c) 2014, 2015 Ingo Schwarze <schwarze@usta.de>
*
* Permission to use, copy, modify, and distribute this software for any
* purpose with or without fee is hereby granted, provided that the above
@@ -814,12 +814,12 @@ catman(const struct req *req, const char *file)
static void
format(const struct req *req, const char *file)
{
+ struct manoutput conf;
struct mparse *mp;
struct mchars *mchars;
struct mdoc *mdoc;
struct man *man;
void *vp;
- char *opts;
int fd;
int usepath;
@@ -834,9 +834,10 @@ format(const struct req *req, const char *file)
mparse_readfd(mp, fd, file);
close(fd);
+ memset(&conf, 0, sizeof(conf));
+ conf.fragment = 1;
usepath = strcmp(req->q.manpath, req->p[0]);
- mandoc_asprintf(&opts,
- "fragment,man=%s?query=%%N&sec=%%S%s%s%s%s",
+ mandoc_asprintf(&conf.man, "%s?query=%%N&sec=%%S%s%s%s%s",
scriptname,
req->q.arch ? "&arch=" : "",
req->q.arch ? req->q.arch : "",
@@ -853,7 +854,7 @@ format(const struct req *req, const char *file)
return;
}
- vp = html_alloc(mchars, opts);
+ vp = html_alloc(mchars, &conf);
if (NULL != mdoc)
html_mdoc(vp, mdoc);
@@ -863,7 +864,7 @@ format(const struct req *req, const char *file)
html_free(vp);
mparse_free(mp);
mchars_free(mchars);
- free(opts);
+ free(conf.man);
}
static void
diff --git a/usr.bin/mandoc/html.c b/usr.bin/mandoc/html.c
index 44933c30fae..81fa4141b87 100644
--- a/usr.bin/mandoc/html.c
+++ b/usr.bin/mandoc/html.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: html.c,v 1.55 2015/01/21 20:20:49 schwarze Exp $ */
+/* $OpenBSD: html.c,v 1.56 2015/03/27 21:17:16 schwarze Exp $ */
/*
* Copyright (c) 2008-2011, 2014 Kristaps Dzonsons <kristaps@bsd.lv>
* Copyright (c) 2011-2015 Ingo Schwarze <schwarze@openbsd.org>
@@ -7,9 +7,9 @@
* purpose with or without fee is hereby granted, provided that the above
* copyright notice and this permission notice appear in all copies.
*
- * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
+ * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHORS DISCLAIM ALL WARRANTIES
* WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
- * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
+ * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHORS BE LIABLE FOR
* ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
* WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
* ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
@@ -30,6 +30,7 @@
#include "mandoc_aux.h"
#include "out.h"
#include "html.h"
+#include "manconf.h"
#include "main.h"
struct htmldata {
@@ -127,40 +128,20 @@ static void print_attr(struct html *, const char *, const char *);
void *
-html_alloc(const struct mchars *mchars, char *outopts)
+html_alloc(const struct mchars *mchars, const struct manoutput *outopts)
{
struct html *h;
- const char *toks[5];
- char *v;
-
- toks[0] = "style";
- toks[1] = "man";
- toks[2] = "includes";
- toks[3] = "fragment";
- toks[4] = NULL;
h = mandoc_calloc(1, sizeof(struct html));
h->tags.head = NULL;
h->symtab = mchars;
- while (outopts && *outopts)
- switch (getsubopt(&outopts, UNCONST(toks), &v)) {
- case 0:
- h->style = v;
- break;
- case 1:
- h->base_man = v;
- break;
- case 2:
- h->base_includes = v;
- break;
- case 3:
- h->oflags |= HTML_FRAGMENT;
- break;
- default:
- break;
- }
+ h->style = outopts->style;
+ h->base_man = outopts->man;
+ h->base_includes = outopts->includes;
+ if (outopts->fragment)
+ h->oflags |= HTML_FRAGMENT;
return(h);
}
diff --git a/usr.bin/mandoc/main.c b/usr.bin/mandoc/main.c
index 0cf4350fa28..b0ae7164081 100644
--- a/usr.bin/mandoc/main.c
+++ b/usr.bin/mandoc/main.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: main.c,v 1.134 2015/03/27 17:36:56 schwarze Exp $ */
+/* $OpenBSD: main.c,v 1.135 2015/03/27 21:17:16 schwarze Exp $ */
/*
* Copyright (c) 2008-2012 Kristaps Dzonsons <kristaps@bsd.lv>
* Copyright (c) 2010-2012, 2014, 2015 Ingo Schwarze <schwarze@openbsd.org>
@@ -76,7 +76,7 @@ struct curparse {
out_man outman; /* man output ptr */
out_free outfree; /* free output ptr */
void *outdata; /* data for output */
- char outopts[BUFSIZ]; /* buf of output opts */
+ struct manoutput *outopts; /* output options */
};
static int fs_lookup(const struct manpaths *,
@@ -118,7 +118,7 @@ main(int argc, char *argv[])
struct manpage *res, *resp;
char *conf_file, *defpaths;
size_t isec, i, sz;
- int prio, best_prio, synopsis_only;
+ int prio, best_prio;
char sec;
enum mandoclevel rctmp;
enum outmode outmode;
@@ -164,12 +164,12 @@ main(int argc, char *argv[])
memset(&curp, 0, sizeof(struct curparse));
curp.outtype = OUTT_LOCALE;
curp.wlevel = MANDOCLEVEL_BADARG;
+ curp.outopts = &conf.output;
options = MPARSE_SO | MPARSE_UTF8 | MPARSE_LATIN1;
defos = NULL;
pager_pid = 1;
show_usage = 0;
- synopsis_only = 0;
outmode = OUTMODE_DEF;
while (-1 != (c = getopt(argc, argv,
@@ -188,8 +188,7 @@ main(int argc, char *argv[])
search.argmode = ARG_WORD;
break;
case 'h':
- (void)strlcat(curp.outopts, "synopsis,", BUFSIZ);
- synopsis_only = 1;
+ conf.output.synopsisonly = 1;
pager_pid = 0;
outmode = OUTMODE_ALL;
break;
@@ -230,8 +229,9 @@ main(int argc, char *argv[])
break;
case 'O':
search.outkey = optarg;
- (void)strlcat(curp.outopts, optarg, BUFSIZ);
- (void)strlcat(curp.outopts, ",", BUFSIZ);
+ while (optarg != NULL)
+ manconf_output(&conf.output,
+ strsep(&optarg, ","));
break;
case 'S':
search.arch = optarg;
@@ -423,7 +423,8 @@ main(int argc, char *argv[])
chdir(conf.manpath.paths[resp->ipath]);
parse(&curp, fd, resp->file);
} else
- passthrough(resp->file, fd, synopsis_only);
+ passthrough(resp->file, fd,
+ conf.output.synopsisonly);
rctmp = mparse_wait(curp.mp);
if (rc < rctmp)
diff --git a/usr.bin/mandoc/main.h b/usr.bin/mandoc/main.h
index 04e8b193486..74f4b76a0fa 100644
--- a/usr.bin/mandoc/main.h
+++ b/usr.bin/mandoc/main.h
@@ -1,15 +1,15 @@
-/* $OpenBSD: main.h,v 1.15 2014/12/31 16:50:54 schwarze Exp $ */
+/* $OpenBSD: main.h,v 1.16 2015/03/27 21:17:16 schwarze Exp $ */
/*
* Copyright (c) 2009, 2010, 2011 Kristaps Dzonsons <kristaps@bsd.lv>
- * Copyright (c) 2014 Ingo Schwarze <schwarze@openbsd.org>
+ * Copyright (c) 2014, 2015 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
* copyright notice and this permission notice appear in all copies.
*
- * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
+ * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHORS DISCLAIM ALL WARRANTIES
* WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
- * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
+ * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHORS BE LIABLE FOR
* ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
* WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
* ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
@@ -23,6 +23,7 @@ __BEGIN_DECLS
struct mchars;
struct mdoc;
struct man;
+struct manoutput;
/*
* Definitions for main.c-visible output device functions, e.g., -Thtml
@@ -31,7 +32,8 @@ struct man;
* terminal output routines with different character settings.
*/
-void *html_alloc(const struct mchars *, char *);
+void *html_alloc(const struct mchars *,
+ const struct manoutput *);
void html_mdoc(void *, const struct mdoc *);
void html_man(void *, const struct man *);
void html_free(void *);
@@ -42,14 +44,19 @@ void tree_man(void *, const struct man *);
void man_mdoc(void *, const struct mdoc *);
void man_man(void *, const struct man *);
-void *locale_alloc(const struct mchars *, char *);
-void *utf8_alloc(const struct mchars *, char *);
-void *ascii_alloc(const struct mchars *, char *);
+void *locale_alloc(const struct mchars *,
+ const struct manoutput *);
+void *utf8_alloc(const struct mchars *,
+ const struct manoutput *);
+void *ascii_alloc(const struct mchars *,
+ const struct manoutput *);
void ascii_free(void *);
void ascii_sepline(void *);
-void *pdf_alloc(const struct mchars *, char *);
-void *ps_alloc(const struct mchars *, char *);
+void *pdf_alloc(const struct mchars *,
+ const struct manoutput *);
+void *ps_alloc(const struct mchars *,
+ const struct manoutput *);
void pspdf_free(void *);
void terminal_mdoc(void *, const struct mdoc *);
diff --git a/usr.bin/mandoc/man.conf.5 b/usr.bin/mandoc/man.conf.5
index fc5ea047881..2ce6ff558f1 100644
--- a/usr.bin/mandoc/man.conf.5
+++ b/usr.bin/mandoc/man.conf.5
@@ -1,4 +1,4 @@
-.\" $OpenBSD: man.conf.5,v 1.2 2015/03/27 15:00:06 jmc Exp $
+.\" $OpenBSD: man.conf.5,v 1.3 2015/03/27 21:17:16 schwarze Exp $
.\"
.\" Copyright (c) 2015 Ingo Schwarze <schwarze@openbsd.org>
.\"
@@ -76,6 +76,26 @@ is recommended and necessary for
.Xr apropos 1
to work, but not strictly required for
.Xr man 1 .
+.It Ic output Ar option Op Ar value
+Configure the default value of an output option.
+These directives are overridden by the
+.Fl O
+command line options of the same names.
+For details, see the
+.Xr mandoc 1
+manual.
+.Pp
+.Bl -column fragment integer "ascii, utf8" -compact
+.It Ar option Ta Ar value Ta used by Fl T Ta purpose
+.It Ta Ta Ta
+.It Ic fragment Ta none Ta Cm html Ta print only body
+.It Ic includes Ta string Ta Cm html Ta path to header files
+.It Ic indent Ta integer Ta Cm ascii , utf8 Ta left margin
+.It Ic man Ta string Ta Cm html Ta path for Xr links
+.It Ic paper Ta string Ta Cm ps , pdf Ta paper size
+.It Ic style Ta string Ta Cm html Ta CSS file
+.It Ic width Ta integer Ta Cm ascii , utf8 Ta right margin
+.El
.It Ic _whatdb Ar path Ns Cm /whatis.db
This directive provides the same functionality as
.Ic manpath ,
diff --git a/usr.bin/mandoc/term_ascii.c b/usr.bin/mandoc/term_ascii.c
index be4d4489bad..31f2f4e6d05 100644
--- a/usr.bin/mandoc/term_ascii.c
+++ b/usr.bin/mandoc/term_ascii.c
@@ -1,15 +1,15 @@
-/* $OpenBSD: term_ascii.c,v 1.30 2015/02/16 13:58:32 tedu Exp $ */
+/* $OpenBSD: term_ascii.c,v 1.31 2015/03/27 21:17:16 schwarze Exp $ */
/*
* Copyright (c) 2010, 2011 Kristaps Dzonsons <kristaps@bsd.lv>
- * Copyright (c) 2014 Ingo Schwarze <schwarze@openbsd.org>
+ * Copyright (c) 2014, 2015 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
* copyright notice and this permission notice appear in all copies.
*
- * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
+ * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHORS DISCLAIM ALL WARRANTIES
* WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
- * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
+ * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHORS BE LIABLE FOR
* ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
* WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
* ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
@@ -29,10 +29,11 @@
#include "mandoc_aux.h"
#include "out.h"
#include "term.h"
+#include "manconf.h"
#include "main.h"
-static struct termp *ascii_init(enum termenc,
- const struct mchars *, char *);
+static struct termp *ascii_init(enum termenc, const struct mchars *,
+ const struct manoutput *);
static double ascii_hspan(const struct termp *,
const struct roffsu *);
static size_t ascii_width(const struct termp *, int);
@@ -50,13 +51,11 @@ static size_t locale_width(const struct termp *, int);
static struct termp *
-ascii_init(enum termenc enc, const struct mchars *mchars, char *outopts)
+ascii_init(enum termenc enc, const struct mchars *mchars,
+ const struct manoutput *outopts)
{
- const char *toks[5];
char *v;
struct termp *p;
- const char *errstr;
- int num;
p = mandoc_calloc(1, sizeof(struct termp));
@@ -92,62 +91,36 @@ ascii_init(enum termenc enc, const struct mchars *mchars, char *outopts)
}
}
- toks[0] = "indent";
- toks[1] = "width";
- toks[2] = "mdoc";
- toks[3] = "synopsis";
- toks[4] = NULL;
-
- while (outopts && *outopts)
- switch (getsubopt(&outopts, UNCONST(toks), &v)) {
- case 0:
- num = strtonum(v, 0, 1000, &errstr);
- if (!errstr)
- p->defindent = num;
- break;
- case 1:
- num = strtonum(v, 0, 1000, &errstr);
- if (!errstr)
- p->defrmargin = num;
- break;
- case 2:
- /*
- * Temporary, undocumented mode
- * to imitate mdoc(7) output style.
- */
- p->mdocstyle = 1;
- p->defindent = 5;
- break;
- case 3:
- p->synopsisonly = 1;
- break;
- default:
- break;
- }
-
- /* Enforce a lower boundary. */
- if (p->defrmargin < 58)
- p->defrmargin = 58;
+ if (outopts->mdoc) {
+ p->mdocstyle = 1;
+ p->defindent = 5;
+ }
+ if (outopts->indent)
+ p->defindent = outopts->indent;
+ if (outopts->width)
+ p->defrmargin = outopts->width;
+ if (outopts->synopsisonly)
+ p->synopsisonly = 1;
return(p);
}
void *
-ascii_alloc(const struct mchars *mchars, char *outopts)
+ascii_alloc(const struct mchars *mchars, const struct manoutput *outopts)
{
return(ascii_init(TERMENC_ASCII, mchars, outopts));
}
void *
-utf8_alloc(const struct mchars *mchars, char *outopts)
+utf8_alloc(const struct mchars *mchars, const struct manoutput *outopts)
{
return(ascii_init(TERMENC_UTF8, mchars, outopts));
}
void *
-locale_alloc(const struct mchars *mchars, char *outopts)
+locale_alloc(const struct mchars *mchars, const struct manoutput *outopts)
{
return(ascii_init(TERMENC_LOCALE, mchars, outopts));
diff --git a/usr.bin/mandoc/term_ps.c b/usr.bin/mandoc/term_ps.c
index 4fc73dbcf21..95d76f8f1a9 100644
--- a/usr.bin/mandoc/term_ps.c
+++ b/usr.bin/mandoc/term_ps.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: term_ps.c,v 1.37 2015/01/21 19:40:22 schwarze Exp $ */
+/* $OpenBSD: term_ps.c,v 1.38 2015/03/27 21:17:16 schwarze Exp $ */
/*
* Copyright (c) 2010, 2011 Kristaps Dzonsons <kristaps@bsd.lv>
* Copyright (c) 2014, 2015 Ingo Schwarze <schwarze@openbsd.org>
@@ -7,9 +7,9 @@
* purpose with or without fee is hereby granted, provided that the above
* copyright notice and this permission notice appear in all copies.
*
- * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
+ * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHORS DISCLAIM ALL WARRANTIES
* WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
- * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
+ * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHORS BE LIABLE FOR
* ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
* WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
* ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
@@ -28,6 +28,7 @@
#include "mandoc_aux.h"
#include "out.h"
#include "term.h"
+#include "manconf.h"
#include "main.h"
/* These work the buffer used by the header and footer. */
@@ -101,7 +102,8 @@ static void ps_printf(struct termp *, const char *, ...);
static void ps_putchar(struct termp *, char);
static void ps_setfont(struct termp *, enum termfont);
static void ps_setwidth(struct termp *, int, size_t);
-static struct termp *pspdf_alloc(const struct mchars *, char *);
+static struct termp *pspdf_alloc(const struct mchars *,
+ const struct manoutput *);
static void pdf_obj(struct termp *, size_t);
/*
@@ -502,7 +504,7 @@ static const struct font fonts[TERMFONT__MAX] = {
};
void *
-pdf_alloc(const struct mchars *mchars, char *outopts)
+pdf_alloc(const struct mchars *mchars, const struct manoutput *outopts)
{
struct termp *p;
@@ -513,7 +515,7 @@ pdf_alloc(const struct mchars *mchars, char *outopts)
}
void *
-ps_alloc(const struct mchars *mchars, char *outopts)
+ps_alloc(const struct mchars *mchars, const struct manoutput *outopts)
{
struct termp *p;
@@ -524,14 +526,12 @@ ps_alloc(const struct mchars *mchars, char *outopts)
}
static struct termp *
-pspdf_alloc(const struct mchars *mchars, char *outopts)
+pspdf_alloc(const struct mchars *mchars, const struct manoutput *outopts)
{
struct termp *p;
unsigned int pagex, pagey;
size_t marginx, marginy, lineheight;
- const char *toks[2];
const char *pp;
- char *v;
p = mandoc_calloc(1, sizeof(struct termp));
p->symtab = mchars;
@@ -550,20 +550,6 @@ pspdf_alloc(const struct mchars *mchars, char *outopts)
p->setwidth = ps_setwidth;
p->width = ps_width;
- toks[0] = "paper";
- toks[1] = NULL;
-
- pp = NULL;
-
- while (outopts && *outopts)
- switch (getsubopt(&outopts, UNCONST(toks), &v)) {
- case 0:
- pp = v;
- break;
- default:
- break;
- }
-
/* Default to US letter (millimetres). */
pagex = 216;
@@ -576,6 +562,7 @@ pspdf_alloc(const struct mchars *mchars, char *outopts)
* only happens once, I'm not terribly concerned.
*/
+ pp = outopts->paper;
if (pp && strcasecmp(pp, "letter")) {
if (0 == strcasecmp(pp, "a3")) {
pagex = 297;