Subversion
 All Data Structures Files Functions Variables Typedefs Enumerations Enumerator Macros Groups Pages
Functions
Version/format files

Version/format files. More...

Functions

svn_error_tsvn_io_read_version_file (int *version, const char *path, apr_pool_t *pool)
 Set *version to the integer that starts the file at path.
 
svn_error_tsvn_io_write_version_file (const char *path, int version, apr_pool_t *pool)
 Create (or overwrite) the file at path with new contents, formatted as a non-negative integer version followed by a single newline.
 
svn_error_tsvn_io_file_readline (apr_file_t *file, svn_stringbuf_t **stringbuf, const char **eol, svn_boolean_t *eof, apr_size_t max_len, apr_pool_t *result_pool, apr_pool_t *scratch_pool)
 Read a line of text from a file, up to a specified length.
 

Detailed Description

Version/format files.

Function Documentation

svn_error_t* svn_io_file_readline ( apr_file_t *  file,
svn_stringbuf_t **  stringbuf,
const char **  eol,
svn_boolean_t eof,
apr_size_t  max_len,
apr_pool_t *  result_pool,
apr_pool_t *  scratch_pool 
)

Read a line of text from a file, up to a specified length.

Allocate *stringbuf in result_pool, and read into it one line from file. Reading stops either after a line-terminator was found or after max_len bytes have been read.

If end-of-file is reached or max_len bytes have been read, and eof is not NULL, then set *eof to TRUE.

The line-terminator is not stored in *stringbuf. The line-terminator is detected automatically and stored in *eol if eol is not NULL. If EOF is reached and file does not end with a newline character, and eol is not NULL, @ *eol is set to NULL.

scratch_pool is used for temporary allocations.

Hint: To read all data until a line-terminator is hit, pass APR_SIZE_MAX for max_len.

Since
New in 1.8.
svn_error_t* svn_io_read_version_file ( int *  version,
const char *  path,
apr_pool_t *  pool 
)

Set *version to the integer that starts the file at path.

If the file does not begin with a series of digits followed by a newline, return the error SVN_ERR_BAD_VERSION_FILE_FORMAT. Use pool for all allocations.

svn_error_t* svn_io_write_version_file ( const char *  path,
int  version,
apr_pool_t *  pool 
)

Create (or overwrite) the file at path with new contents, formatted as a non-negative integer version followed by a single newline.

On successful completion the file will be read-only. Use pool for all allocations.