Unix Man ( )

         

DBM(3)


DBM(3)
XENIX System V (21 1987)


dbminit, fetch, store, delete, firstkey, nextkey - ypae ao ax

typedef struct {char *dptr;int dsize;} datum;

int dbminit (file) char *file;

datum fetch (key) datum key;

store (key, content) datum key, content;

delete (key) datum key;

datum firstkey ()

datum nextkey (key) datum key;


y ypa paoo a ax, oopo ocy aoy eey a ocyecec o y. y oy ocya oe oe a ax (o apa oo). ocy o y oe a p, a oceoae. popa, coye y, o oooac c ao -ldbm.

o key content ocac c oo e a datum, aaeo cpoy dsize ao, a oopy yaae dptr. oyc pooe ae oo ccee cce coe cpo. aa ax paeaec yx aax. ep a o aao a, coepa apy pacpeee a. Bopo a coep coceo ae. epoo aa ee cyc .dir, opoo - cyc .pag.

oye ocya ae ee yo op oo dbminit. B oe op a file.dir file.pag (file - apye y dbminit) o cyecoa. yca aa coaec ye coa x ao c yeo o.

oce op a ae ee pac c oo y fetch aocc ee c oo y store. Bopa aecee pooc c oo a - apyea key. K cae c ae yoac c oo y delete. oceoae pocop cex e ae oe cea c oo y firstkey nextkey. Firstkey opaae ep ae, nextkey opaae , oop ceye a o, c apyeo y. Hecey ooe pocope c ay:

for(key=firstkey();key.dptr!=NULL;key=nextkey(key))

BOPAAEOE AEE


y, opaae ee ae, cyae o opaa opaeoe co. B cyae yceoo aepe opaaec 0. y, opaae aee a datum, cyae o ycaaa oe dptr NULL.

AEA



a `.pag' oe coepa yce oac, a o eo oe oe pepo 4 paa pea oe xpax ae ax. pee epc XENIX p opae yc oac aa o aa o x peae o cooo pocpaca. Tae a e oy copoa o cpeca (cp, cat, tp, tar, ar) e peapeoo aoe ycx oace.

aae dptr cpyypax a datum, opaaex eoop y, yaae caecy oac a, oopa epeacaec oepe oo.

Cyapa a ap `/ae' e oa pea paepa oa (512 aa). oee oo, ce ae ap, ee p xepoa oo aee, o paeac oo oe. Ec o e a, store opaae oy.

Delete e ee oea aa, o eae yaee ac ocy ooo cooa.

opo e, aaae y firstkey nextkey, opeeec xepoae.

popa epeeepae, ooy x e cooa pao c eco aa oopeeo.