xref: /freebsd/usr.bin/whereis/pathnames.h (revision f9bc005b8ef3b507a5ecbc2d7fe4411ef70eff38)
1 /*-
2  * SPDX-License-Identifier: BSD-2-Clause
3  *
4  * Copyright © 2002, Jörg Wunsch
5  *
6  * Redistribution and use in source and binary forms, with or without
7  * modification, are permitted provided that the following conditions
8  * are met:
9  * 1. Redistributions of source code must retain the above copyright
10  *    notice, this list of conditions and the following disclaimer.
11  * 2. Redistributions in binary form must reproduce the above copyright
12  *    notice, this list of conditions and the following disclaimer in the
13  *    documentation and/or other materials provided with the distribution.
14  *
15  * THIS SOFTWARE IS PROVIDED BY THE AUTHOR(S) ``AS IS'' AND ANY EXPRESS OR
16  * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
17  * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
18  * DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR(S) BE LIABLE FOR ANY DIRECT,
19  * INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
20  * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
21  * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
22  * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
23  * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING
24  * IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
25  * POSSIBILITY OF SUCH DAMAGE.
26  */
27 
28 #include <stdio.h>
29 
30 /* Where to look for libexec */
31 #define PATH_LIBEXEC "/usr/libexec"
32 
33 /* Where to look for sources. */
34 static const char *sourcepaths[] = {
35 	"/usr/src/bin",
36 	"/usr/src/cddl/usr.bin",
37 	"/usr/src/cddl/usr.sbin",
38 	"/usr/src/contrib",
39 	"/usr/src/crypto",
40 	"/usr/src/games",
41 	"/usr/src/kerberos5/libexec",
42 	"/usr/src/kerberos5/usr.bin",
43 	"/usr/src/kerberos5/usr.sbin",
44 	"/usr/src/krb5/libexec",
45 	"/usr/src/krb5/usr.bin",
46 	"/usr/src/krb5/usr.sbin",
47 	"/usr/src/libexec",
48 	"/usr/src/sbin",
49 	"/usr/src/secure/bin",
50 	"/usr/src/secure/libexec",
51 	"/usr/src/secure/sbin",
52 	"/usr/src/secure/usr.bin",
53 	"/usr/src/secure/usr.sbin",
54 	"/usr/src/usr.bin",
55 	"/usr/src/usr.sbin",
56 	NULL
57 };
58 
59 /* Each subdirectory of PATH_PORTS will be appended to PATH_SOURCES. */
60 #define PATH_PORTS "/usr/ports"
61 
62 /* How to query the current manpath. */
63 #define MANPATHCMD "manpath -q"
64 
65 /* How to obtain the location of manpages, and how to match this result. */
66 #define MANWHEREISCMD "man -S1:8:6 -w %s 2>/dev/null"
67 #define MANWHEREISALLCMD "man -a -w %s 2>/dev/null"
68 #define MANWHEREISMATCH "^.* [(]source: (.*)[)]$"
69 
70 /* Command used to locate sources that have not been found yet. */
71 #define LOCATECMD "locate '*'/%s 2>/dev/null"
72