recovering clobbered aliases file

MP%mit-xx at sri-unix.UUCP MP%mit-xx at sri-unix.UUCP
Tue Jul 26 14:48:00 AEST 1983


From:  Mark Plotnick <MP at mit-xx>

If your system runs out of disk space frequently (we do), or if you
have butterfingered typists (we do), you may wind up clobbering
certain files such as /usr/lib/aliases.  Well, it happened to us once
too often, and John Woods wrote this little program that reconstructs
/usr/lib/aliases from /usr/lib/aliases.{dir,pag} :

#include <stdio.h>

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

main()
{
	datum Key, firstkey(), nextkey(), Datum, fetch();

	dbminit("/usr/lib/aliases");
	for (Key = firstkey(); Key.dptr != NULL; Key = nextkey(Key))
	{	Datum = fetch(Key);
		printf("%s: %s\n",Key.dptr,Datum.dptr);
	}
}
-------



More information about the Comp.unix.wizards mailing list