version 1.9, 2009/03/26 14:38:11 |
version 1.17, 2009/06/18 10:53:58 |
|
|
/* $Id$ */ |
/* $Id$ */ |
/* |
/* |
* Copyright (c) 2008, 2009 Kristaps Dzonsons <kristaps@openbsd.org> |
* Copyright (c) 2008, 2009 Kristaps Dzonsons <kristaps@kth.se> |
* |
* |
* 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 <assert.h> |
#include <assert.h> |
#include <ctype.h> |
#include <ctype.h> |
#include <stdlib.h> |
#include <stdlib.h> |
#include <stdio.h> |
|
#include <string.h> |
#include <string.h> |
|
|
#include "libman.h" |
#include "libman.h" |
Line 31 static int man_args(struct man *, int, |
|
Line 28 static int man_args(struct man *, int, |
|
int *, char *, char **); |
int *, char *, char **); |
|
|
static int man_flags[MAN_MAX] = { |
static int man_flags[MAN_MAX] = { |
0, /* __ */ |
0, /* br */ |
0, /* TH */ |
0, /* TH */ |
0, /* SH */ |
0, /* SH */ |
0, /* SS */ |
0, /* SS */ |
Line 52 static int man_flags[MAN_MAX] = { |
|
Line 49 static int man_flags[MAN_MAX] = { |
|
FL_NLINE, /* I */ |
FL_NLINE, /* I */ |
FL_NLINE, /* IR */ |
FL_NLINE, /* IR */ |
FL_NLINE, /* RI */ |
FL_NLINE, /* RI */ |
|
0, /* na */ |
|
FL_NLINE, /* i */ |
}; |
}; |
|
|
int |
int |
Line 83 man_macro(struct man *man, int tok, int line, |
|
Line 82 man_macro(struct man *man, int tok, int line, |
|
|
|
if (n == man->last && (FL_NLINE & man_flags[tok])) { |
if (n == man->last && (FL_NLINE & man_flags[tok])) { |
if (MAN_NLINE & man->flags) |
if (MAN_NLINE & man->flags) |
return(man_verr(man, line, ppos, |
return(man_perr(man, line, ppos, WLNSCOPE)); |
"next-line scope already open")); |
|
man->flags |= MAN_NLINE; |
man->flags |= MAN_NLINE; |
return(1); |
return(1); |
} |
} |
|
|
if (FL_TLINE & man_flags[tok]) { |
if (FL_TLINE & man_flags[tok]) { |
if (MAN_NLINE & man->flags) |
if (MAN_NLINE & man->flags) |
return(man_verr(man, line, ppos, |
return(man_perr(man, line, ppos, WLNSCOPE)); |
"next-line scope already open")); |
|
man->flags |= MAN_NLINE; |
man->flags |= MAN_NLINE; |
return(1); |
return(1); |
} |
} |
Line 187 man_args(struct man *m, int line, |
|
Line 184 man_args(struct man *m, int line, |
|
if (buf[*pos]) |
if (buf[*pos]) |
return(1); |
return(1); |
|
|
if ( ! man_vwarn(m, line, *pos, "trailing spaces")) |
if ( ! man_pwarn(m, line, *pos, WTSPACE)) |
return(-1); |
return(-1); |
|
|
return(1); |
return(1); |
Line 205 man_args(struct man *m, int line, |
|
Line 202 man_args(struct man *m, int line, |
|
(*pos)++; |
(*pos)++; |
|
|
if (0 == buf[*pos]) { |
if (0 == buf[*pos]) { |
if ( ! man_vwarn(m, line, *pos, "unterminated quote")) |
if ( ! man_pwarn(m, line, *pos, WTQUOTE)) |
return(-1); |
return(-1); |
return(1); |
return(1); |
} |
} |
Line 220 man_args(struct man *m, int line, |
|
Line 217 man_args(struct man *m, int line, |
|
if (buf[*pos]) |
if (buf[*pos]) |
return(1); |
return(1); |
|
|
if ( ! man_vwarn(m, line, *pos, "trailing spaces")) |
if ( ! man_pwarn(m, line, *pos, WTSPACE)) |
return(-1); |
return(-1); |
return(1); |
return(1); |
} |
} |