Add utils_get_eol_char().

git-svn-id: https://geany.svn.sourceforge.net/svnroot/geany/trunk@5113 ea778897-0a13-0410-b9d1-a72fbfd435f5
This commit is contained in:
Enrico Tröger 2010-08-01 10:23:19 +00:00
parent 292de5d513
commit a18f00ae62
3 changed files with 22 additions and 0 deletions

View File

@ -1,3 +1,9 @@
2010-08-01 Enrico Tröger <enrico(dot)troeger(at)uvena(dot)de>
* src/utils.c, src/utils.h:
Add utils_get_eol_char().
2010-07-31 Enrico Tröger <enrico(dot)troeger(at)uvena(dot)de>
* src/vte.c:

View File

@ -128,6 +128,9 @@ gint utils_get_line_endings(const gchar* buffer, glong size)
guint cr, lf, crlf, max_mode;
gint mode;
if (size == -1)
size = strlen(buffer);
cr = lf = crlf = 0;
for (i = 0; i < size ; i++)
@ -342,6 +345,17 @@ const gchar *utils_get_eol_name(gint eol_mode)
}
const gchar *utils_get_eol_char(gint eol_mode)
{
switch (eol_mode)
{
case SC_EOL_CRLF: return "\r\n"; break;
case SC_EOL_CR: return "\r"; break;
default: return "\n"; break;
}
}
gboolean utils_atob(const gchar *str)
{
if (G_UNLIKELY(str == NULL))

View File

@ -127,6 +127,8 @@ gint utils_write_file(const gchar *filename, const gchar *text);
gchar *utils_find_open_xml_tag(const gchar sel[], gint size, gboolean check_tag);
const gchar *utils_get_eol_char(gint eol_mode);
const gchar *utils_get_eol_name(gint eol_mode);
gboolean utils_atob(const gchar *str);