diff options
author | Jason Downs <downsj@cvs.openbsd.org> | 1996-12-14 21:17:55 +0000 |
---|---|---|
committer | Jason Downs <downsj@cvs.openbsd.org> | 1996-12-14 21:17:55 +0000 |
commit | 608a01ad15ff5ab89386edfd559332580581c47d (patch) | |
tree | 0247c82ab4d95ed523c3f3ecf6cf792a84cb635e /usr.sbin/sendmail/makemap/makemap.c | |
parent | 454743c06055e0f6c7c4532bdc9b81aeab85126c (diff) |
Update to Sendmail 8.8.4, plus recent patches, plus OpenBSD support.
Also include entire example configuration subset.
Includes smrsh (using /usr/libexec/sm.bin).
Of the top of my head, the only things I removed from the distribution were
contrib/mail.local.linux, src/Makefiles, all the *.0 and *.ps files.
Our praliases man page replaces the distributed one, ours is better.
Diffstat (limited to 'usr.sbin/sendmail/makemap/makemap.c')
-rw-r--r-- | usr.sbin/sendmail/makemap/makemap.c | 54 |
1 files changed, 46 insertions, 8 deletions
diff --git a/usr.sbin/sendmail/makemap/makemap.c b/usr.sbin/sendmail/makemap/makemap.c index 371b229a217..2e289a81641 100644 --- a/usr.sbin/sendmail/makemap/makemap.c +++ b/usr.sbin/sendmail/makemap/makemap.c @@ -33,7 +33,7 @@ */ #ifndef lint -static char sccsid[] = "@(#)makemap.c 8.14 (Berkeley) 11/5/95"; +static char sccsid[] = "@(#)makemap.c 8.19 (Berkeley) 11/18/96"; #endif /* not lint */ #include <stdio.h> @@ -45,6 +45,7 @@ static char sccsid[] = "@(#)makemap.c 8.14 (Berkeley) 11/5/95"; #ifndef ISC_UNIX # include <sys/file.h> #endif +#define NOT_SENDMAIL #include "useful.h" #include "conf.h" @@ -95,6 +96,8 @@ main(argc, argv) int lineno; int st; int mode; + int putflags; + long dbcachesize = 1024 * 1024; enum type type; int fd; union @@ -110,6 +113,7 @@ main(argc, argv) union dbent key, val; #ifdef NEWDB BTREEINFO bti; + HASHINFO hinfo; #endif char ibuf[BUFSIZE]; char fbuf[MAXNAME]; @@ -120,7 +124,12 @@ main(argc, argv) progname = argv[0]; - while ((opt = getopt(argc, argv, "Ndforv")) != EOF) +#ifdef FFR_CFLAG +#define OPTIONS "Nc:dforv" +#else +#define OPTIONS "Ndforv" +#endif + while ((opt = getopt(argc, argv, OPTIONS)) != EOF) { switch (opt) { @@ -128,6 +137,12 @@ main(argc, argv) inclnull = TRUE; break; +#ifdef FFR_CFLAG + case 'c': + dbcachesize = atol(optarg); + break; +#endif + case 'd': allowdups = TRUE; break; @@ -187,7 +202,11 @@ main(argc, argv) switch (type) { case T_ERR: +#ifdef FFR_CFLAG + fprintf(stderr, "Usage: %s [-N] [-c cachesize] [-d] [-f] [-o] [-r] [-v] type mapname\n", progname); +#else fprintf(stderr, "Usage: %s [-N] [-d] [-f] [-o] [-r] [-v] type mapname\n", progname); +#endif exit(EX_USAGE); case T_UNKNOWN: @@ -211,20 +230,34 @@ main(argc, argv) bzero(&bti, sizeof bti); if (allowdups) bti.flags |= R_DUP; + if (allowdups || allowreplace) + putflags = 0; + else + putflags = R_NOOVERWRITE; break; case T_HASH: + bzero(&hinfo, sizeof hinfo); + if (allowreplace) + putflags = 0; + else + putflags = R_NOOVERWRITE; + break; #endif #ifdef NDBM case T_DBM: -#endif if (allowdups) { fprintf(stderr, "%s: Type %s does not support -d (allow dups)\n", progname, typename); exit(EX_UNAVAILABLE); } + if (allowreplace) + putflags = DBM_REPLACE; + else + putflags = DBM_INSERT; break; +#endif } /* @@ -279,7 +312,11 @@ main(argc, argv) #ifdef NEWDB case T_HASH: - dbp.db = dbopen(mapname, mode, 0644, DB_HASH, NULL); + /* tweak some parameters for performance */ + hinfo.nelem = 4096; + hinfo.cachesize = dbcachesize; + + dbp.db = dbopen(mapname, mode, 0644, DB_HASH, &hinfo); if (dbp.db != NULL) { # if OLD_NEWDB @@ -291,6 +328,9 @@ main(argc, argv) break; case T_BTREE: + /* tweak some parameters for performance */ + bti.cachesize = dbcachesize; + dbp.db = dbopen(mapname, mode, 0644, DB_BTREE, &bti); if (dbp.db != NULL) { @@ -386,16 +426,14 @@ main(argc, argv) { #ifdef NDBM case T_DBM: - st = dbm_store(dbp.dbm, key.dbm, val.dbm, - allowreplace ? DBM_REPLACE : DBM_INSERT); + st = dbm_store(dbp.dbm, key.dbm, val.dbm, putflags); break; #endif #ifdef NEWDB case T_BTREE: case T_HASH: - st = (*dbp.db->put)(dbp.db, &key.db, &val.db, - allowreplace ? 0 : R_NOOVERWRITE); + st = (*dbp.db->put)(dbp.db, &key.db, &val.db, putflags); break; #endif } |