Example #1
0
int				main(int ac, char **av)
{
	char		*path;
	char		*file;
	struct stat	buf;

	if ((ac = ft_options(&av, NM_OPTIONS, 0)))
	{
		while (*av)
		{
			path = *av;
			file = 0;
			if (ac == 1)
				path = "a.out";
			if (ac > 2)
				ft_printf("\n%s:\n", path);
			if (mmap_file(path, &buf, &file) == SUCCESS)
			{
				ft_nm(file, path);
				munmap_file(file, &buf);
			}
			av++;
		}
	}
	return (FT_EXIT);
}
Example #2
0
int				main(int ac, char **av)
{
	ft_memset(&e, 0, sizeof(e));
	e.prog = ft_strrchr(av[0], '/');
	e.prog = (e.prog == NULL) ? av[0] : e.prog + 1;
	if (setuid(getuid()))
	{
		fprintf(stderr, "%s: setuid\n", e.prog);
		exit(-1);
	}
	e.outpack = e.outpackhdr + sizeof(struct ip);
	e.datalen = DEFDATALEN;
	e.interval = 1;
	e.ttl = 64;
	ac = ft_options(av);
	if (!av[ac])
		ft_usage(0);
	ft_memcpy(e.hostname, av[ac], sizeof(e.hostname));
	ft_init();
	ft_signals();
	ft_setup();
	return (0);
}