version 1.28, 2011/12/08 09:19:13 |
version 1.32, 2011/12/10 16:53:39 |
Line 579 index_merge(const struct of *of, struct mparse *mp, |
|
Line 579 index_merge(const struct of *of, struct mparse *mp, |
|
if (0 == use_all) { |
if (0 == use_all) { |
assert(of->sec); |
assert(of->sec); |
assert(msec); |
assert(msec); |
if (strcmp(msec, of->sec)) |
if (strcasecmp(msec, of->sec)) |
continue; |
continue; |
|
|
if (NULL == arch) { |
if (NULL == arch) { |
if (NULL != of->arch) |
if (NULL != of->arch) |
continue; |
continue; |
} else if (NULL == of->arch || |
} else if (NULL == of->arch || |
strcmp(arch, of->arch)) |
strcasecmp(arch, of->arch)) |
continue; |
continue; |
} |
} |
|
|
Line 1288 pformatted(DB *hash, struct buf *buf, struct buf *dbuf |
|
Line 1288 pformatted(DB *hash, struct buf *buf, struct buf *dbuf |
|
buf_append(buf, of->title); |
buf_append(buf, of->title); |
hash_put(hash, buf, TYPE_Nm); |
hash_put(hash, buf, TYPE_Nm); |
|
|
/* Skip to first blank line. */ |
/* Skip to first blank line. */ |
|
|
while (NULL != (line = fgetln(stream, &len))) |
while (NULL != (line = fgetln(stream, &len))) |
if (len && '\n' == *line) |
if ('\n' == *line) |
break; |
break; |
|
|
/* |
/* |
* Skip to first section header. |
* Assume the first line that is not indented |
* This happens when text is flush-left. |
* is the first section header. Skip to it. |
*/ |
*/ |
|
|
while (NULL != (line = fgetln(stream, &len))) |
while (NULL != (line = fgetln(stream, &len))) |
if (len && '\n' != *line && ' ' != *line) |
if ('\n' != *line && ' ' != *line) |
break; |
break; |
|
|
/* |
/* |
* If no page content can be found or the input line is |
* If no page content can be found, or the input line |
* malformed (zer-length or has no trailing newline), reuse the |
* is already the next section header, or there is no |
* page title as the page description. |
* trailing newline, reuse the page title as the page |
|
* description. |
*/ |
*/ |
|
|
line = fgetln(stream, &len); |
line = fgetln(stream, &len); |
if (NULL == line || len == 0 || '\n' != line[(int)len - 1]) { |
if (NULL == line || ' ' != *line || '\n' != line[(int)len - 1]) { |
buf_appendb(dbuf, buf->cp, buf->size); |
buf_appendb(dbuf, buf->cp, buf->size); |
hash_put(hash, buf, TYPE_Nd); |
hash_put(hash, buf, TYPE_Nd); |
fclose(stream); |
fclose(stream); |
Line 1319 pformatted(DB *hash, struct buf *buf, struct buf *dbuf |
|
Line 1320 pformatted(DB *hash, struct buf *buf, struct buf *dbuf |
|
|
|
line[(int)--len] = '\0'; |
line[(int)--len] = '\0'; |
|
|
/* |
/* |
* Skip to the last dash. |
* Skip to the first dash. |
* Use the remaining line as the description (no more than 70 |
* Use the remaining line as the description (no more than 70 |
* bytes). |
* bytes). |
*/ |
*/ |
|
|
if (NULL != (p = strrchr(line, '-'))) { |
if (NULL != (p = strstr(line, "- "))) { |
for (++p; ' ' == *p || '\b' == *p; p++) |
for (p += 2; ' ' == *p || '\b' == *p; p++) |
/* Skip to next word. */ ; |
/* Skip to next word. */ ; |
} else |
} else |
p = line; |
p = line; |
Line 1336 pformatted(DB *hash, struct buf *buf, struct buf *dbuf |
|
Line 1337 pformatted(DB *hash, struct buf *buf, struct buf *dbuf |
|
p[plen] = '\0'; |
p[plen] = '\0'; |
} |
} |
|
|
|
/* Strip backspace-encoding from line. */ |
|
|
|
while (NULL != (line = memchr(p, '\b', plen))) { |
|
len = line - p; |
|
if (0 == len) { |
|
memmove(line, line + 1, plen--); |
|
continue; |
|
} |
|
memmove(line - 1, line + 1, plen - len); |
|
plen -= 2; |
|
} |
|
|
buf_appendb(dbuf, p, plen + 1); |
buf_appendb(dbuf, p, plen + 1); |
buf->len = 0; |
buf->len = 0; |
buf_appendb(buf, p, plen + 1); |
buf_appendb(buf, p, plen + 1); |
Line 1546 ofile_dirbuild(const char *dir, const char* psec, cons |
|
Line 1559 ofile_dirbuild(const char *dir, const char* psec, cons |
|
buf[0] = '\0'; |
buf[0] = '\0'; |
strlcat(buf, dir, MAXPATHLEN); |
strlcat(buf, dir, MAXPATHLEN); |
p = strrchr(buf, '/'); |
p = strrchr(buf, '/'); |
|
if (NULL != parch && NULL != p) |
|
for (p--; p > buf; p--) |
|
if ('/' == *p) |
|
break; |
if (NULL == p) |
if (NULL == p) |
p = buf; |
p = buf; |
else |
else |