xref: /freebsd/usr.bin/pathchk/pathchk.1 (revision 22cf89c938886d14f5796fc49f9f020c23ea8eaf)
1.\" Copyright (c) 2001, 2002 Chuck Rouillard
2.\" All rights reserved.
3.\"
4.\" Redistribution and use in source and binary forms, with or without
5.\" modification, are permitted provided that the following conditions
6.\" are met:
7.\" 1. Redistributions of source code must retain the above copyright
8.\"    notice, this list of conditions and the following disclaimer.
9.\" 2. Redistributions in binary form must reproduce the above copyright
10.\"    notice, this list of conditions and the following disclaimer in the
11.\"    documentation and/or other materials provided with the distribution.
12.\" 3. The name of the author may not be used to endorse or promote
13.\"    products derived from this software without specific prior written
14.\"    permission.
15.\"
16.\" THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS
17.\" OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
18.\" WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
19.\" ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY
20.\" DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
21.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
22.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
23.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
24.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
25.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
26.\" SUCH DAMAGE.
27.\"
28.Dd May 1, 2010
29.Dt PATHCHK 1
30.Os
31.Sh NAME
32.Nm pathchk
33.Nd check pathnames
34.Sh SYNOPSIS
35.Nm
36.Op Fl pP
37.Ar pathname ...
38.Sh DESCRIPTION
39The
40.Nm
41utility checks whether each of the specified
42.Ar pathname
43arguments is valid or portable.
44.Pp
45A diagnostic message is written for each argument that:
46.Bl -bullet
47.It
48Is longer than
49.Dv PATH_MAX
50bytes.
51.It
52Contains any component longer than
53.Dv NAME_MAX
54bytes.
55(The value of
56.Dv NAME_MAX
57depends on the underlying file system.)
58.It
59Contains a directory component that is not searchable.
60.El
61.Pp
62It is not considered an error if a
63.Ar pathname
64argument contains a nonexistent component as long as a component by that
65name could be created.
66.Pp
67The options are as follows:
68.Bl -tag -width indent
69.It Fl p
70Perform portability checks on the specified
71.Ar pathname
72arguments.
73Diagnostic messages will be written for each argument that:
74.Bl -bullet
75.It
76Is longer than
77.Dv _POSIX_PATH_MAX
78.Pq 255
79bytes.
80.It
81Contains a component longer than
82.Dv _POSIX_NAME_MAX
83.Pq 14
84bytes.
85.It
86Contains any character not in the portable filename character set (that is,
87alphanumeric characters,
88.Ql \&. ,
89.Ql \&-
90and
91.Ql _ ) .
92No component may start with the hyphen
93.Pq Ql \&-
94character.
95.El
96.It Fl P
97In addition to the default or
98.Fl p
99checks, write a diagnostic for each argument that:
100.Bl -bullet
101.It
102Is empty.
103.It
104Contains a component that starts with a hyphen.
105.El
106.El
107.Sh EXIT STATUS
108.Ex -std
109.Sh EXAMPLES
110Check whether the names of files in the current directory are portable to
111other
112.Tn POSIX
113systems:
114.Pp
115.Dl "find . -exec pathchk -p -- {} +"
116.Sh SEE ALSO
117.Xr getconf 1 ,
118.Xr pathconf 2 ,
119.Xr stat 2
120.Sh STANDARDS
121The
122.Nm
123utility conforms to
124.St -p1003.1-2001 .
125.Sh HISTORY
126A
127.Nm
128utility appeared in
129.Fx 5.0 .
130