summaryrefslogtreecommitdiff
path: root/plugins/ConnectionNotify/src/debug.cpp
diff options
context:
space:
mode:
authorMaciej Wycik <makar@poczta.of.pl>2013-06-03 11:14:59 +0000
committerMaciej Wycik <makar@poczta.of.pl>2013-06-03 11:14:59 +0000
commitde9cbaa3b7e815a2a95e894e796196bf5629543d (patch)
treec2dbe4d2d241d580fc43e238fb5689f1d887aa83 /plugins/ConnectionNotify/src/debug.cpp
parentf9944b07bb7623a9c27802c5e83d5f0e3f0e8597 (diff)
git-svn-id: http://svn.miranda-ng.org/main/trunk@4869 1316c22d-e87f-b044-9b9b-93d7a3e3ba9c
Diffstat (limited to 'plugins/ConnectionNotify/src/debug.cpp')
-rw-r--r--plugins/ConnectionNotify/src/debug.cpp75
1 files changed, 75 insertions, 0 deletions
diff --git a/plugins/ConnectionNotify/src/debug.cpp b/plugins/ConnectionNotify/src/debug.cpp
new file mode 100644
index 0000000000..d6bff90fe1
--- /dev/null
+++ b/plugins/ConnectionNotify/src/debug.cpp
@@ -0,0 +1,75 @@
+#include "debug.h"
+
+#define MAX_LENGTH 512
+
+
+void _OutputDebugString(TCHAR* lpOutputString, ... )
+{
+ TCHAR OutMsg[MAX_LENGTH];
+ TCHAR format[MAX_LENGTH];
+ int i,j;
+ va_list argptr;
+
+ va_start( argptr, lpOutputString );
+
+
+
+ for(i=0,j=0;lpOutputString[i] != '\0';i++)
+ {
+ format[j++] = lpOutputString[i];
+ format[j] = '\0';
+ // If escape character
+ //if(lpOutputString[i] == '\\')
+ //{
+ // i++;
+ // continue;
+ //}
+ // if not a substitutal character
+ if(lpOutputString[i] != '%')
+ continue;
+
+ format[j++] = lpOutputString[++i];
+ format[j] = '\0';
+ switch(lpOutputString[i])
+ {
+ // string
+ case 's':
+ {
+ TCHAR* s = va_arg( argptr, TCHAR * );
+ _stprintf(OutMsg,format,s);
+ _tcsncpy(format,OutMsg,_countof(OutMsg));
+ j = _tcslen(format);
+ _tcscat(format,_T(" "));
+ break;
+ }
+ // character
+ case 'c':
+ {
+ char c = (char) va_arg( argptr, int );
+ _stprintf(OutMsg,format,c);
+ _tcsncpy(format,OutMsg,_countof(OutMsg));
+ j = _tcslen(format);
+ _tcscat(format,_T(" "));
+ break;
+ }
+ // integer
+ case 'd':
+ {
+ int d = va_arg( argptr, int );
+ _stprintf(OutMsg,format,d);
+ _tcsncpy(format,OutMsg,_countof(OutMsg));
+ j = _tcslen(format);
+ _tcscat(format,_T(" "));
+ break;
+ }
+ }
+ format[j+1] = '\0';
+ }
+ _tcscat(format,_T("\n"));
+ OutputDebugString(format);
+
+ va_end( argptr );
+
+}
+
+