1
0
mirror of https://git.FreeBSD.org/ports.git synced 2024-12-05 01:55:52 +00:00
freebsd-ports/sysutils/moreutils/files/patch-parallel.c
Dmitry Marakasov f4734d68bd - Add parallel utility to suite
PR:		138979
Submitted by:	Charlie Kester <corky1951@comcast.net> (maintainer)
Feature safe:	yes
2009-09-20 18:54:27 +00:00

29 lines
574 B
C

--- parallel.c.orig 2009-07-25 00:59:37.000000000 -0700
+++ parallel.c 2009-09-19 15:41:07.000000000 -0700
@@ -64,6 +64,7 @@
return;
}
+#ifdef HAVE_WAITID
int wait_for_child(int options) {
id_t id_ignored = 0;
siginfo_t infop;
@@ -76,6 +77,17 @@
return infop.si_status;
return 1;
}
+#else
+int wait_for_child(int options) {
+ int status;
+
+ if(waitpid(-1, &status, options) == -1)
+ return -1; /* nothing to wait for */
+ if(WIFEXITED(status))
+ return WEXITSTATUS(status);
+ return 1;
+}
+#endif
int main(int argc, char **argv) {
int maxjobs = -1;