1.\" Copyright (c) 2000-2001, 2003 Sendmail, Inc. and its suppliers.
2.\"	 All rights reserved.
3.\"
4.\" By using this file, you agree to the terms and conditions set
5.\" forth in the LICENSE file which can be found at the top level of
6.\" the sendmail distribution.
7.\"
8.\"
9.\"     $Id: editmap.8,v 1.10 2013-11-22 20:51:26 ca Exp $
10.\"
11.Dd $Mdocdate: June 9 2014 $
12.Dt EDITMAP 8
13.Os
14.Sh NAME
15.Nm editmap
16.Nd query and edit records in database maps for sendmail
17.Sh SYNOPSIS
18.Nm editmap
19.Bk -words
20.Op Fl C Ar file
21.Op Fl N
22.Op Fl f
23.Op Fl q | Fl u | Fl x
24maptype mapname key
25.Op Dq value ...
26.Ek
27.Sh DESCRIPTION
28.Nm editmap
29queries or edits one record in database maps used by the keyed map lookups in
30.Xr sendmail 8 .
31Arguments are passed on the command line and output (for queries) is
32directed to standard output.
33.Pp
34Depending on how it is compiled,
35.Nm
36handles up to three different database formats,
37selected using the
38.Ar maptype
39parameter.
40They may be
41.Bl -tag -width Fl
42.It Li dbm
43DBM format maps.
44This requires the
45.Xr ndbm 3
46library.
47.It Li btree
48B-Tree format maps.
49This requires the new Berkeley DB
50library.
51.It Li hash
52Hash format maps.
53This also requires the Berkeley DB
54library.
55.El
56.Pp
57If the
58.Li TrustedUser
59option is set in the sendmail configuration file and
60.Nm
61is invoked as root, the generated files will be owned by
62the specified
63.Li TrustedUser .
64.Ss Flags
65.Bl -tag -width Fl
66.It Fl C Ar file
67Use the specified
68.Xr sendmail 8
69configuration
70.Ar file
71for looking up the
72.Li TrustedUser
73option.
74.It Fl N
75Include the null byte that terminates strings
76in the map (for alias maps).
77.It Fl f
78Normally all upper case letters in the key
79are folded to lower case.
80This flag disables that behaviour.
81This is intended to mesh with the
82.Fl f
83flag in the
84.Dq K
85line in sendmail.cf.
86The value is never case folded.
87.It Fl q
88Query the map for the specified key.
89If found, print value to standard output and exit with 0.
90If not found then print an error message to stdout and exit with
91.Dv EX_UNAVAILABLE .
92.It Fl u
93Updates the record for
94.Ar key
95with
96.Ar value
97or inserts a new record if one doesn't exist.
98Exits with 0 on success or
99.Dv EX_IOERR
100on failure.
101.It Fl x
102Deletes the specific key from the map.
103Exits with 0 on success or
104.Dv EX_IOERR
105on failure.
106.El
107.Sh SEE ALSO
108.Xr makemap 8 ,
109.Xr sendmail 8
110.Sh HISTORY
111The
112.Nm
113command appeared in
114.Ox 3.0 .
115