1 '\" te
   2 .\" Copyright (c) 1983 Eric P. Allman
   3 .\" Copyright (c) 1988, 1993 The Regents of the University of California.  All rights reserved.
   4 .\" Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met: 1. Redistributions of source code must retain the above copyright    notice, this list of conditions and the following disclaimer.
   5 .\" 2. Redistributions in binary form must reproduce the above copyright    notice, this list of conditions and the following disclaimer in the    documentation and/or other materials provided with the distribution. 3. All advertising materials mentioning features or use of this software    must display
   6 .\" the following acknowledgement: This product includes software developed by the University of California, Berkeley and its contributors. 4. Neither the name of the University nor the names of its contributors    may be used to endorse or promote products derived from this software    without specific
   7 .\" prior written permission.  THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR
   8 .\" CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER
   9 .\" IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
  10 .\" Copyright (c) 1998-2006, 2008 Sendmail, Inc. and its suppliers.  All rights reserved.
  11 .\" The following license terms and conditions apply, unless a different license is obtained from Sendmail, Inc., 6425 Christie Ave, Fourth Floor, Emeryville, CA 94608, USA, or by electronic mail at license@sendmail.com.  License Terms:  Use, Modification and Redistribution
  12 .\" (including distribution of any modified or derived work) in source and binary forms is permitted only if each of the following conditions is met:  1. Redistributions qualify as "freeware" or "Open Source Software" under    one of the following terms:     (a) Redistributions are made at no charge
  13 .\" beyond the reasonable cost of        materials and delivery.     (b) Redistributions are accompanied by a copy of the Source Code or by an        irrevocable offer to provide a copy of the Source Code for up to three       years at the cost of materials and delivery.  Such redistributions
  14 .\"    must allow further use, modification, and redistribution of the Source       Code under substantially the same terms as this license.  For the        purposes of redistribution "Source Code" means the complete compilable       and linkable source code of sendmail including all modifications.
  15 .\"  2. Redistributions of source code must retain the copyright notices as they    appear in each source code file, these license terms, and the    disclaimer/limitation of liability set forth as paragraph 6 below.  3. Redistributions in binary form must reproduce the Copyright Notice,    these license
  16 .\" terms, and the disclaimer/limitation of liability set    forth as paragraph 6 below, in the documentation and/or other materials    provided with the distribution.  For the purposes of binary distribution    the "Copyright Notice" refers to the following language:    "Copyright (c) 1998-2004 Sendmail,
  17 .\" Inc.  All rights reserved."  4. Neither the name of Sendmail, Inc. nor the University of California nor    the names of their contributors may be used to endorse or promote    products derived from this software without specific prior written    permission.  The name "sendmail" is a trademark
  18 .\" of Sendmail, Inc.  5. All redistributions must comply with the conditions imposed by the    University of California on certain embedded code, whose copyright    notice and conditions for redistribution are as follows:     (a) Copyright (c) 1988, 1993 The Regents of the University of        California.
  19 .\"  All rights reserved.     (b) Redistribution and use in source and binary forms, with or without        modification, are permitted provided that the following conditions        are met:        (i)   Redistributions of source code must retain the above copyright             notice, this list of
  20 .\" conditions and the following disclaimer.        (ii)  Redistributions in binary form must reproduce the above             copyright notice, this list of conditions and the following             disclaimer in the documentation and/or other materials provided             with the distribution.
  21 .\"       (iii) Neither the name of the University nor the names of its             contributors may be used to endorse or promote products derived             from this software without specific prior written permission. 6. Disclaimer/Limitation of Liability: THIS SOFTWARE IS PROVIDED BY    SENDMAIL,
  22 .\" INC. AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED    WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF    MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.  IN    NO EVENT SHALL SENDMAIL, INC., THE REGENTS OF THE UNIVERSITY OF    CALIFORNIA OR CONTRIBUTORS
  23 .\" BE LIABLE FOR ANY DIRECT, INDIRECT,    INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT    NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF    USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON    ANY THEORY OF LIABILITY, WHETHER
  24 .\" IN CONTRACT, STRICT LIABILITY, OR TORT    (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF    THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGES.
  25 .\" Portions Copyright (c) 2009, Sun Microsystems, Inc. All Rights Reserved.
  26 .\" Copyright (c) 2019 Peter Tribble.
  27 .TH EDITMAP 1M "Jan 21, 2019"
  28 .SH NAME
  29 editmap \- query and edit single records in database maps for sendmail
  30 .SH SYNOPSIS
  31 .LP
  32 .nf
  33 \fBeditmap\fR \fB-C\fR \fIfile\fR [\fB-N\fR] [\fB-f\fR] [\fB-q\fR | \fB-u\fR | \fB-x\fR] \fImaptype\fR \fImapname\fR \fIkey\fR
  34      ["\fIvalue\fR"]...
  35 .fi
  36 
  37 .SH DESCRIPTION
  38 .LP
  39 The \fBeditmap\fR command queries or edits one record in a database maps used
  40 by the keyed map lookups in \fBsendmail\fR(1M). Arguments are passed on the
  41 command line and output (for queries) is directed to standard output.
  42 .sp
  43 .LP
  44 Depending on how it is compiled, \fBeditmap\fR handles up to three different
  45 database formats, selected using the \fImaptype\fR parameter. See
  46 \fBOPERANDS\fR.
  47 .sp
  48 .LP
  49 If the \fBTrustedUser\fR option is set in the \fBsendmail\fR configuration
  50 file and \fBeditmap\fR is invoked as root, the generated files are owned by the
  51 specified \fBTrustedUser\fR.
  52 .SH OPTIONS
  53 .LP
  54 The following options are supported:
  55 .sp
  56 .ne 2
  57 .na
  58 \fB-C\fR \fIfile\fR
  59 .ad
  60 .RS 11n
  61 Use the specified \fBsendmail\fR configuration file (\fIfile\fR) to look up the
  62 \fBTrustedUser\fR option.
  63 .RE
  64 
  65 .sp
  66 .ne 2
  67 .na
  68 \fB-f\fR
  69 .ad
  70 .RS 11n
  71 Disable the folding of all upper case letters in the key to lower case.
  72 Normally, all upper case letters in the key are folded to lower case. This is
  73 intended to mesh with the \fB-f\fR flag in the \fBK\fR line in
  74 \fBsendmail.cf\fR. The value is never case folded.
  75 .RE
  76 
  77 .sp
  78 .ne 2
  79 .na
  80 \fB-N\fR
  81 .ad
  82 .RS 11n
  83 Include the null byte that terminates strings in the map (for alias maps).
  84 .RE
  85 
  86 .sp
  87 .ne 2
  88 .na
  89 \fB-q\fR
  90 .ad
  91 .RS 11n
  92 Query the map for the specified key. If found, print value to standard output
  93 and exit with \fB0\fR. If not found then print an error message to \fBstdout\fR
  94 and exit with \fBEX_UNAVAILABLE\fR.
  95 .RE
  96 
  97 .sp
  98 .ne 2
  99 .na
 100 \fB-u\fR
 101 .ad
 102 .RS 11n
 103 Update the record for the specified key with the specified value or inserts a
 104 new record if one doesn't exist. Exits with \fB0\fR on success or
 105 \fBEX_IOERR\fR on failure.
 106 .RE
 107 
 108 .sp
 109 .ne 2
 110 .na
 111 \fB-x\fR
 112 .ad
 113 .RS 11n
 114 Delete the specified key from the map. Exits with \fB0\fR on success or
 115 \fBEX_IOERR\fR on failure.
 116 .RE
 117 
 118 .SH OPERANDS
 119 .LP
 120 The following operands are supported:
 121 .sp
 122 .ne 2
 123 .na
 124 \fIkey\fR
 125 .ad
 126 .RS 12n
 127 The left hand side of a record.
 128 .sp
 129 Each record is of the form:
 130 .sp
 131 .in +2
 132 .nf
 133 \fIkey\fR \fIvalue\fR
 134 .fi
 135 .in -2
 136 .sp
 137 
 138 \fIkey\fR and \fIvalue\fR are separated by white space.
 139 .RE
 140 
 141 .sp
 142 .ne 2
 143 .na
 144 \fImapname\fR
 145 .ad
 146 .RS 12n
 147 File name of the database map being created.
 148 .RE
 149 
 150 .sp
 151 .ne 2
 152 .na
 153 \fImaptype\fR
 154 .ad
 155 .RS 12n
 156 Specifies the database format. The following \fImaptype\fR parameters are
 157 available:
 158 .sp
 159 .ne 2
 160 .na
 161 \fBdbm\fR
 162 .ad
 163 .RS 10n
 164 Specifies \fBDBM\fR format maps.
 165 .RE
 166 
 167 .sp
 168 .ne 2
 169 .na
 170 \fBbtree\fR
 171 .ad
 172 .RS 10n
 173 Specifies B-Tree format maps.
 174 .RE
 175 
 176 .sp
 177 .ne 2
 178 .na
 179 \fBhash\fR
 180 .ad
 181 .RS 10n
 182 Specifies hash format maps.
 183 .RE
 184 
 185 .RE
 186 
 187 .sp
 188 .ne 2
 189 .na
 190 \fIvalue\fR
 191 .ad
 192 .RS 12n
 193 The right hand side of a record.
 194 .sp
 195 Each record is of the form:
 196 .sp
 197 .in +2
 198 .nf
 199 \fIkey\fR \fIvalue\fR
 200 .fi
 201 .in -2
 202 .sp
 203 
 204 \fIkey\fR and \fIvalue\fR are separated by white space.
 205 .RE
 206 
 207 .SH SEE ALSO
 208 .LP
 209 \fBmakemap\fR(1M), \fBsendmail\fR(1M), \fBattributes\fR(5)