]> CyberLeo.Net >> Repos - FreeBSD/FreeBSD.git/blob - lib/libc/gen/fts.3
MFV r358616:
[FreeBSD/FreeBSD.git] / lib / libc / gen / fts.3
1 .\" Copyright (c) 1989, 1991, 1993, 1994
2 .\"     The Regents of the University of California.  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. Neither the name of the University nor the names of its contributors
13 .\"    may be used to endorse or promote products derived from this software
14 .\"    without specific prior written permission.
15 .\"
16 .\" THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
17 .\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
18 .\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
19 .\" ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
20 .\" FOR ANY 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 .\"     @(#)fts.3       8.5 (Berkeley) 4/16/94
29 .\" $FreeBSD$
30 .\"
31 .Dd January 12, 2014
32 .Dt FTS 3
33 .Os
34 .Sh NAME
35 .Nm fts
36 .Nd traverse a file hierarchy
37 .Sh LIBRARY
38 .Lb libc
39 .Sh SYNOPSIS
40 .In fts.h
41 .Ft FTS *
42 .Fn fts_open "char * const *path_argv" "int options" "int (*compar)(const FTSENT * const *, const FTSENT * const *)"
43 .Ft FTSENT *
44 .Fn fts_read "FTS *ftsp"
45 .Ft FTSENT *
46 .Fn fts_children "FTS *ftsp" "int options"
47 .Ft int
48 .Fn fts_set "FTS *ftsp" "FTSENT *f" "int options"
49 .Ft void
50 .Fn fts_set_clientptr "FTS *ftsp" "void *clientdata"
51 .Ft void *
52 .Fn fts_get_clientptr "FTS *ftsp"
53 .Ft FTS *
54 .Fn fts_get_stream "FTSENT *f"
55 .Ft int
56 .Fn fts_close "FTS *ftsp"
57 .Sh DESCRIPTION
58 The
59 .Nm
60 functions are provided for traversing
61 .Ux
62 file hierarchies.
63 A simple overview is that the
64 .Fn fts_open
65 function returns a
66 .Dq handle
67 on a file hierarchy, which is then supplied to
68 the other
69 .Nm
70 functions.
71 The function
72 .Fn fts_read
73 returns a pointer to a structure describing one of the files in the file
74 hierarchy.
75 The function
76 .Fn fts_children
77 returns a pointer to a linked list of structures, each of which describes
78 one of the files contained in a directory in the hierarchy.
79 In general, directories are visited two distinguishable times; in pre-order
80 (before any of their descendants are visited) and in post-order (after all
81 of their descendants have been visited).
82 Files are visited once.
83 It is possible to walk the hierarchy
84 .Dq logically
85 (ignoring symbolic links)
86 or physically (visiting symbolic links), order the walk of the hierarchy or
87 prune and/or re-visit portions of the hierarchy.
88 .Pp
89 Two structures are defined (and typedef'd) in the include file
90 .In fts.h .
91 The first is
92 .Vt FTS ,
93 the structure that represents the file hierarchy itself.
94 The second is
95 .Vt FTSENT ,
96 the structure that represents a file in the file
97 hierarchy.
98 Normally, an
99 .Vt FTSENT
100 structure is returned for every file in the file
101 hierarchy.
102 In this manual page,
103 .Dq file
104 and
105 .Dq Vt FTSENT No structure
106 are generally
107 interchangeable.
108 .Pp
109 The
110 .Vt FTS
111 structure contains space for a single pointer, which may be used to
112 store application data or per-hierarchy state.
113 The
114 .Fn fts_set_clientptr
115 and
116 .Fn fts_get_clientptr
117 functions may be used to set and retrieve this pointer.
118 This is likely to be useful only when accessed from the sort
119 comparison function, which can determine the original
120 .Vt FTS
121 stream of its arguments using the
122 .Fn fts_get_stream
123 function.
124 The two
125 .Li get
126 functions are also available as macros of the same name.
127 .Pp
128 The
129 .Vt FTSENT
130 structure contains at least the following fields, which are
131 described in greater detail below:
132 .Bd -literal
133 typedef struct _ftsent {
134         int fts_info;                   /* status for FTSENT structure */
135         char *fts_accpath;              /* access path */
136         char *fts_path;                 /* root path */
137         size_t fts_pathlen;             /* strlen(fts_path) */
138         char *fts_name;                 /* file name */
139         size_t fts_namelen;             /* strlen(fts_name) */
140         long fts_level;                 /* depth (\-1 to N) */
141         int fts_errno;                  /* file errno */
142         long long fts_number;           /* local numeric value */
143         void *fts_pointer;              /* local address value */
144         struct ftsent *fts_parent;      /* parent directory */
145         struct ftsent *fts_link;        /* next file structure */
146         struct ftsent *fts_cycle;       /* cycle structure */
147         struct stat *fts_statp;         /* stat(2) information */
148 } FTSENT;
149 .Ed
150 .Pp
151 These fields are defined as follows:
152 .Bl -tag -width "fts_namelen"
153 .It Fa fts_info
154 One of the following values describing the returned
155 .Vt FTSENT
156 structure and
157 the file it represents.
158 With the exception of directories without errors
159 .Pq Dv FTS_D ,
160 all of these
161 entries are terminal, that is, they will not be revisited, nor will any
162 of their descendants be visited.
163 .Bl  -tag -width FTS_DEFAULT
164 .It Dv FTS_D
165 A directory being visited in pre-order.
166 .It Dv FTS_DC
167 A directory that causes a cycle in the tree.
168 (The
169 .Fa fts_cycle
170 field of the
171 .Vt FTSENT
172 structure will be filled in as well.)
173 .It Dv FTS_DEFAULT
174 Any
175 .Vt FTSENT
176 structure that represents a file type not explicitly described
177 by one of the other
178 .Fa fts_info
179 values.
180 .It Dv FTS_DNR
181 A directory which cannot be read.
182 This is an error return, and the
183 .Fa fts_errno
184 field will be set to indicate what caused the error.
185 .It Dv FTS_DOT
186 A file named
187 .Ql .\&
188 or
189 .Ql ..\&
190 which was not specified as a file name to
191 .Fn fts_open
192 (see
193 .Dv FTS_SEEDOT ) .
194 .It Dv FTS_DP
195 A directory being visited in post-order.
196 The contents of the
197 .Vt FTSENT
198 structure will be unchanged from when
199 the directory was visited in pre-order, except for the
200 .Fa fts_info
201 field.
202 .It Dv FTS_ERR
203 This is an error return, and the
204 .Fa fts_errno
205 field will be set to indicate what caused the error.
206 .It Dv FTS_F
207 A regular file.
208 .It Dv FTS_NS
209 A file for which no
210 .Xr stat 2
211 information was available.
212 The contents of the
213 .Fa fts_statp
214 field are undefined.
215 This is an error return, and the
216 .Fa fts_errno
217 field will be set to indicate what caused the error.
218 .It Dv FTS_NSOK
219 A file for which no
220 .Xr stat 2
221 information was requested.
222 The contents of the
223 .Fa fts_statp
224 field are undefined.
225 .It Dv FTS_SL
226 A symbolic link.
227 .It Dv FTS_SLNONE
228 A symbolic link with a non-existent target.
229 The contents of the
230 .Fa fts_statp
231 field reference the file characteristic information for the symbolic link
232 itself.
233 .El
234 .It Fa fts_accpath
235 A path for accessing the file from the current directory.
236 .It Fa fts_path
237 The path for the file relative to the root of the traversal.
238 This path contains the path specified to
239 .Fn fts_open
240 as a prefix.
241 .It Fa fts_pathlen
242 The length of the string referenced by
243 .Fa fts_path .
244 .It Fa fts_name
245 The name of the file.
246 .It Fa fts_namelen
247 The length of the string referenced by
248 .Fa fts_name .
249 .It Fa fts_level
250 The depth of the traversal, numbered from \-1 to N, where this file
251 was found.
252 The
253 .Vt FTSENT
254 structure representing the parent of the starting point (or root)
255 of the traversal is numbered
256 .Dv FTS_ROOTPARENTLEVEL
257 (\-1), and the
258 .Vt FTSENT
259 structure for the root
260 itself is numbered
261 .Dv FTS_ROOTLEVEL
262 (0).
263 .It Fa fts_errno
264 Upon return of a
265 .Vt FTSENT
266 structure from the
267 .Fn fts_children
268 or
269 .Fn fts_read
270 functions, with its
271 .Fa fts_info
272 field set to
273 .Dv FTS_DNR ,
274 .Dv FTS_ERR
275 or
276 .Dv FTS_NS ,
277 the
278 .Fa fts_errno
279 field contains the value of the external variable
280 .Va errno
281 specifying the cause of the error.
282 Otherwise, the contents of the
283 .Fa fts_errno
284 field are undefined.
285 .It Fa fts_number
286 This field is provided for the use of the application program and is
287 not modified by the
288 .Nm
289 functions.
290 It is initialized to 0.
291 .It Fa fts_pointer
292 This field is provided for the use of the application program and is
293 not modified by the
294 .Nm
295 functions.
296 It is initialized to
297 .Dv NULL .
298 .It Fa fts_parent
299 A pointer to the
300 .Vt FTSENT
301 structure referencing the file in the hierarchy
302 immediately above the current file, i.e., the directory of which this
303 file is a member.
304 A parent structure for the initial entry point is provided as well,
305 however, only the
306 .Fa fts_level ,
307 .Fa fts_number
308 and
309 .Fa fts_pointer
310 fields are guaranteed to be initialized.
311 .It Fa fts_link
312 Upon return from the
313 .Fn fts_children
314 function, the
315 .Fa fts_link
316 field points to the next structure in the NULL-terminated linked list of
317 directory members.
318 Otherwise, the contents of the
319 .Fa fts_link
320 field are undefined.
321 .It Fa fts_cycle
322 If a directory causes a cycle in the hierarchy (see
323 .Dv FTS_DC ) ,
324 either because
325 of a hard link between two directories, or a symbolic link pointing to a
326 directory, the
327 .Fa fts_cycle
328 field of the structure will point to the
329 .Vt FTSENT
330 structure in the hierarchy that references the same file as the current
331 .Vt FTSENT
332 structure.
333 Otherwise, the contents of the
334 .Fa fts_cycle
335 field are undefined.
336 .It Fa fts_statp
337 A pointer to
338 .Xr stat 2
339 information for the file.
340 .El
341 .Pp
342 A single buffer is used for all of the paths of all of the files in the
343 file hierarchy.
344 Therefore, the
345 .Fa fts_path
346 and
347 .Fa fts_accpath
348 fields are guaranteed to be
349 .Dv NUL Ns -terminated
350 .Em only
351 for the file most recently returned by
352 .Fn fts_read .
353 To use these fields to reference any files represented by other
354 .Vt FTSENT
355 structures will require that the path buffer be modified using the
356 information contained in that
357 .Vt FTSENT
358 structure's
359 .Fa fts_pathlen
360 field.
361 Any such modifications should be undone before further calls to
362 .Fn fts_read
363 are attempted.
364 The
365 .Fa fts_name
366 field is always
367 .Dv NUL Ns -terminated .
368 .Sh FTS_OPEN
369 The
370 .Fn fts_open
371 function takes a pointer to an array of character pointers naming one
372 or more paths which make up a logical file hierarchy to be traversed.
373 The array must be terminated by a
374 .Dv NULL
375 pointer.
376 .Pp
377 There are
378 a number of options, at least one of which (either
379 .Dv FTS_LOGICAL
380 or
381 .Dv FTS_PHYSICAL )
382 must be specified.
383 The options are selected by
384 .Em or Ns 'ing
385 the following values:
386 .Bl -tag -width "FTS_PHYSICAL"
387 .It Dv FTS_COMFOLLOW
388 This option causes any symbolic link specified as a root path to be
389 followed immediately whether or not
390 .Dv FTS_LOGICAL
391 is also specified.
392 .It Dv FTS_LOGICAL
393 This option causes the
394 .Nm
395 routines to return
396 .Vt FTSENT
397 structures for the targets of symbolic links
398 instead of the symbolic links themselves.
399 If this option is set, the only symbolic links for which
400 .Vt FTSENT
401 structures
402 are returned to the application are those referencing non-existent files.
403 Either
404 .Dv FTS_LOGICAL
405 or
406 .Dv FTS_PHYSICAL
407 .Em must
408 be provided to the
409 .Fn fts_open
410 function.
411 .It Dv FTS_NOCHDIR
412 To allow descending to arbitrary depths
413 (independent of
414 .Brq Dv PATH_MAX )
415 and improve performance, the
416 .Nm
417 functions change directories as they walk the file hierarchy.
418 This has the side-effect that an application cannot rely on being
419 in any particular directory during the traversal.
420 The
421 .Dv FTS_NOCHDIR
422 option turns off this feature, and the
423 .Nm
424 functions will not change the current directory.
425 Note that applications should not themselves change their current directory
426 and try to access files unless
427 .Dv FTS_NOCHDIR
428 is specified and absolute
429 pathnames were provided as arguments to
430 .Fn fts_open .
431 .It Dv FTS_NOSTAT
432 By default, returned
433 .Vt FTSENT
434 structures reference file characteristic information (the
435 .Fa statp
436 field) for each file visited.
437 This option relaxes that requirement as a performance optimization,
438 allowing the
439 .Nm
440 functions to set the
441 .Fa fts_info
442 field to
443 .Dv FTS_NSOK
444 and leave the contents of the
445 .Fa statp
446 field undefined.
447 .It Dv FTS_PHYSICAL
448 This option causes the
449 .Nm
450 routines to return
451 .Vt FTSENT
452 structures for symbolic links themselves instead
453 of the target files they point to.
454 If this option is set,
455 .Vt FTSENT
456 structures for all symbolic links in the
457 hierarchy are returned to the application.
458 Either
459 .Dv FTS_LOGICAL
460 or
461 .Dv FTS_PHYSICAL
462 .Em must
463 be provided to the
464 .Fn fts_open
465 function.
466 .It Dv FTS_SEEDOT
467 By default, unless they are specified as path arguments to
468 .Fn fts_open ,
469 any files named
470 .Ql .\&
471 or
472 .Ql ..\&
473 encountered in the file hierarchy are ignored.
474 This option causes the
475 .Nm
476 routines to return
477 .Vt FTSENT
478 structures for them.
479 .It Dv FTS_XDEV
480 This option prevents
481 .Nm
482 from descending into directories that have a different device number
483 than the file from which the descent began.
484 .El
485 .Pp
486 The argument
487 .Fn compar
488 specifies a user-defined function which may be used to order the traversal
489 of the hierarchy.
490 It
491 takes two pointers to pointers to
492 .Vt FTSENT
493 structures as arguments and
494 should return a negative value, zero, or a positive value to indicate
495 if the file referenced by its first argument comes before, in any order
496 with respect to, or after, the file referenced by its second argument.
497 The
498 .Fa fts_accpath ,
499 .Fa fts_path
500 and
501 .Fa fts_pathlen
502 fields of the
503 .Vt FTSENT
504 structures may
505 .Em never
506 be used in this comparison.
507 If the
508 .Fa fts_info
509 field is set to
510 .Dv FTS_NS
511 or
512 .Dv FTS_NSOK ,
513 the
514 .Fa fts_statp
515 field may not either.
516 If the
517 .Fn compar
518 argument is
519 .Dv NULL ,
520 the directory traversal order is in the order listed in
521 .Fa path_argv
522 for the root paths, and in the order listed in the directory for
523 everything else.
524 .Sh FTS_READ
525 The
526 .Fn fts_read
527 function returns a pointer to an
528 .Vt FTSENT
529 structure describing a file in
530 the hierarchy.
531 Directories (that are readable and do not cause cycles) are visited at
532 least twice, once in pre-order and once in post-order.
533 All other files are visited at least once.
534 (Hard links between directories that do not cause cycles or symbolic
535 links to symbolic links may cause files to be visited more than once,
536 or directories more than twice.)
537 .Pp
538 If all the members of the hierarchy have been returned,
539 .Fn fts_read
540 returns
541 .Dv NULL
542 and sets the external variable
543 .Va errno
544 to 0.
545 If an error unrelated to a file in the hierarchy occurs,
546 .Fn fts_read
547 returns
548 .Dv NULL
549 and sets
550 .Va errno
551 appropriately.
552 If an error related to a returned file occurs, a pointer to an
553 .Vt FTSENT
554 structure is returned, and
555 .Va errno
556 may or may not have been set (see
557 .Fa fts_info ) .
558 .Pp
559 The
560 .Vt FTSENT
561 structures returned by
562 .Fn fts_read
563 may be overwritten after a call to
564 .Fn fts_close
565 on the same file hierarchy stream, or, after a call to
566 .Fn fts_read
567 on the same file hierarchy stream unless they represent a file of type
568 directory, in which case they will not be overwritten until after a call to
569 .Fn fts_read
570 after the
571 .Vt FTSENT
572 structure has been returned by the function
573 .Fn fts_read
574 in post-order.
575 .Sh FTS_CHILDREN
576 The
577 .Fn fts_children
578 function returns a pointer to an
579 .Vt FTSENT
580 structure describing the first entry in a NULL-terminated linked list of
581 the files in the directory represented by the
582 .Vt FTSENT
583 structure most recently returned by
584 .Fn fts_read .
585 The list is linked through the
586 .Fa fts_link
587 field of the
588 .Vt FTSENT
589 structure, and is ordered by the user-specified comparison function, if any.
590 Repeated calls to
591 .Fn fts_children
592 will recreate this linked list.
593 .Pp
594 As a special case, if
595 .Fn fts_read
596 has not yet been called for a hierarchy,
597 .Fn fts_children
598 will return a pointer to the files in the logical directory specified to
599 .Fn fts_open ,
600 i.e., the arguments specified to
601 .Fn fts_open .
602 Otherwise, if the
603 .Vt FTSENT
604 structure most recently returned by
605 .Fn fts_read
606 is not a directory being visited in pre-order,
607 or the directory does not contain any files,
608 .Fn fts_children
609 returns
610 .Dv NULL
611 and sets
612 .Va errno
613 to zero.
614 If an error occurs,
615 .Fn fts_children
616 returns
617 .Dv NULL
618 and sets
619 .Va errno
620 appropriately.
621 .Pp
622 The
623 .Vt FTSENT
624 structures returned by
625 .Fn fts_children
626 may be overwritten after a call to
627 .Fn fts_children ,
628 .Fn fts_close
629 or
630 .Fn fts_read
631 on the same file hierarchy stream.
632 .Pp
633 .Em Option
634 may be set to the following value:
635 .Bl -tag -width FTS_NAMEONLY
636 .It Dv FTS_NAMEONLY
637 Only the names of the files are needed.
638 The contents of all the fields in the returned linked list of structures
639 are undefined with the exception of the
640 .Fa fts_name
641 and
642 .Fa fts_namelen
643 fields.
644 .El
645 .Sh FTS_SET
646 The function
647 .Fn fts_set
648 allows the user application to determine further processing for the
649 file
650 .Fa f
651 of the stream
652 .Fa ftsp .
653 The
654 .Fn fts_set
655 function
656 returns 0 on success, and \-1 if an error occurs.
657 .Em Option
658 must be set to one of the following values:
659 .Bl -tag -width FTS_PHYSICAL
660 .It Dv FTS_AGAIN
661 Re-visit the file; any file type may be re-visited.
662 The next call to
663 .Fn fts_read
664 will return the referenced file.
665 The
666 .Fa fts_stat
667 and
668 .Fa fts_info
669 fields of the structure will be reinitialized at that time,
670 but no other fields will have been changed.
671 This option is meaningful only for the most recently returned
672 file from
673 .Fn fts_read .
674 Normal use is for post-order directory visits, where it causes the
675 directory to be re-visited (in both pre and post-order) as well as all
676 of its descendants.
677 .It Dv FTS_FOLLOW
678 The referenced file must be a symbolic link.
679 If the referenced file is the one most recently returned by
680 .Fn fts_read ,
681 the next call to
682 .Fn fts_read
683 returns the file with the
684 .Fa fts_info
685 and
686 .Fa fts_statp
687 fields reinitialized to reflect the target of the symbolic link instead
688 of the symbolic link itself.
689 If the file is one of those most recently returned by
690 .Fn fts_children ,
691 the
692 .Fa fts_info
693 and
694 .Fa fts_statp
695 fields of the structure, when returned by
696 .Fn fts_read ,
697 will reflect the target of the symbolic link instead of the symbolic link
698 itself.
699 In either case, if the target of the symbolic link does not exist the
700 fields of the returned structure will be unchanged and the
701 .Fa fts_info
702 field will be set to
703 .Dv FTS_SLNONE .
704 .Pp
705 If the target of the link is a directory, the pre-order return, followed
706 by the return of all of its descendants, followed by a post-order return,
707 is done.
708 .It Dv FTS_SKIP
709 No descendants of this file are visited.
710 The file may be one of those most recently returned by either
711 .Fn fts_children
712 or
713 .Fn fts_read .
714 .El
715 .Sh FTS_CLOSE
716 The
717 .Fn fts_close
718 function closes a file hierarchy stream
719 .Fa ftsp
720 and restores the current directory to the directory from which
721 .Fn fts_open
722 was called to open
723 .Fa ftsp .
724 The
725 .Fn fts_close
726 function
727 returns 0 on success, and \-1 if an error occurs.
728 .Sh ERRORS
729 The function
730 .Fn fts_open
731 may fail and set
732 .Va errno
733 for any of the errors specified for the library functions
734 .Xr open 2
735 and
736 .Xr malloc 3 .
737 .Pp
738 The function
739 .Fn fts_close
740 may fail and set
741 .Va errno
742 for any of the errors specified for the library functions
743 .Xr chdir 2
744 and
745 .Xr close 2 .
746 .Pp
747 The functions
748 .Fn fts_read
749 and
750 .Fn fts_children
751 may fail and set
752 .Va errno
753 for any of the errors specified for the library functions
754 .Xr chdir 2 ,
755 .Xr malloc 3 ,
756 .Xr opendir 3 ,
757 .Xr readdir 3
758 and
759 .Xr stat 2 .
760 .Pp
761 In addition,
762 .Fn fts_children ,
763 .Fn fts_open
764 and
765 .Fn fts_set
766 may fail and set
767 .Va errno
768 as follows:
769 .Bl -tag -width Er
770 .It Bq Er EINVAL
771 The options were invalid, or the list were empty.
772 .El
773 .Sh SEE ALSO
774 .Xr find 1 ,
775 .Xr chdir 2 ,
776 .Xr stat 2 ,
777 .Xr ftw 3 ,
778 .Xr qsort 3
779 .Sh HISTORY
780 The
781 .Nm
782 interface was first introduced in
783 .Bx 4.4 .
784 The
785 .Fn fts_get_clientptr ,
786 .Fn fts_get_stream ,
787 and
788 .Fn fts_set_clientptr
789 functions were introduced in
790 .Fx 5.0 ,
791 principally to provide for alternative interfaces to the
792 .Nm
793 functionality using different data structures.
794 .Sh BUGS
795 The
796 .Fn fts_open
797 function will automatically set the
798 .Dv FTS_NOCHDIR
799 option if the
800 .Dv FTS_LOGICAL
801 option is provided, or if it cannot
802 .Xr open 2
803 the current directory.