diff options
Diffstat (limited to 'doc.c')
-rw-r--r-- | doc.c | 10 |
1 files changed, 10 insertions, 0 deletions
diff --git a/doc.c b/doc.c index 89ff756..d41db7c 100644 --- a/doc.c +++ b/doc.c @@ -17,6 +17,7 @@ void doc_init(struct doc *d) { .len = 0, }; d->latest = 0; + d->linkc = 0; } void doc_fini(struct doc *d) { @@ -89,3 +90,12 @@ int doc_line_next(struct doc *d, size_t *ofs) { return -1; } } + +const char *doc_get_link(struct doc *d, unsigned short lnk) { + size_t l = 1; + for (size_t i = 0; i < d->lnk.sz; i++) { + if (l == lnk) return &d->lnk.buf[i]; + if (d->lnk.buf[i] == 0) l++; + } + return NULL; +} |