From 6319a239504ba15d6ce76dfbb5525a0ab43ef213 Mon Sep 17 00:00:00 2001 From: Jack Halford Date: Sun, 19 Feb 2017 05:33:28 +0100 Subject: [PATCH] 32bit if, ft_nm displays all symbols thats it --- nm-otool/Makefile | 2 +- nm-otool/src/ft_nm.c | 15 ++++++++++++--- 2 files changed, 13 insertions(+), 4 deletions(-) diff --git a/nm-otool/Makefile b/nm-otool/Makefile index d7903305..2bc4da50 100644 --- a/nm-otool/Makefile +++ b/nm-otool/Makefile @@ -6,7 +6,7 @@ # By: jhalford +#+ +:+ +#+ # # +#+#+#+#+#+ +#+ # # Created: 2017/02/19 03:29:38 by jhalford #+# #+# # -# Updated: 2017/02/19 03:56:22 by jhalford ### ########.fr # +# Updated: 2017/02/19 03:59:47 by jhalford ### ########.fr # # # # **************************************************************************** # diff --git a/nm-otool/src/ft_nm.c b/nm-otool/src/ft_nm.c index e15c128e..9e51800c 100644 --- a/nm-otool/src/ft_nm.c +++ b/nm-otool/src/ft_nm.c @@ -6,7 +6,7 @@ /* By: jhalford +#+ +:+ +#+ */ /* +#+#+#+#+#+ +#+ */ /* Created: 2017/02/19 03:09:12 by jhalford #+# #+# */ -/* Updated: 2017/02/19 03:56:34 by jhalford ### ########.fr */ +/* Updated: 2017/02/19 05:32:56 by jhalford ### ########.fr */ /* */ /* ************************************************************************** */ @@ -55,11 +55,20 @@ void nm(char *ptr) unsigned int magic_number; magic_number = *(int *)ptr; - if (magic_number == MH_MAGIC_64) + if (magic_number == MH_MAGIC_64 || magic_number == MH_CIGAM_64) { - /* ft_printf("je suis un binaire 64 bits\n"); */ + ft_printf("I'm a 64 it binary\n"); handle_64(ptr); } + else if (magic_number == MH_MAGIC) + { + ft_printf("I'm a 32 it binary\n"); + /* handle_32(ptr); */ + } + else + { + ft_printf("unknown architecure\n"); + } } int main(int ac, char **av)