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