-/* $Id: mdoc_validate.c,v 1.389 2021/07/18 11:41:23 schwarze Exp $ */
+/* $Id: mdoc_validate.c,v 1.390 2021/10/04 14:19:14 schwarze Exp $ */
/*
- * Copyright (c) 2010-2020 Ingo Schwarze <schwarze@openbsd.org>
+ * Copyright (c) 2010-2021 Ingo Schwarze <schwarze@openbsd.org>
* Copyright (c) 2008-2012 Kristaps Dzonsons <kristaps@bsd.lv>
* Copyright (c) 2010 Joerg Sonnenberger <joerg@netbsd.org>
*
{
#ifndef OSNAME
struct utsname utsname;
- static char *defbuf;
#endif
struct roff_node *n;
#ifdef OSNAME
mdoc->meta.os = mandoc_strdup(OSNAME);
#else /*!OSNAME */
- if (defbuf == NULL) {
+ if (mdoc->os_r == NULL) {
if (uname(&utsname) == -1) {
mandoc_msg(MANDOCERR_OS_UNAME, n->line, n->pos, "Os");
- defbuf = mandoc_strdup("UNKNOWN");
+ mdoc->os_r = mandoc_strdup("UNKNOWN");
} else
- mandoc_asprintf(&defbuf, "%s %s",
+ mandoc_asprintf(&mdoc->os_r, "%s %s",
utsname.sysname, utsname.release);
}
- mdoc->meta.os = mandoc_strdup(defbuf);
+ mdoc->meta.os = mandoc_strdup(mdoc->os_r);
#endif /*!OSNAME*/
out:
-/* $Id: roff.c,v 1.379 2021/10/04 10:12:27 schwarze Exp $ */
+/* $Id: roff.c,v 1.380 2021/10/04 14:19:14 schwarze Exp $ */
/*
- * Copyright (c) 2010-2015, 2017-2020 Ingo Schwarze <schwarze@openbsd.org>
+ * Copyright (c) 2010-2015, 2017-2021 Ingo Schwarze <schwarze@openbsd.org>
* Copyright (c) 2008-2012, 2014 Kristaps Dzonsons <kristaps@bsd.lv>
*
* Permission to use, copy, modify, and distribute this software for any
roff_man_free(struct roff_man *man)
{
roff_man_free1(man);
+ free(man->os_r);
free(man);
}
struct ohash *mdocmac; /* Mdoc macro lookup table. */
struct ohash *manmac; /* Man macro lookup table. */
const char *os_s; /* Default operating system. */
+ char *os_r; /* Operating system name at run time. */
struct roff_node *last; /* The last node parsed. */
struct roff_node *last_es; /* The most recent Es node. */
int quick; /* Abort parse early. */