diff options
author | Nikos Mavrogiannopoulos <nmav@gnutls.org> | 2012-02-14 23:33:33 +0100 |
---|---|---|
committer | Nikos Mavrogiannopoulos <nmav@gnutls.org> | 2012-02-14 23:33:33 +0100 |
commit | bfcfa38345be3e19ac014b9cc7b38ad665fd32f3 (patch) | |
tree | 96f01d2172dbc4aa88d3237d33d36688fa737b40 /doc/common.c | |
parent | f4d7b989f4455f60ce99e99a9509085530920d79 (diff) | |
download | gnutls-bfcfa38345be3e19ac014b9cc7b38ad665fd32f3.tar.gz |
break long strings.
Diffstat (limited to 'doc/common.c')
-rw-r--r-- | doc/common.c | 47 |
1 files changed, 47 insertions, 0 deletions
diff --git a/doc/common.c b/doc/common.c new file mode 100644 index 0000000000..4ceaff80cb --- /dev/null +++ b/doc/common.c @@ -0,0 +1,47 @@ +char* escape_string( const char* str, char* buffer, int buffer_size) +{ +int i = 0, j = 0; + + +while( str[i] != 0 && j <buffer_size - 1) { + if (str[i]=='_') { + buffer[j++] = '\\'; + buffer[j++] = '_'; + buffer[j++] = '\\'; + buffer[j++] = '-'; + } else if (str[i]=='#') { + buffer[j++] = '\\'; + buffer[j++] = '#'; + } else { + buffer[j++] = str[i]; + } + i++; +}; + +buffer[j] = 0; + +return buffer; + +} + +char* escape_texi_string( const char* str, char* buffer, int buffer_size) +{ +int i = 0, j = 0; + + +while( str[i] != 0 && j <buffer_size - 1) { + if (str[i]=='_') { + buffer[j++] = '_'; + buffer[j++] = '@'; + buffer[j++] = '-'; + } else { + buffer[j++] = str[i]; + } + i++; +}; + +buffer[j] = 0; + +return buffer; + +} |