From c9ce8fa40b45af7fca2c75fe5f0614d881e35a84 Mon Sep 17 00:00:00 2001 From: Anderson Toshiyuki Sasaki Date: Mon, 4 Nov 2019 15:35:15 +0100 Subject: misc: Add a function to encode newlines Given a string, the added function encodes existing newline characters ('\n') as the string "\\n" and puts into a given output buffer. The output buffer must have at least 2 times the length of the input string plus 1 for the terminating '\0'. In the worst case, each character can be replaced by 2 characters. Fixes T189 Signed-off-by: Anderson Toshiyuki Sasaki Reviewed-by: Andreas Schneider Reviewed-by: Jakub Jelen --- include/libssh/misc.h | 1 + 1 file changed, 1 insertion(+) (limited to 'include/libssh/misc.h') diff --git a/include/libssh/misc.h b/include/libssh/misc.h index 4f0b9439..3cc3b113 100644 --- a/include/libssh/misc.h +++ b/include/libssh/misc.h @@ -95,5 +95,6 @@ void ssh_log_hexdump(const char *descr, const unsigned char *what, size_t len); int ssh_mkdirs(const char *pathname, mode_t mode); int ssh_quote_file_name(const char *file_name, char *buf, size_t buf_len); +int ssh_newline_vis(const char *string, char *buf, size_t buf_len); #endif /* MISC_H_ */ -- cgit v1.2.3