File: al_for_each_fs_entry.3

package info (click to toggle)
allegro5 2%3A5.2.2-1
  • links: PTS, VCS
  • area: main
  • in suites: stretch
  • size: 23,032 kB
  • sloc: ansic: 120,340; cpp: 15,707; objc: 4,805; python: 2,915; java: 2,195; sh: 887; xml: 86; makefile: 49; perl: 37; pascal: 24
file content (66 lines) | stat: -rw-r--r-- 2,576 bytes parent folder | download
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
.TH "al_for_each_fs_entry" "3" "" "Allegro reference manual" ""
.SH NAME
.PP
al_for_each_fs_entry \- Allegro 5 API
.SH SYNOPSIS
.IP
.nf
\f[C]
#include\ <allegro5/allegro.h>

int\ al_for_each_fs_entry(ALLEGRO_FS_ENTRY\ *dir,
\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ int\ (*callback)(ALLEGRO_FS_ENTRY\ *dir,\ void\ *extra),
\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ void\ *extra)
\f[]
.fi
.SH DESCRIPTION
.PP
This function takes the ALLEGRO_FS_ENTRY(3) \f[C]dir\f[], which should
represent a directory, and looks for any other file system entries that
are in it.
This function will then call the callback function \f[C]callback\f[]
once for every filesystem entry in the directory \f[C]dir\f[].
.PP
The callback \f[C]callback\f[] must be of type
\f[C]int\ callback(ALLEGRO_FS_ENTRY\ *\ entry,\ void\ *\ extra)\f[].
The \f[C]callback\f[] will be called with a pointer to an
ALLEGRO_FS_ENTRY(3) that matches one file or directory in \f[C]dir\f[],
and the pointer passed in the \f[C]extra\f[] parameter to
al_for_each_fs_entry(3).
.PP
When \f[C]callback\f[] returns \f[C]ALLEGRO_FOR_EACH_FS_ENTRY_STOP\f[]
or \f[C]ALLEGRO_FOR_EACH_FS_ENTRY_ERROR\f[], iteration will stop
immediately and al_for_each_fs_entry(3) will return the value the
\f[C]callback\f[] returned.
.PP
When \f[C]callback\f[] returns \f[C]ALLEGRO_FOR_EACH_FS_ENTRY_OK\f[]
iteration will continue normally, and if the ALLEGRO_FS_ENTRY(3)
parameter of \f[C]callback\f[] is a directory, al_for_each_fs_entry(3)
will call itself on that directory.
Therefore the function will recusively descend into that directory.
.PP
However, when \f[C]callback\f[] returns
\f[C]ALLEGRO_FOR_EACH_FS_ENTRY_SKIP\f[] iteration will continue, but
al_for_each_fs_entry(3) will NOT recurse into the ALLEGRO_FS_ENTRY(3)
parameter of \f[C]callback\f[] even if it is a directory.
.PP
This function will skip any files or directories named \f[C]\&.\f[] or
\f[C]\&..\f[] which may exist on certain platforms and may signify the
current and the parent directory.
The \f[C]callback\f[] will not be called for files or directories with
such a name.
.PP
Returns ALLEGRO_FOR_EACH_FS_ENTRY_OK if sucessful, or
ALLEGRO_FOR_EACH_FS_ENTRY_ERROR if something went wrong in processing
the directory.
In that case it will use al_set_errno(3) to indicate the type of error
which occurred.
This function returns ALLEGRO_FOR_EACH_FS_ENTRY_STOP in case iteration
was stopped by making \f[C]callback\f[] return that value.
In this case, al_set_errno(3) will not be used.
.SH SEE ALSO
.PP
ALLEGRO_FOR_EACH_FS_ENTRY_RESULT(3)
.SH SINCE
.PP
5.1.9