50 #ifndef _FILE_HELP_H_INCLUDED_ 51 #define _FILE_HELP_H_INCLUDED_ 58 #ifdef X11WORKBENCH_PROJECT_BUILD 61 #include "X11workbenchToolkit_config.h" 63 #else // X11WORKBENCH_PROJECT_BUILD 67 #include "X11workbenchToolkit_install_config.h" 69 #endif // X11WORKBENCH_PROJECT_BUILD 82 #define NAME_MAX MAX_PATH 88 #define NAME_MAX MAXNAMLEN 93 #endif // WIN32, !WIN32 186 file_help_buf_dirty = 1,
187 file_help_buf_reserved01 = 2,
188 file_help_buf_reserved02 = 4,
189 file_help_buf_reserved03 = 8,
190 file_help_buf_reserved04 = 16,
191 file_help_buf_reserved05 = 32,
192 file_help_buf_reserved06 = 64,
193 file_help_buf_reserved07 = 128,
194 file_help_buf_reserved08 = 256,
196 file_help_buf_last = 0x80000000L
212 return pBuf && (pBuf->
iFlags & file_help_buf_dirty);
589 int cbNameReturn,
unsigned long *pdwModeAttrReturn);
649 int WBStat(
const char *szFileName,
unsigned long *pdwModeAttrReturn);
665 unsigned long *pdwModeAttrReturn);
668 #if defined(HAVE_LONGLONG) || defined(__DOXYGEN__) 700 #else // defined(HAVE_LONGLONG) || defined(__DOXYGEN__) 706 #endif // defined(HAVE_LONGLONG) || defined(__DOXYGEN__) 711 #endif // __cplusplus 714 #endif // _FILE_HELP_H_INCLUDED_ char ** ppLineBuf
array of pointers to beginning of each line (WBAlloc'd TODO: make it part of 'cData'?...
int FBWriteFileBufHandle(int iHandle, const file_help_buf_t *pFB)
Write the file_help_buf_t object's text data to a file using an open file handle.
long lBufferCount
number of bytes of valid data
file_help_buf_t * FBGetFileBuf(const char *szFileName)
Construct a file_help_buf_t from a file.
void FBInsertLineIntoFileBuf(file_help_buf_t **ppBuf, long lLineNum, const char *szLine)
Insert a line of text into a file_help_buf_t object at a specific line index.
void * WBAllocDirectoryList(const char *szDirSpec)
Allocate a 'Directory List' object for a specified directory spec.
unsigned long long WBGetFileModDateTime(const char *szFileName)
Obtain the 'time_t' value for a file's modification date/time (unix time, seconds since the epoch)
int WBWriteFileFromBuffer(const char *szFileName, const char *pBuf, size_t cbBuf)
read a file's contents into a buffer, returning the length of the buffer
void FBDestroyFileBuf(file_help_buf_t *pFB)
Destroy a file_help_buf_t object.
struct tag_file_help_buf file_help_buf_t
basic 'buffered I/O' object structure for 'FileBuf' APIs
char cData[sizeof(char *)]
the data itself (aligned to size of a pointer)
struct tag_file_help_buf * pPrev
pointer to 'previous' item in linked list (NULL for owner object)
struct tag_file_help_buf * pNext
pointer to 'next' item in linked list (NULL for last object)
void FBDeleteLineFromFileBuf(file_help_buf_t *pBuf, long lLineNum)
Delete a line of text from a file_help_buf_t object at a specific line index.
int WBCheckFileModDateTime(const char *szFileName, unsigned long long tVal)
Compare a 64-bit unsigned integer value against a file's modification date/time (unix time,...
int WBStat(const char *szFileName, unsigned long *pdwModeAttrReturn)
Obtain the 'stat' flags for a file name, resolving links as needed.
int WBGetDirectoryListFileStat(const void *pDirectoryList, const char *szFileName, unsigned long *pdwModeAttrReturn)
Obtain the 'stat' flags for a file name, resolving links as needed, with respect to a 'Directory List...
long lLineCount
number of lines in 'cData' when ppLineBuf not NULL
long lLineBufSize
size of memory block pointed to by 'ppLineBuf'
size_t WBReadFileIntoBuffer(const char *szFileName, char **ppBuf)
read a file's contents into a buffer, returning the length of the buffer
int WBIsDirectory(const char *szName)
Return whether a file is a directory or a symlink to a directory.
int FBParseFileBuf(file_help_buf_t *pFB)
Parse or Re-Parse the data for a file_help_buf_t object.
void FBInsertIntoFileBuf(file_help_buf_t **ppBuf, long cbOffset, const void *pData, long cbData)
Insert text into a file_help_buf_t object at a specific byte offset.
int WBNextDirectoryEntry(void *pDirectoryList, char *szNameReturn, int cbNameReturn, unsigned long *pdwModeAttrReturn)
Obtain information about the next entry in a 'Directory List'.
tag_file_help_buf_flags
bit flags for file_help_buf_t 'iFlags' member
char * WBGetDirectoryListFileFullPath(const void *pDirectoryList, const char *szFileName)
Construct a fully qualified canonical path from a 'Directory List' object and a file name.
int FBWriteFileBuf(const char *szFileName, const file_help_buf_t *pFB)
Write the file_help_buf_t object's text data to a file using a filename.
char * WBGetDirectoryListSymLinkTarget(const void *pDirectoryList, const char *szFileName)
Obtain the target of a symbolic link file name with respect to a 'Directory List' object.
int WBReplicateFilePermissions(const char *szProto, const char *szTarget)
replicate permissions on a target file based on another file's permissions
void FBReplaceLineInFileBuf(file_help_buf_t **ppBuf, long lLineNum, const char *szLine)
Insert a line of text into a file_help_buf_t object at a specific line index.
static __inline__ int FBIsFileBufDirty(const file_help_buf_t *pBuf)
Inline function, returns TRUE if file_help_buf_t is 'dirty'.
basic 'buffered I/O' object structure for 'FileBuf' APIs
static __inline__ int FBWriteFileFromBuffer(const char *szFileName, const char *pBuf, unsigned int cbBuf)
Write a file from a regular buffer using a file name.
char * WBGetCanonicalPath(const char *szFileName)
Return the canonical path for a file name (similar to POSIX 'realpath()' funtion)
char * WBGetCurrentDirectory(void)
Return allocated string containing the current working directory.
file_help_buf_t * FBGetFileBufFromBuffer(const char *pBuf, long cbBuf)
Construct a file_help_buf_t from a buffer.
char * WBGetSymLinkTarget(const char *szFileName)
Obtain the target of a symbolic link.
void WBDestroyDirectoryList(void *pDirectoryList)
Destroy a 'Directory List' object allocated by WBAllocDirectoryList()
long lBufferSize
size of entire buffer
file_help_buf_t * FBGetFileBufViaHandle(int iHandle)
Construct a file_help_buf_t from a file handle.
void FBDeleteFromFileBuf(file_help_buf_t *pBuf, long cbOffset, long cbDelFrom)
Delete text from a file_help_buf_t object at a specific byte offset.
int iFlags
various bit flags