version 1.99, 2017/06/01 19:05:37 |
version 1.102, 2017/06/14 01:31:26 |
|
|
/* $Id$ */ |
/* $Id$ */ |
/* |
/* |
* Copyright (c) 2008-2011, 2014 Kristaps Dzonsons <kristaps@bsd.lv> |
* Copyright (c) 2008-2011, 2014 Kristaps Dzonsons <kristaps@bsd.lv> |
* Copyright (c) 2011-2015 Ingo Schwarze <schwarze@openbsd.org> |
* Copyright (c) 2011-2015, 2017 Ingo Schwarze <schwarze@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 above |
* purpose with or without fee is hereby granted, provided that the above |
|
|
#include <string.h> |
#include <string.h> |
#include <time.h> |
#include <time.h> |
|
|
#include "mandoc.h" |
|
#include "mandoc_aux.h" |
#include "mandoc_aux.h" |
|
#include "mandoc.h" |
|
#include "roff.h" |
#include "libmandoc.h" |
#include "libmandoc.h" |
|
|
static int a2time(time_t *, const char *, const char *); |
static int a2time(time_t *, const char *, const char *); |
Line 95 mandoc_escape(const char **end, const char **start, in |
|
Line 96 mandoc_escape(const char **end, const char **start, in |
|
case ',': |
case ',': |
case '/': |
case '/': |
return ESCAPE_IGNORE; |
return ESCAPE_IGNORE; |
|
case 'p': |
|
return ESCAPE_BREAK; |
|
|
/* |
/* |
* The \z escape is supposed to output the following |
* The \z escape is supposed to output the following |
Line 175 mandoc_escape(const char **end, const char **start, in |
|
Line 178 mandoc_escape(const char **end, const char **start, in |
|
++*end; |
++*end; |
return ESCAPE_ERROR; |
return ESCAPE_ERROR; |
} |
} |
gly = (*start)[-1] == 'h' ? ESCAPE_HORIZ : ESCAPE_IGNORE; |
switch ((*start)[-1]) { |
|
case 'h': |
|
gly = ESCAPE_HORIZ; |
|
break; |
|
case 'l': |
|
gly = ESCAPE_HLINE; |
|
break; |
|
default: |
|
gly = ESCAPE_IGNORE; |
|
break; |
|
} |
term = **start; |
term = **start; |
*start = ++*end; |
*start = ++*end; |
break; |
break; |
|
|
} |
} |
|
|
char * |
char * |
mandoc_normdate(struct mparse *parse, char *in, int ln, int pos) |
mandoc_normdate(struct roff_man *man, char *in, int ln, int pos) |
{ |
{ |
time_t t; |
time_t t; |
|
|
/* No date specified: use today's date. */ |
/* No date specified: use today's date. */ |
|
|
if (in == NULL || *in == '\0' || strcmp(in, "$" "Mdocdate$") == 0) { |
if (in == NULL || *in == '\0' || strcmp(in, "$" "Mdocdate$") == 0) { |
mandoc_msg(MANDOCERR_DATE_MISSING, parse, ln, pos, NULL); |
mandoc_msg(MANDOCERR_DATE_MISSING, man->parse, ln, pos, NULL); |
return time2a(time(NULL)); |
return time2a(time(NULL)); |
} |
} |
|
|
Line 525 mandoc_normdate(struct mparse *parse, char *in, int ln |
|
Line 538 mandoc_normdate(struct mparse *parse, char *in, int ln |
|
a2time(&t, "%b %d, %Y", in)) |
a2time(&t, "%b %d, %Y", in)) |
return time2a(t); |
return time2a(t); |
|
|
/* Do not warn about the legacy man(7) format. */ |
/* In man(7), do not warn about the legacy format. */ |
|
|
if ( ! a2time(&t, "%Y-%m-%d", in)) |
if (a2time(&t, "%Y-%m-%d", in) == 0) |
mandoc_msg(MANDOCERR_DATE_BAD, parse, ln, pos, in); |
mandoc_msg(MANDOCERR_DATE_BAD, man->parse, ln, pos, in); |
|
else if (man->macroset == MACROSET_MDOC) |
|
mandoc_vmsg(MANDOCERR_DATE_LEGACY, man->parse, |
|
ln, pos, "Dd %s", in); |
|
|
/* Use any non-mdoc(7) date verbatim. */ |
/* Use any non-mdoc(7) date verbatim. */ |
|
|