int main(int argc, char** argv) {
    int LCS_threshold=0,n=0,i=0,j=0;
    char clustername[10];
    create_cluster();
    display_clusters();
    printf("NC_LCS=%d",((int)large_cluster(cnode)));
    printf("\nEnter the LCS threshold:");
    scanf("%d",&LCS_threshold);
    printf("\nEnter the cluster name:");
    scanf("%s",clustername);
    n=num_of_clusters;
    for(i=0;i<n;i++)
    {
       if((strcmp((cnode+i)->cname,clustername)==0))
       {
           for(j=0;j<((cnode+i)->num_of_pages);j++)
           {
               
               printf("\n%s",(((cnode+i)->pagelink)+j)->pname);
           }
       }
        
    }
  
    free_clusters();


    return (EXIT_SUCCESS);
}
Exemple #2
0
int main(int argc, char **argv)
{
  int count, status, goal = argc;
  state *s;
  TCHAR *fn, *cwd;

#ifndef __GLIBC__
  //  __progname  = basename(argv[0]);
#endif
  
  s = new state;
  if (initialize_state(s))
    fatal_error("%s: Unable to initialize state variable", __progname);

  process_cmd_line(s,argc,argv);

#ifdef _WIN32
  if (prepare_windows_command_line(s))
    fatal_error("%s: Unable to process command line arguments", __progname);
#else
  s->argc = argc;
  s->argv = argv;
#endif

  // Anything left on the command line at this point is a file
  // or directory we're supposed to process. If there's nothing
  // specified, we should tackle standard input 
  if (optind == argc) {
    status = process_stdin(s);
  }
  else {
    MD5DEEP_ALLOC(TCHAR, fn, SSDEEP_PATH_MAX);
    MD5DEEP_ALLOC(TCHAR, cwd, SSDEEP_PATH_MAX);
    
    cwd = _tgetcwd(cwd, SSDEEP_PATH_MAX);
    if (NULL == cwd)
      fatal_error("%s: %s", __progname, strerror(errno));
  
    count = optind;
  
    // The signature comparsion mode needs to use the command line
    // arguments and argument count. We don't do wildcard expansion
    // on it on Win32 (i.e. where it matters). The setting of 'goal'
    // to the original argc occured at the start of main(), so we just
    // need to update it if we're *not* in signature compare mode.
    if (not (s->mode & mode_sigcompare)) {
      goal = s->argc;
    }
    
    while (count < goal)
    {
      if (MODE(mode_sigcompare))
	match_load(s,argv[count]);
      else if (MODE(mode_compare_unknown))
	match_compare_unknown(s,argv[count]);
      else {
	generate_filename(s, fn, cwd, s->argv[count]);
	
#ifdef _WIN32
	status = process_win32(s, fn);
#else
	status = process_normal(s, fn);
#endif
      }
      
      ++count;
    }

    // If we processed files, but didn't find anything large enough
    // to be meaningful, we should display a warning message to the user.
    // This happens mostly when people are testing very small files
    // e.g. $ echo "hello world" > foo && ssdeep foo
    if ((not s->found_meaningful_file) and s->processed_file)
    {
      print_error(s,"%s: Did not process files large enough to produce meaningful results", __progname);
    }
  }


  // If the user has requested us to compare signature files, use
  // our existng code to pretty-print directory matching to do the
  // work for us.
  if (MODE(mode_sigcompare))
    s->mode |= mode_match_pretty;
  if (MODE(mode_match_pretty) or MODE(mode_sigcompare) or MODE(mode_cluster))
    find_matches_in_known(s);
  if (MODE(mode_cluster))
    display_clusters(s);

  return (EXIT_SUCCESS);
}