eyBuildLib API Reference : eyBuildLib
ebfile - eybuild file operation library
trimpath( ) - remove useless or noneffective '.', '..' in given path
get_dirlen( ) - get the length of directory from given path
get_filename( ) - get filename from given path
get_extname( ) - get file extended name from given path
file_size( ) - get file size if file exist
file_exists( ) - test file exist or not
file_isdir( ) - test the file is a directory or not
file_isreg( ) - test the file is a regular file or not
file_ischar( ) - test the file is a character device or not
file_isblock( ) - test the file is a block device or not
file_isfifo( ) - test the file is a fifo or not
file_islink( ) - test the file is a symbolic link or not
file_readable( ) - test the file readable or not
file_writeable( ) - test the file writeable or not
file_executable( ) - test the file executable or not
file_atime( ) - get the last access time of the file
file_ctime( ) - get the create time of the file
file_mtime( ) - get the last modified time of the file
eybuild file operation library
ebfile.h
trimpath( ) - remove useless or noneffective '.', '..' in given path
char * trimpath ( char * path /* to tidy */ )
this routine is to remove useless or noneffective '.', '..' in given path.
Index | Raw Path | Result --------|---------------------------|------------------ 1 | path | normalized path 2 | /foo// | /foo/ 3 | /foo/./ | /foo/ 4 | /foo/../bar | /bar 5 | /foo/../bar/ | /bar/ 6 | /foo/../bar/../baz | /baz 7 | //foo//./bar | /foo/bar 8 | /../foo | /foo 9 | /foo/../bar/../../baz | /baz 10 | /.././../ | / 11 | /.. | / 12 | ../foo | ../foo 13 | ./foo/.././bar | ./bar 14 | foo/../.././bar/ | ../bar/
This routine will force convert \ to / and jump over disk driver in WIN32 system.
pointer to path
get_dirlen( ) - get the length of directory from given path
int get_dirlen ( const char * path )
this routine is to get the length of directory, which includes the last / or \
Index | Raw Path | Result --------|---------------------------|------------------ 1 | c: | 2 2 | c:\mydir\foo.c | 9 3 | /usr/foo.c | 5 4 | /usr/ | 5 5 | / | 1 6 | . | 0
the length of directory(includes last / or \)
get_filename( ) - get filename from given path
char * get_filename ( const char * path )
this routine return the next address of last / or \, or the start address if not found
Index | Raw Path | Result --------|---------------------------|------------------ 1 | c:foo.c | foo.c 2 | c:\bar.c | bar.c 3 | /usr/foo | foo 4 | bar | bar
pointer to filename
get_extname( ) - get file extended name from given path
char * get_extname ( const char * path )
this routine returned file externed name, or pointer to end of path if not found.
Index | Raw Path | Result --------|---------------------------|------------------ 1 | c:\foo.c | .c 2 | /usr/foo.tar.gz | .tar.gz 3 | /usr/ |
pointer to extern filename(includes .), or ""
file_size( ) - get file size if file exist
long file_size ( const char * filename )
this routine return the size if the file exist
return the size if the file exist, otherwise return ERROR
file_exists( ) - test file exist or not
BOOL file_exists ( const char * filename )
this routine is to test file exist or not
TRUE if file exist, otherwize FALSE
file_isdir( ) - test the file is a directory or not
int file_isdir ( const char * filename )
this routine is to test the file is a directory or not
ret>0 if yes, ret==0 if not, otherwize ret<0 if file not exist
file_isreg( ) - test the file is a regular file or not
int file_isreg ( const char * filename )
this routine is to test the file is a regular file or not
ret>0 if yes, ret==0 if not, otherwize ret<0 if file not exist
file_ischar( ) - test the file is a character device or not
int file_ischar ( const char * filename )
this routine is to test the file is a character device or not
ret>0 if yes, ret==0 if not, otherwize ret<0 if file not exist
file_isblock( ) - test the file is a block device or not
int file_isblock ( const char * filename )
this routine is to test the file is a block device or not
ret>0 if yes, ret==0 if not, otherwize ret<0 if file not exist
file_isfifo( ) - test the file is a fifo or not
int file_isfifo ( const char * filename )
this routine is to test the file is a fifo or not
ret>0 if yes, ret==0 if not, otherwize ret<0 if file not exist
file_islink( ) - test the file is a symbolic link or not
int file_islink ( const char * filename )
this routine is to test the file is a symbolic link or not
ret>0 if yes, ret==0 if not, otherwize ret<0 if file not exist
file_readable( ) - test the file readable or not
int file_readable ( const char * filename )
this routine is to test the file readable or not. In POSIX OS, the second bit of returned value is to mark root readable or not.
ret>0 if yes, ret==0 if not, otherwize ret<0 if file not exist
file_writeable( ) - test the file writeable or not
int file_writeable ( const char * filename )
this routine is to test the file writeable or not. In POSIX OS, the second bit of returned value, is to mark root writeable or not.
ret>0 if yes, ret==0 if not, otherwize ret<0 if file not exist
file_executable( ) - test the file executable or not
int file_executable ( const char * filename )
this routine is to test the file executable or not. In POSIX OS, the second bit of returned value is to mark root executable or not.
ret>0 if yes, ret==0 if not, otherwize ret<0 if file not exist
file_atime( ) - get the last access time of the file
time_t file_atime ( const char * filename )
this routine is to get the last access time of the file
last access time, or ERROR if file is not exist
file_ctime( ) - get the create time of the file
time_t file_ctime ( const char * filename )
this routine is to get the create time of the file
the create time of the file, or ERROR if file is not exist
file_mtime( ) - get the last modified time of the file
time_t file_mtime ( const char * filename )
this routine is to get the last modified time of the file
last last modified time, ERROR if file not exist