version 1.3, 2009/04/02 16:37:40 |
version 1.6, 2009/04/12 19:49:35 |
|
|
/* $Id$ */ |
/* $Id$ */ |
/* |
/* |
* Copyright (c) 2008, 2009 Kristaps Dzonsons <kristaps@openbsd.org> |
* Copyright (c) 2008, 2009 Kristaps Dzonsons <kristaps@openbsd.org> |
* |
* |
* Permission to use, copy, modify, and distribute this software for any |
* Permission to use, copy, modify, and distribute this software for any |
* purpose with or without fee is hereby granted, provided that the |
* purpose with or without fee is hereby granted, provided that the above |
* above copyright notice and this permission notice appear in all |
* copyright notice and this permission notice appear in all copies. |
* copies. |
|
* |
* |
* THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL |
* THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES |
* WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED |
* WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF |
* WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE |
* MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR |
* AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL |
* ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES |
* DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR |
* WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN |
* PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER |
* ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF |
* TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR |
* OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. |
* PERFORMANCE OF THIS SOFTWARE. |
|
*/ |
*/ |
#include <sys/types.h> |
#include <sys/types.h> |
|
|
|
|
}; |
}; |
|
|
enum mwarn { |
enum mwarn { |
|
WPRINT, |
WESCAPE, |
WESCAPE, |
WWRONGMSEC, |
WWRONGMSEC, |
WSECOOO, |
WSECOOO, |
Line 95 static int warn_child_gt(struct mdoc *, const char *, |
|
Line 94 static int warn_child_gt(struct mdoc *, const char *, |
|
static int err_child_eq(struct mdoc *, const char *, int); |
static int err_child_eq(struct mdoc *, const char *, int); |
static int warn_child_eq(struct mdoc *, const char *, int); |
static int warn_child_eq(struct mdoc *, const char *, int); |
static int count_child(struct mdoc *); |
static int count_child(struct mdoc *); |
|
static int warn_print(struct mdoc *, int, int); |
static int warn_count(struct mdoc *, const char *, |
static int warn_count(struct mdoc *, const char *, |
int, const char *, int); |
int, const char *, int); |
static int err_count(struct mdoc *, const char *, |
static int err_count(struct mdoc *, const char *, |
Line 460 pwarn(struct mdoc *m, int line, int pos, enum mwarn ty |
|
Line 460 pwarn(struct mdoc *m, int line, int pos, enum mwarn ty |
|
p = "prologue macros out-of-order"; |
p = "prologue macros out-of-order"; |
c = WARN_COMPAT; |
c = WARN_COMPAT; |
break; |
break; |
|
case (WPRINT): |
|
p = "invalid character"; |
|
break; |
case (WESCAPE): |
case (WESCAPE): |
p = "invalid escape sequence"; |
p = "invalid escape sequence"; |
break; |
break; |
Line 497 pwarn(struct mdoc *m, int line, int pos, enum mwarn ty |
|
Line 500 pwarn(struct mdoc *m, int line, int pos, enum mwarn ty |
|
} |
} |
|
|
|
|
|
static int |
|
warn_print(struct mdoc *m, int ln, int pos) |
|
{ |
|
if (MDOC_IGN_CHARS & m->pflags) |
|
return(pwarn(m, ln, pos, WPRINT)); |
|
return(perr(m, ln, pos, EPRINT)); |
|
} |
|
|
|
|
static inline int |
static inline int |
warn_count(struct mdoc *m, const char *k, |
warn_count(struct mdoc *m, const char *k, |
int want, const char *v, int has) |
int want, const char *v, int has) |
Line 699 check_text(struct mdoc *mdoc, int line, int pos, const |
|
Line 710 check_text(struct mdoc *mdoc, int line, int pos, const |
|
for ( ; *p; p++) { |
for ( ; *p; p++) { |
if ('\t' == *p) { |
if ('\t' == *p) { |
if ( ! (MDOC_LITERAL & mdoc->flags)) |
if ( ! (MDOC_LITERAL & mdoc->flags)) |
return(perr(mdoc, line, pos, EPRINT)); |
if ( ! warn_print(mdoc, line, pos)) |
|
return(0); |
} else if ( ! isprint((u_char)*p)) |
} else if ( ! isprint((u_char)*p)) |
return(perr(mdoc, line, pos, EPRINT)); |
if ( ! warn_print(mdoc, line, pos)) |
|
return(0); |
|
|
if ('\\' != *p) |
if ('\\' != *p) |
continue; |
continue; |
|
|
pre_er(PRE_ARGS) |
pre_er(PRE_ARGS) |
{ |
{ |
|
|
return(check_msec(mdoc, n, 2, 0)); |
return(check_msec(mdoc, n, 2, 3, 9, 0)); |
} |
} |
|
|
|
|