- ignore trailing NUL in database key/value pairs (which sendmail's

aliases.db has)
- add rcsid
This commit is contained in:
lukem 1997-10-13 03:47:07 +00:00
parent 652dc94093
commit 21504c46eb
2 changed files with 14 additions and 8 deletions

View File

@ -1,4 +1,4 @@
.\" $NetBSD: makedbm.8,v 1.3 1997/10/07 14:23:50 lukem Exp $
.\" $NetBSD: makedbm.8,v 1.4 1997/10/13 03:47:07 lukem Exp $
.\"
.\" Copyright (c) 1994 Mats O Jansson <moj@stacken.kth.se>
.\" All rights reserved.
@ -64,9 +64,7 @@ is a comment character and indicates that the rest of the line should
be ignored.
.Pp
.Ar outfile
is the pathname of the generated databases, sans the
.Dq .db
suffix.
is the pathname of the generated databases.
.Pp
The options are as follows:
.Bl -tag -width indent
@ -105,9 +103,7 @@ Dump the contents of
to standard output, in a format suitable to be passed back into
.Nm "" .
.Ar dbfile
is the pathname to the database, sans the
.Dq .db
suffix.
is the pathname to the database.
.El
.Sh SEE ALSO
.Xr db 3 ,

View File

@ -1,4 +1,4 @@
/* $NetBSD: makedbm.c,v 1.5 1997/10/07 14:42:33 lukem Exp $ */
/* $NetBSD: makedbm.c,v 1.6 1997/10/13 03:47:09 lukem Exp $ */
/*
* Copyright (c) 1994 Mats O Jansson <moj@stacken.kth.se>
@ -31,6 +31,11 @@
* SUCH DAMAGE.
*/
#include <sys/cdefs.h>
#ifndef lint
__RCSID("$NetBSD: makedbm.c,v 1.6 1997/10/13 03:47:09 lukem Exp $");
#endif
#include <sys/param.h>
#include <sys/stat.h>
@ -209,6 +214,11 @@ list_database(database)
while (key.dptr != NULL) {
val = ypdb_fetch(db, key);
/* workround trailing \0 in aliases.db */
if (key.dptr[key.dsize - 1] == '\0')
key.dsize--;
if (val.dptr[val.dsize - 1] == '\0')
val.dsize--;
printf("%*.*s %*.*s\n",
key.dsize, key.dsize, key.dptr,
val.dsize, val.dsize, val.dptr);