4.3BSD/usr/contrib/spms/src/lib/libpdb/test/closepdb.a

!<arch>
Iclosepdb       418697934   968   27    100644  105       `
aaa
bbb|ccc
ddd|eee:
fff:lp=here:id=butnothere
ggg|
hhh|iii:lp=andhere

:jjj
kkk|lll|:lp:lp=andherealso:

Oclosepdb       418697934   968   27    100644  160       `
aaa
bbb|ccc
ddd|eee:
new|fff:lp=here:id=butnothere
ggg|
hhh|iii:lp=andhere
new|:
:jjj
kkk|lll|:lp:lp=andherealso:
Tclosepdb: ./T_INPUT database buffer exceeded
Tclosepdb.c     418697937   968   27    100644  1011      `
/*
 * closepdb()
 */
#include <stdio.h>
#include "path.h"
#include "pdb.h"
#include "yesno.h"

#define KEYSIZE 10

char *PGN = "Tclosepdb";		/* program name */

main()
{
	int closepdb();			/* close database */
	int i;				/* input case counter */
	int keybuf[KEYSIZE];		/* key string buffer */
	int pbaddkey();			/* add key */
	int pgetent();			/* load next entry into buffer */
	int pputent();			/* write buffer to database */
	PDB *mustopenpdb();		/* must open database or die */
	PDB *pdbp;			/* database stream */
	
	/* normal update */
	pdbp = mustopenpdb("T_INPUT", ".", "rw");
	for (i = 1; pgetent(pdbp) != EOF; i++)
		{
		switch (i)
			{
			case 4: pbaddkey("new");
				break;
			case 7: pbaddkey("new");
				break;
			}
		pputent(pdbp);
		}
	closepdb(pdbp);

	/* update with deliberate error */
	pdbp = mustopenpdb("T_INPUT", ".", "rw");
	if (pgetent(pdbp) != EOF)
		{
		i = 0;
		do	{
			sprintf(keybuf, "%d", ++i);
			} while (pbaddkey(keybuf) == YES);
		}
	pputent(pdbp);
	closepdb(pdbp);
	exit(0);
}

Tclosepdb.sh    418870169   968   27    100755  171       `
#!/bin/csh -f
#
# closepdb()
#
cp Iclosepdb T_INPUT
Tclosepdb >& ERROR
cat T_INPUT ERROR | diff - Oclosepdb
set diffstatus = $status
rm -f T_INPUT ERROR
exit($diffstatus)