From 104e6d39ab8aef18a5d94601ba68ca4ebd381904 Mon Sep 17 00:00:00 2001 From: Andreas Schneider Date: Sat, 25 Jul 2009 17:55:58 +0200 Subject: Add a sftp_tel64() function. --- include/libssh/sftp.h | 11 +++++++++++ libssh/libssh.map | 1 + libssh/sftp.c | 6 +++++- 3 files changed, 17 insertions(+), 1 deletion(-) diff --git a/include/libssh/sftp.h b/include/libssh/sftp.h index de6e567..8b28318 100644 --- a/include/libssh/sftp.h +++ b/include/libssh/sftp.h @@ -469,6 +469,17 @@ int sftp_seek64(SFTP_FILE *file, uint64_t new_offset); */ unsigned long sftp_tell(SFTP_FILE *file); +/** + * @brief Report current byte position in file. + * + * @param file Open sftp file handle. + * + * @return The offset of the current byte relative to the beginning + * of the file associated with the file descriptor. < 0 on + * error. + */ +u64 sftp_tell64(SFTP_FILE *file); + /** * @brief Rewinds the position of the file pointer to the beginning of the * file. diff --git a/libssh/libssh.map b/libssh/libssh.map index 84a9b03..f67353f 100644 --- a/libssh/libssh.map +++ b/libssh/libssh.map @@ -38,6 +38,7 @@ SSH_0.3 { sftp_new; sftp_free; sftp_init; sftp_opendir; sftp_readdir; sftp_dir_eof; sftp_stat; sftp_lstat; sftp_fstat; sftp_attributes_free; sftp_dir_close; sftp_file_close; sftp_open; sftp_read; sftp_write; sftp_seek; sftp_tell; + sftp_tell64; sftp_rewind; sftp_rm; sftp_rmdir; sftp_mkdir; sftp_rename; sftp_setstat; sftp_symlink; sftp_readlink; sftp_canonicalize_path; sftp_server_new; sftp_server_init; diff --git a/libssh/sftp.c b/libssh/sftp.c index c9653ba..e888dc2 100644 --- a/libssh/sftp.c +++ b/libssh/sftp.c @@ -1777,7 +1777,11 @@ int sftp_seek64(SFTP_FILE *file, u64 new_offset) { /* Report current byte position in file. */ unsigned long sftp_tell(SFTP_FILE *file) { - return file->offset; + return (unsigned long)file->offset; +} +/* Report current byte position in file. */ +u64 sftp_tell64(SFTP_FILE *file) { + return (u64)file->offset; } /* Rewinds the position of the file pointer to the beginning of the file.*/ -- cgit