Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/SoftEtherVPN/SoftEtherVPN_Stable.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authordnobori <da.git@softether.co.jp>2014-10-03 19:09:23 +0400
committerdnobori <da.git@softether.co.jp>2014-10-03 19:09:23 +0400
commit10d4b2c43ddc9fcc2f318c76e3d66f11ef383fad (patch)
tree0f6a9b771241360febb89ab977d2c45ff9654d90 /src/Mayaqua/Internat.c
parent16b713b98da8dba29f0f845d5a8c36d6f7c34824 (diff)
v4.10-9505-beta
Diffstat (limited to 'src/Mayaqua/Internat.c')
-rw-r--r--src/Mayaqua/Internat.c77
1 files changed, 77 insertions, 0 deletions
diff --git a/src/Mayaqua/Internat.c b/src/Mayaqua/Internat.c
index f2f75729..64e0d38c 100644
--- a/src/Mayaqua/Internat.c
+++ b/src/Mayaqua/Internat.c
@@ -3025,6 +3025,83 @@ wchar_t *UniReplaceFormatStringFor64(wchar_t *fmt)
return ret;
}
+// Get lines from a string
+UNI_TOKEN_LIST *UniGetLines(wchar_t *str)
+{
+ UINT i, len;
+ BUF *b = NULL;
+ LIST *o;
+ UNI_TOKEN_LIST *ret;
+ // Validate arguments
+ if (str == NULL)
+ {
+ return UniNullToken();
+ }
+
+ o = NewListFast(NULL);
+
+ len = UniStrLen(str);
+
+ b = NewBuf();
+
+ for (i = 0;i < len;i++)
+ {
+ wchar_t c = str[i];
+ bool f = false;
+
+ if (c == L'\r')
+ {
+ if (str[i + 1] == L'\n')
+ {
+ i++;
+ }
+ f = true;
+ }
+ else if (c == L'\n')
+ {
+ f = true;
+ }
+
+ if (f)
+ {
+ wchar_t zero = 0;
+ wchar_t *s;
+ WriteBuf(b, &zero, sizeof(wchar_t));
+
+ s = (wchar_t *)b->Buf;
+
+ Add(o, UniCopyStr(s));
+
+ ClearBuf(b);
+ }
+ else
+ {
+ WriteBuf(b, &c, sizeof(wchar_t));
+ }
+ }
+
+ if (true)
+ {
+ wchar_t zero = 0;
+ wchar_t *s;
+ WriteBuf(b, &zero, sizeof(wchar_t));
+
+ s = (wchar_t *)b->Buf;
+
+ Add(o, UniCopyStr(s));
+
+ ClearBuf(b);
+ }
+
+ FreeBuf(b);
+
+ ret = UniListToTokenList(o);
+
+ UniFreeStrList(o);
+
+ return ret;
+}
+
// Display the string on the screen
void UniPrintStr(wchar_t *string)
{