diff options
| author | svn2git <svn2git@FreeBSD.org> | 1994-05-01 08:00:00 +0000 |
|---|---|---|
| committer | svn2git <svn2git@FreeBSD.org> | 1994-05-01 08:00:00 +0000 |
| commit | a16f65c7d117419bd266c28a1901ef129a337569 (patch) | |
| tree | 2626602f66dc3551e7a7c7bc9ad763c3bc7ab40a /usr.sbin/sendmail/makemap | |
| parent | 8503f4f13f77abf7adc8f7e329c6f9c1d52b6a20 (diff) | |
Diffstat (limited to 'usr.sbin/sendmail/makemap')
| -rw-r--r-- | usr.sbin/sendmail/makemap/Makefile | 2 | ||||
| -rw-r--r-- | usr.sbin/sendmail/makemap/Makefile.dist | 81 | ||||
| -rw-r--r-- | usr.sbin/sendmail/makemap/makemap.8 | 11 | ||||
| -rw-r--r-- | usr.sbin/sendmail/makemap/makemap.c | 45 |
4 files changed, 129 insertions, 10 deletions
diff --git a/usr.sbin/sendmail/makemap/Makefile b/usr.sbin/sendmail/makemap/Makefile index 1cc9b5970d21..c4ac74eaea4d 100644 --- a/usr.sbin/sendmail/makemap/Makefile +++ b/usr.sbin/sendmail/makemap/Makefile @@ -2,7 +2,7 @@ PROG= makemap MAN8= makemap.8 -CFLAGS+=-I${.CURDIR}/../src -DNEWDB +CFLAGS+=-I${.CURDIR}/../src -DNDBM -DNEWDB .include "../../Makefile.inc" .include <bsd.prog.mk> diff --git a/usr.sbin/sendmail/makemap/Makefile.dist b/usr.sbin/sendmail/makemap/Makefile.dist new file mode 100644 index 000000000000..3e7817a2658b --- /dev/null +++ b/usr.sbin/sendmail/makemap/Makefile.dist @@ -0,0 +1,81 @@ +# +# This Makefile is designed to work on the old "make" program. It does +# not use the obj subdirectory. It also does not install documentation +# automatically -- think of it as a quick start for sites that have the +# old make program (I recommend that you get and port the new make if you +# are going to be doing any signficant work on sendmail). +# +# @(#)Makefile.dist 8.2 (Berkeley) 11/27/93 +# + +# use O=-O (usual) or O=-g (debugging) +O= -O + +# location of sendmail source directory +SRCDIR= ../src + +# define the database mechanisms available for map & alias lookups: +# -DNDBM -- use new DBM +# -DNEWDB -- use new Berkeley DB +# The really old (V7) DBM library is no longer supported. +# +DBMDEF= -DNDBM -DNEWDB + +# environment definitions (e.g., -D_AIX3) +ENVDEF= + +# see also conf.h for additional compilation flags + +# include directories +INCDIRS=-I${SRCDIR} -I/usr/sww/include/db + +# loader options +LDOPTS= + +# library directories +LIBDIRS=-L/usr/sww/lib + +# libraries required on your system +LIBS= -ldb -ldbm + +# location of makemap binary (usually /usr/sbin or /usr/etc) +BINDIR= ${DESTDIR}/usr/sbin + +# additional .o files needed +OBJADD= + +################### end of user configuration flags ###################### + +CFLAGS= -I. $O ${INCDIRS} ${DBMDEF} ${ENVDEF} + +OBJS= makemap.o ${OBJADD} + +LINKS= ${DESTDIR}/usr/ucb/newaliases ${DESTDIR}/usr/ucb/mailq +BINOWN= bin +BINGRP= bin +BINMODE=555 + +ALL= makemap makemap.0 + +all: ${ALL} + +makemap: ${BEFORE} ${OBJS} + ${CC} -o makemap ${LDOPTS} ${OBJS} ${LIBDIRS} ${LIBS} + +makemap.0: makemap.8 + nroff -h -mandoc makemap.8 > makemap.0 + +install: install-makemap install-docs + +install-makemap: makemap + install -o ${BINOWN} -g ${BINGRP} -m ${BINMODE} makemap ${BINDIR} + +# doesn't actually install them -- you may want to install pre-nroff versions +install-docs: makemap.0 + +clean: + rm -f ${OBJS} makemap makemap.0 + +# dependencies +# gross overkill, and yet still not quite enough.... +${OBJS}: ${SRCDIR}/conf.h diff --git a/usr.sbin/sendmail/makemap/makemap.8 b/usr.sbin/sendmail/makemap/makemap.8 index 70ee4465f3bb..2fd678e7ee0a 100644 --- a/usr.sbin/sendmail/makemap/makemap.8 +++ b/usr.sbin/sendmail/makemap/makemap.8 @@ -29,7 +29,7 @@ .\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF .\" SUCH DAMAGE. .\" -.\" @(#)makemap.8 8.1 (Berkeley) 6/17/93 +.\" @(#)makemap.8 8.2 (Berkeley) 9/22/93 .\" .Dd November 16, 1992 .Dt MAKEMAP 8 @@ -99,13 +99,14 @@ in the map. This must match the \-N flag in the sendmail.cf ``K'' line. .It Fl f -Fold all upper case letters in the key -to lower case; -this is intended to mesh with the +Normally all upper case letters in the key +are folded to lower case. +This flag disables that behavior. +This is intended to mesh with the \-f flag in the \fBK\fP line in sendmail.cf. -The value is not case folded. +The value is never case folded. .It Fl o Append to an old file. This allows you to augment an existing file. diff --git a/usr.sbin/sendmail/makemap/makemap.c b/usr.sbin/sendmail/makemap/makemap.c index 7996c1ac8ab8..f2d4aea9ca90 100644 --- a/usr.sbin/sendmail/makemap/makemap.c +++ b/usr.sbin/sendmail/makemap/makemap.c @@ -33,11 +33,12 @@ */ #ifndef lint -static char sccsid[] = "@(#)makemap.c 8.1 (Berkeley) 6/7/93"; +static char sccsid[] = "@(#)makemap.c 8.6 (Berkeley) 11/22/93"; #endif /* not lint */ #include <stdio.h> #include <sysexits.h> +#include <sys/types.h> #include <sys/file.h> #include <ctype.h> #include <string.h> @@ -80,11 +81,12 @@ main(argc, argv) bool notrunc = FALSE; bool allowreplace = FALSE; bool verbose = FALSE; - bool foldcase = FALSE; + bool foldcase = TRUE; int exitstat; int opt; char *typename; char *mapname; + char *ext; int lineno; int st; int mode; @@ -101,6 +103,7 @@ main(argc, argv) } dbp; union dbent key, val; char ibuf[BUFSIZE]; + char fbuf[MAXNAME]; extern char *optarg; extern int optind; @@ -115,7 +118,7 @@ main(argc, argv) break; case 'f': - foldcase = TRUE; + foldcase = FALSE; break; case 'o': @@ -144,13 +147,22 @@ main(argc, argv) { typename = argv[0]; mapname = argv[1]; + ext = NULL; if (strcmp(typename, "dbm") == 0) + { type = T_DBM; + } else if (strcmp(typename, "btree") == 0) + { type = T_BTREE; + ext = ".db"; + } else if (strcmp(typename, "hash") == 0) + { type = T_HASH; + ext = ".db"; + } else type = T_UNKNOWN; } @@ -179,6 +191,24 @@ main(argc, argv) } /* + ** Adjust file names. + */ + + if (ext != NULL) + { + int el, fl; + + el = strlen(ext); + fl = strlen(mapname); + if (fl < el || strcmp(&mapname[fl - el], ext) != 0) + { + strcpy(fbuf, mapname); + strcat(fbuf, ext); + mapname = fbuf; + } + } + + /* ** Create the database. */ @@ -232,8 +262,15 @@ main(argc, argv) */ p = strchr(ibuf, '\n'); - if (*p != '\0') + if (p != NULL) *p = '\0'; + else if (!feof(stdin)) + { + fprintf(stderr, "%s: %s: line %d: line too long (%d bytes max)\n", + progname, mapname, lineno, sizeof ibuf); + continue; + } + if (ibuf[0] == '\0' || ibuf[0] == '#') continue; if (isspace(ibuf[0])) |
