Subversion Repositories Tewi

Rev

Rev 361 | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 361 Rev 416
Line 1... Line 1...
1
/* $Id: main.c 361 2024-10-17 00:37:10Z nishi $ */
1
/* $Id: main.c 416 2024-11-19 07:54:58Z nishi $ */
2
 
2
 
3
#define SOURCE
3
#define SOURCE
4
 
4
 
5
#include "../config.h"
5
#include "../config.h"
6
 
6
 
Line 98... Line 98...
98
 
98
 
99
char tw_server[2048];
99
char tw_server[2048];
100
 
100
 
101
int startup(int argc, char** argv);
101
int startup(int argc, char** argv);
102
 
102
 
103
#if defined(__MINGW32__) || defined(_MSC_VER) || (defined(__WATCOMC__) && !defined(__OS2__) && !defined(__NETWARE__) && !defined(__DOS__)) || defined(__BORLANDC__)
103
#if defined(__MINGW32__) || (defined(_MSC_VER) && !defined(WINCE)) || (defined(__WATCOMC__) && !defined(__OS2__) && !defined(__NETWARE__) && !defined(__DOS__)) || defined(__BORLANDC__)
104
char* get_registry(const char* main, const char* sub) {
104
char* get_registry(const char* main, const char* sub) {
105
	DWORD bufsize = 512;
105
	DWORD bufsize = 512;
106
	HKEY handle;
106
	HKEY handle;
107
	char* value = malloc(513);
107
	char* value = malloc(513);
108
	int err = RegOpenKeyEx(HKEY_LOCAL_MACHINE, main, 0, KEY_QUERY_VALUE, &handle);
108
	int err = RegOpenKeyEx(HKEY_LOCAL_MACHINE, main, 0, KEY_QUERY_VALUE, &handle);
Line 759... Line 759...
759
#endif
759
#endif
760
 
760
 
761
int startup(int argc, char** argv) {
761
int startup(int argc, char** argv) {
762
	int i;
762
	int i;
763
	char* r;
763
	char* r;
764
#if defined(__MINGW32__) || defined(_MSC_VER) || (defined(__WATCOMC__) && !defined(__OS2__) && !defined(__NETWARE__) && !defined(__DOS__)) || defined(__BORLANDC__)
764
#if defined(__MINGW32__) || (defined(_MSC_VER) && !defined(WINCE)) || (defined(__WATCOMC__) && !defined(__OS2__) && !defined(__NETWARE__) && !defined(__DOS__)) || defined(__BORLANDC__)
765
	char* confpath = cm_strdup(PREFIX "/etc/tewi.conf");
765
	char* confpath = cm_strdup(PREFIX "/etc/tewi.conf");
766
	char* regpath = get_registry("Software\\Microsoft\\Windows\\CurrentVersion\\Uninstall\\Tewi HTTPd", "InstallDir");
766
	char* regpath = get_registry("Software\\Microsoft\\Windows\\CurrentVersion\\Uninstall\\Tewi HTTPd", "InstallDir");
767
	if(regpath != NULL) {
767
	if(regpath != NULL) {
768
		free(confpath);
768
		free(confpath);
769
		confpath = cm_strcat(regpath, "/etc/tewi.conf");
769
		confpath = cm_strcat(regpath, "/etc/tewi.conf");
Line 846... Line 846...
846
	cm_force_log(r);
846
	cm_force_log(r);
847
	free(r);
847
	free(r);
848
#if !defined(__MINGW32__) && !defined(_MSC_VER) && !defined(__BORLANDC__) && !defined(__WATCOMC__)
848
#if !defined(__MINGW32__) && !defined(_MSC_VER) && !defined(__BORLANDC__) && !defined(__WATCOMC__)
849
	signal(SIGCHLD, SIG_IGN);
849
	signal(SIGCHLD, SIG_IGN);
850
	signal(SIGPIPE, SIG_IGN);
850
	signal(SIGPIPE, SIG_IGN);
851
#elif !defined(BUILD_GUI) && !defined(__OS2__) && !defined(__NETWARE__) && !defined(__DOS__)
851
#elif !defined(BUILD_GUI) && !defined(__OS2__) && !defined(__NETWARE__) && !defined(__DOS__) && !defined(WINCE)
852
	SetConsoleTitle(tw_server);
852
	SetConsoleTitle(tw_server);
853
#endif
853
#endif
854
	return -1;
854
	return -1;
855
}
855
}