Annotation of src/usr.bin/lndir/lndir.1, Revision 1.23
1.23 ! jmc 1: .\" $OpenBSD: lndir.1,v 1.22 2007/05/31 19:20:12 jmc Exp $
1.2 downsj 2: .\"
3: .\" Copyright (c) 1997, Jason Downs. All rights reserved.
4: .\"
5: .\" Redistribution and use in source and binary forms, with or without
6: .\" modification, are permitted provided that the following conditions
7: .\" are met:
8: .\" 1. Redistributions of source code must retain the above copyright
9: .\" notice, this list of conditions and the following disclaimer.
10: .\" 2. Redistributions in binary form must reproduce the above copyright
11: .\" notice, this list of conditions and the following disclaimer in the
12: .\" documentation and/or other materials provided with the distribution.
13: .\"
14: .\" THIS SOFTWARE IS PROVIDED BY THE AUTHOR(S) ``AS IS'' AND ANY EXPRESS
15: .\" OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
16: .\" WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
17: .\" DISCLAIMED. IN NO EVENT SHALL THE AUTHOR(S) BE LIABLE FOR ANY DIRECT,
18: .\" INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
19: .\" (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
20: .\" SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
21: .\" CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
22: .\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
23: .\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
24: .\" SUCH DAMAGE.
25: .\"
1.1 downsj 26: .\" $XConsortium: lndir.man /main/9 1995/12/15 14:00:35 gildea $
27: .\"
28: .\" Copyright (c) 1993, 1994 X Consortium
1.8 aaron 29: .\"
1.1 downsj 30: .\" Permission is hereby granted, free of charge, to any person obtaining
31: .\" a copy of this software and associated documentation files (the
32: .\" "Software"), to deal in the Software without restriction, including
33: .\" without limitation the rights to use, copy, modify, merge, publish,
34: .\" distribute, sublicense, and/or sell copies of the Software, and to
35: .\" permit persons to whom the Software is furnished to do so, subject to
36: .\" the following conditions:
1.8 aaron 37: .\"
1.1 downsj 38: .\" The above copyright notice and this permission notice shall be
39: .\" included in all copies or substantial portions of the Software.
1.8 aaron 40: .\"
1.1 downsj 41: .\" THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
42: .\" EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
43: .\" MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
44: .\" IN NO EVENT SHALL THE X CONSORTIUM BE LIABLE FOR ANY CLAIM, DAMAGES OR
45: .\" OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
46: .\" ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
47: .\" OTHER DEALINGS IN THE SOFTWARE.
1.8 aaron 48: .\"
1.1 downsj 49: .\" Except as contained in this notice, the name of the X Consortium shall
50: .\" not be used in advertising or otherwise to promote the sale, use or
51: .\" other dealings in this Software without prior written authorization
52: .\" from the X Consortium.
1.8 aaron 53: .\"
1.23 ! jmc 54: .Dd $Mdocdate: May 31 2007 $
1.2 downsj 55: .Dt LNDIR 1
1.8 aaron 56: .Os
1.2 downsj 57: .Sh NAME
58: .Nm lndir
1.17 jmc 59: .Nd "create a shadow directory of symbolic links to another directory tree"
1.2 downsj 60: .Sh SYNOPSIS
61: .Nm lndir
1.20 jmc 62: .Op Fl is
1.2 downsj 63: .Op Fl e Ar exceptfile
1.16 millert 64: .Ar fromdir
1.2 downsj 65: .Op Ar todir
66: .Sh DESCRIPTION
1.1 downsj 67: The
1.12 aaron 68: .Nm
1.8 aaron 69: program makes a shadow copy
70: .Ar todir
1.1 downsj 71: of a directory tree
1.10 aaron 72: .Ar fromdir ,
1.1 downsj 73: except that the shadow is not
74: populated with real files but instead with symbolic links pointing at
1.8 aaron 75: the real files in the
1.2 downsj 76: .Ar fromdir
1.9 aaron 77: directory tree.
78: This is usually useful for maintaining source code for
79: different machine architectures.
80: You create a shadow directory
1.1 downsj 81: containing links to the real source, which you will have usually
1.9 aaron 82: mounted from a remote machine.
83: You can build in the shadow tree, and
1.1 downsj 84: the object files will be in the shadow directory, while the
85: source files in the shadow directory are just symlinks to the real
86: files.
1.2 downsj 87: .Pp
1.8 aaron 88: This scheme has the advantage that if you update the source, you need not
1.1 downsj 89: propagate the change to the other architectures by hand, since all
1.23 ! jmc 90: source in all shadow directories are symlinks to the real thing:
! 91: just change working directory to the shadow directory and recompile away.
1.2 downsj 92: .Pp
1.1 downsj 93: The
1.2 downsj 94: .Ar todir
1.9 aaron 95: argument is optional and defaults to the current directory.
96: The
1.2 downsj 97: .Ar fromdir
1.21 jmc 98: argument may be relative (e.g.\&
99: .Pa ../src )
1.9 aaron 100: and is relative to
1.2 downsj 101: .Ar todir
1.1 downsj 102: (not the current directory).
1.8 aaron 103: .Pp
1.1 downsj 104: If you add files, simply run
1.12 aaron 105: .Nm
1.9 aaron 106: again.
107: New files will be silently added.
108: Old files will be
1.1 downsj 109: checked that they have the correct link.
1.2 downsj 110: .Pp
1.1 downsj 111: Deleting files is a more painful problem; the symlinks will
112: just point into never never land.
1.2 downsj 113: .Pp
1.21 jmc 114: The options are as follows:
115: .Bl -tag -width Ds
116: .It Fl e Ar exceptfile
117: Add the specified file to the list of excluded files/directories.
118: This is effective in all directories searched by
119: .Nm .
120: This option may be specified as many times as needed.
121: .Pp
122: The following types of files are excluded by default:
123: .Pp
124: .Bl -dash -offset indent -compact
125: .It
126: files whose names end in
127: .Sq ~
128: .It
129: files whose names start with
130: .Sq .#
131: .It
132: RCS, SCCS, CVS, and CVS.adm directories
133: .El
134: .It Fl i
1.8 aaron 135: If a file in
1.2 downsj 136: .Ar fromdir
1.8 aaron 137: is a symbolic link,
1.12 aaron 138: .Nm
1.8 aaron 139: will make the same link in
1.2 downsj 140: .Ar todir
1.8 aaron 141: rather than making a link back to the (symbolic link) entry in
1.2 downsj 142: .Ar fromdir .
143: The
1.3 downsj 144: .Fl i
1.21 jmc 145: flag changes that behavior,
146: i.e. it causes the program to not treat symbolic links in
1.2 downsj 147: .Ar fromdir
1.9 aaron 148: specially.
149: The link created in
1.2 downsj 150: .Ar todir
1.8 aaron 151: will point back to the corresponding (symbolic link) file in
1.2 downsj 152: .Ar fromdir .
1.1 downsj 153: If the link is to a directory, this is almost certainly the wrong thing.
1.2 downsj 154: .Pp
1.1 downsj 155: This option exists mostly to emulate the behavior the C version of
1.12 aaron 156: .Nm
1.9 aaron 157: had in X11R6.
158: Its use is not recommended.
1.20 jmc 159: .It Fl s
160: Suppresses status messages normally output as
161: .Nm
162: descends into each subdirectory.
1.2 downsj 163: .El
164: .Sh DIAGNOSTICS
1.1 downsj 165: The program displays the name of each subdirectory it enters, followed
1.9 aaron 166: by a colon.
167: The
1.3 downsj 168: .Fl s
1.2 downsj 169: option suppresses these messages.
170: .Pp
1.1 downsj 171: A warning message is displayed if the symbolic link cannot be created.
172: The usual problem is that a regular file of the same name already
173: exists.
1.2 downsj 174: .Pp
1.1 downsj 175: If the link already exists but doesn't point to the correct file, the
176: program prints the link name and the location where it does point.
1.12 aaron 177: .Sh SEE ALSO
178: .Xr find 1 ,
179: .Xr ln 1 ,
180: .Xr patch 1
181: .Sh HISTORY
182: .Nm
183: was first distributed as part of X11.
184: .Pp
185: This version first appeared in
1.14 mickey 186: .Ox 1.2 .
1.2 downsj 187: .Sh BUGS
1.1 downsj 188: The
1.4 downsj 189: .Xr patch 1
1.9 aaron 190: program gets upset if it cannot change the files.
191: You should never run
1.4 downsj 192: .Xr patch 1
1.1 downsj 193: from a shadow directory anyway.
1.4 downsj 194: .Pp
1.21 jmc 195: To clear out all files before you can relink
196: (if
197: .Ar fromdir
198: moved, for instance):
199: .Bd -literal -offset indent
200: $ find todir -type l -print0 | xargs -0 -r rm
1.4 downsj 201: .Ed
1.5 downsj 202: .Pp
1.21 jmc 203: Find all files that are not directories:
204: .Bd -literal -offset indent
205: $ find . ! -type d -print0
1.4 downsj 206: .Ed