示例#1
0
int main(){
  int j=1,n,b,i;
  scanf("%d",&n);
  for(;j<=n;j++){
    scanf("%d%d",&b,&i);
    printf("Scenario #%d:\n",j);
    printf(bugs(b,i)?"S":"No s");
    printf("uspicious bugs found!\n\n");
  }
}
示例#2
0
 void run() {
     bugs();
     tst1();
 }
示例#3
0
文件: duff.c 项目: fengye110/duff
/* I don't know what this function does.
 * I just put it in because it looks cool.
 */
int main(int argc, char** argv)
{
  int ch;
  char* temp;
  off_t limit;

  setlocale(LC_ALL, "");
  bindtextdomain(PACKAGE, LOCALEDIR);
  textdomain(PACKAGE);

  while ((ch = getopt(argc, argv, "0DHLPad:ef:hl:pqrtuvz")) != -1)
  {
    switch (ch)
    {
      case '0':
        null_terminate_flag = 1;
        break;
      case 'D':
        same_device_flag = 1;
        break;
      case 'H':
        follow_links_mode = ARG_SYMLINKS;
        break;
      case 'L':
        follow_links_mode = ALL_SYMLINKS;
        break;
      case 'P':
        follow_links_mode = NO_SYMLINKS;
        break;
      case 'a':
        all_files_flag = 1;
        break;
      case 'd':
        if (set_digest_function(optarg) != 0)
          error(_("%s is not a supported digest function"), optarg);
        break;
      case 'e':
        excess_flag = 1;
        break;
      case 'f':
        header_format = optarg;
        break;
      case 'h':
        usage();
        bugs();
        exit(EXIT_SUCCESS);
      case 'l':
        limit = (off_t) strtoull(optarg, &temp, 10);
        if (temp == optarg || errno == ERANGE || errno == EINVAL)
          warning(_("Ignoring invalid sample limit %s"), optarg);
        else
          sample_limit = limit;
        break;
      case 'p':
        physical_flag = 1;
        break;
      case 'q':
        quiet_flag = 1;
        break;
      case 'r':
        recursive_flag = 1;
        break;
      case 't':
        thorough_flag = 1;
        break;
      case 'u':
        unique_files_flag = 1;
        break;
      case 'v':
        version();
        exit(EXIT_SUCCESS);
      case 'z':
        ignore_empty_flag = 1;
        break;
      default:
        usage();
        bugs();
        exit(EXIT_FAILURE);
    }
  }

  argc -= optind;
  argv += optind;

  if (!header_format)
  {
    if (thorough_flag)
      header_format = _("%n files in cluster %i (%s bytes)");
    else
      header_format = _("%n files in cluster %i (%s bytes, digest %d)");
  }

  header_uses_digest = cluster_header_uses_digest(header_format);

  if (thorough_flag && header_uses_digest)
    error(_("Digest (%%d) is not calculated when using -t"));

  process_args(argc, argv);

  exit(EXIT_SUCCESS);
}
示例#4
0
文件: duff.c 项目: jcburley/duff
/* I don't know what this function does.
 * I just put it in because it looks cool.
 */
int main(int argc, char** argv)
{
  int i, ch;
  char* temp;
  off_t limit;
  char path[PATH_MAX];
  
  while ((ch = getopt(argc, argv, "HLPaef:hl:pqrtvz")) != -1)
  {
    switch (ch)
    {
      case 'H':
	follow_links_mode = ARG_SYMLINKS;
	break;
      case 'L':
	follow_links_mode = ALL_SYMLINKS;
	break;
      case 'P':
	follow_links_mode = NO_SYMLINKS;
	break;
      case 'a':
        all_files_flag = 1;
        break;
      case 'e':
        excess_flag = 1;
	break;
      case 'f':
        header_format = optarg;
        break;
      case 'h':
        usage();
        bugs();
        exit(0);
      case 'l':
        limit = (off_t) strtoull(optarg, &temp, 10);
	if (temp == optarg || errno == ERANGE || errno == EINVAL)
	  warning("malformed size limit %s; ignoring", optarg);
	else
	{
	  if (limit < SAMPLE_COUNT)
	    warning("sample limit must be at least %u; ignoring", SAMPLE_COUNT);
	  else
	    sample_limit = limit;
	}
	break;
      case 'p':
	physical_flag = 1;
	break;
      case 'q':
        quiet_flag = 1;
        break;
      case 'r':
        recursive_flag = 1;
        break;
      case 't':
        thorough_flag = 1;
        break;
      case 'v':
        version();
        exit(0);
      case 'z':
	ignore_empty_flag = 1;
	break;
      default:
        usage();
        bugs();
        exit(1);
    }
  }
  
  argc -= optind;
  argv += optind;

  if (argc)
  {
    for (i = 0;  i < argc;  i++)
    {
#if !LSTAT_FOLLOWS_SLASHED_SYMLINK
      /* Kill trailing slashes (except in "/") */
      while ((temp = strrchr(argv[i], '/')))
      {
	if (temp == argv[i] || *(temp + 1) != '\0')
	  break;
	*temp = '\0';
      }
#endif

      process_path(argv[i], 0);
    }
  }
  else
  {
    /* Read file names from stdin */
    while (fgets(path, sizeof(path), stdin))
    {
      if ((temp = strchr(path, '\n')))
	*temp = '\0';

      process_path(path, 0);

      if (feof(stdin) || ferror(stdin))
	break;
    }
  }

  warning("paths processed; now sorting entries and reporting clusters");
  
  report_clusters();
  
  exit(0);
}