示例#1
0
文件: parsing.c 项目: abelcha/corewar
int		asm_parsing(header_t *header, char **stock, char *name)
{
  int		i;
  t_args	*args;
  t_list	*list;

  i = -1;
  if (!(args = my_calloc(1, sizeof(*args))))
    return (FAILURE);
  if (!(list = init_list()))
    return (FAILURE);
  while (stock[++i])
    {
      stock[i] = epur_str(stock[i]);
      if (split_list(stock[i], args) == FAILURE)
	return (FAILURE);
      if (line_parsing(args, list, name) == FAILURE)
	return (FAILURE);
    }
  double_free(stock);
  remplace_label(list);
  get_every_label_value(list);
  write_in_file(list, header, name);
  return (SUCCESS);
}
示例#2
0
int
main(int argc, char**argv)
{
  if (argc<2) {
    printf("Syntax:");
    printf("  %s <test-number> <test-number> <test-number> . . .\r\n", argv[0]);
    return -1;
  }

  if (mallopt(M_CHECK_ACTION, 7) != 1) {
    fprintf(stderr, "mallopt() failed");
    return(-1);
  }
  
  int ctr;
  for( ctr=1; ctr < argc; ctr++ )
  {
    int test_number = atoi(argv[ctr]);

    switch (test_number) {
      case 1: unintialized_use(); break;
      case 2: rw_after_free(); break;
      case 3: rw_malloc_overrun(); break;
      case 4: rw_bad_stk_location(); break;
      case 5: mem_leak(); break;
      case 6: test_6(); break;
      case 7: memcpy_overlapping_src_dst(); break;
      case 8: double_free(); break;
      case 9: systemcall_unaddressable_bytes(); break;
      case 10: stk_overrun(); break;
      case 11: glob_buff_overrun(); break;
      default: printf("No test or invalid test specified (only 1--9 are valid).");
               return -1;
    }
  }

  return 0;
}