35 #include "uaplatformlayer.h" 50 #elif defined(_WIN32) && !defined(USE_CTRLC_ON_WINDOWS) 57 #if defined(_WIN32) && !defined(USE_CTRLC_ON_WINDOWS) 59 if (_kbhit() && _getch() ==
'x')
return 1;
62 if (GetAsyncKeyState(VK_ESCAPE))
return 1;
77 void signal_handler(
int signo)
86 struct sigaction new_action, old_action;
89 new_action.sa_handler = signal_handler;
90 sigemptyset(&new_action.sa_mask);
91 new_action.sa_flags = 0;
94 sigaction(SIGINT, NULL, &old_action);
95 if (old_action.sa_handler != SIG_IGN)
97 sigaction(SIGINT, &new_action, NULL);
100 sigaction(SIGTERM, NULL, &old_action);
101 if (old_action.sa_handler != SIG_IGN)
103 sigaction(SIGTERM, &new_action, NULL);
107 new_action.sa_handler = SIG_IGN;
108 sigemptyset(&new_action.sa_mask);
109 new_action.sa_flags = 0;
112 sigaction(SIGPIPE, NULL, &old_action);
113 if (old_action.sa_handler != SIG_IGN)
115 sigaction(SIGPIPE, &new_action, NULL);
118 #elif defined(_WIN32) 122 # ifdef USE_CTRLC_ON_WINDOWS 123 # include <windows.h> 125 BOOL CtrlHandler(
DWORD fdwCtrlType)
127 switch ( fdwCtrlType )
141 SetConsoleCtrlHandler( (PHANDLER_ROUTINE) CtrlHandler, TRUE );
159 char* pszAppPath = NULL;
160 char* pszFind = NULL;
164 TCHAR result[MAX_PATH];
165 char szAppPath[MAX_PATH];
167 GetModuleFileName(NULL, result, MAX_PATH);
168 for (
int i=0; i<MAX_PATH; i++ ) szAppPath[i] = (
char)result[i];
169 pszFind = strrchr(szAppPath,
'\\');
170 #else // #ifdef _WIN32_WCE 171 char szAppPath[MAX_PATH];
173 GetModuleFileNameA(NULL, szAppPath, MAX_PATH);
174 szAppPath[MAX_PATH-1] = 0;
175 pszFind = strrchr(szAppPath,
'\\');
176 #endif // #ifdef _WIN32_WCE 177 #elif defined(__QNX__) 178 char szAppPath[PATH_MAX] = {0};
179 getcwd(szAppPath,
sizeof(szAppPath)-1);
180 #else // #ifdef _WIN32 181 char szAppPath[PATH_MAX];
183 memset(szAppPath, 0,
sizeof(szAppPath));
184 #if defined (VXWORKS) 185 strncpy(szAppPath,
"ide0:/ESystem/opcua/dummy.exe",
sizeof(szAppPath)-1);
186 #else //defined (VXWORKS) 187 if ( readlink(
"/proc/self/exe", szAppPath,
sizeof(szAppPath)-1) < 0 )
191 #endif //defined (VXWORKS) 192 pszFind = strrchr(szAppPath,
'/');
193 #endif // #ifdef _WIN32 198 pszAppPath =
new char [maxPath+1];
199 pszAppPath[maxPath] = 0;
200 strncpy(pszAppPath, szAppPath, strlen(szAppPath)+1);