version 1.200, 2014/01/06 22:39:25 |
version 1.204, 2014/03/23 12:11:18 |
|
|
|
|
#include "mdoc.h" |
#include "mdoc.h" |
#include "mandoc.h" |
#include "mandoc.h" |
|
#include "mandoc_aux.h" |
#include "libmdoc.h" |
#include "libmdoc.h" |
#include "libmandoc.h" |
#include "libmandoc.h" |
|
|
Line 1894 post_hyph(POST_ARGS) |
|
Line 1895 post_hyph(POST_ARGS) |
|
if (MDOC_TEXT != nch->type) |
if (MDOC_TEXT != nch->type) |
continue; |
continue; |
cp = nch->string; |
cp = nch->string; |
if (3 > strnlen(cp, 3)) |
if ('\0' == *cp) |
continue; |
continue; |
while ('\0' != *(++cp)) |
while ('\0' != *(++cp)) |
if ('-' == *cp && |
if ('-' == *cp && |
Line 2348 post_bx(POST_ARGS) |
|
Line 2349 post_bx(POST_ARGS) |
|
static int |
static int |
post_os(POST_ARGS) |
post_os(POST_ARGS) |
{ |
{ |
struct mdoc_node *n; |
|
char buf[BUFSIZ]; |
char buf[BUFSIZ]; |
int c; |
|
#ifndef OSNAME |
#ifndef OSNAME |
struct utsname utsname; |
struct utsname utsname; |
|
static char *defbuf; |
#endif |
#endif |
|
struct mdoc_node *n; |
|
int c; |
|
|
n = mdoc->last; |
n = mdoc->last; |
|
|
Line 2376 post_os(POST_ARGS) |
|
Line 2378 post_os(POST_ARGS) |
|
|
|
assert(c); |
assert(c); |
|
|
if ('\0' == buf[0]) { |
if ('\0' != *buf) { |
if (mdoc->defos) { |
mdoc->meta.os = mandoc_strdup(buf); |
mdoc->meta.os = mandoc_strdup(mdoc->defos); |
return(1); |
return(1); |
} |
} |
|
|
if (mdoc->defos) { |
|
mdoc->meta.os = mandoc_strdup(mdoc->defos); |
|
return(1); |
|
} |
|
|
#ifdef OSNAME |
#ifdef OSNAME |
if (strlcat(buf, OSNAME, BUFSIZ) >= BUFSIZ) { |
mdoc->meta.os = mandoc_strdup(OSNAME); |
mdoc_nmsg(mdoc, n, MANDOCERR_MEM); |
|
return(0); |
|
} |
|
#else /*!OSNAME */ |
#else /*!OSNAME */ |
|
if (NULL == defbuf) { |
if (-1 == uname(&utsname)) { |
if (-1 == uname(&utsname)) { |
mdoc_nmsg(mdoc, n, MANDOCERR_UNAME); |
mdoc_nmsg(mdoc, n, MANDOCERR_UNAME); |
mdoc->meta.os = mandoc_strdup("UNKNOWN"); |
defbuf = mandoc_strdup("UNKNOWN"); |
return(post_prol(mdoc)); |
} else |
} |
mandoc_asprintf(&defbuf, "%s %s", |
|
utsname.sysname, utsname.release); |
if (strlcat(buf, utsname.sysname, BUFSIZ) >= BUFSIZ) { |
|
mdoc_nmsg(mdoc, n, MANDOCERR_MEM); |
|
return(0); |
|
} |
|
if (strlcat(buf, " ", BUFSIZ) >= BUFSIZ) { |
|
mdoc_nmsg(mdoc, n, MANDOCERR_MEM); |
|
return(0); |
|
} |
|
if (strlcat(buf, utsname.release, BUFSIZ) >= BUFSIZ) { |
|
mdoc_nmsg(mdoc, n, MANDOCERR_MEM); |
|
return(0); |
|
} |
|
#endif /*!OSNAME*/ |
|
} |
} |
|
mdoc->meta.os = mandoc_strdup(defbuf); |
mdoc->meta.os = mandoc_strdup(buf); |
#endif /*!OSNAME*/ |
return(1); |
return(1); |
} |
} |
|
|