Exemple #1
0
static void		change_sht(t_ast *tmp, int i, t_shpt *g_shpt)
{
	t_shpt	*sht;

	while (tmp)
	{
		if (find_optname(tmp->token->token, g_shpt) != 2)
		{
			sht = g_shpt;
			while (sht)
			{
				if (strcmp(tmp->token->token, sht->name) == 0)
					break ;
				sht = sht->next;
			}
			if (i == 1)
				sht->on_off = "on";
			if (i == 2)
				sht->on_off = "off";
		}
		else
			print_invalid_argument(tmp);
		tmp = tmp->brother;
	}
}
int get_timeout(const char *const argv[])
{
	int timeout = atoi(argv[2]);
	if (timeout < 0)
	{
		print_invalid_argument();
		// FIXME review this value
		exit(1);
	}	
	return timeout;
}
int get_memory_to_allocate(const char *const argv[])
{
	int memory_to_allocate = atoi(argv[1]);
	if (memory_to_allocate < 0)
	{
		print_invalid_argument();
		// FIXME review this value
		exit(1);
	}	
	return memory_to_allocate;
}