Note to self: test patches before posting
Attached is a revised version that adds back a needed #include in
cmdopt.cpp.
--Andrew Black
Andrew Black wrote:
Greetings all
Attached is a cleanup patch that contains non-porting related changes
resulting from the windows port I've been working on.
--Andrew Black
Log:
2006-08-07 Andrew Black <[EMAIL PROTECTED]>
* cmdopt.cpp (eval_options): use raise (signal) rather than
kill(getpid (), signal)
* runall.cpp (merge_argv): Add missing terminator to generated array
for bare executables
* cmdopt.cpp, output.cpp, runall.cpp: remove unneeded #includes
Index: cmdopt.cpp
===================================================================
--- cmdopt.cpp (revision 429667)
+++ cmdopt.cpp (working copy)
@@ -31,11 +31,11 @@
#include <assert.h>
#include <ctype.h> /* for isspace */
#include <errno.h> /* for errno */
-#include <signal.h> /* for kill, SIG_IGN */
+#include <signal.h> /* for raise, signal, SIG_IGN */
#include <stdio.h> /* for *printf, fputs */
#include <stdlib.h> /* for exit */
#include <string.h> /* for str* */
-#include <unistd.h> /* for getpid */
+#include <unistd.h> /* for sleep */
#include "exec.h"
#include "util.h"
@@ -316,10 +316,9 @@
if (optarg && *optarg) {
const long signo = get_signo (optarg);
if (0 <= signo) {
- if (0 > kill (getpid (), signo))
- terminate (1, "kill(%d, %s) failed: %s\n",
- getpid (), get_signame (signo),
- strerror (errno));
+ if (0 > raise (signo))
+ terminate (1, "raise(%s) failed: %s\n",
+ get_signame (signo), strerror (errno));
break;
}
}
@@ -377,7 +376,7 @@
@return the parsed argv array
*/
char**
-split_opt_string (const char* const opts)
+split_opt_string (const char* opts)
{
char in_quote = 0;
int in_escape = 0;
Index: output.cpp
===================================================================
--- output.cpp (revision 429667)
+++ output.cpp (working copy)
@@ -30,16 +30,11 @@
#include <stdlib.h> /* for exit, free */
#include <string.h> /* for str* */
-#include <unistd.h>
- /* for close, dup, exec, fork - remove when removing diff dependancy*/
#include <sys/types.h>
-#include <sys/wait.h> /* for waitpid, W* */
#include <sys/stat.h>
#include "cmdopt.h"
-#include "exec.h"
- /* for get_signame - remove when removing diff dependancy */
#include "util.h"
#include "output.h"
Index: runall.cpp
===================================================================
--- runall.cpp (revision 429667)
+++ runall.cpp (working copy)
@@ -31,10 +31,7 @@
#include <string.h> /* for str* */
#include <ctype.h> /* for isspace */
-#include <unistd.h>
- /* for close, dup, exec, fork - remove when removing diff dependancy*/
#include <sys/types.h>
-#include <sys/wait.h> /* for waitpid, W* */
#include <sys/stat.h>
@@ -94,12 +91,15 @@
for (/* none */; argv [arg_count]; ++arg_count);
/* reallocate memory for copying them, extending the buffer */
- split = (char**)RW_REALLOC (split, (arg_count + 1) * sizeof (char*));
+ split = (char**)RW_REALLOC (split, (arg_count + 2) * sizeof (char*));
/* And copy the pointers */
for (i=0; i < arg_count; ++i)
split [i+1] = argv [i];
+ /* Then terminate the array*/
+ split [++i] = (char*)0;
+
return split;
} /* Otherwise, it's a complex executable with 1 or more arguments */