summaryrefslogtreecommitdiff
path: root/gnu/usr.bin/perl/ext/SDBM_File/sdbm
diff options
context:
space:
mode:
authorTodd C. Miller <millert@cvs.openbsd.org>2000-04-06 16:11:09 +0000
committerTodd C. Miller <millert@cvs.openbsd.org>2000-04-06 16:11:09 +0000
commite852ed17d905386f3bbad057fda2f07926227f89 (patch)
tree9c602984a369e27373c3cd3b71bd8c8e791393f2 /gnu/usr.bin/perl/ext/SDBM_File/sdbm
parent9cfdf10e50d1f9e72606c75c7b7a0e18940c80aa (diff)
virgin perl 5.6.0
Diffstat (limited to 'gnu/usr.bin/perl/ext/SDBM_File/sdbm')
-rw-r--r--gnu/usr.bin/perl/ext/SDBM_File/sdbm/README.too5
-rw-r--r--gnu/usr.bin/perl/ext/SDBM_File/sdbm/dba.c14
-rw-r--r--gnu/usr.bin/perl/ext/SDBM_File/sdbm/dbd.c18
-rw-r--r--gnu/usr.bin/perl/ext/SDBM_File/sdbm/dbe.c34
-rw-r--r--gnu/usr.bin/perl/ext/SDBM_File/sdbm/dbu.c18
5 files changed, 45 insertions, 44 deletions
diff --git a/gnu/usr.bin/perl/ext/SDBM_File/sdbm/README.too b/gnu/usr.bin/perl/ext/SDBM_File/sdbm/README.too
index c2d095944da..1fec3156ddc 100644
--- a/gnu/usr.bin/perl/ext/SDBM_File/sdbm/README.too
+++ b/gnu/usr.bin/perl/ext/SDBM_File/sdbm/README.too
@@ -7,3 +7,8 @@ Fri Apr 15 10:15:30 EDT 1994.
Additional portability/configuration changes for libsdbm by Andy Dougherty
doughera@lafcol.lafayette.edu.
+
+
+Mon Mar 22 03:24:47 PST 1999.
+
+sdbm_exists added to the library by Russ Allbery <rra@stanford.edu>.
diff --git a/gnu/usr.bin/perl/ext/SDBM_File/sdbm/dba.c b/gnu/usr.bin/perl/ext/SDBM_File/sdbm/dba.c
index 05e70c8961c..74067763985 100644
--- a/gnu/usr.bin/perl/ext/SDBM_File/sdbm/dba.c
+++ b/gnu/usr.bin/perl/ext/SDBM_File/sdbm/dba.c
@@ -11,8 +11,7 @@ char *progname;
extern void oops();
int
-main(argc, argv)
-char **argv;
+main(int argc, char **argv)
{
int n;
char *p;
@@ -23,6 +22,9 @@ char **argv;
if (p = argv[1]) {
name = (char *) malloc((n = strlen(p)) + 5);
+ if (!name)
+ oops("cannot get memory");
+
strcpy(name, p);
strcpy(name + n, ".pag");
@@ -37,8 +39,8 @@ char **argv;
return 0;
}
-sdump(pagf)
-int pagf;
+void
+sdump(int pagf)
{
register b;
register n = 0;
@@ -67,8 +69,8 @@ int pagf;
oops("read failed: block %d", n);
}
-pagestat(pag)
-char *pag;
+int
+pagestat(char *pag)
{
register n;
register free;
diff --git a/gnu/usr.bin/perl/ext/SDBM_File/sdbm/dbd.c b/gnu/usr.bin/perl/ext/SDBM_File/sdbm/dbd.c
index 04ab842e2d6..0a58d9a0f43 100644
--- a/gnu/usr.bin/perl/ext/SDBM_File/sdbm/dbd.c
+++ b/gnu/usr.bin/perl/ext/SDBM_File/sdbm/dbd.c
@@ -14,8 +14,7 @@ extern void oops();
#define empty(page) (((short *) page)[0] == 0)
int
-main(argc, argv)
-char **argv;
+main(int argc, char **argv)
{
int n;
char *p;
@@ -26,6 +25,9 @@ char **argv;
if (p = argv[1]) {
name = (char *) malloc((n = strlen(p)) + 5);
+ if (!name)
+ oops("cannot get memory");
+
strcpy(name, p);
strcpy(name + n, ".pag");
@@ -39,8 +41,8 @@ char **argv;
return 0;
}
-sdump(pagf)
-int pagf;
+void
+sdump(int pagf)
{
register r;
register n = 0;
@@ -65,8 +67,8 @@ int pagf;
#ifdef OLD
-dispage(pag)
-char *pag;
+int
+dispage(char *pag)
{
register i, n;
register off;
@@ -87,8 +89,8 @@ char *pag;
}
}
#else
-dispage(pag)
-char *pag;
+void
+dispage(char *pag)
{
register i, n;
register off;
diff --git a/gnu/usr.bin/perl/ext/SDBM_File/sdbm/dbe.c b/gnu/usr.bin/perl/ext/SDBM_File/sdbm/dbe.c
index 2a306f276ec..166e64efdf2 100644
--- a/gnu/usr.bin/perl/ext/SDBM_File/sdbm/dbe.c
+++ b/gnu/usr.bin/perl/ext/SDBM_File/sdbm/dbe.c
@@ -52,10 +52,7 @@ char *optarg; /* Global argument pointer. */
#endif
char
-getopt(argc, argv, optstring)
-int argc;
-char **argv;
-char *optstring;
+getopt(int argc, char **argv, char *optstring)
{
register int c;
register char *place;
@@ -131,14 +128,13 @@ char *optstring;
void
-print_datum(db)
-datum db;
+print_datum(datum db)
{
int i;
putchar('"');
for (i = 0; i < db.dsize; i++) {
- if (isprint(db.dptr[i]))
+ if (isprint((unsigned char)db.dptr[i]))
putchar(db.dptr[i]);
else {
putchar('\\');
@@ -152,8 +148,7 @@ datum db;
datum
-read_datum(s)
-char *s;
+read_datum(char *s)
{
datum db;
char *p;
@@ -161,6 +156,9 @@ char *s;
db.dsize = 0;
db.dptr = (char *) malloc(strlen(s) * sizeof(char));
+ if (!db.dptr)
+ oops("cannot get memory");
+
for (p = db.dptr; *s != '\0'; p++, db.dsize++, s++) {
if (*s == '\\') {
if (*++s == 'n')
@@ -171,7 +169,10 @@ char *s;
*p = '\f';
else if (*s == 't')
*p = '\t';
- else if (isdigit(*s) && isdigit(*(s + 1)) && isdigit(*(s + 2))) {
+ else if (isdigit((unsigned char)*s)
+ && isdigit((unsigned char)*(s + 1))
+ && isdigit((unsigned char)*(s + 2)))
+ {
i = (*s++ - '0') << 6;
i |= (*s++ - '0') << 3;
i |= *s - '0';
@@ -191,22 +192,21 @@ char *s;
char *
-key2s(db)
-datum db;
+key2s(datum db)
{
char *buf;
char *p1, *p2;
buf = (char *) malloc((db.dsize + 1) * sizeof(char));
+ if (!buf)
+ oops("cannot get memory");
for (p1 = buf, p2 = db.dptr; *p2 != '\0'; *p1++ = *p2++);
*p1 = '\0';
return buf;
}
-
-main(argc, argv)
-int argc;
-char **argv;
+int
+main(int argc, char **argv)
{
typedef enum {
YOW, FETCH, STORE, DELETE, SCAN, REGEXP
@@ -285,7 +285,7 @@ char **argv;
}
}
- if (giveusage | what == YOW | argn < 1) {
+ if (giveusage || what == YOW || argn < 1) {
fprintf(stderr, "Usage: %s databse [-m r|w|rw] [-crtx] -a|-d|-f|-F|-s [key [content]]\n", argv[0]);
exit(-1);
}
diff --git a/gnu/usr.bin/perl/ext/SDBM_File/sdbm/dbu.c b/gnu/usr.bin/perl/ext/SDBM_File/sdbm/dbu.c
index a3c0004da9f..e68b78de44e 100644
--- a/gnu/usr.bin/perl/ext/SDBM_File/sdbm/dbu.c
+++ b/gnu/usr.bin/perl/ext/SDBM_File/sdbm/dbu.c
@@ -65,9 +65,7 @@ static cmd *parse();
static void badk(), doit(), prdatum();
int
-main(argc, argv)
-int argc;
-char *argv[];
+main(int argc, char **argv)
{
int c;
register cmd *act;
@@ -98,9 +96,7 @@ char *argv[];
}
static void
-doit(act, file)
-register cmd *act;
-char *file;
+doit(register cmd *act, char *file)
{
datum key;
datum val;
@@ -197,8 +193,7 @@ char *file;
}
static void
-badk(word)
-char *word;
+badk(char *word)
{
register int i;
@@ -214,8 +209,7 @@ char *word;
}
static cmd *
-parse(str)
-register char *str;
+parse(register char *str)
{
register int i = CTABSIZ;
register cmd *p;
@@ -227,9 +221,7 @@ register char *str;
}
static void
-prdatum(stream, d)
-FILE *stream;
-datum d;
+prdatum(FILE *stream, datum d)
{
register int c;
register char *p = d.dptr;