Use the new swapvp function

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



As promissed...

Any other places that may need it?

ChangeLog
  Make use of the new swapvp function in wine{gcc,wrap}.


Index: tools/winegcc.c
===================================================================
RCS file: /var/cvs/wine/tools/winegcc.c,v
retrieving revision 1.14
diff -u -r1.14 winegcc.c
--- tools/winegcc.c	1 Apr 2003 00:12:02 -0000	1.14
+++ tools/winegcc.c	1 Apr 2003 22:31:44 -0000
@@ -27,13 +27,7 @@
 #include <stdarg.h>
 #include <string.h>
 #include <errno.h>
-#ifdef HAVE_SYS_WAIT_H
-#include <sys/wait.h>
-#endif
 #include <sys/stat.h>
-#ifdef HAVE_UNISTD_H
-# include <unistd.h>
-#endif
 
 static char **tmp_files;
 static int nb_tmp_files;
@@ -75,29 +69,17 @@
 
 void spawn(char *const argv[])
 {
-#ifdef HAVE__SPAWNVP
-    if (!_spawnvp( _P_WAIT, argv[0], argv)) return;
-#else
-    int pid, status, wret, i;
-
+    int i, status;
+    
     if (verbose)
     {	
 	for(i = 0; argv[i]; i++) printf("%s ", argv[i]);
 	printf("\n");
     }
+    if (!(status = spawnvp( _P_WAIT, argv[0], argv))) return;
     
-    if ((pid = fork()) == 0) execvp(argv[0], argv);
-    else if (pid > 0)
-    {
-	while (pid != (wret = waitpid(pid, &status, 0)))
-	    if (wret == -1 && errno != EINTR) break;
-	
-        if (pid == wret && WIFEXITED(status) && WEXITSTATUS(status) == 0) return;
-        error("%s failed.", argv[0]);
-    }
-#endif  /* HAVE__SPAWNVP */
-
-    perror("Error:");
+    if (status > 0) error("%s failed.", argv[0]);
+    else perror("Error:");
     exit(3);
 }
 
Index: tools/winewrap.c
===================================================================
RCS file: /var/cvs/wine/tools/winewrap.c,v
retrieving revision 1.13
diff -u -r1.13 winewrap.c
--- tools/winewrap.c	1 Apr 2003 00:12:02 -0000	1.13
+++ tools/winewrap.c	1 Apr 2003 22:31:54 -0000
@@ -27,13 +27,7 @@
 #include <stdarg.h>
 #include <stdlib.h>
 #include <errno.h>
-#ifdef HAVE_SYS_WAIT_H
-#include <sys/wait.h>
-#endif
 #include <sys/stat.h>
-#ifdef HAVE_UNISTD_H
-# include <unistd.h>
-#endif
 
 #ifndef WINEDLLS
 #define WINEDLLS "/usr/local/lib/wine"
@@ -296,29 +290,17 @@
 
 void spawn(char *const argv[])
 {
-#ifdef HAVE__SPAWNVP
-    if (!_spawnvp( _P_WAIT, argv[0], argv)) return;
-#else
-    int pid, status, wret, i;
-
+    int i, status;
+    
     if (verbose)
     {	
 	for(i = 0; argv[i]; i++) printf("%s ", argv[i]);
 	printf("\n");
     }
+    if (!(status = spawnvp( _P_WAIT, argv[0], argv))) return;
     
-    if ((pid = fork()) == 0) execvp(argv[0], argv);
-    else if (pid > 0)
-    {
-	while (pid != (wret = waitpid(pid, &status, 0)))
-	    if (wret == -1 && errno != EINTR) break;
-	
-        if (pid == wret && WIFEXITED(status) && WEXITSTATUS(status) == 0) return;
-        error("%s failed.", argv[0]);
-    }
-#endif  /* HAVE__SPAWNVP */
-
-    perror("Error:");
+    if (status > 0) error("%s failed.", argv[0]);
+    else perror("Error:");
     exit(3);
 }
 

-- 
Dimi.



[Index of Archives]     [Gimp for Windows]     [Red Hat]     [Samba]     [Yosemite Camping]     [Graphics Cards]     [Wine Home]

  Powered by Linux