+/* +------------------------------------+\r
+ * | Inspire Internet Relay Chat Daemon |\r
+ * +------------------------------------+\r
+ *\r
+ * InspIRCd: (C) 2002-2007 InspIRCd Development Team\r
+ * See: http://www.inspircd.org/wiki/index.php/Credits\r
+ *\r
+ * This program is free but copyrighted software; see\r
+ * the file COPYING for details.\r
+ *\r
+ * ---------------------------------------------------\r
+ */\r
+\r
#include "inspircd_win32wrapper.h"\r
#include "inspircd.h"\r
#include <string>\r
#define INADDR_NONE 0xffffffff\r
#endif\r
\r
-\r
HANDLE hIPCPipe;\r
\r
int inet_aton(const char *cp, struct in_addr *addr)\r
sockaddr_in sa;\r
int len = sizeof(SOCKADDR);\r
int rv = WSAStringToAddress((LPSTR)src, af, NULL, (LPSOCKADDR)&sa, &len);\r
+ if(rv >= 0)\r
+ {\r
+ if(WSAGetLastError() == 10022) // Invalid Argument\r
+ rv = 0;\r
+ else\r
+ rv = 1;\r
+ }\r
memcpy(dst, &sa.sin_addr, sizeof(struct in_addr));\r
return rv;\r
}\r
return returnval;\r
}\r
\r
+\r
+void ClearConsole()\r
+{\r
+ COORD coordScreen = { 0, 0 }; /* here's where we'll home the cursor */\r
+ HANDLE hConsole = GetStdHandle(STD_OUTPUT_HANDLE);\r
+ DWORD cCharsWritten;\r
+ CONSOLE_SCREEN_BUFFER_INFO csbi; /* to get buffer info */ \r
+ DWORD dwConSize; /* number of character cells in the current buffer */ \r
+\r
+ /* get the number of character cells in the current buffer */ \r
+\r
+ if (GetConsoleScreenBufferInfo( hConsole, &csbi ))\r
+ {\r
+ dwConSize = csbi.dwSize.X * csbi.dwSize.Y;\r
+ /* fill the entire screen with blanks */ \r
+ if (FillConsoleOutputCharacter( hConsole, (TCHAR) ' ', dwConSize, coordScreen, &cCharsWritten ))\r
+ {\r
+ /* get the current text attribute */ \r
+ if (GetConsoleScreenBufferInfo( hConsole, &csbi ))\r
+ {\r
+ /* now set the buffer's attributes accordingly */\r
+ if (FillConsoleOutputAttribute( hConsole, csbi.wAttributes, dwConSize, coordScreen, &cCharsWritten ))\r
+ {\r
+ /* put the cursor at (0, 0) */\r
+ SetConsoleCursorPosition( hConsole, coordScreen );\r
+ }\r
+ }\r
+ }\r
+ }\r
+ return;\r
+}\r