=================================================================== RCS file: /cvsrepo/anoncvs/cvs/src/usr.bin/mandoc/Attic/mdoc_action.c,v retrieving revision 1.23 retrieving revision 1.24 diff -u -r1.23 -r1.24 --- src/usr.bin/mandoc/Attic/mdoc_action.c 2009/10/19 16:27:52 1.23 +++ src/usr.bin/mandoc/Attic/mdoc_action.c 2009/10/27 21:40:07 1.24 @@ -1,4 +1,4 @@ -/* $Id: mdoc_action.c,v 1.23 2009/10/19 16:27:52 schwarze Exp $ */ +/* $Id: mdoc_action.c,v 1.24 2009/10/27 21:40:07 schwarze Exp $ */ /* * Copyright (c) 2008, 2009 Kristaps Dzonsons * @@ -14,13 +14,16 @@ * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. */ +#ifndef OSNAME #include +#endif #include #include #include #include #include +#include #include "libmdoc.h" @@ -170,7 +173,7 @@ { NULL, NULL }, /* Ud */ { NULL, post_lb }, /* Lb */ { NULL, NULL }, /* Lp */ - { NULL, post_tilde }, /* Lk */ + { NULL, NULL }, /* Lk */ { NULL, NULL }, /* Mt */ { NULL, NULL }, /* Brq */ { NULL, NULL }, /* Bro */ @@ -182,9 +185,10 @@ { NULL, NULL }, /* %Q */ { NULL, NULL }, /* br */ { NULL, NULL }, /* sp */ + { NULL, NULL }, /* %U */ }; -#define RSORD_MAX 13 +#define RSORD_MAX 14 static const int rsord[RSORD_MAX] = { MDOC__A, @@ -199,7 +203,8 @@ MDOC__Q, MDOC__D, MDOC__O, - MDOC__C + MDOC__C, + MDOC__U }; @@ -516,8 +521,16 @@ post_os(POST_ARGS) { char buf[64]; +#ifndef OSNAME struct utsname utsname; +#endif + /* + * Setting OSNAME to be the name of the target operating system, + * e.g., "OpenBSD 4.4", will result in the compile-time constant + * by supplied instead of the value in uname(). + */ + if (m->meta.os) free(m->meta.os); @@ -526,6 +539,10 @@ return(0); if (0 == buf[0]) { +#ifdef OSNAME + if (strlcat(buf, OSNAME, 64) >= 64) + return(mdoc_nerr(m, n, EUTSNAME)); +#else if (-1 == uname(&utsname)) return(mdoc_nerr(m, n, EUTSNAME)); if (strlcat(buf, utsname.sysname, 64) >= 64) @@ -534,6 +551,7 @@ return(mdoc_nerr(m, n, ETOOLONG)); if (strlcat(buf, utsname.release, 64) >= 64) return(mdoc_nerr(m, n, ETOOLONG)); +#endif } if (NULL == (m->meta.os = strdup(buf))) @@ -753,7 +771,6 @@ np = n; m->next = MDOC_NEXT_CHILD; - /* XXX: not documented for `Lk'. */ if ( ! mdoc_word_alloc(m, n->line, n->pos, "~")) return(0); m->last = np;