version 1.17, 2014/04/02 20:32:41 |
version 1.18, 2014/04/02 22:36:56 |
Line 179 formatescape(const char *buf, size_t *start, size_t en |
|
Line 179 formatescape(const char *buf, size_t *start, size_t en |
|
static int |
static int |
trylink(const char *buf, size_t *start, size_t end, size_t dsz) |
trylink(const char *buf, size_t *start, size_t end, size_t dsz) |
{ |
{ |
size_t sv, nstart, nend, i, j; |
size_t sv, nstart, nend, i, j, textsz; |
int hasdouble; |
const char *text; |
|
int hasdouble; |
|
|
/* |
/* |
* Scan to the start of the terminus. |
* Scan to the start of the terminus. |
* This function is more or less replicated in the formatcode() |
* This function is more or less replicated in the formatcode() |
* for null or index formatting codes. |
* for null or index formatting codes. |
*/ |
*/ |
hasdouble = 0; |
|
for (sv = nstart = *start; nstart < end; nstart++) { |
for (sv = nstart = *start; nstart < end; nstart++) { |
/* Do we have a double-colon? */ |
|
if (':' == buf[nstart] && |
|
nstart > sv && |
|
':' == buf[nstart - 1]) |
|
hasdouble = 1; |
|
if ('>' != buf[nstart]) |
if ('>' != buf[nstart]) |
continue; |
continue; |
else if (dsz == 1) |
else if (dsz == 1) |
Line 201 trylink(const char *buf, size_t *start, size_t end, si |
|
Line 196 trylink(const char *buf, size_t *start, size_t end, si |
|
assert(nstart > 0); |
assert(nstart > 0); |
if (' ' != buf[nstart - 1]) |
if (' ' != buf[nstart - 1]) |
continue; |
continue; |
i = nstart; |
for (i = nstart, j = 0; i < end && j < dsz; j++) |
for (j = 0; i < end && j < dsz; j++) |
|
if ('>' != buf[i++]) |
if ('>' != buf[i++]) |
break; |
break; |
if (dsz == j) |
if (dsz == j) |
Line 217 trylink(const char *buf, size_t *start, size_t end, si |
|
Line 211 trylink(const char *buf, size_t *start, size_t end, si |
|
nend = nstart; |
nend = nstart; |
if (dsz > 1) |
if (dsz > 1) |
nend--; |
nend--; |
|
|
|
/* Re-scan to see if we have a title. */ |
|
text = &buf[*start]; |
|
for (textsz = *start; textsz < nend; textsz++) |
|
if ('|' == buf[textsz]) |
|
break; |
|
|
|
if (textsz < nend) { |
|
sv = textsz + 1; |
|
textsz = textsz - *start; |
|
} else |
|
textsz = 0; |
|
|
|
/* Now see if we're a Perl manual. */ |
|
for (hasdouble = 0, i = sv + 1; i < end; i++) |
|
if (':' == buf[i] && ':' == buf[i - 1]) { |
|
hasdouble = 1; |
|
break; |
|
} |
|
|
/* |
/* |
* Provide for some common invocations of the link primitive. |
* Provide for some common invocations of the link primitive. |