This is a live mirror of the Perl 5 development currently hosted at https://github.com/perl/perl5
Remove another dead function in vms/vms.c.
[perl5.git] / ext / SDBM_File / util.c
CommitLineData
463ee0b2
LW
1#include <stdio.h>
2#ifdef SDBM
3#include "sdbm.h"
4#else
5#include "ndbm.h"
6#endif
7
8void
5aaab254 9oops(char *s1, char *s2)
463ee0b2
LW
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
f0f333f4 25okpage(char *pag)
463ee0b2 26{
5aaab254
KW
27 unsigned n;
28 int off;
29 short *ino = (short *) pag;
463ee0b2
LW
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}