aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/ft_music.c14
-rw-r--r--src/ft_treat_args.c4
-rw-r--r--src/ft_warp_level.c4
-rw-r--r--src/main.c4
4 files changed, 12 insertions, 14 deletions
diff --git a/src/ft_music.c b/src/ft_music.c
index f1801f9..a3e2120 100644
--- a/src/ft_music.c
+++ b/src/ft_music.c
@@ -16,16 +16,14 @@
#include <unistd.h>
void
- ft_music_fork(char **mcmd_words)
+ ft_music_fork(char **mcmd_words, char *const envp[])
{
/* execve(2) here */
+ char *arg[3];
- char *arg[4];
-
- arg[0] = "/bin/sh";
- arg[1] = "-c";
- arg[2] = "aplay ./media/sound/DEVANT-LES-KAISSONS.wav";
- arg[3] = NULL;
+ arg[0] = "/usr/bin/aplay";
+ arg[1] = "./media/sound/DEVANT-LES-KAISSONS.wav";
+ arg[2] = NULL;
(void)mcmd_words;
- execve("/bin/sh", &arg[0], NULL);
+ execve("/usr/bin/aplay", &arg[0], envp);
}
diff --git a/src/ft_treat_args.c b/src/ft_treat_args.c
index c4ffc98..79eedae 100644
--- a/src/ft_treat_args.c
+++ b/src/ft_treat_args.c
@@ -29,7 +29,7 @@ uint8_t
}
uint8_t
- ft_use_args(int argc, const char *argv[], t_cub *clist)
+ ft_use_args(int argc, const char *argv[], char *const envp[], t_cub *clist)
{
if (argc < 3)
{
@@ -42,7 +42,7 @@ uint8_t
clist->isoldmus = 1;
clist->mpid = fork();
if (clist->mpid == 0)
- ft_music_fork(clist->mlist.mcmd_words);
+ ft_music_fork(clist->mlist.mcmd_words, envp);
}
ft_hooks_and_loops(&clist->wlist, clist);
}
diff --git a/src/ft_warp_level.c b/src/ft_warp_level.c
index 9bd8d92..2721aca 100644
--- a/src/ft_warp_level.c
+++ b/src/ft_warp_level.c
@@ -76,8 +76,8 @@ static void
else if (isoldmus && cl->mlist.ismusic
&& ft_strncmp(tmp_mup, cl->mlist.music_path, ft_strlen(tmp_mup) + 1))
{
- /* kill(cl->mpid, SIGTERM); */
- /* wait(&cl->mpid); */
+ kill(cl->mpid, SIGTERM);
+ wait(&cl->mpid);
/* cl->mpid = fork(); */
/* if (cl->mpid == 0) */
/* ft_music_fork(cl->mlist.mcmd_words); */
diff --git a/src/main.c b/src/main.c
index b55e051..43b482a 100644
--- a/src/main.c
+++ b/src/main.c
@@ -15,7 +15,7 @@
#include <cub3d.h>
int
- main(int argc, const char *argv[])
+ main(int argc, const char *argv[], char *const envp[])
{
t_cub clist;
@@ -27,6 +27,6 @@ int
if (ft_init_winlx(&clist) < 0)
return (ft_exit(FT_RET_FAILED_MLX, &clist));
ft_wall_tex_init(&clist);
- ft_use_args(argc, argv, &clist);
+ ft_use_args(argc, argv, envp, &clist);
return (FT_RET_FINE);
}