aboutsummaryrefslogtreecommitdiffstats
path: root/src/ft_get_music.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/ft_get_music.c')
-rw-r--r--src/ft_get_music.c11
1 files changed, 7 insertions, 4 deletions
diff --git a/src/ft_get_music.c b/src/ft_get_music.c
index cdd7039..2383e0a 100644
--- a/src/ft_get_music.c
+++ b/src/ft_get_music.c
@@ -15,7 +15,7 @@
#include <stdlib.h>
#include <stdint.h>
-static void
+static int8_t
ft_set_music_cmd(t_map *mlist)
{
uint8_t len;
@@ -24,9 +24,13 @@ static void
len += ft_strlen(FT_MUS_CMD) - 2;
ft_memdel((void**)&mlist->music_cmd);
if (!(mlist->music_cmd = (char *)malloc((len + 1) * sizeof(char))))
- return ;
+ return (-1);
ft_sprintf(mlist->music_cmd, FT_MUS_CMD,
mlist->music_path);
+ ft_free_words(mlist->mcmd_words);
+ if (!(mlist->mcmd_words = ft_split(mlist->music_cmd, ' ')))
+ return (-1);
+ return (0);
}
int8_t
@@ -54,6 +58,5 @@ int8_t
return (-1);
}
clist->mlist.ismusic = 1;
- ft_set_music_cmd(&clist->mlist);
- return (0);
+ return ((ft_set_music_cmd(&clist->mlist) == 0) ? (0) : (-1));
}