Ejemplo n.º 1
0
int main()
{
	struct cell *base_table[MAX];
	long long i,limit,size,j;
	struct collision_keys **c=NULL;
	for(i=0;i<MAX;i++)
	{
		base_table[i]=(struct cell*)malloc(sizeof(struct cell));
		base_table[i]->key=-1;
		base_table[i]->next_level=NULL;
		base_table[i]->collision=0;
	}
	size=extract_input("input.txt",base_table,c);
	construct_second_level(base_table,c,size);
	for(i=0;i<MAX;i++)
	{
		if(base_table[i]->next_level!=NULL)
		{
			limit=(base_table[i]->collision)*(base_table[i]->collision);
			for(j=0;j<limit;j++)
			{
				if((base_table[i]->next_level)[j].collision>0)
					printf("%d\n",(base_table[i]->next_level)[j].collision);
			}
		}
	}
return 0;
}
Ejemplo n.º 2
0
int		exec_line(t_param *param, char *line)
{
  t_pipeline	pipeline;

  pipeline.line = line;
  pipeline.nb_pipe = get_nb_pipe(pipeline.line);
  if (!verify(&pipeline))
    return (-42);
  if ((param->tty) && (param->debug))
    my_fprintf(2, "%[6]Exec line `%S' (%d pipes)%[]\n",
	       pipeline.line, pipeline.nb_pipe);
  pipeline.input = extract_input(pipeline.line);
  pipeline.output = extract_output(pipeline.line);
  if (verify_pipe_redirless(pipeline.line) == -1)
   return (-42);
  if ((param->tty) && (param->debug))
    {
      if (pipeline.input.type != NONE)
	my_fprintf(2, "%[6]Input file : %S%[]\n", pipeline.input.file);
      if (pipeline.output.type != NONE)
	my_fprintf(2, "%[6]Output file : %S%[]\n", pipeline.output.file);
    }
  exec_pipeline(param, &pipeline);
  return (pipeline.status);
}