FreeBSD Bugzilla – Attachment 129466 Details for
Bug 173448
[patch] ftw.3 manual page example addition
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
Remember
[x]
|
Forgot Password
Login:
[x]
[patch]
file.diff
file.diff (text/plain), 1.09 KB, created by
Fernando ApesteguĂa
on 2012-11-07 18:30:00 UTC
(
hide
)
Description:
file.diff
Filename:
MIME Type:
Creator:
Fernando ApesteguĂa
Created:
2012-11-07 18:30:00 UTC
Size:
1.09 KB
patch
obsolete
>--- /usr/src/lib/libc/gen/ftw.3 2012-01-03 04:26:08.000000000 +0100 >+++ ftw_man/ftw.3 2012-11-07 19:18:48.000000000 +0100 >@@ -155,6 +155,54 @@ > will stop processing the tree and return the value from > .Fa fn . > Both functions return \-1 if an error is detected. >+.Sh EXAMPLES >+Following there is a small example that shows how >+.Nm >+works. It traverses the file tree starting at the directory pointed >+by the only program argument and shows the complete path and a brief >+indicator about the file type. >+.Bd -literal >+#include <ftw.h> >+#include <stdio.h> >+ >+int >+ftw_callback(const char *path, const struct stat *sb, int typeflag) >+{ >+ char type; >+ >+ switch(typeflag) { >+ case FTW_F: >+ type = 'F'; >+ break; >+ case FTW_D: >+ type = 'D'; >+ break; >+ case FTW_DNR: >+ type = '-'; >+ break; >+ case FTW_NS: >+ type = 'X'; >+ break; >+ } >+ >+ printf("[%c] %s\n", type, path); >+ >+ return (0); >+} >+ >+int >+main(int argc, char **argv) >+{ >+ >+ if (argc != 2) { >+ printf("Usage %s <directory>\n", argv[0]); >+ return (0); >+ } else { >+ return (ftw(argv[1], ftw_callback, /*UNUSED*/ 10)); >+ } >+ >+} >+.Ed > .Sh ERRORS > The > .Fn ftw
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Diff
Attachments on
bug 173448
: 129466