Typedefs | |
| typedef int( | File_Sort_F )(const dirent *const *, const dirent *const *) |
Functions | |
| int | filename_absolute (char *to, int tolen, const char *from, const char *cwd=0) |
| int | filename_relative (char *to, int tolen, const char *from, const char *cwd=0) |
| const char * | filename_name (const char *) |
| char * | filename_name (char *a) |
| const char * | filename_ext (const char *) |
| char * | filename_ext (char *a) |
| bool | filename_match (const char *, const char *pattern) |
| bool | filename_exist (const char *) |
| bool | filename_isdir (const char *) |
| double | filename_size (const char *) |
| long int | filename_mtime (const char *) |
| int | alphasort (const dirent *const *, const dirent *const *) |
| int | casealphasort (const dirent *const *, const dirent *const *) |
| int | casenumericsort (const dirent *const *, const dirent *const *) |
| int | numericsort (const dirent *const *, const dirent *const *) |
| int | filename_list (const char *d, dirent ***list, File_Sort_F *sort) |
| int | filename_list (const char *d, dirent ***list) |
|
||||||||||||||||||||
|
Return the filename from expanded to a full "absolute" path name by prepending the current directory:
The return value is the number of bytes this wants to write to output. If this value is greater or equal to length, then you know the output has been truncated, and you can call this again with a buffer of n+1 bytes. Leading "./" sequences in input are removed, and "../" sequences are removed as well as the matching trailing part of the prefixed directory. Technically this is incorrect if symbolic links are used but this matches the behavior of most programs. If the pwd argument is null, this also expands names starting with '~' to the user or another user's HOME directory. To expand a filename starting with ~ in the current directory you must start it with "./~". If input is a zero-length string then the pwd is returned with a slash added to the end. |
|
|
Returns true if the file exists . |
|
|
Returns a pointer to the last period in filename_name(f), or a pointer to the trailing nul if none. Notice that this points at the period, not after it! |
|
|
Returns true if the file exists and is a directory. |
|
||||||||||||
|
Returns true if filename s matches pattern p. The following glob syntax is used by pattern:
|
|
|
Returns the modification time of the file as a Unix timestamp (number of seconds since the start of 1970 in GMT). Returns 0 if the file does not exist. |
|
|
Returns a pointer to after the last slash in name. If the name ends with a slash then this returns a pointer to the NUL. If there is no slash this returns a pointer to the start of name. |
|
||||||||||||||||||||
|
Does the opposite of filename_absolute(). Produces the shortest possible name in output that is relative to the current directory. If the filename does not start with any text that matches the current directory then it is returned unchanged. Return value is the number of characters it wants to write to output. |
|
|
Returns the size of the file in bytes. Returns zero if it does not exist. |
©2006 Bill Spitzak and others.