summaryrefslogtreecommitdiff
path: root/tools
diff options
context:
space:
mode:
Diffstat (limited to 'tools')
-rw-r--r--tools/if_mach.c10
-rw-r--r--tools/if_not_there.c8
2 files changed, 16 insertions, 2 deletions
diff --git a/tools/if_mach.c b/tools/if_mach.c
index 18c40e55..2ddad6f2 100644
--- a/tools/if_mach.c
+++ b/tools/if_mach.c
@@ -5,6 +5,14 @@
# include <string.h>
# include <unistd.h>
+#ifdef __cplusplus
+# define EXECV_ARGV_T char**
+#else
+ /* The 2nd argument of execvp() prototype may be either char**, or */
+ /* char* const*, or const char* const*. */
+# define EXECV_ARGV_T void*
+#endif
+
int main(int argc, char **argv)
{
if (argc < 4) goto Usage;
@@ -13,7 +21,7 @@ int main(int argc, char **argv)
&& strcmp(OS_TYPE, argv[2]) != 0) return(0);
fprintf(stderr, "^^^^Starting command^^^^\n");
fflush(stdout);
- execvp(TRUSTED_STRING(argv[3]), (void *)(argv + 3));
+ execvp(TRUSTED_STRING(argv[3]), (EXECV_ARGV_T)(argv + 3));
perror("Couldn't execute");
Usage:
diff --git a/tools/if_not_there.c b/tools/if_not_there.c
index 10f5d14a..d388d04b 100644
--- a/tools/if_not_there.c
+++ b/tools/if_not_there.c
@@ -10,6 +10,12 @@
#include <dirent.h>
#endif /* __DJGPP__ */
+#ifdef __cplusplus
+# define EXECV_ARGV_T char**
+#else
+# define EXECV_ARGV_T void* /* see the comment in if_mach.c */
+#endif
+
int main(int argc, char **argv)
{
FILE * f;
@@ -43,7 +49,7 @@ int main(int argc, char **argv)
if (argc == 2)
return(2); /* the file does not exist but no command is given */
- execvp(TRUSTED_STRING(argv[2]), (void *)(argv + 2));
+ execvp(TRUSTED_STRING(argv[2]), (EXECV_ARGV_T)(argv + 2));
exit(1);
Usage: