version 1.3, 2016/08/17 18:59:37 |
version 1.6, 2023/04/28 19:11:03 |
|
|
/* $Id$ */ |
/* $Id$ */ |
/* |
/* |
* Copyright (c) 2016 Ingo Schwarze <schwarze@openbsd.org> |
* Copyright (c) 2016 Ingo Schwarze <schwarze@openbsd.org> |
* |
* |
|
|
* Function to read the mandoc database from disk into RAM, |
* Function to read the mandoc database from disk into RAM, |
* such that data can be added or removed. |
* such that data can be added or removed. |
* The interface is defined in "dba.h". |
* The interface is defined in "dba.h". |
* This file is seperate from dba.c because this also uses "dbm.h". |
* This file is separate from dba.c because this also uses "dbm.h". |
*/ |
*/ |
|
#include "config.h" |
|
|
#include <regex.h> |
#include <regex.h> |
#include <stdint.h> |
#include <stdint.h> |
#include <stdlib.h> |
#include <stdlib.h> |
Line 48 dba_read(const char *fname) |
|
Line 50 dba_read(const char *fname) |
|
dba = dba_new(npages < 128 ? 128 : npages); |
dba = dba_new(npages < 128 ? 128 : npages); |
for (ip = 0; ip < npages; ip++) { |
for (ip = 0; ip < npages; ip++) { |
pdata = dbm_page_get(ip); |
pdata = dbm_page_get(ip); |
page = dba_page_new(dba->pages, NULL, pdata->sect, |
page = dba_page_new(dba->pages, pdata->arch, |
pdata->arch, pdata->desc, pdata->file + 1, *pdata->file); |
pdata->desc, pdata->file + 1, *pdata->file); |
for (cp = pdata->name; *cp != '\0'; cp = strchr(cp, '\0') + 1) |
for (cp = pdata->name; *cp != '\0'; cp = strchr(cp, '\0') + 1) |
dba_page_add(page, DBP_NAME, cp); |
dba_page_add(page, DBP_NAME, cp); |
cp = pdata->sect; |
for (cp = pdata->sect; *cp != '\0'; cp = strchr(cp, '\0') + 1) |
while (*(cp = strchr(cp, '\0') + 1) != '\0') |
|
dba_page_add(page, DBP_SECT, cp); |
dba_page_add(page, DBP_SECT, cp); |
if ((cp = pdata->arch) != NULL) |
if ((cp = pdata->arch) != NULL) |
while (*(cp = strchr(cp, '\0') + 1) != '\0') |
while (*(cp = strchr(cp, '\0') + 1) != '\0') |