2 #ifndef h_pnd_pathiter_h
3 #define h_png_pathiter_h
5 // man don'y you wish it was python, perl or c++ right about now?
6 // perl: foreach i ( split ( ':', path ) ) would be sauce right now
8 // this really should be replaced by a function pair .. one to
9 // start a new search and one to go to next, bailing when done. Maybe
10 // a state struct. Like we have time. OR perhaps just a single
11 // func with a callback. Whatever.
13 #define SEARCHPATH_PRE \
15 char *head = searchpath; \
16 char buffer [ FILENAME_MAX ]; \
19 colon = strchr ( head, ':' ); \
20 end = strchr ( head, '\0' ); \
22 if ( colon && colon < end ) { \
23 memset ( buffer, '\0', FILENAME_MAX ); \
24 strncpy ( buffer, head, colon - head ); \
26 strncpy ( buffer, head, FILENAME_MAX - 1 ); \
29 //printf ( "Path to search: '%s'\n", buffer );
31 #define SEARCHPATH_POST \
32 /* next search path */ \
33 if ( colon && colon < end ) { \