-/* $OpenBSD: att.c,v 1.10 2015/04/02 21:03:18 schwarze Exp $ */
+/* $OpenBSD: att.c,v 1.11 2015/10/06 18:30:43 schwarze Exp $ */
/*
* Copyright (c) 2009 Kristaps Dzonsons <kristaps@bsd.lv>
*
LINE("V.3", "AT&T System\\~V Release\\~3 UNIX");
LINE("V.4", "AT&T System\\~V Release\\~4 UNIX");
- return(NULL);
+ return NULL;
}
-/* $OpenBSD: cgi.c,v 1.47 2015/04/18 16:34:03 schwarze Exp $ */
+/* $OpenBSD: cgi.c,v 1.48 2015/10/06 18:30:43 schwarze Exp $ */
/*
* Copyright (c) 2011, 2012 Kristaps Dzonsons <kristaps@bsd.lv>
* Copyright (c) 2014, 2015 Ingo Schwarze <schwarze@usta.de>
for ( ; '\0' != *p; p++, q++) {
if ('%' == *p) {
if ('\0' == (hex[0] = *(p + 1)))
- return(0);
+ return 0;
if ('\0' == (hex[1] = *(p + 2)))
- return(0);
+ return 0;
if (1 != sscanf(hex, "%x", &c))
- return(0);
+ return 0;
if ('\0' == c)
- return(0);
+ return 0;
*q = (char)c;
p += 2;
}
*q = '\0';
- return(1);
+ return 1;
}
static void
if ( ! (isalnum((unsigned char)*frag) ||
'-' == *frag || '.' == *frag ||
'/' == *frag || '_' == *frag))
- return(0);
+ return 0;
frag++;
}
- return(1);
+ return 1;
}
static int
size_t i;
if ( ! strcmp(manpath, "mandoc"))
- return(1);
+ return 1;
for (i = 0; i < req->psz; i++)
if ( ! strcmp(manpath, req->p[i]))
- return(1);
+ return 1;
- return(0);
+ return 0;
}
static int
if ('.' == file[0] && '/' == file[1])
file += 2;
- return ( ! (strstr(file, "../") || strstr(file, "/..") ||
- (strncmp(file, "man", 3) && strncmp(file, "cat", 3))));
+ return ! (strstr(file, "../") || strstr(file, "/..") ||
+ (strncmp(file, "man", 3) && strncmp(file, "cat", 3)));
}
static void
if (setitimer(ITIMER_VIRTUAL, &itimer, NULL) == -1) {
fprintf(stderr, "setitimer: %s\n", strerror(errno));
pg_error_internal();
- return(EXIT_FAILURE);
+ return EXIT_FAILURE;
}
/* Scan our run-time environment. */
fprintf(stderr, "unsafe SCRIPT_NAME \"%s\"\n",
scriptname);
pg_error_internal();
- return(EXIT_FAILURE);
+ return EXIT_FAILURE;
}
/*
fprintf(stderr, "MAN_DIR: %s: %s\n",
MAN_DIR, strerror(errno));
pg_error_internal();
- return(EXIT_FAILURE);
+ return EXIT_FAILURE;
}
memset(&req, 0, sizeof(struct req));
else if ( ! validate_manpath(&req, req.q.manpath)) {
pg_error_badrequest(
"You specified an invalid manpath.");
- return(EXIT_FAILURE);
+ return EXIT_FAILURE;
}
if ( ! (NULL == req.q.arch || validate_urifrag(req.q.arch))) {
pg_error_badrequest(
"You specified an invalid architecture.");
- return(EXIT_FAILURE);
+ return EXIT_FAILURE;
}
/* Dispatch to the three different pages. */
for (i = 0; i < (int)req.psz; i++)
free(req.p[i]);
free(req.p);
- return(EXIT_SUCCESS);
+ return EXIT_SUCCESS;
}
/*
-/* $OpenBSD: chars.c,v 1.36 2015/02/17 20:33:44 schwarze Exp $ */
+/* $OpenBSD: chars.c,v 1.37 2015/10/06 18:30:43 schwarze Exp $ */
/*
* Copyright (c) 2009, 2010, 2011 Kristaps Dzonsons <kristaps@bsd.lv>
* Copyright (c) 2011, 2014 Ingo Schwarze <schwarze@openbsd.org>
}
tab->htab = htab;
- return(tab);
+ return tab;
}
int
const struct ln *ln;
ln = find(arg, p, sz);
- return(ln != NULL ? ln->unicode : sz == 1 ? (unsigned char)*p : -1);
+ return ln != NULL ? ln->unicode : sz == 1 ? (unsigned char)*p : -1;
}
int
int i;
i = mandoc_strntoi(p, sz, 10);
- return(i >= 0 && i < 256 ? i : -1);
+ return i >= 0 && i < 256 ? i : -1;
}
int
i = mandoc_strntoi(p, sz, 16);
assert(i >= 0 && i <= 0x10FFFF);
- return(i);
+ return i;
}
const char *
ln = find(arg, p, sz);
if (ln == NULL) {
*rsz = 1;
- return(sz == 1 ? p : NULL);
+ return sz == 1 ? p : NULL;
}
*rsz = strlen(ln->ascii);
- return(ln->ascii);
+ return ln->ascii;
}
const char *
for (i = 0; i < LINES_MAX; i++)
if (uc == lines[i].unicode)
- return(lines[i].ascii);
- return("<?>");
+ return lines[i].ascii;
+ return "<?>";
}
static const struct ln *
assert(p);
if (0 == sz || p[0] < PRINT_LO || p[0] > PRINT_HI)
- return(NULL);
+ return NULL;
hash = (int)p[0] - PRINT_LO;
for (pp = tab->htab[hash]; pp; pp = pp->next)
if (0 == strncmp(pp->code, p, sz) &&
'\0' == pp->code[(int)sz])
- return(pp);
+ return pp;
- return(NULL);
+ return NULL;
}
-/* $OpenBSD: eqn.c,v 1.21 2015/03/03 22:22:20 bentley Exp $ */
+/* $OpenBSD: eqn.c,v 1.22 2015/10/06 18:30:43 schwarze Exp $ */
/*
* Copyright (c) 2011, 2014 Kristaps Dzonsons <kristaps@bsd.lv>
* Copyright (c) 2014, 2015 Ingo Schwarze <schwarze@openbsd.org>
while (' ' == *p || '\t' == *p)
p++;
if ('\0' == *p)
- return(er);
+ return er;
mandoc_vmsg(MANDOCERR_ARG_SKIP, ep->parse,
ln, pos, "EN %s", p);
- return(er);
+ return er;
}
/*
ep->sz += sz;
strlcat(ep->data, p + pos, ep->sz + 1);
strlcat(ep->data, " ", ep->sz + 1);
- return(ROFF_IGN);
+ return ROFF_IGN;
}
struct eqn_node *
p->eqn.pos = pos;
p->gsize = EQN_DEFSIZE;
- return(p);
+ return p;
}
/*
for (i = 0; i < (int)ep->defsz; i++)
if (ep->defs[i].keysz && STRNEQ(ep->defs[i].key,
ep->defs[i].keysz, key, sz))
- return(&ep->defs[i]);
+ return &ep->defs[i];
- return(NULL);
+ return NULL;
}
/*
if (lim >= EQN_NEST_MAX) {
mandoc_msg(MANDOCERR_ROFFLOOP, ep->parse,
ep->eqn.ln, ep->eqn.pos, NULL);
- return(NULL);
+ return NULL;
}
ep->cur = ep->rew;
q = 0;
if ('\0' == *start)
- return(NULL);
+ return NULL;
if (quote == *start) {
ep->cur++;
/* Quotes aren't expanded for values. */
if (q || ! repl)
- return(start);
+ return start;
if (NULL != (def = eqn_def_find(ep, start, *sz))) {
diff = def->valsz - *sz;
goto again;
}
- return(start);
+ return start;
}
/*
eqn_nexttok(struct eqn_node *ep, size_t *sz)
{
- return(eqn_next(ep, '"', sz, 1));
+ return eqn_next(ep, '"', sz, 1);
}
/*
eqn_nextrawtok(struct eqn_node *ep, size_t *sz)
{
- return(eqn_next(ep, '"', sz, 0));
+ return eqn_next(ep, '"', sz, 0);
}
/*
quoted = ep->data[ep->cur] == '"';
if (NULL == (start = eqn_nexttok(ep, &sz)))
- return(EQN_TOK_EOF);
+ return EQN_TOK_EOF;
if (quoted) {
if (p != NULL)
*p = mandoc_strndup(start, sz);
- return(EQN_TOK__MAX);
+ return EQN_TOK__MAX;
}
for (i = 0; i < EQN_TOK__MAX; i++) {
if (i == EQN_TOK__MAX && NULL != p)
*p = mandoc_strndup(start, sz);
- return(i);
+ return i;
}
static void
parent->first = bp;
parent->last = bp;
- return(bp);
+ return bp;
}
/*
newb->first = newb->last = b;
newb->first->next = NULL;
b->parent = newb;
- return(newb);
+ return newb;
}
/*
*/
if (ep->data == NULL)
- return(ROFF_IGN);
+ return ROFF_IGN;
next_tok:
tok = eqn_tok_parse(ep, &p);
* End of file!
* TODO: make sure we're not in an open subexpression.
*/
- return(ROFF_EQN);
+ return ROFF_EQN;
default:
assert(tok == EQN_TOK__MAX);
assert(NULL != p);
ep->eqn.root = mandoc_calloc(1, sizeof(struct eqn_box));
ep->eqn.root->expectargs = UINT_MAX;
- return(eqn_parse(ep, ep->eqn.root));
+ return eqn_parse(ep, ep->eqn.root);
}
void
-/* $OpenBSD: html.c,v 1.57 2015/09/26 00:53:15 schwarze Exp $ */
+/* $OpenBSD: html.c,v 1.58 2015/10/06 18:30:43 schwarze Exp $ */
/*
* Copyright (c) 2008-2011, 2014 Kristaps Dzonsons <kristaps@bsd.lv>
* Copyright (c) 2011-2015 Ingo Schwarze <schwarze@openbsd.org>
if (outopts->fragment)
h->oflags |= HTML_FRAGMENT;
- return(h);
+ return h;
}
void
cp++;
switch (mandoc_escape(&cp, NULL, NULL)) {
case ESCAPE_ERROR:
- return(sz);
+ return sz;
case ESCAPE_UNICODE:
/* FALLTHROUGH */
case ESCAPE_NUMBERED:
break;
}
}
- return(sz);
+ return sz;
}
static int
case ASCII_BREAK:
break;
default:
- return(0);
+ return 0;
}
- return(1);
+ return 1;
}
static int
putchar(c);
}
- return(nospace);
+ return nospace;
}
static void
if ((HTML_AUTOCLOSE | HTML_CLRLINE) & htmltags[tag].flags)
putchar('\n');
- return(t);
+ return t;
}
static void
-/* $OpenBSD: main.c,v 1.149 2015/07/28 18:38:05 schwarze Exp $ */
+/* $OpenBSD: main.c,v 1.150 2015/10/06 18:30:43 schwarze Exp $ */
/*
* Copyright (c) 2008-2012 Kristaps Dzonsons <kristaps@bsd.lv>
* Copyright (c) 2010-2012, 2014, 2015 Ingo Schwarze <schwarze@openbsd.org>
if (0 == strncmp(progname, "mandocdb", 8) ||
0 == strncmp(progname, "makewhatis", 10))
- return(mandocdb(argc, argv));
+ return mandocdb(argc, argv);
/* Search options. */
fprintf(stderr,
"%s: -I %s: Bad argument\n",
progname, optarg);
- return((int)MANDOCLEVEL_BADARG);
+ return (int)MANDOCLEVEL_BADARG;
}
if (defos) {
fprintf(stderr,
"%s: -I %s: Duplicate argument\n",
progname, optarg);
- return((int)MANDOCLEVEL_BADARG);
+ return (int)MANDOCLEVEL_BADARG;
}
defos = mandoc_strdup(optarg + 3);
break;
break;
case 'K':
if ( ! koptions(&options, optarg))
- return((int)MANDOCLEVEL_BADARG);
+ return (int)MANDOCLEVEL_BADARG;
break;
case 'k':
search.argmode = ARG_EXPR;
break;
case 'T':
if ( ! toptions(&curp, optarg))
- return((int)MANDOCLEVEL_BADARG);
+ return (int)MANDOCLEVEL_BADARG;
break;
case 'W':
if ( ! woptions(&curp, optarg))
- return((int)MANDOCLEVEL_BADARG);
+ return (int)MANDOCLEVEL_BADARG;
break;
case 'w':
outmode = OUTMODE_FLN;
/* mandoc(1) */
if (search.argmode == ARG_FILE && ! moptions(&options, auxpaths))
- return((int)MANDOCLEVEL_BADARG);
+ return (int)MANDOCLEVEL_BADARG;
if (use_pager && ! isatty(STDOUT_FILENO))
use_pager = 0;
tag_unlink();
}
- return((int)rc);
+ return (int)rc;
}
static void
file = mandoc_strdup(*globinfo.gl_pathv);
globfree(&globinfo);
if (globres != 0)
- return(0);
+ return 0;
found:
fprintf(stderr, "%s: outdated mandoc.db lacks %s(%s) entry, run "
page->bits = NAME_FILE & NAME_MASK;
page->sec = (*sec >= '1' && *sec <= '9') ? *sec - '1' + 1 : 10;
page->form = form;
- return(1);
+ return 1;
}
static void
} else {
fprintf(stderr, "%s: -K %s: Bad argument\n",
progname, arg);
- return(0);
+ return 0;
}
- return(1);
+ return 1;
}
static int
else {
fprintf(stderr, "%s: -m %s: Bad argument\n",
progname, arg);
- return(0);
+ return 0;
}
- return(1);
+ return 1;
}
static int
else {
fprintf(stderr, "%s: -T %s: Bad argument\n",
progname, arg);
- return(0);
+ return 0;
}
- return(1);
+ return 1;
}
static int
default:
fprintf(stderr, "%s: -W %s: Bad argument\n",
progname, o);
- return(0);
+ return 0;
}
}
- return(1);
+ return 1;
}
static void
case 0:
break;
default:
- return(pager_pid);
+ return pager_pid;
}
/* The child process becomes the pager. */
-/* $OpenBSD: man.c,v 1.112 2015/09/04 21:24:26 schwarze Exp $ */
+/* $OpenBSD: man.c,v 1.113 2015/10/06 18:30:43 schwarze Exp $ */
/*
* Copyright (c) 2008, 2009, 2010, 2011 Kristaps Dzonsons <kristaps@bsd.lv>
* Copyright (c) 2013, 2014, 2015 Ingo Schwarze <schwarze@openbsd.org>
if (man->last->type != ROFFT_EQN || ln > man->last->line)
man->flags |= MAN_NEWLINE;
- return (roff_getcontrol(man->roff, buf, &offs) ?
+ return roff_getcontrol(man->roff, buf, &offs) ?
man_pmacro(man, ln, buf, offs) :
- man_ptext(man, ln, buf, offs));
+ man_ptext(man, ln, buf, offs);
}
static void
if (man->flags & MAN_LITERAL) {
roff_word_alloc(man, line, offs, buf + offs);
man_descope(man, line, offs);
- return(1);
+ return 1;
}
for (i = offs; buf[i] == ' '; i++)
roff_elem_alloc(man, line, offs, MAN_sp);
man->next = ROFF_NEXT_SIBLING;
}
- return(1);
+ return 1;
}
/*
man->last->flags |= MAN_EOS;
man_descope(man, line, offs);
- return(1);
+ return 1;
}
static int
if (tok == TOKEN_NONE) {
mandoc_msg(MANDOCERR_MACRO, man->parse,
ln, ppos, buf + ppos - 1);
- return(1);
+ return 1;
}
/* Skip a leading escape sequence or tab. */
n = man->last;
if (n->type == ROFFT_BODY &&
strcmp(n->prev->child->string, "NAME"))
- return(2);
+ return 2;
}
/*
if ( ! bline || man->flags & MAN_ELINE ||
man_macros[tok].flags & MAN_NSCOPED)
- return(1);
+ return 1;
assert(man->flags & MAN_BLINE);
man->flags &= ~MAN_BLINE;
man_unscope(man, man->last->parent);
roff_body_alloc(man, ln, ppos, man->last->tok);
- return(1);
+ return 1;
}
void
{
assert(man && man->parse);
- return(man->parse);
+ return man->parse;
}
-/* $OpenBSD: man_hash.c,v 1.23 2015/04/19 13:59:37 schwarze Exp $ */
+/* $OpenBSD: man_hash.c,v 1.24 2015/10/06 18:30:43 schwarze Exp $ */
/*
* Copyright (c) 2008, 2009, 2010 Kristaps Dzonsons <kristaps@bsd.lv>
+ * Copyright (c) 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
int tok;
if ('\0' == (x = tmp[0]))
- return(TOKEN_NONE);
+ return TOKEN_NONE;
if ( ! (isalpha((unsigned char)x)))
- return(TOKEN_NONE);
+ return TOKEN_NONE;
HASH_ROW(x);
for (i = 0; i < HASH_DEPTH; i++) {
if (UCHAR_MAX == (y = table[x + i]))
- return(TOKEN_NONE);
+ return TOKEN_NONE;
tok = y;
if (0 == strcmp(tmp, man_macronames[tok]))
- return(tok);
+ return tok;
}
- return(TOKEN_NONE);
+ return TOKEN_NONE;
}
-/* $OpenBSD: man_html.c,v 1.71 2015/09/26 00:53:15 schwarze Exp $ */
+/* $OpenBSD: man_html.c,v 1.72 2015/10/06 18:30:43 schwarze Exp $ */
/*
* Copyright (c) 2008-2012, 2014 Kristaps Dzonsons <kristaps@bsd.lv>
* Copyright (c) 2013, 2014, 2015 Ingo Schwarze <schwarze@openbsd.org>
{
if (n->type != ROFFT_TEXT)
- return(0);
+ return 0;
if (a2roffsu(n->string, su, SCALE_EN))
- return(1);
+ return 1;
- return(0);
+ return 0;
}
static void
/* So the div isn't empty: */
print_text(h, "\\~");
- return(0);
+ return 0;
}
static int
mh->fl &= ~MANH_LITERAL;
PAIR_CLASS_INIT(&tag, "section");
print_otag(h, TAG_DIV, 1, &tag);
- return(1);
+ return 1;
} else if (n->type == ROFFT_BODY)
- return(1);
+ return 1;
print_otag(h, TAG_H1, 0, NULL);
- return(1);
+ return 1;
}
static int
if (savelit)
mh->fl |= MANH_LITERAL;
- return(0);
+ return 0;
}
static int
print_otag(h, TAG_SMALL, 0, NULL);
if (MAN_SB == n->tok)
print_otag(h, TAG_B, 0, NULL);
- return(1);
+ return 1;
}
static int
mh->fl &= ~MANH_LITERAL;
PAIR_CLASS_INIT(&tag, "subsection");
print_otag(h, TAG_DIV, 1, &tag);
- return(1);
+ return 1;
} else if (n->type == ROFFT_BODY)
- return(1);
+ return 1;
print_otag(h, TAG_H2, 0, NULL);
- return(1);
+ return 1;
}
static int
{
if (n->type == ROFFT_HEAD)
- return(0);
+ return 0;
else if (n->type == ROFFT_BLOCK)
print_bvspace(h, n);
- return(1);
+ return 1;
}
static int
if (n->type == ROFFT_BODY) {
print_otag(h, TAG_DD, 0, NULL);
- return(1);
+ return 1;
} else if (n->type != ROFFT_HEAD) {
print_otag(h, TAG_DL, 0, NULL);
- return(1);
+ return 1;
}
/* FIXME: width specification. */
}
}
- return(0);
+ return 0;
}
static int
const struct roff_node *np;
if (n->type == ROFFT_HEAD)
- return(0);
+ return 0;
else if (n->type != ROFFT_BLOCK)
- return(1);
+ return 1;
np = n->head->child;
PAIR_STYLE_INIT(&tag[0], h);
PAIR_CLASS_INIT(&tag[1], "spacer");
print_otag(h, TAG_DIV, 2, tag);
- return(1);
+ return 1;
}
static int
print_stagq(h, tt);
h->flags |= HTML_NOSPACE;
print_text(h, "]");
- return(0);
+ return 0;
}
static int
{
print_otag(h, TAG_B, 0, NULL);
- return(1);
+ return 1;
}
static int
{
print_otag(h, TAG_I, 0, NULL);
- return(1);
+ return 1;
}
static int
} else
mh->fl |= MANH_LITERAL;
- return(0);
+ return 0;
}
static int
{
print_otag(h, TAG_BR, 0, NULL);
- return(0);
+ return 0;
}
static int
man_ign_pre(MAN_ARGS)
{
- return(0);
+ return 0;
}
static int
struct roffsu su;
if (n->type == ROFFT_HEAD)
- return(0);
+ return 0;
else if (n->type == ROFFT_BODY)
- return(1);
+ return 1;
SCALE_HS_INIT(&su, INDENT);
if (n->head->child)
bufcat_su(h, "margin-left", &su);
PAIR_STYLE_INIT(&tag, h);
print_otag(h, TAG_DIV, 1, &tag);
- return(1);
+ return 1;
}
static int
print_man_nodelist(man, n->child, mh, h);
- return(0);
+ return 0;
}
-/* $OpenBSD: man_macro.c,v 1.73 2015/09/26 00:53:15 schwarze Exp $ */
+/* $OpenBSD: man_macro.c,v 1.74 2015/10/06 18:30:43 schwarze Exp $ */
/*
* Copyright (c) 2008, 2009, 2010, 2011 Kristaps Dzonsons <kristaps@bsd.lv>
* Copyright (c) 2012, 2013, 2014, 2015 Ingo Schwarze <schwarze@openbsd.org>
assert(' ' != *start);
if ('\0' == *start)
- return(0);
+ return 0;
*v = mandoc_getarg(man->parse, v, line, pos);
- return(1);
+ return 1;
}
-/* $OpenBSD: man_term.c,v 1.137 2015/09/21 13:24:32 schwarze Exp $ */
+/* $OpenBSD: man_term.c,v 1.138 2015/10/06 18:30:43 schwarze Exp $ */
/*
* Copyright (c) 2008-2012 Kristaps Dzonsons <kristaps@bsd.lv>
* Copyright (c) 2010-2015 Ingo Schwarze <schwarze@openbsd.org>
pre_ign(DECL_ARGS)
{
- return(0);
+ return 0;
}
static int
{
term_setwidth(p, n->nchild ? n->child->string : NULL);
- return(0);
+ return 0;
}
static int
{
term_fontrepl(p, TERMFONT_UNDER);
- return(1);
+ return 1;
}
static int
p->flags |= TERMP_NOSPACE;
}
- return(0);
+ return 0;
}
static int
n = n->child;
if (n == NULL) {
mt->pardist = 1;
- return(0);
+ return 0;
}
assert(n->type == ROFFT_TEXT);
if (a2roffsu(n->string, &su, SCALE_VS))
mt->pardist = term_vspan(p, &su);
- return(0);
+ return 0;
}
static int
p->flags |= TERMP_NOSPACE;
}
- return(0);
+ return 0;
}
static int
{
term_fontrepl(p, TERMFONT_BOLD);
- return(1);
+ return 1;
}
static int
term_fontrepl(p, TERMFONT_NONE);
p->flags |= TERMP_NOSPACE;
term_word(p, "]");
- return(0);
+ return 0;
}
static int
if (NULL == n->child) {
term_fontlast(p);
- return(0);
+ return 0;
}
cp = n->child->string;
default:
break;
}
- return(0);
+ return 0;
}
static int
if (NULL == n->child) {
p->offset = mt->offset;
- return(0);
+ return 0;
}
cp = n->child->string;
cp--;
if ( ! a2roffsu(++cp, &su, SCALE_EN))
- return(0);
+ return 0;
v = (term_hspan(p, &su) + 11) / 24;
if (p->offset > SHRT_MAX)
p->offset = term_len(p, p->defindent);
- return(0);
+ return 0;
}
static int
/* FALLTHROUGH */
case MAN_P:
/* FALLTHROUGH */
- return(0);
+ return 0;
default:
break;
}
p->flags &= ~(TERMP_NOBREAK | TERMP_BRIND);
}
- return(0);
+ return 0;
}
static int
switch (n->type) {
case ROFFT_BLOCK:
print_bvspace(p, n, mt->pardist);
- return(1);
+ return 1;
case ROFFT_BODY:
break;
default:
- return(0);
+ return 0;
}
if ( ! (MANT_LITERAL & mt->fl)) {
p->offset = mt->offset;
p->rmargin = mt->offset + len;
- return(1);
+ return 1;
}
static void
break;
}
- return(n->type != ROFFT_HEAD);
+ return n->type != ROFFT_HEAD;
}
static int
print_bvspace(p, n, mt->pardist);
/* FALLTHROUGH */
default:
- return(1);
+ return 1;
}
/* Calculate the offset from the optional second argument. */
if (savelit)
mt->fl |= MANT_LITERAL;
- return(0);
+ return 0;
case ROFFT_BODY:
p->offset = mt->offset + len;
p->rmargin = p->maxrmargin;
break;
}
- return(1);
+ return 1;
}
static void
print_bvspace(p, n, mt->pardist);
/* FALLTHROUGH */
default:
- return(1);
+ return 1;
}
/* Calculate offset. */
if (savelit)
mt->fl |= MANT_LITERAL;
- return(0);
+ return 0;
case ROFFT_BODY:
p->offset = mt->offset + len;
p->rmargin = p->maxrmargin;
break;
}
- return(1);
+ return 1;
}
static void
break;
}
- return(1);
+ return 1;
}
static void
break;
}
- return(1);
+ return 1;
}
static void
switch (n->type) {
case ROFFT_BLOCK:
term_newln(p);
- return(1);
+ return 1;
case ROFFT_HEAD:
- return(0);
+ return 0;
default:
break;
}
mt->lmargincur = mt->lmarginsz;
mt->lmargin[mt->lmargincur] = term_len(p, p->defindent);
- return(1);
+ return 1;
}
static void
pre_UR(DECL_ARGS)
{
- return (n->type != ROFFT_HEAD);
+ return n->type != ROFFT_HEAD;
}
static void
-/* $OpenBSD: mandoc.c,v 1.61 2015/08/29 22:39:59 schwarze Exp $ */
+/* $OpenBSD: mandoc.c,v 1.62 2015/10/06 18:30:43 schwarze Exp $ */
/*
* Copyright (c) 2008-2011, 2014 Kristaps Dzonsons <kristaps@bsd.lv>
* Copyright (c) 2011-2015 Ingo Schwarze <schwarze@openbsd.org>
break;
case 'C':
if ('\'' != **start)
- return(ESCAPE_ERROR);
+ return ESCAPE_ERROR;
*start = ++*end;
gly = ESCAPE_SPECIAL;
term = '\'';
case ',':
/* FALLTHROUGH */
case '/':
- return(ESCAPE_IGNORE);
+ return ESCAPE_IGNORE;
/*
* The \z escape is supposed to output the following
* let us just skip the next character.
*/
case 'z':
- return(ESCAPE_SKIPCHAR);
+ return ESCAPE_SKIPCHAR;
/*
* Handle all triggers matching \X(xy, \Xx, and \X[xxxx], where
/* FALLTHROUGH */
case 'o':
if (**start == '\0')
- return(ESCAPE_ERROR);
+ return ESCAPE_ERROR;
if (gly == ESCAPE_ERROR)
gly = ESCAPE_OVERSTRIKE;
term = **start;
if (strchr(" %&()*+-./0123456789:<=>", **start)) {
if ('\0' != **start)
++*end;
- return(ESCAPE_ERROR);
+ return ESCAPE_ERROR;
}
gly = ESCAPE_IGNORE;
term = **start;
*/
case 'N':
if ('\0' == **start)
- return(ESCAPE_ERROR);
+ return ESCAPE_ERROR;
(*end)++;
if (isdigit((unsigned char)**start)) {
*sz = 1;
- return(ESCAPE_IGNORE);
+ return ESCAPE_IGNORE;
}
(*start)++;
while (isdigit((unsigned char)**end))
*sz = *end - *start;
if ('\0' != **end)
(*end)++;
- return(ESCAPE_NUMBERED);
+ return ESCAPE_NUMBERED;
/*
* Sizes get a special category of their own.
while (**end != term) {
switch (**end) {
case '\0':
- return(ESCAPE_ERROR);
+ return ESCAPE_ERROR;
case '\\':
(*end)++;
if (ESCAPE_ERROR ==
mandoc_escape(end, NULL, NULL))
- return(ESCAPE_ERROR);
+ return ESCAPE_ERROR;
break;
default:
(*end)++;
} else {
assert(*sz > 0);
if ((size_t)*sz > strlen(*start))
- return(ESCAPE_ERROR);
+ return ESCAPE_ERROR;
*end += *sz;
}
break;
}
- return(gly);
+ return gly;
}
/*
if ('\0' == *cp && (white || ' ' == cp[-1]))
mandoc_msg(MANDOCERR_SPACE_EOL, parse, ln, *pos, NULL);
- return(start);
+ return start;
}
static int
pp = strptime(p, fmt, &tm);
if (NULL != pp && '\0' == *pp) {
*t = mktime(&tm);
- return(1);
+ return 1;
}
- return(0);
+ return 0;
}
static char *
tm = localtime(&t);
if (tm == NULL)
- return(NULL);
+ return NULL;
/*
* Reserve space:
if (0 == strftime(p, 4 + 1, "%Y", tm))
goto fail;
- return(buf);
+ return buf;
fail:
free(buf);
- return(NULL);
+ return NULL;
}
char *
t = 0;
}
out = t ? time2a(t) : NULL;
- return(out ? out : mandoc_strdup(in));
+ return out ? out : mandoc_strdup(in);
}
int
int enclosed, found;
if (0 == sz)
- return(0);
+ return 0;
/*
* End-of-sentence recognition must include situations where
found = 1;
break;
default:
- return(found && (!enclosed || isalnum((unsigned char)*q)));
+ return found &&
+ (!enclosed || isalnum((unsigned char)*q));
}
}
- return(found && !enclosed);
+ return found && !enclosed;
}
/*
long v;
if (sz > 31)
- return(-1);
+ return -1;
memcpy(buf, p, sz);
buf[(int)sz] = '\0';
v = strtol(buf, &ep, base);
if (buf[0] == '\0' || *ep != '\0')
- return(-1);
+ return -1;
if (v > INT_MAX)
v = INT_MAX;
if (v < INT_MIN)
v = INT_MIN;
- return((int)v);
+ return (int)v;
}
-/* $OpenBSD: mandoc_aux.c,v 1.4 2014/11/28 19:25:03 schwarze Exp $ */
+/* $OpenBSD: mandoc_aux.c,v 1.5 2015/10/06 18:30:43 schwarze Exp $ */
/*
* Copyright (c) 2009, 2011 Kristaps Dzonsons <kristaps@bsd.lv>
* Copyright (c) 2014 Ingo Schwarze <schwarze@openbsd.org>
perror(NULL);
exit((int)MANDOCLEVEL_SYSERR);
}
- return(ret);
+ return ret;
}
void *
perror(NULL);
exit((int)MANDOCLEVEL_SYSERR);
}
- return(ptr);
+ return ptr;
}
void *
perror(NULL);
exit((int)MANDOCLEVEL_SYSERR);
}
- return(ptr);
+ return ptr;
}
void *
perror(NULL);
exit((int)MANDOCLEVEL_SYSERR);
}
- return(ptr);
+ return ptr;
}
void *
perror(NULL);
exit((int)MANDOCLEVEL_SYSERR);
}
- return(ptr);
+ return ptr;
}
char *
perror(NULL);
exit((int)MANDOCLEVEL_SYSERR);
}
- return(p);
+ return p;
}
char *
p = mandoc_malloc(sz + 1);
memcpy(p, ptr, sz);
p[(int)sz] = '\0';
- return(p);
+ return p;
}
-/* $OpenBSD: mandocdb.c,v 1.149 2015/09/16 09:49:48 schwarze Exp $ */
+/* $OpenBSD: mandocdb.c,v 1.150 2015/10/06 18:30:43 schwarze Exp $ */
/*
* Copyright (c) 2011, 2012 Kristaps Dzonsons <kristaps@bsd.lv>
* Copyright (c) 2011-2015 Ingo Schwarze <schwarze@openbsd.org>
mpages_free();
ohash_delete(&mpages);
ohash_delete(&mlinks);
- return(exitcode);
+ return exitcode;
usage:
fprintf(stderr, "usage: %s [-aDnpQ] [-C file] [-Tutf8]\n"
" %s [-aDnpQ] [-Tutf8] dir ...\n"
progname, progname, progname,
progname, progname);
- return((int)MANDOCLEVEL_BADARG);
+ return (int)MANDOCLEVEL_BADARG;
}
/*
if (NULL == f) {
exitcode = (int)MANDOCLEVEL_SYSERR;
say("", "&fts_open");
- return(0);
+ return 0;
}
dsec = arch = NULL;
}
fts_close(f);
- return(1);
+ return 1;
}
/*
if (SEC_SYNOPSIS != n->sec ||
NULL == (n = n->child) ||
n->type != ROFFT_TEXT)
- return(0);
+ return 0;
/*
* Only consider those `Fd' macro fields that begin with an
*/
if (strcmp("#include", n->string))
- return(0);
+ return 0;
if ((n = n->next) == NULL || n->type != ROFFT_TEXT)
- return(0);
+ return 0;
/*
* Strip away the enclosing angle brackets and make sure we're
start++;
if (0 == (sz = strlen(start)))
- return(0);
+ return 0;
end = &start[(int)sz - 1];
if ('>' == *end || '"' == *end)
if (end > start)
putkeys(mpage, start, end - start + 1, TYPE_In);
- return(0);
+ return 0;
}
static void
{
if (n->child == NULL)
- return(0);
+ return 0;
parse_mdoc_fname(mpage, n->child);
if (n->type == ROFFT_TEXT)
putkey(mpage, n->string, TYPE_Fa);
- return(0);
+ return 0;
}
static int
{
if (n->type != ROFFT_HEAD)
- return(1);
+ return 1;
if (n->child != NULL)
parse_mdoc_fname(mpage, n->child);
- return(0);
+ return 0;
}
static int
char *cp;
if (NULL == (n = n->child))
- return(0);
+ return 0;
if (NULL == n->next) {
putkey(mpage, n->string, TYPE_Xr);
- return(0);
+ return 0;
}
mandoc_asprintf(&cp, "%s(%s)", n->string, n->next->string);
putkey(mpage, cp, TYPE_Xr);
free(cp);
- return(0);
+ return 0;
}
static int
if (n->type == ROFFT_BODY)
deroff(&mpage->desc, n);
- return(0);
+ return 0;
}
static int
putkey(mpage, n->child->string, ROFFT_HEAD);
mpage->name_head_done = 1;
}
- return(0);
+ return 0;
}
static int
const struct roff_node *n)
{
- return(n->sec == SEC_CUSTOM && n->type == ROFFT_HEAD);
+ return n->sec == SEC_CUSTOM && n->type == ROFFT_HEAD;
}
static int
const struct roff_node *n)
{
- return(n->type == ROFFT_HEAD);
+ return n->type == ROFFT_HEAD;
}
static int
const struct roff_node *n)
{
- return(n->type == ROFFT_BODY);
+ return n->type == ROFFT_BODY;
}
/*
out[4] = (cp >> 6 & 63) | 128;
out[5] = (cp & 63) | 128;
} else
- return(0);
+ return 0;
out[rc] = '\0';
- return(rc);
+ return rc;
}
/*
--*psz;
if (dst != NULL) {
(*public)[*psz] = '\0';
- return(1);
+ return 1;
} else
- return(0);
+ return 0;
}
static void
int rc, ofl;
if (nodb)
- return(1);
+ return 1;
*tempfilename = '\0';
ofl = SQLITE_OPEN_READWRITE;
exitcode = (int)MANDOCLEVEL_SYSERR;
if (SQLITE_CANTOPEN != rc)
say(MANDOC_DB, "%s", sqlite3_errstr(rc));
- return(0);
+ return 0;
}
goto prepare_statements;
}
if (MPARSE_QUICK & mparse_options) {
exitcode = (int)MANDOCLEVEL_SYSERR;
say(MANDOC_DB "~", "%s", sqlite3_errstr(rc));
- return(0);
+ return 0;
}
(void)strlcpy(tempfilename, "/tmp/mandocdb.XXXXXX",
if (NULL == mkdtemp(tempfilename)) {
exitcode = (int)MANDOCLEVEL_SYSERR;
say("", "&%s", tempfilename);
- return(0);
+ return 0;
}
(void)strlcat(tempfilename, "/" MANDOC_DB,
sizeof(tempfilename));
if (SQLITE_OK != rc) {
exitcode = (int)MANDOCLEVEL_SYSERR;
say("", "%s: %s", tempfilename, sqlite3_errstr(rc));
- return(0);
+ return 0;
}
create_tables:
exitcode = (int)MANDOCLEVEL_SYSERR;
say(MANDOC_DB, "%s", sqlite3_errmsg(db));
sqlite3_close(db);
- return(0);
+ return 0;
}
prepare_statements:
say(MANDOC_DB, "PRAGMA foreign_keys: %s",
sqlite3_errmsg(db));
sqlite3_close(db);
- return(0);
+ return 0;
}
sql = "DELETE FROM mpages WHERE pageid IN "
say(MANDOC_DB, "PRAGMA synchronous: %s",
sqlite3_errmsg(db));
sqlite3_close(db);
- return(0);
+ return 0;
}
- return(1);
+ return 1;
}
static void *
hash_calloc(size_t n, size_t sz, void *arg)
{
- return(mandoc_calloc(n, sz));
+ return mandoc_calloc(n, sz);
}
static void *
hash_alloc(size_t sz, void *arg)
{
- return(mandoc_malloc(sz));
+ return mandoc_malloc(sz);
}
static void
if (2 == getcwd_status) {
exitcode = (int)MANDOCLEVEL_SYSERR;
say("", "getcwd: %s", startdir);
- return(0);
+ return 0;
}
if (-1 == chdir(startdir)) {
exitcode = (int)MANDOCLEVEL_SYSERR;
say("", "&chdir %s", startdir);
- return(0);
+ return 0;
}
}
exitcode = (int)MANDOCLEVEL_BADARG;
say("", "&%s: realpath", targetdir);
}
- return(0);
+ return 0;
} else if (-1 == chdir(basedir)) {
if (report_baddir || errno != ENOENT) {
exitcode = (int)MANDOCLEVEL_BADARG;
say("", "&chdir");
}
- return(0);
+ return 0;
}
chdir_status = 1;
cp = strchr(basedir, '\0');
if (cp - basedir >= PATH_MAX - 1) {
exitcode = (int)MANDOCLEVEL_SYSERR;
say("", "Filename too long");
- return(0);
+ return 0;
}
*cp++ = '/';
*cp = '\0';
}
- return(1);
+ return 1;
}
static void
-/* $OpenBSD: mansearch.c,v 1.44 2015/04/01 12:48:00 schwarze Exp $ */
+/* $OpenBSD: mansearch.c,v 1.45 2015/10/06 18:30:44 schwarze Exp $ */
/*
* Copyright (c) 2012 Kristaps Dzonsons <kristaps@bsd.lv>
* Copyright (c) 2013, 2014, 2015 Ingo Schwarze <schwarze@openbsd.org>
if (start) {
if (NULL != pagecache) {
fprintf(stderr, "pagecache already enabled\n");
- return((int)MANDOCLEVEL_BADARG);
+ return (int)MANDOCLEVEL_BADARG;
}
pagecache = mmap(NULL, PC_PAGESIZE * PC_NUMPAGES,
if (MAP_FAILED == pagecache) {
perror("mmap");
pagecache = NULL;
- return((int)MANDOCLEVEL_SYSERR);
+ return (int)MANDOCLEVEL_SYSERR;
}
c = sqlite3_config(SQLITE_CONFIG_PAGECACHE,
pagecache, PC_PAGESIZE, PC_NUMPAGES);
if (SQLITE_OK == c)
- return((int)MANDOCLEVEL_OK);
+ return (int)MANDOCLEVEL_OK;
fprintf(stderr, "pagecache: %s\n", sqlite3_errstr(c));
} else if (NULL == pagecache) {
fprintf(stderr, "pagecache missing\n");
- return((int)MANDOCLEVEL_BADARG);
+ return (int)MANDOCLEVEL_BADARG;
}
if (-1 == munmap(pagecache, PC_PAGESIZE * PC_NUMPAGES)) {
perror("munmap");
pagecache = NULL;
- return((int)MANDOCLEVEL_SYSERR);
+ return (int)MANDOCLEVEL_SYSERR;
}
pagecache = NULL;
- return((int)MANDOCLEVEL_OK);
+ return (int)MANDOCLEVEL_OK;
}
int
if (argc == 0 || (e = exprcomp(search, argc, argv)) == NULL) {
*sz = 0;
- return(0);
+ return 0;
}
info.calloc = hash_calloc;
exprfree(e);
free(sql);
*sz = cur;
- return(1);
+ return 1;
}
void
mp1 = vp1;
mp2 = vp2;
- return( (diff = mp2->bits - mp1->bits) ? diff :
- (diff = mp1->sec - mp2->sec) ? diff :
- strcasecmp(mp1->names, mp2->names));
+ return (diff = mp2->bits - mp1->bits) ? diff :
+ (diff = mp1->sec - mp2->sec) ? diff :
+ strcasecmp(mp1->names, mp2->names);
}
static void
if (SQLITE_DONE != c)
fprintf(stderr, "%s\n", sqlite3_errmsg(db));
sqlite3_reset(s);
- return(output);
+ return output;
}
/*
needop = 1;
}
- return(sql);
+ return sql;
}
/*
toopen = logic = igncase = 0;
}
if ( ! (toopen || logic || igncase || toclose))
- return(first);
+ return first;
fail:
if (NULL != first)
exprfree(first);
- return(NULL);
+ return NULL;
}
static struct expr *
int i, irc;
if ('\0' == *buf)
- return(NULL);
+ return NULL;
e = mandoc_calloc(1, sizeof(struct expr));
e->bits = TYPE_Nm;
e->substr = buf;
e->equal = 1;
- return(e);
+ return e;
}
/*
regerror(irc, &e->regexp, errbuf, sizeof(errbuf));
fprintf(stderr, "regcomp: %s\n", errbuf);
free(e);
- return(NULL);
+ return NULL;
}
}
if (e->bits)
- return(e);
+ return e;
/*
* Parse out all possible fields.
if (i == mansearch_keymax) {
if (strcasecmp(key, "any")) {
free(e);
- return(NULL);
+ return NULL;
}
e->bits |= ~0ULL;
}
}
- return(e);
+ return e;
}
static void
hash_calloc(size_t nmemb, size_t sz, void *arg)
{
- return(mandoc_calloc(nmemb, sz));
+ return mandoc_calloc(nmemb, sz);
}
static void *
hash_alloc(size_t sz, void *arg)
{
- return(mandoc_malloc(sz));
+ return mandoc_malloc(sz);
}
static void
-/* $OpenBSD: mdoc.c,v 1.141 2015/04/23 16:17:04 schwarze Exp $ */
+/* $OpenBSD: mdoc.c,v 1.142 2015/10/06 18:30:44 schwarze Exp $ */
/*
* Copyright (c) 2008, 2009, 2010, 2011 Kristaps Dzonsons <kristaps@bsd.lv>
* Copyright (c) 2010, 2012-2015 Ingo Schwarze <schwarze@openbsd.org>
else
mdoc->flags &= ~MDOC_SYNOPSIS;
- return(roff_getcontrol(mdoc->roff, buf, &offs) ?
+ return roff_getcontrol(mdoc->roff, buf, &offs) ?
mdoc_pmacro(mdoc, ln, buf, offs) :
- mdoc_ptext(mdoc, ln, buf, offs));
+ mdoc_ptext(mdoc, ln, buf, offs);
}
void
p->end = end;
roff_node_append(mdoc, p);
mdoc->next = ROFF_NEXT_SIBLING;
- return(p);
+ return p;
}
struct roff_node *
}
roff_node_append(mdoc, p);
mdoc->next = ROFF_NEXT_CHILD;
- return(p);
+ return p;
}
void
/* `Bl' is open without any children. */
mdoc->flags |= MDOC_FREECOL;
mdoc_macro(mdoc, MDOC_It, line, offs, &offs, buf);
- return(1);
+ return 1;
}
if (n->tok == MDOC_It && n->type == ROFFT_BLOCK &&
/* `Bl' has block-level `It' children. */
mdoc->flags |= MDOC_FREECOL;
mdoc_macro(mdoc, MDOC_It, line, offs, &offs, buf);
- return(1);
+ return 1;
}
/*
roff_elem_alloc(mdoc, line, offs, MDOC_sp);
mdoc->next = ROFF_NEXT_SIBLING;
mdoc_valid_post(mdoc);
- return(1);
+ return 1;
}
roff_word_alloc(mdoc, line, offs, buf+offs);
if (mdoc->flags & MDOC_LITERAL)
- return(1);
+ return 1;
/*
* End-of-sentence check. If the last character is an unescaped
if (mandoc_eos(buf+offs, (size_t)(end-buf-offs)))
mdoc->last->flags |= MDOC_EOS;
- return(1);
+ return 1;
}
/*
if (tok == TOKEN_NONE) {
mandoc_msg(MANDOCERR_MACRO, mdoc->parse,
ln, sv, buf + sv - 1);
- return(1);
+ return 1;
}
/* Skip a leading escape sequence or tab. */
if (NULL == mdoc->last || MDOC_It == tok || MDOC_El == tok) {
mdoc_macro(mdoc, tok, ln, sv, &offs, buf);
- return(1);
+ return 1;
}
n = mdoc->last;
n->end == ENDBODY_NOT && n->norm->Bl.type == LIST_column) {
mdoc->flags |= MDOC_FREECOL;
mdoc_macro(mdoc, MDOC_It, ln, sv, &sv, buf);
- return(1);
+ return 1;
}
/*
LIST_column == n->parent->norm->Bl.type) {
mdoc->flags |= MDOC_FREECOL;
mdoc_macro(mdoc, MDOC_It, ln, sv, &sv, buf);
- return(1);
+ return 1;
}
/* Normal processing of a macro. */
if (mdoc->quick && MDOC_Sh == tok &&
SEC_NAME != mdoc->last->sec)
- return(2);
+ return 2;
- return(1);
+ return 1;
}
enum mdelim
{
if ('\0' == p[0])
- return(DELIM_NONE);
+ return DELIM_NONE;
if ('\0' == p[1])
switch (p[0]) {
case '(':
/* FALLTHROUGH */
case '[':
- return(DELIM_OPEN);
+ return DELIM_OPEN;
case '|':
- return(DELIM_MIDDLE);
+ return DELIM_MIDDLE;
case '.':
/* FALLTHROUGH */
case ',':
case ')':
/* FALLTHROUGH */
case ']':
- return(DELIM_CLOSE);
+ return DELIM_CLOSE;
default:
- return(DELIM_NONE);
+ return DELIM_NONE;
}
if ('\\' != p[0])
- return(DELIM_NONE);
+ return DELIM_NONE;
if (0 == strcmp(p + 1, "."))
- return(DELIM_CLOSE);
+ return DELIM_CLOSE;
if (0 == strcmp(p + 1, "fR|\\fP"))
- return(DELIM_MIDDLE);
+ return DELIM_MIDDLE;
- return(DELIM_NONE);
+ return DELIM_NONE;
}
-/* $OpenBSD: mdoc_argv.c,v 1.60 2015/04/19 13:59:37 schwarze Exp $ */
+/* $OpenBSD: mdoc_argv.c,v 1.61 2015/10/06 18:30:44 schwarze Exp $ */
/*
* Copyright (c) 2008, 2009, 2010, 2011 Kristaps Dzonsons <kristaps@bsd.lv>
* Copyright (c) 2012, 2014, 2015 Ingo Schwarze <schwarze@openbsd.org>
v = &v_local;
fl = tok == TOKEN_NONE ? ARGSFL_NONE : mdocargs[tok].flags;
if (tok != MDOC_It)
- return(args(mdoc, line, pos, buf, fl, v));
+ return args(mdoc, line, pos, buf, fl, v);
/*
* We know that we're in an `It', so it's reasonable to expect
break;
}
- return(args(mdoc, line, pos, buf, fl, v));
+ return args(mdoc, line, pos, buf, fl, v);
}
static enum margserr
if ('\0' == buf[*pos]) {
if (MDOC_PPHRASE & mdoc->flags)
- return(ARGS_EOLN);
+ return ARGS_EOLN;
/*
* If we're not in a partial phrase and the flag for
* being a phrase literal is still set, the punctuation
mdoc->parse, line, *pos, NULL);
mdoc->flags &= ~MDOC_PHRASELIT;
- return(ARGS_EOLN);
+ return ARGS_EOLN;
}
*v = &buf[*pos];
if (ARGSFL_DELIM == fl)
if (args_checkpunct(buf, *pos))
- return(ARGS_PUNCT);
+ return ARGS_PUNCT;
/*
* First handle TABSEP items, restricted to `Bl -column'. This
for (pp = &buf[*pos]; ' ' == *pp; pp++, (*pos)++)
/* Skip ahead. */ ;
- return(rc);
+ return rc;
}
/*
if ('\0' == buf[*pos]) {
if (MDOC_PPHRASE & mdoc->flags)
- return(ARGS_QWORD);
+ return ARGS_QWORD;
mandoc_msg(MANDOCERR_ARG_QUOTE,
mdoc->parse, line, *pos, NULL);
- return(ARGS_QWORD);
+ return ARGS_QWORD;
}
mdoc->flags &= ~MDOC_PHRASELIT;
buf[(*pos)++] = '\0';
if ('\0' == buf[*pos])
- return(ARGS_QWORD);
+ return ARGS_QWORD;
while (' ' == buf[*pos])
(*pos)++;
mandoc_msg(MANDOCERR_SPACE_EOL, mdoc->parse,
line, *pos, NULL);
- return(ARGS_QWORD);
+ return ARGS_QWORD;
}
p = &buf[*pos];
*v = mandoc_getarg(mdoc->parse, &p, line, pos);
- return(ARGS_WORD);
+ return ARGS_WORD;
}
/*
dbuf[j] = buf[i];
if (DELIMSZ == j)
- return(0);
+ return 0;
dbuf[j] = '\0';
if (DELIM_CLOSE != mdoc_isdelim(dbuf))
- return(0);
+ return 0;
while (' ' == buf[i])
i++;
dbuf[j++] = buf[i++];
if (DELIMSZ == j)
- return(0);
+ return 0;
dbuf[j] = '\0';
d = mdoc_isdelim(dbuf);
if (DELIM_NONE == d || DELIM_OPEN == d)
- return(0);
+ return 0;
while (' ' == buf[i])
i++;
}
- return('\0' == buf[i]);
+ return '\0' == buf[i];
}
static void
-/* $OpenBSD: mdoc_hash.c,v 1.20 2015/04/19 13:59:37 schwarze Exp $ */
+/* $OpenBSD: mdoc_hash.c,v 1.21 2015/10/06 18:30:44 schwarze Exp $ */
/*
* Copyright (c) 2008, 2009 Kristaps Dzonsons <kristaps@bsd.lv>
+ * Copyright (c) 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
int major, i, j;
if (0 == p[0])
- return(TOKEN_NONE);
+ return TOKEN_NONE;
if ( ! isalpha((unsigned char)p[0]) && '%' != p[0])
- return(TOKEN_NONE);
+ return TOKEN_NONE;
if (isalpha((unsigned char)p[1]))
major = 12 * (tolower((unsigned char)p[1]) - 97);
else if ('1' == p[1])
major = 12 * 26;
else
- return(TOKEN_NONE);
+ return TOKEN_NONE;
if (p[2] && p[3])
- return(TOKEN_NONE);
+ return TOKEN_NONE;
for (j = 0; j < 12; j++) {
if (UCHAR_MAX == (i = table[major + j]))
break;
if (0 == strcmp(p, mdoc_macronames[i]))
- return(i);
+ return i;
}
- return(TOKEN_NONE);
+ return TOKEN_NONE;
}
-/* $OpenBSD: mdoc_html.c,v 1.111 2015/09/26 00:53:15 schwarze Exp $ */
+/* $OpenBSD: mdoc_html.c,v 1.112 2015/10/06 18:30:44 schwarze Exp $ */
/*
* Copyright (c) 2008-2011, 2014 Kristaps Dzonsons <kristaps@bsd.lv>
* Copyright (c) 2014, 2015 Ingo Schwarze <schwarze@openbsd.org>
free(title);
free(volume);
- return(1);
+ return 1;
}
static int
case ROFFT_BLOCK:
PAIR_CLASS_INIT(&tag, "section");
print_otag(h, TAG_DIV, 1, &tag);
- return(1);
+ return 1;
case ROFFT_BODY:
if (n->sec == SEC_AUTHORS)
h->flags &= ~(HTML_SPLIT|HTML_NOSPLIT);
- return(1);
+ return 1;
default:
break;
}
} else
print_otag(h, TAG_H1, 0, NULL);
- return(1);
+ return 1;
}
static int
if (n->type == ROFFT_BLOCK) {
PAIR_CLASS_INIT(&tag, "subsection");
print_otag(h, TAG_DIV, 1, &tag);
- return(1);
+ return 1;
} else if (n->type == ROFFT_BODY)
- return(1);
+ return 1;
bufinit(h);
bufcat(h, "x");
} else
print_otag(h, TAG_H2, 0, NULL);
- return(1);
+ return 1;
}
static int
/* `Cm' has no leading hyphen. */
if (MDOC_Cm == n->tok)
- return(1);
+ return 1;
print_text(h, "\\-");
n->next->flags & MDOC_LINE)))
h->flags |= HTML_NOSPACE;
- return(1);
+ return 1;
}
static int
struct htmlpair tag;
if (n->type != ROFFT_BODY)
- return(1);
+ return 1;
/* XXX: this tag in theory can contain block elements. */
print_text(h, "\\(em");
PAIR_CLASS_INIT(&tag, "desc");
print_otag(h, TAG_SPAN, 1, &tag);
- return(1);
+ return 1;
}
static int
print_otag(h, TAG_B, 1, &tag);
if (n->child == NULL && meta->name != NULL)
print_text(h, meta->name);
- return(1);
+ return 1;
case ROFFT_BODY:
print_otag(h, TAG_TD, 0, NULL);
- return(1);
+ return 1;
default:
break;
}
print_otag(h, TAG_COL, 0, NULL);
print_otag(h, TAG_TBODY, 0, NULL);
print_otag(h, TAG_TR, 0, NULL);
- return(1);
+ return 1;
}
static int
struct htmlpair tag[2];
if (NULL == n->child)
- return(0);
+ return 0;
PAIR_CLASS_INIT(&tag[0], "link-man");
print_text(h, n->string);
if (NULL == (n = n->next))
- return(0);
+ return 0;
h->flags |= HTML_NOSPACE;
print_text(h, "(");
print_text(h, n->string);
h->flags |= HTML_NOSPACE;
print_text(h, ")");
- return(0);
+ return 0;
}
static int
if ( ! (MDOC_LINE & n->flags))
h->flags |= HTML_NOSPACE;
- return(1);
+ return 1;
}
static int
PAIR_CLASS_INIT(&tag, "arg");
print_otag(h, TAG_I, 1, &tag);
- return(1);
+ return 1;
}
static int
pp = "UNIX";
break;
default:
- return(1);
+ return 1;
}
PAIR_CLASS_INIT(&tag, "unix");
print_text(h, n->child->string);
h->flags = flags;
}
- return(0);
+ return 0;
}
static int
print_text(h, "BSD");
} else {
print_text(h, "BSD");
- return(0);
+ return 0;
}
if (NULL != (n = n->next)) {
print_text(h, n->string);
}
- return(0);
+ return 0;
}
static int
case LIST_hyphen:
/* FALLTHROUGH */
case LIST_enum:
- return(0);
+ return 0;
case LIST_diag:
/* FALLTHROUGH */
case LIST_hang:
}
}
- return(1);
+ return 1;
}
static int
if (n->type == ROFFT_BODY) {
if (LIST_column == n->norm->Bl.type)
print_otag(h, TAG_TBODY, 0, NULL);
- return(1);
+ return 1;
}
if (n->type == ROFFT_HEAD) {
if (LIST_column != n->norm->Bl.type)
- return(0);
+ return 0;
/*
* For each column, print out the <COL> tag with our
print_otag(h, TAG_COL, 1, tag);
}
- return(0);
+ return 0;
}
SCALE_VS_INIT(&su, 0);
abort();
}
- return(1);
+ return 1;
}
static int
print_text(h, "utility exits\\~0");
print_text(h, "on success, and\\~>0 if an error occurs.");
- return(0);
+ return 0;
}
static int
PAIR_CLASS_INIT(&tag, "emph");
print_otag(h, TAG_SPAN, 1, &tag);
- return(1);
+ return 1;
}
static int
struct roffsu su;
if (n->type != ROFFT_BLOCK)
- return(1);
+ return 1;
SCALE_VS_INIT(&su, 0);
bufinit(h);
print_otag(h, TAG_CODE, 1, tag);
}
- return(1);
+ return 1;
}
static int
print_otag(h, TAG_I, 1, tag);
print_otag(h, TAG_A, 2, tag);
- return(1);
+ return 1;
}
static int
struct roffsu su;
if (n->type == ROFFT_HEAD)
- return(0);
+ return 0;
if (n->type == ROFFT_BLOCK) {
comp = n->norm->Bd.comp;
}
if ( ! comp)
print_paragraph(h);
- return(1);
+ return 1;
}
/* Handle the -offset argument. */
DISP_literal != n->norm->Bd.type) {
PAIR_CLASS_INIT(&tag[1], "display");
print_otag(h, TAG_DIV, 2, tag);
- return(1);
+ return 1;
}
PAIR_CLASS_INIT(&tag[1], "lit display");
if (0 == sv)
h->flags &= ~HTML_LITERAL;
- return(0);
+ return 0;
}
static int
PAIR_CLASS_INIT(&tag, "file");
print_otag(h, TAG_I, 1, &tag);
- return(1);
+ return 1;
}
static int
PAIR_CLASS_INIT(&tag, "addr");
print_otag(h, TAG_I, 1, &tag);
- return(1);
+ return 1;
}
static int
if (n->norm->An.auth == AUTH_split) {
h->flags &= ~HTML_NOSPLIT;
h->flags |= HTML_SPLIT;
- return(0);
+ return 0;
}
if (n->norm->An.auth == AUTH_nosplit) {
h->flags &= ~HTML_SPLIT;
h->flags |= HTML_NOSPLIT;
- return(0);
+ return 0;
}
if (h->flags & HTML_SPLIT)
PAIR_CLASS_INIT(&tag, "author");
print_otag(h, TAG_SPAN, 1, &tag);
- return(1);
+ return 1;
}
static int
synopsis_pre(h, n);
PAIR_CLASS_INIT(&tag, "config");
print_otag(h, TAG_B, 1, &tag);
- return(1);
+ return 1;
}
static int
PAIR_CLASS_INIT(&tag, "define");
print_otag(h, TAG_SPAN, 1, &tag);
- return(1);
+ return 1;
}
static int
PAIR_CLASS_INIT(&tag, "env");
print_otag(h, TAG_SPAN, 1, &tag);
- return(1);
+ return 1;
}
static int
PAIR_CLASS_INIT(&tag, "errno");
print_otag(h, TAG_SPAN, 1, &tag);
- return(1);
+ return 1;
}
static int
PAIR_CLASS_INIT(&tag, "farg");
if (n->parent->tok != MDOC_Fo) {
print_otag(h, TAG_I, 1, &tag);
- return(1);
+ return 1;
}
for (nn = n->child; nn; nn = nn->next) {
print_text(h, ",");
}
- return(0);
+ return 0;
}
static int
synopsis_pre(h, n);
if (NULL == (n = n->child))
- return(0);
+ return 0;
assert(n->type == ROFFT_TEXT);
if (strcmp(n->string, "#include")) {
PAIR_CLASS_INIT(&tag[0], "macro");
print_otag(h, TAG_B, 1, tag);
- return(1);
+ return 1;
}
PAIR_CLASS_INIT(&tag[0], "includes");
print_text(h, n->string);
}
- return(0);
+ return 0;
}
static int
if (n->type == ROFFT_BLOCK) {
synopsis_pre(h, n);
- return(1);
+ return 1;
} else if (n->type == ROFFT_ELEM) {
synopsis_pre(h, n);
} else if (n->type == ROFFT_HEAD)
- return(0);
+ return 0;
PAIR_CLASS_INIT(&tag, "type");
print_otag(h, TAG_SPAN, 1, &tag);
- return(1);
+ return 1;
}
static int
synopsis_pre(h, n);
PAIR_CLASS_INIT(&tag, "ftype");
print_otag(h, TAG_I, 1, &tag);
- return(1);
+ return 1;
}
static int
print_text(h, ";");
}
- return(0);
+ return 0;
}
static int
if ( ! (HTML_NONOSPACE & h->flags))
h->flags &= ~HTML_NOSPACE;
- return(0);
+ return 0;
}
static int
mdoc_skip_pre(MDOC_ARGS)
{
- return(0);
+ return 0;
}
static int
{
print_paragraph(h);
- return(0);
+ return 0;
}
static int
/* So the div isn't empty: */
print_text(h, "\\~");
- return(0);
+ return 0;
}
struct htmlpair tag[2];
if (NULL == (n = n->child))
- return(0);
+ return 0;
assert(n->type == ROFFT_TEXT);
for (n = n->next; n; n = n->next)
print_text(h, n->string);
- return(0);
+ return 0;
}
static int
print_tagq(h, t);
}
- return(0);
+ return 0;
}
static int
h->flags |= HTML_NOSPACE;
print_text(h, "(");
h->flags |= HTML_NOSPACE;
- return(1);
+ return 1;
} else if (n->type == ROFFT_BLOCK) {
synopsis_pre(h, n);
- return(1);
+ return 1;
}
if (n->child == NULL)
- return(0);
+ return 0;
assert(n->child->string);
PAIR_CLASS_INIT(&tag, "fname");
t = print_otag(h, TAG_B, 1, &tag);
print_text(h, n->child->string);
print_tagq(h, t);
- return(0);
+ return 0;
}
static void
print_text(h, n->string);
}
- return(0);
+ return 0;
}
static int
PAIR_CLASS_INIT(&tag, "cmd");
print_otag(h, TAG_B, 1, &tag);
- return(1);
+ return 1;
}
static int
print_text(h, "errno");
print_tagq(h, t);
print_text(h, "is set to indicate the error.");
- return(0);
+ return 0;
}
static int
PAIR_CLASS_INIT(&tag, "var");
print_otag(h, TAG_B, 1, &tag);
- return(1);
+ return 1;
}
static int
h->flags |= HTML_NOSPACE;
print_text(h, "\\(aq");
h->flags |= HTML_NOSPACE;
- return(1);
+ return 1;
}
static int
struct roffsu su;
if (n->type == ROFFT_HEAD)
- return(0);
+ return 0;
else if (n->type != ROFFT_BODY)
- return(1);
+ return 1;
if (FONT_Em == n->norm->Bf.font)
PAIR_CLASS_INIT(&tag[0], "emph");
bufcat_su(h, "margin-left", &su);
PAIR_STYLE_INIT(&tag[1], h);
print_otag(h, TAG_DIV, 2, tag);
- return(1);
+ return 1;
}
static int
PAIR_CLASS_INIT(&tag, "symb");
print_otag(h, TAG_SPAN, 1, &tag);
- return(1);
+ return 1;
}
static int
{
h->flags |= HTML_IGNDELIM;
- return(1);
+ return 1;
}
static void
struct htmlpair tag;
if (n->type != ROFFT_BLOCK)
- return(1);
+ return 1;
if (n->prev && SEC_SEE_ALSO == n->sec)
print_paragraph(h);
PAIR_CLASS_INIT(&tag, "ref");
print_otag(h, TAG_SPAN, 1, &tag);
- return(1);
+ return 1;
}
static int
PAIR_CLASS_INIT(&tag, "none");
print_otag(h, TAG_CODE, 1, &tag);
- return(1);
+ return 1;
}
static int
PAIR_CLASS_INIT(&tag, "lit");
print_otag(h, TAG_CODE, 1, &tag);
- return(1);
+ return 1;
}
static int
PAIR_CLASS_INIT(&tag, "symb");
print_otag(h, TAG_SPAN, 1, &tag);
- return(1);
+ return 1;
}
static int
{
print_text(h, "is currently in beta test.");
- return(0);
+ return 0;
}
static int
{
print_text(h, "currently under development.");
- return(0);
+ return 0;
}
static int
PAIR_CLASS_INIT(&tag, "lib");
print_otag(h, TAG_SPAN, 1, &tag);
- return(1);
+ return 1;
}
static int
if (MDOC__U != n->tok) {
print_otag(h, t, 1, tag);
- return(1);
+ return 1;
}
PAIR_HREF_INIT(&tag[1], n->child->string);
print_otag(h, TAG_A, 2, tag);
- return(1);
+ return 1;
}
static void
case ROFFT_BLOCK:
break;
case ROFFT_HEAD:
- return(0);
+ return 0;
case ROFFT_BODY:
if (n->parent->args || 0 == n->prev->nchild)
h->flags |= HTML_PREKEEP;
abort();
}
- return(1);
+ return 1;
}
static void
struct htmlpair tag;
if (n->type != ROFFT_BODY)
- return(1);
+ return 1;
switch (n->tok) {
case MDOC_Ao:
case MDOC_En:
if (NULL == n->norm->Es ||
NULL == n->norm->Es->child)
- return(1);
+ return 1;
print_text(h, n->norm->Es->child->string);
break;
case MDOC_Do:
}
h->flags |= HTML_NOSPACE;
- return(1);
+ return 1;
}
static void
{
if (n->type != ROFFT_BODY)
- return(1);
+ return 1;
if (n->end == ENDBODY_NOT &&
n->parent->head->child == NULL &&
n->parent->head->child != NULL && (n->child != NULL ||
(n->parent->tail != NULL && n->parent->tail->child != NULL)))
h->flags |= HTML_NOSPACE;
- return(1);
+ return 1;
}
static void
-/* $OpenBSD: mdoc_macro.c,v 1.157 2015/09/26 00:53:15 schwarze Exp $ */
+/* $OpenBSD: mdoc_macro.c,v 1.158 2015/10/06 18:30:44 schwarze Exp $ */
/*
* Copyright (c) 2008-2012 Kristaps Dzonsons <kristaps@bsd.lv>
* Copyright (c) 2010, 2012-2015 Ingo Schwarze <schwarze@openbsd.org>
res = mdoc_hash_find(p);
if (res != TOKEN_NONE) {
if (mdoc_macros[res].flags & MDOC_CALLABLE)
- return(res);
+ return res;
if (res != MDOC_br && res != MDOC_sp && res != MDOC_ll)
mandoc_msg(MANDOCERR_MACRO_CALL,
mdoc->parse, line, ppos, p);
}
}
- return(TOKEN_NONE);
+ return TOKEN_NONE;
}
/*
{
switch (tok) {
case MDOC_Ac:
- return(MDOC_Ao);
+ return MDOC_Ao;
case MDOC_Bc:
- return(MDOC_Bo);
+ return MDOC_Bo;
case MDOC_Brc:
- return(MDOC_Bro);
+ return MDOC_Bro;
case MDOC_Dc:
- return(MDOC_Do);
+ return MDOC_Do;
case MDOC_Ec:
- return(MDOC_Eo);
+ return MDOC_Eo;
case MDOC_Ed:
- return(MDOC_Bd);
+ return MDOC_Bd;
case MDOC_Ef:
- return(MDOC_Bf);
+ return MDOC_Bf;
case MDOC_Ek:
- return(MDOC_Bk);
+ return MDOC_Bk;
case MDOC_El:
- return(MDOC_Bl);
+ return MDOC_Bl;
case MDOC_Fc:
- return(MDOC_Fo);
+ return MDOC_Fo;
case MDOC_Oc:
- return(MDOC_Oo);
+ return MDOC_Oo;
case MDOC_Pc:
- return(MDOC_Po);
+ return MDOC_Po;
case MDOC_Qc:
- return(MDOC_Qo);
+ return MDOC_Qo;
case MDOC_Re:
- return(MDOC_Rs);
+ return MDOC_Rs;
case MDOC_Sc:
- return(MDOC_So);
+ return MDOC_So;
case MDOC_Xc:
- return(MDOC_Xo);
+ return MDOC_Xo;
default:
- return(tok);
+ return tok;
}
}
}
}
}
- return(irc);
+ return irc;
}
/*
if (ntok == TOKEN_NONE) {
dword(mdoc, line, ppos, p, DELIM_MAX, tok == TOKEN_NONE ||
mdoc_macros[tok].flags & MDOC_JOIN);
- return(0);
+ return 0;
} else {
if (mdoc_macros[tok].fp == in_line_eoln)
rew_elem(mdoc, tok);
mdoc_macro(mdoc, ntok, line, ppos, pos, buf);
if (tok == TOKEN_NONE)
append_delims(mdoc, line, pos, buf);
- return(1);
+ return 1;
}
}
for (;;) {
la = *pos;
if (mdoc_args(mdoc, line, pos, buf, tok, NULL) == ARGS_EOLN)
- return(0);
+ return 0;
if (macro_or_word(mdoc, tok, line, la, pos, buf, 1))
- return(1);
+ return 1;
}
}
-/* $OpenBSD: mdoc_man.c,v 1.91 2015/04/18 17:50:02 schwarze Exp $ */
+/* $OpenBSD: mdoc_man.c,v 1.92 2015/10/06 18:30:44 schwarze Exp $ */
/*
* Copyright (c) 2011-2015 Ingo Schwarze <schwarze@openbsd.org>
*
cond_head(DECL_ARGS)
{
- return(n->type == ROFFT_HEAD);
+ return n->type == ROFFT_HEAD;
}
static int
cond_body(DECL_ARGS)
{
- return(n->type == ROFFT_BODY);
+ return n->type == ROFFT_BODY;
}
static int
prefix = manacts[n->tok].prefix;
if (NULL == prefix)
- return(1);
+ return 1;
print_word(prefix);
outflags &= ~MMAN_spc;
- return(1);
+ return 1;
}
static void
print_word("on success, and\\~>0 if an error occurs.");
outflags |= MMAN_nl;
- return(0);
+ return 0;
}
static void
outflags &= ~MMAN_spc;
} else
font_push('I');
- return(1);
+ return 1;
}
static void
putchar('\"');
outflags &= ~MMAN_spc;
}
- return(1);
+ return 1;
}
/*
case AUTH_split:
outflags &= ~MMAN_An_nosplit;
outflags |= MMAN_An_split;
- return(0);
+ return 0;
case AUTH_nosplit:
outflags &= ~MMAN_An_split;
outflags |= MMAN_An_nosplit;
- return(0);
+ return 0;
default:
if (MMAN_An_split & outflags)
outflags |= MMAN_br;
else if (SEC_AUTHORS == n->sec &&
! (MMAN_An_nosplit & outflags))
outflags |= MMAN_An_split;
- return(1);
+ return 1;
}
}
outflags &= ~MMAN_spc;
print_word("'");
outflags &= ~MMAN_spc;
- return(0);
+ return 0;
}
static int
print_word(n->nchild == 1 &&
n->child->tok == MDOC_Mt ? "<" : "\\(la");
outflags &= ~MMAN_spc;
- return(1);
+ return 1;
}
static void
if (0 == n->norm->Bd.comp && NULL != n->parent->prev)
outflags |= MMAN_sp;
print_offs(n->norm->Bd.offs, 1);
- return(1);
+ return 1;
}
static void
switch (n->type) {
case ROFFT_BLOCK:
- return(1);
+ return 1;
case ROFFT_BODY:
break;
default:
- return(0);
+ return 0;
}
switch (n->norm->Bf.font) {
case FONT_Em:
font_push('R');
break;
}
- return(1);
+ return 1;
}
static void
switch (n->type) {
case ROFFT_BLOCK:
- return(1);
+ return 1;
case ROFFT_BODY:
outflags |= MMAN_Bk;
- return(1);
+ return 1;
default:
- return(0);
+ return 0;
}
}
switch (n->norm->Bl.type) {
case LIST_enum:
n->norm->Bl.count = 0;
- return(1);
+ return 1;
case LIST_column:
break;
default:
- return(1);
+ return 1;
}
if (n->nchild) {
print_word(".");
}
outflags |= MMAN_nl;
- return(1);
+ return 1;
}
static void
{
outflags |= MMAN_br;
- return(0);
+ return 0;
}
static int
}
print_word("BSD");
if (NULL == n)
- return(0);
+ return 0;
outflags &= ~MMAN_spc;
print_word("-");
outflags &= ~MMAN_spc;
print_word(n->string);
- return(0);
+ return 0;
}
static int
{
print_offs("6n", 0);
- return(1);
+ return 1;
}
static void
{
font_push('I');
- return(1);
+ return 1;
}
static int
if (NULL == n->norm->Es ||
NULL == n->norm->Es->child)
- return(1);
+ return 1;
print_word(n->norm->Es->child->string);
outflags &= ~MMAN_spc;
- return(1);
+ return 1;
}
static void
n->parent->head->child != NULL && (n->child != NULL ||
(n->parent->tail != NULL && n->parent->tail->child != NULL)))
outflags &= ~(MMAN_spc | MMAN_nl);
- return(1);
+ return 1;
}
static void
if (NULL != (n = n->next))
print_word(",");
}
- return(0);
+ return 0;
}
static void
pre_syn(n);
font_push('B');
- return(1);
+ return 1;
}
static void
print_word("\\-");
if (n->nchild)
outflags &= ~MMAN_spc;
- return(1);
+ return 1;
}
static void
n = n->child;
if (NULL == n)
- return(0);
+ return 0;
if (MDOC_SYNPRETTY & n->flags)
print_block(".HP 4n", MMAN_nl);
n = n->next;
if (NULL != n)
pre_fa(meta, n);
- return(0);
+ return 0;
}
static void
break;
case ROFFT_HEAD:
if (n->child == NULL)
- return(0);
+ return 0;
if (MDOC_SYNPRETTY & n->flags)
print_block(".HP 4n", MMAN_nl);
font_push('B');
default:
break;
}
- return(1);
+ return 1;
}
static void
pre_syn(n);
font_push('I');
- return(1);
+ return 1;
}
static int
outflags &= ~MMAN_spc;
font_push('I');
}
- return(1);
+ return 1;
}
static void
outflags &= ~MMAN_br;
switch (bln->norm->Bl.type) {
case LIST_item:
- return(0);
+ return 0;
case LIST_inset:
/* FALLTHROUGH */
case LIST_diag:
else
print_line(".R \"", 0);
outflags &= ~MMAN_spc;
- return(1);
+ return 1;
case LIST_bullet:
/* FALLTHROUGH */
case LIST_dash:
print_word("-");
font_pop();
outflags |= MMAN_nl;
- return(0);
+ return 0;
case LIST_enum:
print_width(&bln->norm->Bl, NULL);
TPremain = 0;
outflags |= MMAN_nl;
print_count(&bln->norm->Bl.count);
outflags |= MMAN_nl;
- return(0);
+ return 0;
case LIST_hang:
print_width(&bln->norm->Bl, n->child);
TPremain = 0;
outflags |= MMAN_nl;
- return(1);
+ return 1;
case LIST_tag:
print_width(&bln->norm->Bl, n->child);
putchar('\n');
outflags &= ~MMAN_spc;
- return(1);
+ return 1;
default:
- return(1);
+ return 1;
}
default:
break;
}
- return(1);
+ return 1;
}
/*
const struct roff_node *link, *descr;
if (NULL == (link = n->child))
- return(0);
+ return 0;
if (NULL != (descr = link->next)) {
font_push('I');
font_push('B');
print_word(link->string);
font_pop();
- return(0);
+ return 0;
}
static int
{
print_line(".ll", 0);
- return(1);
+ return 1;
}
static int
{
font_push('R');
- return(1);
+ return 1;
}
static int
pre_syn(n);
}
if (n->type != ROFFT_ELEM && n->type != ROFFT_HEAD)
- return(1);
+ return 1;
name = n->child ? n->child->string : meta->name;
if (NULL == name)
- return(0);
+ return 0;
if (n->type == ROFFT_HEAD) {
if (NULL == n->parent->prev)
outflags |= MMAN_sp;
font_push('B');
if (NULL == n->child)
print_word(meta->name);
- return(1);
+ return 1;
}
static void
{
outflags |= MMAN_spc_force;
- return(1);
+ return 1;
}
static int
{
outflags &= ~MMAN_spc;
- return(0);
+ return 0;
}
static void
outflags |= MMAN_PP;
outflags |= MMAN_sp | MMAN_nl;
outflags &= ~MMAN_br;
- return(0);
+ return 0;
}
static int
outflags |= MMAN_PP | MMAN_sp | MMAN_nl;
outflags &= ~MMAN_br;
}
- return(1);
+ return 1;
}
static int
print_word("is set to indicate the error.");
outflags |= MMAN_nl;
- return(0);
+ return 0;
}
static int
pre_skip(DECL_ARGS)
{
- return(0);
+ return 0;
}
static int
if (MMAN_Sm & outflags)
outflags |= MMAN_spc;
- return(0);
+ return 0;
}
static int
print_line(".PP", 0);
} else
print_line(".sp", 0);
- return(1);
+ return 1;
}
static void
{
font_push('B');
- return(1);
+ return 1;
}
static int
switch (n->type) {
case ROFFT_BLOCK:
pre_syn(n);
- return(1);
+ return 1;
case ROFFT_BODY:
break;
default:
- return(0);
+ return 0;
}
}
font_push('I');
- return(1);
+ return 1;
}
static void
n = n->child;
if (NULL == n)
- return(0);
+ return 0;
print_node(meta, n);
n = n->next;
if (NULL == n)
- return(0);
+ return 0;
outflags &= ~MMAN_spc;
print_word("(");
print_node(meta, n);
print_word(")");
- return(0);
+ return 0;
}
static int
print_word(manacts[n->tok].prefix);
if (NULL == n->child)
- return(0);
+ return 0;
outflags &= ~MMAN_spc;
print_word("\\ ");
outflags &= ~MMAN_spc;
- return(1);
+ return 1;
}
-/* $OpenBSD: mdoc_term.c,v 1.226 2015/09/26 00:53:15 schwarze Exp $ */
+/* $OpenBSD: mdoc_term.c,v 1.227 2015/10/06 18:30:44 schwarze Exp $ */
/*
* Copyright (c) 2008, 2009, 2010, 2011 Kristaps Dzonsons <kristaps@bsd.lv>
* Copyright (c) 2010, 2012-2015 Ingo Schwarze <schwarze@openbsd.org>
SCALE_HS_INIT(&su, term_strlen(p, v));
su.scale /= term_strlen(p, "0");
}
- return(term_hspan(p, &su) / 24);
+ return term_hspan(p, &su) / 24;
}
/*
{
term_setwidth(p, n->nchild ? n->child->string : NULL);
- return(0);
+ return 0;
}
static int
if (n->type == ROFFT_BLOCK) {
print_bvspace(p, n->parent->parent, n);
- return(1);
+ return 1;
}
bl = n->parent->parent->parent;
/* FALLTHROUGH */
case LIST_enum:
if (n->type == ROFFT_HEAD)
- return(0);
+ return 0;
break;
case LIST_column:
if (n->type == ROFFT_HEAD)
- return(0);
+ return 0;
break;
default:
break;
}
- return(1);
+ return 1;
}
static void
if (n->type == ROFFT_BLOCK) {
p->flags |= TERMP_PREKEEP;
- return(1);
+ return 1;
}
if (n->type == ROFFT_BODY) {
if (NULL == n->child)
- return(0);
+ return 0;
p->flags |= TERMP_NOSPACE;
cp = NULL;
if (n->prev->child != NULL)
p->offset += term_len(p, 6);
else
p->offset += term_len(p, 1) + term_strlen(p, cp);
- return(1);
+ return 1;
}
if (NULL == n->child && NULL == meta->name)
- return(0);
+ return 0;
if (n->type == ROFFT_HEAD)
synopsis_pre(p, n->parent);
term_fontpush(p, TERMFONT_BOLD);
if (NULL == n->child)
term_word(p, meta->name);
- return(1);
+ return 1;
}
static void
n->next->flags & MDOC_LINE)))
p->flags |= TERMP_NOSPACE;
- return(1);
+ return 1;
}
static int
if (NULL == n->next || MDOC__A != n->next->tok)
term_word(p, "and");
- return(1);
+ return 1;
}
static int
if (n->norm->An.auth == AUTH_split) {
p->flags &= ~TERMP_NOSPLIT;
p->flags |= TERMP_SPLIT;
- return(0);
+ return 0;
}
if (n->norm->An.auth == AUTH_nosplit) {
p->flags &= ~TERMP_SPLIT;
p->flags |= TERMP_NOSPLIT;
- return(0);
+ return 0;
}
if (p->flags & TERMP_SPLIT)
if (n->sec == SEC_AUTHORS && ! (p->flags & TERMP_NOSPLIT))
p->flags |= TERMP_SPLIT;
- return(1);
+ return 1;
}
static int
if ( ! (MDOC_LINE & n->flags))
p->flags |= TERMP_NOSPACE;
- return(1);
+ return 1;
}
static int
{
if (SEC_SEE_ALSO != n->sec)
- return(1);
+ return 1;
if (n->type == ROFFT_BLOCK && n->prev != NULL)
term_vspace(p);
- return(1);
+ return 1;
}
static int
term_word(p, "is set to indicate the error.");
p->flags |= TERMP_SENTENCE;
- return(0);
+ return 0;
}
static int
term_word(p, "on success, and\\~>0 if an error occurs.");
p->flags |= TERMP_SENTENCE;
- return(0);
+ return 0;
}
static int
if (n->type == ROFFT_BODY)
term_word(p, "\\(en");
- return(1);
+ return 1;
}
static int
termp_bl_pre(DECL_ARGS)
{
- return(n->type != ROFFT_HEAD);
+ return n->type != ROFFT_HEAD;
}
static void
{
if (NULL == (n = n->child))
- return(0);
+ return 0;
assert(n->type == ROFFT_TEXT);
term_word(p, n->string);
if (NULL == (n = n->next))
- return(0);
+ return 0;
p->flags |= TERMP_NOSPACE;
term_word(p, "(");
p->flags |= TERMP_NOSPACE;
term_word(p, ")");
- return(0);
+ return 0;
}
/*
if (n->type == ROFFT_ELEM) {
synopsis_pre(p, n);
- return(termp_under_pre(p, pair, meta, n));
+ return termp_under_pre(p, pair, meta, n);
} else if (n->type == ROFFT_BLOCK) {
synopsis_pre(p, n);
- return(1);
+ return 1;
} else if (n->type == ROFFT_HEAD)
- return(0);
+ return 0;
- return(termp_under_pre(p, pair, meta, n));
+ return termp_under_pre(p, pair, meta, n);
}
static int
termp_tag_pre(p, pair, meta, n);
term_fontpush(p, TERMFONT_BOLD);
- return(1);
+ return 1;
}
static int
{
synopsis_pre(p, n);
- return(termp_bold_pre(p, pair, meta, n));
+ return termp_bold_pre(p, pair, meta, n);
}
static void
default:
break;
}
- return(1);
+ return 1;
}
static void
term_word(p, "is currently in beta test.");
p->flags |= TERMP_SENTENCE;
- return(0);
+ return 0;
}
static void
term_word(p, "currently under development.");
p->flags |= TERMP_SENTENCE;
- return(0);
+ return 0;
}
static int
{
if (n->type != ROFFT_BLOCK)
- return(1);
+ return 1;
term_newln(p);
p->offset += term_len(p, p->defindent + 1);
- return(1);
+ return 1;
}
static int
/* NB: MDOC_LINE does not effect this! */
synopsis_pre(p, n);
term_fontpush(p, TERMFONT_UNDER);
- return(1);
+ return 1;
}
static int
synopsis_pre(p, n);
if (NULL == (n = n->child))
- return(0);
+ return 0;
if (pretty) {
rmargin = p->rmargin;
term_flushln(p);
}
- return(0);
+ return 0;
}
static int
if (n->parent->tok != MDOC_Fo) {
term_fontpush(p, TERMFONT_UNDER);
- return(1);
+ return 1;
}
for (nn = n->child; nn; nn = nn->next) {
}
}
- return(0);
+ return 0;
}
static int
if (n->type == ROFFT_BLOCK) {
print_bvspace(p, n, n);
- return(1);
+ return 1;
} else if (n->type == ROFFT_HEAD)
- return(0);
+ return 0;
/* Handle the -offset argument. */
if (DISP_literal != n->norm->Bd.type &&
DISP_unfilled != n->norm->Bd.type &&
DISP_centered != n->norm->Bd.type)
- return(1);
+ return 1;
tabwidth = p->tabwidth;
if (DISP_literal == n->norm->Bd.type)
p->tabwidth = tabwidth;
p->rmargin = rm;
p->maxrmargin = rmax;
- return(0);
+ return 0;
}
static void
term_word(p, "BSD");
} else {
term_word(p, "BSD");
- return(0);
+ return 0;
}
if (NULL != (n = n->next)) {
term_word(p, n->string);
}
- return(0);
+ return 0;
}
static int
term_word(p, n->child->string);
p->flags = flags;
}
- return(0);
+ return 0;
}
static void
break;
}
- return(1);
+ return 1;
}
static void
synopsis_pre(p, n);
term_fontpush(p, TERMFONT_BOLD);
- return(1);
+ return 1;
}
static int
}
p->flags |= TERMP_NOSPACE;
- return(1);
+ return 1;
}
static void
for (i = 0; i < len; i++)
term_vspace(p);
- return(0);
+ return 0;
}
static int
termp_skip_pre(DECL_ARGS)
{
- return(0);
+ return 0;
}
static int
{
if (n->type != ROFFT_BODY && n->type != ROFFT_ELEM)
- return(1);
+ return 1;
switch (n->tok) {
case MDOC_Ao:
case MDOC_En:
if (NULL == n->norm->Es ||
NULL == n->norm->Es->child)
- return(1);
+ return 1;
term_word(p, n->norm->Es->child->string);
break;
case MDOC_Po:
}
p->flags |= TERMP_NOSPACE;
- return(1);
+ return 1;
}
static void
{
if (n->type != ROFFT_BODY)
- return(1);
+ return 1;
if (n->end == ENDBODY_NOT &&
n->parent->head->child == NULL &&
(n->parent->tail != NULL && n->parent->tail->child != NULL)))
p->flags |= TERMP_NOSPACE;
- return(1);
+ return 1;
}
static void
if (n->type == ROFFT_BLOCK) {
synopsis_pre(p, n);
- return(1);
+ return 1;
} else if (n->type == ROFFT_BODY) {
if (pretty) {
rmargin = p->rmargin;
p->offset = p->rmargin;
p->rmargin = rmargin;
}
- return(1);
+ return 1;
}
if (NULL == n->child)
- return(0);
+ return 0;
/* XXX: we drop non-initial arguments as per groff. */
assert(n->child->string);
term_fontpush(p, TERMFONT_BOLD);
term_word(p, n->child->string);
- return(0);
+ return 0;
}
static void
{
if (n->type == ROFFT_HEAD)
- return(0);
+ return 0;
else if (n->type != ROFFT_BODY)
- return(1);
+ return 1;
if (FONT_Em == n->norm->Bf.font)
term_fontpush(p, TERMFONT_UNDER);
else
term_fontpush(p, TERMFONT_NONE);
- return(1);
+ return 1;
}
static int
if (p->col && ! (TERMP_NONOSPACE & p->flags))
p->flags &= ~TERMP_NOSPACE;
- return(0);
+ return 0;
}
static int
p->flags |= TERMP_NOSPACE;
term_word(p, "'");
p->flags |= TERMP_NOSPACE;
- return(1);
+ return 1;
}
static void
{
term_fontpush(p, TERMFONT_NONE);
- return(1);
+ return 1;
}
static int
const struct roff_node *link, *descr;
if (NULL == (link = n->child))
- return(0);
+ return 0;
if (NULL != (descr = link->next)) {
term_fontpush(p, TERMFONT_UNDER);
term_word(p, link->string);
term_fontpop(p);
- return(0);
+ return 0;
}
static int
case ROFFT_BLOCK:
break;
case ROFFT_HEAD:
- return(0);
+ return 0;
case ROFFT_BODY:
if (n->parent->args || 0 == n->prev->nchild)
p->flags |= TERMP_PREKEEP;
abort();
}
- return(1);
+ return 1;
}
static void
*/
if (n->parent && MDOC_Rs == n->parent->tok &&
n->parent->norm->Rs.quote_T)
- return(termp_quote_pre(p, pair, meta, n));
+ return termp_quote_pre(p, pair, meta, n);
term_fontpush(p, TERMFONT_UNDER);
- return(1);
+ return 1;
}
static int
{
term_fontpush(p, TERMFONT_UNDER);
- return(1);
+ return 1;
}
static int
(n->parent->tok == MDOC_Bq &&
n->parent->parent->parent->tok == MDOC_It)))
tag_put(n->child->string, 1, p->line);
- return(1);
+ return 1;
}
static int
n->parent->parent->prev == NULL &&
n->parent->parent->parent->tok == MDOC_It)))
tag_put(n->child->string, 1, p->line);
- return(1);
+ return 1;
}
-/* $OpenBSD: mdoc_validate.c,v 1.209 2015/09/26 00:53:15 schwarze Exp $ */
+/* $OpenBSD: mdoc_validate.c,v 1.210 2015/10/06 18:30:44 schwarze Exp $ */
/*
* Copyright (c) 2008-2012 Kristaps Dzonsons <kristaps@bsd.lv>
* Copyright (c) 2010-2015 Ingo Schwarze <schwarze@openbsd.org>
for (n = n->child; n != NULL; n = n->next)
if ((n->tok == MDOC_An && n->nchild) || child_an(n))
- return(1);
- return(0);
+ return 1;
+ return 0;
}
static void
for (i = 0; i < (int)SEC__MAX; i++)
if (secnames[i] && 0 == strcmp(p, secnames[i]))
- return((enum roff_sec)i);
+ return (enum roff_sec)i;
- return(SEC_CUSTOM);
+ return SEC_CUSTOM;
}
static size_t
switch (macro) {
case MDOC_Ad:
- return(12);
+ return 12;
case MDOC_Ao:
- return(12);
+ return 12;
case MDOC_An:
- return(12);
+ return 12;
case MDOC_Aq:
- return(12);
+ return 12;
case MDOC_Ar:
- return(12);
+ return 12;
case MDOC_Bo:
- return(12);
+ return 12;
case MDOC_Bq:
- return(12);
+ return 12;
case MDOC_Cd:
- return(12);
+ return 12;
case MDOC_Cm:
- return(10);
+ return 10;
case MDOC_Do:
- return(10);
+ return 10;
case MDOC_Dq:
- return(12);
+ return 12;
case MDOC_Dv:
- return(12);
+ return 12;
case MDOC_Eo:
- return(12);
+ return 12;
case MDOC_Em:
- return(10);
+ return 10;
case MDOC_Er:
- return(17);
+ return 17;
case MDOC_Ev:
- return(15);
+ return 15;
case MDOC_Fa:
- return(12);
+ return 12;
case MDOC_Fl:
- return(10);
+ return 10;
case MDOC_Fo:
- return(16);
+ return 16;
case MDOC_Fn:
- return(16);
+ return 16;
case MDOC_Ic:
- return(10);
+ return 10;
case MDOC_Li:
- return(16);
+ return 16;
case MDOC_Ms:
- return(6);
+ return 6;
case MDOC_Nm:
- return(10);
+ return 10;
case MDOC_No:
- return(12);
+ return 12;
case MDOC_Oo:
- return(10);
+ return 10;
case MDOC_Op:
- return(14);
+ return 14;
case MDOC_Pa:
- return(32);
+ return 32;
case MDOC_Pf:
- return(12);
+ return 12;
case MDOC_Po:
- return(12);
+ return 12;
case MDOC_Pq:
- return(12);
+ return 12;
case MDOC_Ql:
- return(16);
+ return 16;
case MDOC_Qo:
- return(12);
+ return 12;
case MDOC_So:
- return(12);
+ return 12;
case MDOC_Sq:
- return(12);
+ return 12;
case MDOC_Sy:
- return(6);
+ return 6;
case MDOC_Sx:
- return(16);
+ return 16;
case MDOC_Tn:
- return(10);
+ return 10;
case MDOC_Va:
- return(12);
+ return 12;
case MDOC_Vt:
- return(12);
+ return 12;
case MDOC_Xr:
- return(10);
+ return 10;
default:
break;
};
- return(0);
+ return 0;
}
-/* $OpenBSD: msec.c,v 1.11 2014/12/21 00:17:24 daniel Exp $ */
+/* $OpenBSD: msec.c,v 1.12 2015/10/06 18:30:44 schwarze Exp $ */
/*
* Copyright (c) 2009 Kristaps Dzonsons <kristaps@bsd.lv>
*
#include "msec.in"
- return(NULL);
+ return NULL;
}
-/* $OpenBSD: out.c,v 1.32 2015/09/26 00:53:15 schwarze Exp $ */
+/* $OpenBSD: out.c,v 1.33 2015/10/06 18:30:44 schwarze Exp $ */
/*
* Copyright (c) 2009, 2010, 2011 Kristaps Dzonsons <kristaps@bsd.lv>
* Copyright (c) 2011, 2014, 2015 Ingo Schwarze <schwarze@openbsd.org>
dst->unit = def == SCALE_MAX ? SCALE_BU : def;
dst->scale = strtod(src, &endptr);
if (endptr == src)
- return(0);
+ return 0;
switch (*endptr++) {
case 'c':
/* FALLTHROUGH */
default:
if (SCALE_MAX == def)
- return(0);
+ return 0;
dst->unit = def;
break;
}
- return(*endptr == '\0' ? 2 : 1);
+ return *endptr == '\0' ? 2 : 1;
}
/*
-/* $OpenBSD: preconv.c,v 1.6 2015/03/09 21:30:27 schwarze Exp $ */
+/* $OpenBSD: preconv.c,v 1.7 2015/10/06 18:30:44 schwarze Exp $ */
/*
* Copyright (c) 2011 Kristaps Dzonsons <kristaps@bsd.lv>
* Copyright (c) 2014 Ingo Schwarze <schwarze@openbsd.org>
*oi += snprintf(ob->buf + *oi, 11, "\\[u%.4X]", accum);
*ii = (char *)cu - ib->buf;
*filenc &= ~MPARSE_LATIN1;
- return(1);
+ return 1;
latin:
if ( ! (*filenc & MPARSE_LATIN1))
- return(0);
+ return 0;
*oi += snprintf(ob->buf + *oi, 11,
"\\[u%.4X]", (unsigned char)ib->buf[(*ii)++]);
*filenc &= ~MPARSE_UTF8;
- return(1);
+ return 1;
}
int
if ((sz = (size_t)(eoln - ln)) < 10 ||
memcmp(ln, ".\\\" -*-", 7) || memcmp(eoln - 3, "-*-", 3))
- return(MPARSE_UTF8 | MPARSE_LATIN1);
+ return MPARSE_UTF8 | MPARSE_LATIN1;
/* Move after the header and adjust for the trailer. */
sz--;
}
if (0 == sz)
- return(0);
+ return 0;
/* Check us against known encodings. */
if (phsz > 4 && !strncasecmp(ln, "utf-8", 5))
- return(MPARSE_UTF8);
+ return MPARSE_UTF8;
if (phsz > 10 && !strncasecmp(ln, "iso-latin-1", 11))
- return(MPARSE_LATIN1);
- return(0);
+ return MPARSE_LATIN1;
+ return 0;
}
- return(MPARSE_UTF8 | MPARSE_LATIN1);
+ return MPARSE_UTF8 | MPARSE_LATIN1;
}
-/* $OpenBSD: read.c,v 1.116 2015/09/14 15:35:47 schwarze Exp $ */
+/* $OpenBSD: read.c,v 1.117 2015/10/06 18:30:44 schwarze Exp $ */
/*
* Copyright (c) 2008, 2009, 2010, 2011 Kristaps Dzonsons <kristaps@bsd.lv>
* Copyright (c) 2010-2015 Ingo Schwarze <schwarze@openbsd.org>
if (curp->gzip == 0 && S_ISREG(st.st_mode)) {
if (st.st_size > 0x7fffffff) {
mandoc_msg(MANDOCERR_TOOLARGE, curp, 0, 0, NULL);
- return(0);
+ return 0;
}
*with_mmap = 1;
fb->sz = (size_t)st.st_size;
fb->buf = mmap(NULL, fb->sz, PROT_READ, MAP_SHARED, fd, 0);
if (fb->buf != MAP_FAILED)
- return(1);
+ return 1;
}
if (curp->gzip) {
read(fd, fb->buf + (int)off, fb->sz - off);
if (ssz == 0) {
fb->sz = off;
- return(1);
+ return 1;
}
if (ssz == -1) {
perror(file);
free(fb->buf);
fb->buf = NULL;
- return(0);
+ return 0;
}
static void
if (fd != STDIN_FILENO && close(fd) == -1)
perror(file);
- return(curp->file_status);
+ return curp->file_status;
}
enum mandoclevel
/* First try to use the filename as it is. */
if ((*fd = open(file, O_RDONLY)) != -1)
- return(MANDOCLEVEL_OK);
+ return MANDOCLEVEL_OK;
/*
* If that doesn't work and the filename doesn't
free(cp);
if (*fd != -1) {
curp->gzip = 1;
- return(MANDOCLEVEL_OK);
+ return MANDOCLEVEL_OK;
}
}
/* Neither worked, give up. */
mandoc_msg(MANDOCERR_FILE, curp, 0, 0, strerror(errno));
- return(MANDOCLEVEL_ERROR);
+ return MANDOCLEVEL_ERROR;
}
struct mparse *
curp->man->macroset = MACROSET_MAN;
}
curp->man->first->tok = TOKEN_NONE;
- return(curp);
+ return curp;
}
void
mparse_strerror(enum mandocerr er)
{
- return(mandocerrs[er]);
+ return mandocerrs[er];
}
const char *
mparse_strlevel(enum mandoclevel lvl)
{
- return(mandoclevels[lvl]);
+ return mandoclevels[lvl];
}
void
{
assert(p->secondary);
- return(p->secondary->sz ? p->secondary->buf : NULL);
+ return p->secondary->sz ? p->secondary->buf : NULL;
}
-/* $OpenBSD: roff.c,v 1.148 2015/09/26 00:53:15 schwarze Exp $ */
+/* $OpenBSD: roff.c,v 1.149 2015/10/06 18:30:44 schwarze Exp $ */
/*
* Copyright (c) 2008-2012, 2014 Kristaps Dzonsons <kristaps@bsd.lv>
* Copyright (c) 2010-2015 Ingo Schwarze <schwarze@openbsd.org>
*/
if (p[0] < ASCII_LO || p[0] > ASCII_HI)
- return(ROFF_MAX);
+ return ROFF_MAX;
buc = ROFF_HASH(p);
if (NULL == (n = hash[buc]))
- return(ROFF_MAX);
+ return ROFF_MAX;
for ( ; n; n = n->next)
if (0 == strncmp(n->name, p, s) && '\0' == n->name[(int)s])
- return((enum rofft)(n - roffs));
+ return (enum rofft)(n - roffs);
- return(ROFF_MAX);
+ return ROFF_MAX;
}
/* --- stack of request blocks -------------------------------------------- */
roffhash_init();
- return(r);
+ return r;
}
/* --- syntax tree state data management ---------------------------------- */
man->defos = defos;
man->quick = quick;
roff_man_alloc1(man);
- return(man);
+ return man;
}
/* --- syntax tree handling ----------------------------------------------- */
n->flags |= MDOC_LINE;
man->flags &= ~MDOC_NEWLINE;
- return(n);
+ return n;
}
void
n = roff_node_alloc(man, line, pos, ROFFT_BLOCK, tok);
roff_node_append(man, n);
man->next = ROFF_NEXT_CHILD;
- return(n);
+ return n;
}
struct roff_node *
n = roff_node_alloc(man, line, pos, ROFFT_HEAD, tok);
roff_node_append(man, n);
man->next = ROFF_NEXT_CHILD;
- return(n);
+ return n;
}
struct roff_node *
n = roff_node_alloc(man, line, pos, ROFFT_BODY, tok);
roff_node_append(man, n);
man->next = ROFF_NEXT_CHILD;
- return(n);
+ return n;
}
void
if (EXPAND_LIMIT < ++expand_count) {
mandoc_msg(MANDOCERR_ROFFLOOP, r->parse,
ln, (int)(stesc - buf->buf), NULL);
- return(ROFF_IGN);
+ return ROFF_IGN;
}
/*
} else if (buf->sz + strlen(res) > SHRT_MAX) {
mandoc_msg(MANDOCERR_ROFFLOOP, r->parse,
ln, (int)(stesc - buf->buf), NULL);
- return(ROFF_IGN);
+ return ROFF_IGN;
}
/* Replace the escape sequence by the string. */
free(buf->buf);
buf->buf = nbuf;
}
- return(ROFF_CONT);
+ return ROFF_CONT;
}
/*
*offs = 0;
free(roffit_macro);
roffit_lines = 0;
- return(ROFF_REPARSE);
+ return ROFF_REPARSE;
} else if (roffit_lines > 1)
--roffit_lines;
*p = ASCII_HYPH;
p++;
}
- return(ROFF_CONT);
+ return ROFF_CONT;
}
enum rofferr
(r->eqn == NULL || r->eqn_inline)) {
e = roff_eqndelim(r, buf, pos);
if (e == ROFF_REPARSE)
- return(e);
+ return e;
assert(e == ROFF_CONT);
}
e = roff_res(r, buf, ln, pos);
if (e == ROFF_IGN)
- return(e);
+ return e;
assert(e == ROFF_CONT);
ctl = roff_getcontrol(r, buf->buf, &pos);
e = (*roffs[t].text)(r, t, buf, ln, pos, pos, offs);
assert(e == ROFF_IGN || e == ROFF_CONT);
if (e != ROFF_CONT)
- return(e);
+ return e;
}
if (r->eqn != NULL)
- return(eqn_read(&r->eqn, ln, buf->buf, ppos, offs));
+ return eqn_read(&r->eqn, ln, buf->buf, ppos, offs);
if (r->tbl != NULL && ( ! ctl || buf->buf[pos] == '\0'))
- return(tbl_read(r->tbl, ln, buf->buf, ppos));
+ return tbl_read(r->tbl, ln, buf->buf, ppos);
if ( ! ctl)
- return(roff_parsetext(buf, pos, offs));
+ return roff_parsetext(buf, pos, offs);
/* Skip empty request lines. */
if (buf->buf[pos] == '"') {
mandoc_msg(MANDOCERR_COMMENT_BAD, r->parse,
ln, pos, NULL);
- return(ROFF_IGN);
+ return ROFF_IGN;
} else if (buf->buf[pos] == '\0')
- return(ROFF_IGN);
+ return ROFF_IGN;
/*
* If a scope is open, go to the child handler for that macro,
if (r->last) {
t = r->last->tok;
assert(roffs[t].sub);
- return((*roffs[t].sub)(r, t, buf, ln, ppos, pos, offs));
+ return (*roffs[t].sub)(r, t, buf, ln, ppos, pos, offs);
}
/* No scope is open. This is a new request or macro. */
mandoc_msg(MANDOCERR_TBLMACRO, r->parse,
ln, pos, buf->buf + spos);
if (t == ROFF_TS)
- return(ROFF_IGN);
+ return ROFF_IGN;
while (buf->buf[pos] != '\0' && buf->buf[pos] != ' ')
pos++;
while (buf->buf[pos] != '\0' && buf->buf[pos] == ' ')
pos++;
- return(tbl_read(r->tbl, ln, buf->buf, pos));
+ return tbl_read(r->tbl, ln, buf->buf, pos);
}
/*
*/
if (t == ROFF_MAX)
- return(ROFF_CONT);
+ return ROFF_CONT;
/* Execute a roff request or a user defined macro. */
assert(roffs[t].proc);
- return((*roffs[t].proc)(r, t, buf, ln, ppos, pos, offs));
+ return (*roffs[t].proc)(r, t, buf, ln, ppos, pos, offs);
}
void
cp = buf + *pos;
if ('\0' == *cp || '"' == *cp || '\t' == *cp || ' ' == *cp)
- return(ROFF_MAX);
+ return ROFF_MAX;
mac = cp;
maclen = roff_getname(r, &cp, ln, ppos);
if (ROFF_MAX != t)
*pos = cp - buf;
- return(t);
+ return t;
}
/* --- handling of request blocks ----------------------------------------- */
if (r->last == NULL) {
mandoc_msg(MANDOCERR_BLK_NOTOPEN, r->parse,
ln, ppos, "..");
- return(ROFF_IGN);
+ return ROFF_IGN;
}
switch (r->last->tok) {
default:
mandoc_msg(MANDOCERR_BLK_NOTOPEN, r->parse,
ln, ppos, "..");
- return(ROFF_IGN);
+ return ROFF_IGN;
}
if (buf->buf[pos] != '\0')
roffnode_pop(r);
roffnode_cleanscope(r);
- return(ROFF_IGN);
+ return ROFF_IGN;
}
if (namesz == 0 && tok != ROFF_ig) {
mandoc_msg(MANDOCERR_REQ_EMPTY, r->parse,
ln, ppos, roffs[tok].name);
- return(ROFF_IGN);
+ return ROFF_IGN;
}
roffnode_push(r, tok, name, ln, ppos);
roff_setstrn(&r->strtab, name, namesz, "", 0, 0);
if (*cp == '\0')
- return(ROFF_IGN);
+ return ROFF_IGN;
/* Get the custom end marker. */
mandoc_vmsg(MANDOCERR_ARG_EXCESS, r->parse,
ln, pos, ".%s ... %s", roffs[tok].name, cp);
- return(ROFF_IGN);
+ return ROFF_IGN;
}
static enum rofferr
pos = i;
if (roff_parse(r, buf->buf, &pos, ln, ppos) !=
ROFF_MAX)
- return(ROFF_RERUN);
- return(ROFF_IGN);
+ return ROFF_RERUN;
+ return ROFF_IGN;
}
}
if (t != ROFF_cblock) {
if (tok != ROFF_ig)
roff_setstr(r, r->last->name, buf->buf + ppos, 2);
- return(ROFF_IGN);
+ return ROFF_IGN;
}
assert(roffs[t].proc);
- return((*roffs[t].proc)(r, t, buf, ln, ppos, pos, offs));
+ return (*roffs[t].proc)(r, t, buf, ln, ppos, pos, offs);
}
static enum rofferr
if (tok != ROFF_ig)
roff_setstr(r, r->last->name, buf->buf + pos, 2);
- return(ROFF_IGN);
+ return ROFF_IGN;
}
static enum rofferr
if ((t != ROFF_MAX) &&
(rr || roffs[t].flags & ROFFMAC_STRUCT)) {
assert(roffs[t].proc);
- return((*roffs[t].proc)(r, t, buf, ln, ppos, pos, offs));
+ return (*roffs[t].proc)(r, t, buf, ln, ppos, pos, offs);
}
/*
if (*ep != '\0')
++ep;
}
- return(rr ? ROFF_CONT : ROFF_IGN);
+ return rr ? ROFF_CONT : ROFF_IGN;
}
static enum rofferr
if (*ep != '\0')
++ep;
}
- return(rr ? ROFF_CONT : ROFF_IGN);
+ return rr ? ROFF_CONT : ROFF_IGN;
}
/* --- handling of numeric and conditional expressions -------------------- */
*res = scaled;
*pos = p + 1;
- return(1);
+ return 1;
}
/*
else if (*s3 != '\0')
s3++;
*pos = s3 - v;
- return(match);
+ return match;
}
/*
switch (v[*pos]) {
case '\0':
- return(0);
+ return 0;
case 'n':
/* FALLTHROUGH */
case 'o':
(*pos)++;
- return(wanttrue);
+ return wanttrue;
case 'c':
/* FALLTHROUGH */
case 'd':
/* FALLTHROUGH */
case 'v':
(*pos)++;
- return(!wanttrue);
+ return !wanttrue;
case 'r':
cp = name = v + ++*pos;
sz = roff_getname(r, &cp, ln, *pos);
*pos = cp - v;
- return((sz && roff_hasregn(r, name, sz)) == wanttrue);
+ return (sz && roff_hasregn(r, name, sz)) == wanttrue;
default:
break;
}
savepos = *pos;
if (roff_evalnum(r, ln, v, pos, &number, ROFFNUM_SCALE))
- return((number > 0) == wanttrue);
+ return (number > 0) == wanttrue;
else if (*pos == savepos)
- return(roff_evalstrcond(v, pos) == wanttrue);
+ return roff_evalstrcond(v, pos) == wanttrue;
else
- return (0);
+ return 0;
}
static enum rofferr
roff_line_ignore(ROFF_ARGS)
{
- return(ROFF_IGN);
+ return ROFF_IGN;
}
static enum rofferr
mandoc_msg(MANDOCERR_REQ_INSEC, r->parse,
ln, ppos, roffs[tok].name);
- return(ROFF_IGN);
+ return ROFF_IGN;
}
static enum rofferr
mandoc_msg(MANDOCERR_REQ_UNSUPP, r->parse,
ln, ppos, roffs[tok].name);
- return(ROFF_IGN);
+ return ROFF_IGN;
}
static enum rofferr
out:
*offs = pos;
- return(ROFF_RERUN);
+ return ROFF_RERUN;
}
static enum rofferr
name = string = buf->buf + pos;
if (*name == '\0')
- return(ROFF_IGN);
+ return ROFF_IGN;
namesz = roff_getname(r, &string, ln, pos);
if (name[namesz] == '\\')
- return(ROFF_IGN);
+ return ROFF_IGN;
/* Read past the initial double-quote, if any. */
if (*string == '"')
/* The rest is the value. */
roff_setstrn(&r->strtab, name, namesz, string, strlen(string),
ROFF_as == tok);
- return(ROFF_IGN);
+ return ROFF_IGN;
}
/*
(*pos)++;
break;
default:
- return(0);
+ return 0;
}
(*pos)++;
- return(*res);
+ return *res;
}
/*
{
if ('(' != v[*pos])
- return(roff_getnum(v, pos, res, flags));
+ return roff_getnum(v, pos, res, flags);
(*pos)++;
if ( ! roff_evalnum(r, ln, v, pos, res, flags | ROFFNUM_WHITE))
- return(0);
+ return 0;
/*
* Omission of the closing parenthesis
if (')' == v[*pos])
(*pos)++;
else if (NULL == res)
- return(0);
+ return 0;
- return(1);
+ return 1;
}
/*
(*pos)++;
if ( ! roff_evalpar(r, ln, v, pos, res, flags))
- return(0);
+ return 0;
while (1) {
if (flags & ROFFNUM_WHITE)
(*pos)++;
if ( ! roff_evalpar(r, ln, v, pos, &operand2, flags))
- return(0);
+ return 0;
if (flags & ROFFNUM_WHITE)
while (isspace((unsigned char)v[*pos]))
abort();
}
}
- return(1);
+ return 1;
}
/* --- register management ------------------------------------------------ */
switch (*name) {
case '$': /* Number of arguments of the last macro evaluated. */
- return(r->argc);
+ return r->argc;
case 'A': /* ASCII approximation mode is always off. */
- return(0);
+ return 0;
case 'g': /* Groff compatibility mode is always on. */
- return(1);
+ return 1;
case 'H': /* Fixed horizontal resolution. */
- return (24);
+ return 24;
case 'j': /* Always adjust left margin only. */
- return(0);
+ return 0;
case 'T': /* Some output device is always defined. */
- return(1);
+ return 1;
case 'V': /* Fixed vertical resolution. */
- return (40);
+ return 40;
default:
- return (-1);
+ return -1;
}
}
if ('.' == name[0] && '\0' != name[1] && '\0' == name[2]) {
val = roff_getregro(r, name + 1);
if (-1 != val)
- return (val);
+ return val;
}
for (reg = r->regtab; reg; reg = reg->next)
if (0 == strcmp(name, reg->key.p))
- return(reg->val);
+ return reg->val;
- return(0);
+ return 0;
}
static int
if ('.' == name[0] && 2 == len) {
val = roff_getregro(r, name + 1);
if (-1 != val)
- return (val);
+ return val;
}
for (reg = r->regtab; reg; reg = reg->next)
if (len == reg->key.sz &&
0 == strncmp(name, reg->key.p, len))
- return(reg->val);
+ return reg->val;
- return(0);
+ return 0;
}
static int
if ('.' == name[0] && 2 == len) {
val = roff_getregro(r, name + 1);
if (-1 != val)
- return(1);
+ return 1;
}
for (reg = r->regtab; reg; reg = reg->next)
if (len == reg->key.sz &&
0 == strncmp(name, reg->key.p, len))
- return(1);
+ return 1;
- return(0);
+ return 0;
}
static void
key = val = buf->buf + pos;
if (*key == '\0')
- return(ROFF_IGN);
+ return ROFF_IGN;
keysz = roff_getname(r, &val, ln, pos);
if (key[keysz] == '\\')
- return(ROFF_IGN);
+ return ROFF_IGN;
key[keysz] = '\0';
sign = *val;
if (roff_evalnum(r, ln, val, NULL, &iv, ROFFNUM_SCALE))
roff_setreg(r, key, iv, sign);
- return(ROFF_IGN);
+ return ROFF_IGN;
}
static enum rofferr
name = cp = buf->buf + pos;
if (*name == '\0')
- return(ROFF_IGN);
+ return ROFF_IGN;
namesz = roff_getname(r, &cp, ln, pos);
name[namesz] = '\0';
free(reg->key.p);
free(reg);
}
- return(ROFF_IGN);
+ return ROFF_IGN;
}
/* --- handler functions for roff requests -------------------------------- */
if (name[namesz] == '\\')
break;
}
- return(ROFF_IGN);
+ return ROFF_IGN;
}
static enum rofferr
if ( ! roff_evalnum(r, ln, buf->buf, &pos, &iv, 0)) {
mandoc_msg(MANDOCERR_IT_NONUM, r->parse,
ln, ppos, buf->buf + 1);
- return(ROFF_IGN);
+ return ROFF_IGN;
}
while (isspace((unsigned char)buf->buf[pos]))
roffit_macro = mandoc_strdup(iv != 1 ||
strcmp(buf->buf + pos, "an-trap") ?
buf->buf + pos : "br");
- return(ROFF_IGN);
+ return ROFF_IGN;
}
static enum rofferr
if (r->format == 0)
r->format = MPARSE_MDOC;
- return(ROFF_CONT);
+ return ROFF_CONT;
}
static enum rofferr
if (r->format == 0)
r->format = MPARSE_MAN;
- return(ROFF_CONT);
+ return ROFF_CONT;
}
static enum rofferr
free(buf->buf);
buf->buf = mandoc_strdup(".sp");
buf->sz = 4;
- return(ROFF_REPARSE);
+ return ROFF_REPARSE;
}
- return(ROFF_IGN);
+ return ROFF_IGN;
}
static enum rofferr
else
tbl_restart(ppos, ln, r->tbl);
- return(ROFF_IGN);
+ return ROFF_IGN;
}
/*
cp2 = strchr(cp1, r->eqn == NULL ?
r->last_eqn->odelim : r->last_eqn->cdelim);
if (cp2 == NULL)
- return(ROFF_CONT);
+ return ROFF_CONT;
*cp2++ = '\0';
bef_pr = bef_nl = aft_nl = aft_pr = "";
/* Toggle the in-line state of the eqn subsystem. */
r->eqn_inline = r->eqn == NULL;
- return(ROFF_REPARSE);
+ return ROFF_REPARSE;
}
static enum rofferr
mandoc_vmsg(MANDOCERR_ARG_SKIP, r->parse, ln, pos,
".EQ %s", buf->buf + pos);
- return(ROFF_IGN);
+ return ROFF_IGN;
}
static enum rofferr
{
mandoc_msg(MANDOCERR_BLK_NOTOPEN, r->parse, ln, ppos, "EN");
- return(ROFF_IGN);
+ return ROFF_IGN;
}
static enum rofferr
r->first_tbl = r->last_tbl = tbl;
r->tbl = r->last_tbl = tbl;
- return(ROFF_IGN);
+ return ROFF_IGN;
}
static enum rofferr
{
buf->buf[pos - 1] = '\0';
- return(ROFF_CONT);
+ return ROFF_CONT;
}
static enum rofferr
mandoc_vmsg(MANDOCERR_ARG_EXCESS, r->parse,
ln, p - buf->buf, "cc ... %s", p);
- return(ROFF_IGN);
+ return ROFF_IGN;
}
static enum rofferr
if (*p == '\0') {
mandoc_msg(MANDOCERR_REQ_EMPTY, r->parse, ln, ppos, "tr");
- return(ROFF_IGN);
+ return ROFF_IGN;
}
while (*p != '\0') {
if (esc == ESCAPE_ERROR) {
mandoc_msg(MANDOCERR_ESC_BAD, r->parse,
ln, (int)(p - buf->buf), first);
- return(ROFF_IGN);
+ return ROFF_IGN;
}
fsz = (size_t)(p - first);
}
if (esc == ESCAPE_ERROR) {
mandoc_msg(MANDOCERR_ESC_BAD, r->parse,
ln, (int)(p - buf->buf), second);
- return(ROFF_IGN);
+ return ROFF_IGN;
}
ssz = (size_t)(p - second);
} else if (*second == '\0') {
r->xtab[(int)*first].sz = ssz;
}
- return(ROFF_IGN);
+ return ROFF_IGN;
}
static enum rofferr
free(buf->buf);
buf->buf = cp;
*offs = 0;
- return(ROFF_REPARSE);
+ return ROFF_REPARSE;
}
*offs = pos;
- return(ROFF_SO);
+ return ROFF_SO;
}
/* --- user defined strings and macros ------------------------------------ */
buf->buf = n1;
*offs = 0;
- return(buf->sz > 1 && buf->buf[buf->sz - 2] == '\n' ?
- ROFF_REPARSE : ROFF_APPEND);
+ return buf->sz > 1 && buf->buf[buf->sz - 2] == '\n' ?
+ ROFF_REPARSE : ROFF_APPEND;
}
static size_t
name = *cpp;
if ('\0' == *name)
- return(0);
+ return 0;
/* Read until end of name and terminate it with NUL. */
for (cp = name; 1; cp++) {
cp++;
*cpp = cp;
- return(namesz);
+ return namesz;
}
/*
for (n = r->strtab; n; n = n->next)
if (0 == strncmp(name, n->key.p, len) &&
'\0' == n->key.p[(int)len])
- return(n->val.p);
+ return n->val.p;
for (i = 0; i < PREDEFS_MAX; i++)
if (0 == strncmp(name, predefs[i].name, len) &&
'\0' == predefs[i].name[(int)len])
- return(predefs[i].str);
+ return predefs[i].str;
- return(NULL);
+ return NULL;
}
static void
roff_span(const struct roff *r)
{
- return(r->tbl ? tbl_span(r->tbl) : NULL);
+ return r->tbl ? tbl_span(r->tbl) : NULL;
}
const struct eqn *
roff_eqn(const struct roff *r)
{
- return(r->last_eqn ? &r->last_eqn->eqn : NULL);
+ return r->last_eqn ? &r->last_eqn->eqn : NULL;
}
/*
enum mandoc_esc esc;
if (NULL == r->xmbtab && NULL == r->xtab)
- return(mandoc_strdup(p));
+ return mandoc_strdup(p);
else if ('\0' == *p)
- return(mandoc_strdup(""));
+ return mandoc_strdup("");
/*
* Step through each character looking for term matches
}
res[(int)ssz] = '\0';
- return(res);
+ return res;
}
int
roff_getformat(const struct roff *r)
{
- return(r->format);
+ return r->format;
}
/*
if (0 != r->control && cp[pos] == r->control)
pos++;
else if (0 != r->control)
- return(0);
+ return 0;
else if ('\\' == cp[pos] && '.' == cp[pos + 1])
pos += 2;
else if ('.' == cp[pos] || '\'' == cp[pos])
pos++;
else
- return(0);
+ return 0;
while (' ' == cp[pos] || '\t' == cp[pos])
pos++;
*ppos = pos;
- return(1);
+ return 1;
}
-/* $OpenBSD: st.c,v 1.9 2015/04/02 21:03:18 schwarze Exp $ */
+/* $OpenBSD: st.c,v 1.10 2015/10/06 18:30:44 schwarze Exp $ */
/*
* Copyright (c) 2009 Kristaps Dzonsons <kristaps@bsd.lv>
*
#include "st.in"
- return(NULL);
+ return NULL;
}
-/* $OpenBSD: tag.c,v 1.7 2015/08/29 15:28:19 schwarze Exp $ */
+/* $OpenBSD: tag.c,v 1.8 2015/10/06 18:30:44 schwarze Exp $ */
/*
* Copyright (c) 2015 Ingo Schwarze <schwarze@openbsd.org>
*
tag_info.key_offset = offsetof(struct tag_entry, s);
tag_info.data = NULL;
ohash_init(&tag_data, 4, &tag_info);
- return(&tag_files);
+ return &tag_files;
fail:
tag_unlink();
*tag_files.tfn = '\0';
tag_files.ofd = -1;
tag_files.tfd = -1;
- return(NULL);
+ return NULL;
}
/*
tag_alloc(size_t sz, void *arg)
{
- return(mandoc_malloc(sz));
+ return mandoc_malloc(sz);
}
static void *
tag_calloc(size_t nmemb, size_t sz, void *arg)
{
- return(mandoc_calloc(nmemb, sz));
+ return mandoc_calloc(nmemb, sz);
}
static void
-/* $OpenBSD: tbl.c,v 1.20 2015/01/30 17:31:20 schwarze Exp $ */
+/* $OpenBSD: tbl.c,v 1.21 2015/10/06 18:30:44 schwarze Exp $ */
/*
* Copyright (c) 2009, 2010, 2011 Kristaps Dzonsons <kristaps@bsd.lv>
* Copyright (c) 2011, 2015 Ingo Schwarze <schwarze@openbsd.org>
if (*cp == ';') {
tbl_option(tbl, ln, p, &pos);
if (p[pos] == '\0')
- return(ROFF_IGN);
+ return ROFF_IGN;
}
}
switch (tbl->part) {
case TBL_PART_LAYOUT:
tbl_layout(tbl, ln, p, pos);
- return(ROFF_IGN);
+ return ROFF_IGN;
case TBL_PART_CDATA:
- return(tbl_cdata(tbl, ln, p, pos) ? ROFF_TBL : ROFF_IGN);
+ return tbl_cdata(tbl, ln, p, pos) ? ROFF_TBL : ROFF_IGN;
default:
break;
}
tbl_data(tbl, ln, p, pos);
- return(ROFF_TBL);
+ return ROFF_TBL;
}
struct tbl_node *
tbl->part = TBL_PART_OPTS;
tbl->opts.tab = '\t';
tbl->opts.decimal = '.';
- return(tbl);
+ return tbl;
}
void
: tbl->first_span;
if (span)
tbl->current_span = span;
- return(span);
+ return span;
}
int
if (sp == NULL) {
mandoc_msg(MANDOCERR_TBLDATA_NONE, tbl->parse,
tbl->line, tbl->pos, NULL);
- return(0);
+ return 0;
}
- return(1);
+ return 1;
}
-/* $OpenBSD: tbl_data.c,v 1.27 2015/04/19 20:34:56 schwarze Exp $ */
+/* $OpenBSD: tbl_data.c,v 1.28 2015/10/06 18:30:44 schwarze Exp $ */
/*
* Copyright (c) 2009, 2010, 2011 Kristaps Dzonsons <kristaps@bsd.lv>
* Copyright (c) 2011, 2015 Ingo Schwarze <schwarze@openbsd.org>
pos++;
while (p[pos] != '\0')
getdata(tbl, tbl->last_span, ln, p, &pos);
- return(1);
+ return 1;
} else if (p[pos] == '\0') {
tbl->part = TBL_PART_DATA;
- return(1);
+ return 1;
}
/* Fallthrough: T} is part of a word. */
mandoc_msg(MANDOCERR_TBLDATA_SPAN, tbl->parse,
ln, pos, dat->string);
- return(0);
+ return 0;
}
static struct tbl_span *
dp->prev->next = dp;
tbl->last_span = dp;
- return(dp);
+ return dp;
}
void
-/* $OpenBSD: tbl_html.c,v 1.11 2015/01/30 17:31:20 schwarze Exp $ */
+/* $OpenBSD: tbl_html.c,v 1.12 2015/10/06 18:30:44 schwarze Exp $ */
/*
* Copyright (c) 2011 Kristaps Dzonsons <kristaps@bsd.lv>
+ * 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
html_tbl_len(size_t sz, void *arg)
{
- return(sz);
+ return sz;
}
static size_t
html_tbl_strlen(const char *p, void *arg)
{
- return(strlen(p));
+ return strlen(p);
}
static void
-/* $OpenBSD: tbl_layout.c,v 1.26 2015/04/29 12:44:10 schwarze Exp $ */
+/* $OpenBSD: tbl_layout.c,v 1.27 2015/10/06 18:30:44 schwarze Exp $ */
/*
* Copyright (c) 2009, 2010, 2011 Kristaps Dzonsons <kristaps@bsd.lv>
* Copyright (c) 2012, 2014, 2015 Ingo Schwarze <schwarze@openbsd.org>
if (tbl->opts.cols <= p->col)
tbl->opts.cols = p->col + 1;
- return(p);
+ return p;
}
-/* $OpenBSD: tbl_term.c,v 1.29 2015/09/26 00:53:15 schwarze Exp $ */
+/* $OpenBSD: tbl_term.c,v 1.30 2015/10/06 18:30:44 schwarze Exp $ */
/*
* Copyright (c) 2009, 2011 Kristaps Dzonsons <kristaps@bsd.lv>
* Copyright (c) 2011, 2012, 2014, 2015 Ingo Schwarze <schwarze@openbsd.org>
term_tbl_strlen(const char *p, void *arg)
{
- return(term_strlen((const struct termp *)arg, p));
+ return term_strlen((const struct termp *)arg, p);
}
static size_t
term_tbl_len(size_t sz, void *arg)
{
- return(term_len((const struct termp *)arg, sz));
+ return term_len((const struct termp *)arg, sz);
}
void
-/* $OpenBSD: term.c,v 1.111 2015/09/26 00:53:15 schwarze Exp $ */
+/* $OpenBSD: term.c,v 1.112 2015/10/06 18:30:44 schwarze Exp $ */
/*
* Copyright (c) 2008, 2009, 2010, 2011 Kristaps Dzonsons <kristaps@bsd.lv>
* Copyright (c) 2010-2015 Ingo Schwarze <schwarze@openbsd.org>
term_len(const struct termp *p, size_t sz)
{
- return((*p->width)(p, ' ') * sz);
+ return (*p->width)(p, ' ') * sz;
}
static size_t
if (*skip) {
(*skip) = 0;
- return(0);
+ return 0;
} else
- return((*p->width)(p, c));
+ return (*p->width)(p, c);
}
size_t
}
}
- return(sz);
+ return sz;
}
int
abort();
}
ri = r > 0.0 ? r + 0.4995 : r - 0.4995;
- return(ri < 66 ? ri : 1);
+ return ri < 66 ? ri : 1;
}
/*
term_hspan(const struct termp *p, const struct roffsu *su)
{
- return((*p->hspan)(p, su));
+ return (*p->hspan)(p, su);
}
-/* $OpenBSD: term_ascii.c,v 1.34 2015/09/26 00:53:15 schwarze Exp $ */
+/* $OpenBSD: term_ascii.c,v 1.35 2015/10/06 18:30:44 schwarze Exp $ */
/*
* Copyright (c) 2010, 2011 Kristaps Dzonsons <kristaps@bsd.lv>
* Copyright (c) 2014, 2015 Ingo Schwarze <schwarze@openbsd.org>
if (outopts->synopsisonly)
p->synopsisonly = 1;
- return(p);
+ return p;
}
void *
ascii_alloc(const struct mchars *mchars, const struct manoutput *outopts)
{
- return(ascii_init(TERMENC_ASCII, mchars, outopts));
+ return ascii_init(TERMENC_ASCII, mchars, outopts);
}
void *
utf8_alloc(const struct mchars *mchars, const struct manoutput *outopts)
{
- return(ascii_init(TERMENC_UTF8, mchars, outopts));
+ return ascii_init(TERMENC_UTF8, mchars, outopts);
}
void *
locale_alloc(const struct mchars *mchars, const struct manoutput *outopts)
{
- return(ascii_init(TERMENC_LOCALE, mchars, outopts));
+ return ascii_init(TERMENC_LOCALE, mchars, outopts);
}
static void
ascii_width(const struct termp *p, int c)
{
- return(1);
+ return 1;
}
void
default:
abort();
}
- return(r > 0.0 ? r + 0.01 : r - 0.01);
+ return r > 0.0 ? r + 0.01 : r - 0.01;
}
const char *
assert(uc >= 0);
if ((size_t)uc < sizeof(tab)/sizeof(tab[0]))
- return(tab[uc]);
- return(mchars_uc2str(uc));
+ return tab[uc];
+ return mchars_uc2str(uc);
}
static size_t
rc = wcwidth(c);
if (rc < 0)
rc = 0;
- return(rc);
+ return rc;
}
static void
-/* $OpenBSD: term_ps.c,v 1.39 2015/04/04 17:46:58 schwarze Exp $ */
+/* $OpenBSD: term_ps.c,v 1.40 2015/10/06 18:30:44 schwarze Exp $ */
/*
* Copyright (c) 2010, 2011 Kristaps Dzonsons <kristaps@bsd.lv>
* Copyright (c) 2014, 2015 Ingo Schwarze <schwarze@openbsd.org>
if (NULL != (p = pspdf_alloc(mchars, outopts)))
p->type = TERMTYPE_PDF;
- return(p);
+ return p;
}
void *
if (NULL != (p = pspdf_alloc(mchars, outopts)))
p->type = TERMTYPE_PS;
- return(p);
+ return p;
}
static struct termp *
p->ps->lineheight = lineheight;
p->defrmargin = pagex - (marginx * 2);
- return(p);
+ return p;
}
static void
else
c -= 32;
- return((size_t)fonts[(int)TERMFONT_NONE].gly[c].wx);
+ return (size_t)fonts[(int)TERMFONT_NONE].gly[c].wx;
}
static int
break;
}
- return(r * 24.0);
+ return r * 24.0;
}
static void