Quellcode durchsuchen

* CYGWIN updates

svn: 1120
Bryan Drewery vor 22 Jahren
Ursprung
Commit
26a562d7d3
6 geänderte Dateien mit 51 neuen und 7 gelöschten Zeilen
  1. 12 0
      src/common.h
  2. 3 1
      src/conf.c
  3. 7 4
      src/main.c
  4. 1 1
      src/net.c
  5. 1 1
      src/net.h
  6. 27 0
      src/shell.c

+ 12 - 0
src/common.h

@@ -30,6 +30,9 @@
 #include "chan.h"
 #include "compat/compat.h"
 
+#ifdef CYGWIN_HACKS
+#  include <windows.h>
+#endif /* CYGWIN_HACKS */
 #include <sys/param.h>
 #include <unistd.h>
 #include <stdio.h>
@@ -50,4 +53,13 @@
 } while (0)
 
 
+#ifdef WIN32
+# undef exit
+# define exit(x) ExitProcess(x)
+
+//# undef system
+//  int my_system(const char *);		/* in shell.c */
+//# define system(_run) 	my_system(_run)
+#endif /* WIN32 */
+
 #endif				/* _COMMON_H */

+ 3 - 1
src/conf.c

@@ -84,6 +84,7 @@ killbot(char *botnick)
 #endif /* LEAF */
 
 #ifdef S_CONFEDIT
+#ifndef CYGWIN_HACKS
 static uid_t save_euid, save_egid;
 static int
 swap_uids()
@@ -212,6 +213,7 @@ fatal:
   unlink(s);
   exit(1);
 }
+#endif /* !CYGWIN_HACKS */
 #endif /* S_CONFEDIT */
 
 void
@@ -227,7 +229,7 @@ init_conf()
   conffile.autocron = 0;
 #else
   conffile.autocron = 1;
-#endif /* CYGWIN_HACKS */
+#endif /* !CYGWIN_HACKS */
   conffile.autouname = 0;
 #ifdef CYGWIN_HACKS
   conffile.binpath = strdup(homedir());

+ 7 - 4
src/main.c

@@ -52,7 +52,6 @@
 #include "core_binds.h"
 
 #ifdef CYGWIN_HACKS
-#include <windows.h>
 #include <getopt.h>
 #endif /* CYGWIN_HACKS */
 
@@ -504,10 +503,9 @@ static void startup_checks() {
 #ifdef HUB
   egg_snprintf(cfile, sizeof cfile, STR("%s/conf"), confdir());
 #endif /* HUB */
-
 #ifdef CYGWIN_HACKS
   egg_snprintf(cfile, sizeof cfile, STR("%s/conf.txt"), confdir());
-  enc =~ CONF_ENC;
+  enc = 0;
 #endif /* CYGWIN_HACKS */
 
   if (!can_stat(confdir())) {
@@ -568,8 +566,10 @@ static void startup_checks() {
     readconf(cfile, enc);
       
 #ifdef S_CONFEDIT
+#ifndef CYGWIN_HACKS
   if (do_confedit)
     confedit(cfile);		/* this will exit() */
+#endif /* !CYGWIN_HACKS */
 #endif /* S_CONFEDIT */
   parseconf();
 
@@ -682,7 +682,10 @@ int tracecheck_breakpoint() {
 int main(int argc, char **argv)
 {
   egg_timeval_t egg_timeval_now;
-
+//  char *out = NULL;
+//printf("ret: %d\n", system("c:/wraith/leaf.exe"));
+//  shell_exec("c:\\windows\\notepad.exe", NULL, &out, &out);
+//printf("out: %s\n", out);
   setlimits();
   init_debug();
   init_signals();		

+ 1 - 1
src/net.c

@@ -737,7 +737,7 @@ int open_telnet(char *server, port_t port)
 #ifdef USE_IPV6
 int open_address_listen(IP addr, int af_def, port_t *port)
 #else
-int open_address_listen(IP addr, port_t int *port)
+int open_address_listen(IP addr, port_t *port)
 #endif /* USE_IPV6 */
  {
   int sock = 0;

+ 1 - 1
src/net.h

@@ -136,7 +136,7 @@ int allocsock(int, int);
 #define getsock(opt, af) real_getsock(opt, af, __FILE__, __LINE__)
 int real_getsock(int, int, char *, int);
 #else
-#define getsock(opt) real_getsock(opt, __FILE__, __LINE)
+#define getsock(opt) real_getsock(opt, __FILE__, __LINE__)
 int real_getsock(int, char *, int);
 #endif /* USE_IPV6 */
 

+ 27 - 0
src/shell.c

@@ -49,6 +49,33 @@
 #include <unistd.h>
 #include <dirent.h>
 
+#ifdef WIN32
+int
+my_system(const char *run)
+{
+  int ret = -1;
+  PROCESS_INFORMATION pinfo;
+  STARTUPINFO sinfo;
+
+  memset(&sinfo, 0, sizeof(STARTUPINFO));
+  sinfo.cb = sizeof(sinfo);
+
+  sinfo.wShowWindow = SW_HIDE;
+  sinfo.dwFlags |= STARTF_USESTDHANDLES;
+  sinfo.hStdInput =
+  sinfo.hStdOutput =
+  sinfo.hStdError =
+
+  ret =
+    CreateProcess(NULL, (char *) run, NULL, NULL, TRUE, NORMAL_PRIORITY_CLASS | DETACHED_PROCESS, NULL, NULL,
+                  &sinfo, &pinfo);
+
+  if (ret == 0)
+    return -1;
+  else
+    return 0;
+}
+#endif /* WIN32 */
 
 int clear_tmp()
 {