xref: /netbsd-src/usr.sbin/services_mkdb/services_mkdb.8 (revision dd75ac5b443e967e26b4d18cc8cd5eb98512bfbf)
1.\"	$NetBSD: services_mkdb.8,v 1.13 2023/02/12 22:48:02 uwe Exp $
2.\"
3.\" Copyright (c) 1999 The NetBSD Foundation, Inc.
4.\" All rights reserved.
5.\"
6.\" This code is derived from software contributed to The NetBSD Foundation
7.\" by Luke Mewburn.
8.\"
9.\" Redistribution and use in source and binary forms, with or without
10.\" modification, are permitted provided that the following conditions
11.\" are met:
12.\" 1. Redistributions of source code must retain the above copyright
13.\"    notice, this list of conditions and the following disclaimer.
14.\" 2. Redistributions in binary form must reproduce the above copyright
15.\"    notice, this list of conditions and the following disclaimer in the
16.\"    documentation and/or other materials provided with the distribution.
17.\"
18.\" THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS
19.\" ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
20.\" TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
21.\" PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS
22.\" BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
23.\" CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
24.\" SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
25.\" INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
26.\" CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
27.\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
28.\" POSSIBILITY OF SUCH DAMAGE.
29.\"
30.Dd February 12, 2023
31.Dt SERVICES_MKDB 8
32.Os
33.Sh NAME
34.Nm services_mkdb
35.Nd generate the services databases
36.Sh SYNOPSIS
37.Nm
38.Op Fl qv
39.Op Fl o Ar database
40.Op Fl V Ar style
41.Op Ar file
42.Nm
43.Fl u
44.Op Ar file
45.Sh DESCRIPTION
46.Nm
47creates a
48.Xr cdb 5
49database for the specified file.
50If no file is specified, then
51.Pa /etc/services
52is used.
53The database is installed into
54.Pa /var/db/services.cdb
55for CDB format and into
56.Pa /var/db/services.db
57for legacy DB format (see
58.Fl V ) .
59The file must be in the correct format
60.Pq see Xr services 5 .
61.Pp
62The options are as follows:
63.Bl -tag -width Fl
64.It Fl o Ar database
65Put the output databases in the named file.
66.It Fl q
67Don't warn about duplicate services.
68This is the default behavior.
69.It Fl u
70Print the services file to stdout, omitting duplicate entries and comments.
71.It Fl V Ar style
72Create a specific version of the database style.
73.Ar style
74can be
75.Cm cdb
76to request the CDB format (default) or
77.Cm db
78to request the DB format.
79The DB format is useful for compatibility with old statically
80linked binaries.
81.It Fl v
82Warn about duplicate services.
83.El
84.Pp
85The databases are used by the C library services routines
86.Pq see Xr getservent 3 .
87.Pp
88.Nm
89exits zero on success, non-zero on failure.
90.Sh FILES
91.Bl -tag -width Pa -compact
92.It Pa /etc/services
93The current services file.
94.It Pa /var/db/services.cdb
95The current services database.
96.It Pa /var/db/services.cdb.tmp
97A temporary file.
98.El
99.Sh SEE ALSO
100.Xr db 3 ,
101.Xr getservent 3 ,
102.Xr cdb 5 ,
103.Xr services 5
104.Sh BUGS
105Because
106.Nm
107guarantees not to install a partial destination file it must
108build a temporary file in the same file system and if successful use
109.Xr rename 2
110to install over the destination file.
111.Pp
112If
113.Nm
114fails it will leave the previous version of the destination file intact.
115