version 1.159, 2010/07/18 17:00:26 |
version 1.161, 2010/08/07 20:57:33 |
|
|
#include <sys/types.h> |
#include <sys/types.h> |
|
|
#include <assert.h> |
#include <assert.h> |
#include <ctype.h> |
|
#include <stdarg.h> |
#include <stdarg.h> |
#include <stdio.h> |
#include <stdio.h> |
#include <stdlib.h> |
#include <stdlib.h> |
Line 764 mdoc_pmacro(struct mdoc *m, int ln, char *buf, int off |
|
Line 763 mdoc_pmacro(struct mdoc *m, int ln, char *buf, int off |
|
|
|
i = offs; |
i = offs; |
|
|
/* Accept whitespace after the initial control char. */ |
/* Accept tabs/whitespace after the initial control char. */ |
|
|
if (' ' == buf[i]) { |
if (' ' == buf[i] || '\t' == buf[i]) { |
i++; |
i++; |
while (buf[i] && ' ' == buf[i]) |
while (buf[i] && (' ' == buf[i] || '\t' == buf[i])) |
i++; |
i++; |
if ('\0' == buf[i]) |
if ('\0' == buf[i]) |
return(1); |
return(1); |
Line 776 mdoc_pmacro(struct mdoc *m, int ln, char *buf, int off |
|
Line 775 mdoc_pmacro(struct mdoc *m, int ln, char *buf, int off |
|
|
|
sv = i; |
sv = i; |
|
|
/* Copy the first word into a nil-terminated buffer. */ |
/* |
|
* Copy the first word into a nil-terminated buffer. Stop |
|
* copying when a tab, space, or eoln is encountered. |
|
*/ |
|
|
for (j = 0; j < 4; j++, i++) { |
for (j = 0; j < 4; j++, i++) |
if ('\0' == (mac[j] = buf[i])) |
if ('\0' == (mac[j] = buf[i])) |
break; |
break; |
else if (' ' == buf[i]) |
else if (' ' == buf[i] || '\t' == buf[i]) |
break; |
break; |
|
|
/* Check for invalid characters. */ |
|
|
|
if (isgraph((u_char)buf[i])) |
|
continue; |
|
if ( ! mdoc_pmsg(m, ln, i, MANDOCERR_BADCHAR)) |
|
return(0); |
|
i--; |
|
} |
|
|
|
mac[j] = '\0'; |
mac[j] = '\0'; |
|
|
if (j == 4 || j < 2) { |
if (j == 4 || j < 2) { |
Line 807 mdoc_pmacro(struct mdoc *m, int ln, char *buf, int off |
|
Line 800 mdoc_pmacro(struct mdoc *m, int ln, char *buf, int off |
|
return(1); |
return(1); |
} |
} |
|
|
/* The macro is sane. Jump to the next word. */ |
/* Disregard the first trailing tab, if applicable. */ |
|
|
|
if ('\t' == buf[i]) |
|
i++; |
|
|
|
/* Jump to the next non-whitespace word. */ |
|
|
while (buf[i] && ' ' == buf[i]) |
while (buf[i] && ' ' == buf[i]) |
i++; |
i++; |