1#include <stdio.h> 2#ifdef SDBM 3#include "sdbm.h" 4#else 5#include "ndbm.h" 6#endif 7 8void 9oops(char *s1, char *s2) 10{ 11 extern int errno, sys_nerr; 12 extern char *sys_errlist[]; 13 extern char *progname; 14 15 if (progname) 16 fprintf(stderr, "%s: ", progname); 17 fprintf(stderr, s1, s2); 18 if (errno > 0 && errno < sys_nerr) 19 fprintf(stderr, " (%s)", sys_errlist[errno]); 20 fprintf(stderr, "\n"); 21 exit(1); 22} 23 24int 25okpage(char *pag) 26{ 27 unsigned n; 28 int off; 29 short *ino = (short *) pag; 30 31 if ((n = ino[0]) > PBLKSIZ / sizeof(short)) 32 return 0; 33 34 if (!n) 35 return 1; 36 37 off = PBLKSIZ; 38 for (ino++; n; ino += 2) { 39 if (ino[0] > off || ino[1] > off || 40 ino[1] > ino[0]) 41 return 0; 42 off = ino[1]; 43 n -= 2; 44 } 45 46 return 1; 47} 48