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