Пример #1
0
static int parse_d(int c, char **argv, int argc,
   const struct ebt_u_entry *entry, unsigned int *flags,
   struct ebt_entry_target **target)
{
        struct ebt_nat_info *natinfo = (struct ebt_nat_info *)(*target)->data;

        struct ether_addr *addr;

        switch (c) {
        case NAT_D:
                check_option(flags, OPT_DNAT);
                to_dest_supplied = 1;
                if (!(addr = ether_aton(optarg)))

                        print_error("Problem with specified "
                                    "--to-destination mac");
                memcpy(natinfo->mac, addr, ETH_ALEN);
                break;

        case NAT_D_TARGET:
                check_option(flags, OPT_DNAT_TARGET);
                if (FILL_TARGET(optarg, natinfo->target))
                        print_error("Illegal --dnat-target target");

                break;
        default:
                return 0;
        }
        return 1;
}
Пример #2
0
static int
is_option (enum arg_type opt, const char *curarg, grub_size_t len)
{
  switch (opt)
    {
    case TYPE_WITH_CONFIGFILE_OPTION:
      return check_option (curarg, "--with-configfile", len);
    case TYPE_NOAPM_OPTION:
      return check_option (curarg, "--no-apm", len);
    case TYPE_FORCE_OPTION:
      return check_option (curarg, "--force", len);
    case TYPE_TYPE_OR_NOMEM_OPTION:
      return check_option (curarg, "--type=netbsd", len)
	|| check_option (curarg, "--type=freebsd", len)
	|| check_option (curarg, "--type=openbsd", len)
	|| check_option (curarg, "--type=linux", len)
	|| check_option (curarg, "--type=biglinux", len)
	|| check_option (curarg, "--type=multiboot", len)
	|| check_option (curarg, "--no-mem-option", len);
    case TYPE_OPTION:
      return (len >= 2 && curarg[0] == '-' && curarg[1] == '-');
    default:
      return 0;
    } 
}
Пример #3
0
void scan_options(int n,char **in)
{
  char *out;

  if ((out=check_option(in,n,'l','u')) != NULL)
    sscanf(out,"%lu",&length);
  if ((out=check_option(in,n,'x','u')) != NULL)
    sscanf(out,"%lu",&exclude);
  if ((out=check_option(in,n,'c','s')) != NULL)
    column=out;
  if ((out=check_option(in,n,'m','u')) != NULL)
    sscanf(out,"%u",&minemb);
  if ((out=check_option(in,n,'M','2')) != NULL) {
    sscanf(out,"%u,%u",&comp,&maxemb);
    maxdim=comp*(maxemb+1);
    dimset=1;
  }
  if ((out=check_option(in,n,'d','u')) != NULL)
    sscanf(out,"%u",&delay);
  if ((out=check_option(in,n,'f','f')) != NULL)
    sscanf(out,"%lf",&rt);
  if ((out=check_option(in,n,'t','u')) != NULL)
    sscanf(out,"%lu",&theiler);
  if ((out=check_option(in,n,'V','u')) != NULL)
    sscanf(out,"%u",&verbosity);
  if ((out=check_option(in,n,'o','o')) != NULL) {
    stdo=0;
    if (strlen(out) > 0)
      outfile=out;
  }
}
Пример #4
0
void scan_options(int n,char **argv)
{
  char *out;

  if ((out=check_option(argv,n,'l','u')) != NULL)
    sscanf(out,"%lu",&length);
  if ((out=check_option(argv,n,'x','u')) != NULL)
    sscanf(out,"%lu",&exclude);
  if ((out=check_option(argv,n,'c','u')) != NULL)
    sscanf(out,"%u",&column);
  if ((out=check_option(argv,n,'m','u')) != NULL)
    sscanf(out,"%u",&dim);
  if ((out=check_option(argv,n,'d','u')) != NULL)
    sscanf(out,"%u",&delay);
  if ((out=check_option(argv,n,'t','u')) != NULL)
    sscanf(out,"%u",&mindist);
  if ((out=check_option(argv,n,'r','f')) != NULL) {
    epsset=1;
    sscanf(out,"%lf",&eps0);
  }
  if ((out=check_option(argv,n,'s','u')) != NULL)
    sscanf(out,"%u",&steps);
  if ((out=check_option(argv,n,'V','u')) != NULL)
    sscanf(out,"%u",&verbosity);
  if ((out=check_option(argv,n,'o','o')) != NULL)
    if (strlen(out) > 0)
      outfile=out;
}
Пример #5
0
int		my_option(t_alum *am, t_jcj *jcj)
{
  if ((init_story()) < 0)
    return (-1);
  if ((init_line(am)) < 0)
    return (-1);
  if ((check_option(am)) < 0 || ((check_option(am) > 0)))
    return (-1);
  return (0);
}
Пример #6
0
void scan_options(int n,char **in)
{
  char *out;

  if ((out=check_option(in,n,'l','u')) != NULL)
    sscanf(out,"%lu",&length);
  if ((out=check_option(in,n,'x','u')) != NULL)
    sscanf(out,"%lu",&exclude);
  if ((out=check_option(in,n,'c','s')) != NULL)
    columns=out;
  if ((out=check_option(in,n,'m','2')) != NULL) {
    sscanf(out,"%u,%u",&dim,&embed);
    dimset=1;
  }
  if ((out=check_option(in,n,'d','u')) != NULL)
    sscanf(out,"%u",&delay);
  if ((out=check_option(in,n,'V','u')) != NULL)
    sscanf(out,"%u",&verbosity);
  if ((out=check_option(in,n,'r','f')) != NULL) {
    epsset=1;
    sscanf(out,"%lf",&eps);
  }
  if ((out=check_option(in,n,'%','f')) != NULL) {
    sscanf(out,"%lf",&fraction);
    fraction /= 100.0;
  }
  if ((out=check_option(in,n,'o','o')) != NULL) {
    stdo=0;
    if (strlen(out) > 0)
      outfile=out;
  }
}
Пример #7
0
void scan_options(int argc,char **argv)
{
  char *out;

  if ((out=check_option(argv,argc,'p','u')) != NULL) {
    sscanf(out,"%u",&poles);
    if (poles < 1) {
      fprintf(stderr,"The order should at least be one!\n");
      exit(127);
    }
  }
  if ((out=check_option(argv,argc,'l','u')) != NULL)
    sscanf(out,"%lu",&length);
  if ((out=check_option(argv,argc,'x','u')) != NULL)
    sscanf(out,"%lu",&exclude);
  if ((out=check_option(argv,argc,'m','u')) != NULL) {
    sscanf(out,"%u",&dim);
    dimset=1;
  }
  if ((out=check_option(argv,argc,'c','u')) != NULL)
    column=out;
  if ((out=check_option(argv,argc,'V','u')) != NULL)
    sscanf(out,"%u",&verbosity);
  if ((out=check_option(argv,argc,'s','u')) != NULL) {
    sscanf(out,"%u",&ilength);
    run_model=1;
  }
  if ((out=check_option(argv,argc,'o','o')) != NULL) {
    stdo=0;
    if (strlen(out) > 0)
      outfile=out;
  }
}
Пример #8
0
static int parse(int c, char **argv, int argc,
		 const struct ebt_u_entry *entry, unsigned int *flags,
		 struct ebt_entry_match **match)
{
	struct ebt_among_info *info =
	    (struct ebt_among_info *) (*match)->data;
	struct ebt_mac_wormhash *wh;
	struct ebt_entry_match *h;
	int new_size, old_size;

	switch (c) {
	case AMONG_DST:
	case AMONG_SRC:
		if (check_inverse(optarg)) {
			if (c == AMONG_DST)
				info->bitmask |= EBT_AMONG_DST_NEG;
			else
				info->bitmask |= EBT_AMONG_SRC_NEG;
		}
		if (optind > argc)
			print_error("No MAC list specified\n");
		wh = create_wormhash(argv[optind - 1]);
		old_size = sizeof(struct ebt_entry_match) +
				(**match).match_size;
		h = malloc((new_size =
			    old_size + ebt_mac_wormhash_size(wh)));
		memcpy(h, *match, old_size);
		memcpy((char *) h + old_size, wh,
		       ebt_mac_wormhash_size(wh));
		h->match_size = new_size - sizeof(struct ebt_entry_match);
		info = (struct ebt_among_info *) h->data;
		if (c == AMONG_DST) {
			check_option(flags, OPT_DST);
			info->wh_dst_ofs =
			    old_size - sizeof(struct ebt_entry_match);
		} else {
			check_option(flags, OPT_SRC);
			info->wh_src_ofs =
			    old_size - sizeof(struct ebt_entry_match);
		}
		free(*match);
		*match = h;
		free(wh);
		break;
	default:
		return 0;
	}
	return 1;
}
Пример #9
0
int
main (int argc, char *argv[])
{
    int n = 0;
    char *x = NULL;
    dns_random_init (seed);

    prog = strdup ((x = strrchr (argv[0], '/')) != NULL ? x + 1 : argv[0]);
    n = check_option (argc, argv);
    argv += n;
    argc -= n;

    while (*argv)
    {
        if (!ip4_scan (*argv, ip))
            errx (-1, "could not parse IP address `%s'", *argv);
        if (dns_name4 (&out, ip) == -1)
            errx (-1, "could not find host name for `%s'", *argv);

        buffer_put (buffer_1, out.s, out.len);
        buffer_puts (buffer_1,"\n");

        ++argv;
    }
    buffer_flush (buffer_1);

    return 0;
}
Пример #10
0
int		b_echo(char **cmd)
{
  int		newline;
  int		opt;
  int		id;
  int		ret;

  ret = 0;
  id = 1;
  newline = 1;
  opt = OPT_DISABLE;
  if (cmd != NULL && cmd[0] != NULL)
    {
      if (check_option(cmd, &opt, &newline, &id) == EXIT_FAILURE)
	return (EXIT_SUCCESS);
      while (cmd[id])
	{
	  (opt) ? (my_putstr(cmd[id])) : (ret = print_echo(cmd[id]));
	  if (cmd[id + 1] != NULL)
	    my_putchar(' ');
	  id++;
	}
    }
  if (newline && ret == EXIT_SUCCESS)
    my_putchar('\n');
  return (EXIT_SUCCESS);
}
Пример #11
0
void AP_OSD_Backend::write(uint8_t x, uint8_t y, bool blink, const char *fmt, ...)
{
    if (blink && (blink_phase < 2)) {
        return;
    }
    char buff[32];
    va_list ap;
    va_start(ap, fmt);
    int res = hal.util->vsnprintf(buff, sizeof(buff), fmt, ap);
    if (res > 0 && check_option(AP_OSD::OPTION_DECIMAL_PACK)) {
        // automatically use packed decimal characters
        // based on fiam idea implemented in inav osd
        char *p = strchr(&buff[1],'.');
        if (p && isdigit(p[1]) && isdigit(p[-1])) {
            p[-1] += SYM_DIG_OFS_1;
            p[1] += SYM_DIG_OFS_2;
            memmove(p, p+1, strlen(p+1)+1);
            res--;
        }
    }
    if (res < int(sizeof(buff))) {
        write(x, y, buff);
    }
    va_end(ap);
}
Пример #12
0
static int parse(int c, char **argv, int argc, const struct ebt_u_entry *entry,
                 unsigned int *flags, struct ebt_entry_match **match)
{
    struct ebt_mark_m_info *markinfo = (struct ebt_mark_m_info *)
                                       (*match)->data;
    char *end;

    switch (c) {
    case MARK:
        check_option(flags, MARK);
        if (check_inverse(optarg))
            markinfo->invert = 1;
        if (optind > argc)
            print_error("No mark specified");
        markinfo->mark = strtoul(argv[optind - 1], &end, 0);
        markinfo->bitmask = EBT_MARK_AND;
        if (*end == '/') {
            if (end == argv[optind - 1])
                markinfo->bitmask = EBT_MARK_OR;
            markinfo->mask = strtoul(end+1, &end, 0);
        } else
            markinfo->mask = 0xffffffff;
        if ( *end != '\0' || end == argv[optind - 1])
            print_error("Bad mark value '%s'", argv[optind - 1]);
        break;
    default:
        return 0;
    }
    return 1;
}
Пример #13
0
int tofb(int argc, char * argv[])
{
	int ret = -1;
	char path[256] = ROOT_PATH"/in.bmp";

	ret = check_option(argc, argv, &g_info);
	if (ret) {
		return ret;
	}

	switch(g_info.action)
	{
	case eAction_file_to_file:
		ret = file_to_file(g_info.input_file, g_info.output_file, g_info.output_rgb);
		break;
	case eAction_file_to_fb:
		ret = file_to_fb(g_info.input_file);
		break;
	case eAction_fb_to_file:
		ret = fb_to_file(g_info.output_file, g_info.output_rgb);
		break;
	default:
		break;
	}

	return ret;
}
Пример #14
0
Файл: main.c Проект: floklein/42
int		check_arg(char **av, int ac, int *option_nb, int *arg_nb)
{
	int		i;
	int		valid_fd;

	i = 1;
	valid_fd = 0;
	while (i < ac)
	{
		if (av[i][0] == '-' && av[i][1] != '\0')
		{
			if (check_option(av[i], option_nb) == -1)
				return (-1);
			else
				i++;
		}
		else
		{
			check_valid_fd(av[i], &valid_fd);
			*arg_nb = *arg_nb + 1;
			i++;
		}
	}
	return (valid_fd);
}
Пример #15
0
//Thanks to betaflight/inav for simple and clean artificial horizon visual design
void AP_OSD_Screen::draw_horizon(uint8_t x, uint8_t y)
{
    AP_AHRS &ahrs = AP::ahrs();
    float roll = ahrs.roll;
    float pitch = -ahrs.pitch;

    //inverted roll AH
    if (check_option(AP_OSD::OPTION_INVERTED_AH_ROLL)) {
        roll = -roll;
    }

    roll = constrain_float(roll, -ah_max_roll, ah_max_roll);
    pitch = constrain_float(pitch, -ah_max_pitch, ah_max_pitch);

    for (int dx = -4; dx <= 4; dx++) {
        float fy =  dx * roll + pitch * ah_pitch_rad_to_char + 0.5f;
        int dy = floorf(fy);
        char c = (fy - dy) * SYM_AH_COUNT;
        //chars in font in reversed order
        c = SYM_AH_START + ((SYM_AH_COUNT - 1) - c);
        if (dy >= -4 && dy <= 4) {
            backend->write(x + dx, y - dy, false, "%c", c);
        }
    }
    backend->write(x-1,y, false, "%c%c%c", SYM_AH_CENTER_LINE_LEFT, SYM_AH_CENTER, SYM_AH_CENTER_LINE_RIGHT);
}
Пример #16
0
int main(int argc, char *argv[])
{
    int i;
    
    for (i = 1; i < argc; i++)
        check_option(argv[i]);
    
    if (bad_option)
        return 1;

#ifndef GCC3
    printf("This test requires GCC 3");
    return 1;
#endif

    check(Q(sizeof(S1)), 1, "struct with 1 char; power mode");
    check(Q(sizeof(S2)), 2, "struct with 1 char; mac68k mode");
    check(Q(sizeof(S3)), 1, "struct with 1 char; native mode");
    check(Q(sizeof(S4)), 12, "struct with char, double; power mode");
    check(Q(offsetof(S4, f2)), 4, "offset of double in a struct with char, double; power mode");
    check(Q(sizeof(S5)), 16, "struct with char, double; natural mode");
    check(Q(offsetof(S5, f2)), 8, "offset of double in a struct with char, double; natural mode");
    check(Q(sizeof(S6)), 24, "struct with char, double, char; natural mode");
    check(Q(sizeof(S7)), 5, "struct with char, long; packed mode");
    check(Q(sizeof(S8)), 8, "struct with char, long; power mode");

    if (nbr_failures > 0)
    	return 1;
    else
    	return 0;
}
Пример #17
0
/* Returns 1 if each of the test_opts options agrees with the entire
 * list of options.
 * Returns 0 if any noopt is found in test_opts and opt is found in options.
 * Returns 0 if any opt is found in test_opts but is not found in options.
 * Unlike fs type matching, nonetdev,user and nonetdev,nouser have
 * DIFFERENT meanings; each option is matched explicitly as specified.
 */
int
matching_opts (const char *options, const char *test_opts) {
     const char *p, *r;
     char *q;
     int len, this_len;

     if (test_opts == NULL)
	  return 1;

     len = strlen(test_opts);
     q = alloca(len+1);
     if (q == NULL)
          die (EX_SYSERR, _("not enough memory"));
     
     for (p = test_opts; p < test_opts+len; p++) {
	  r = strchr(p, ',');
	  if (r) {
	       this_len = r-p;
	  } else {
	       this_len = strlen(p);
	  }
	  if (!this_len) continue; /* if two ',' appear in a row */
	  strncpy(q, p, this_len);
	  q[this_len] = '\0';
	  if (!check_option(options, q))
	       return 0; /* any match failure means failure */
	  p += this_len;
     }

     /* no match failures in list means success */
     return 1;
}
Пример #18
0
/**
 * mnt_match_options:
 * @optstr: options string
 * @pattern: comma delimited list of options
 *
 * The "no" could used for individual items in the @options list. The "no"
 * prefix does not have a global meaning.
 *
 * Unlike fs type matching, nonetdev,user and nonetdev,nouser have
 * DIFFERENT meanings; each option is matched explicitly as specified.
 *
 * The "no" prefix interpretation could be disable by "+" prefix, for example
 * "+noauto" matches if @optstr literally contains "noauto" string.
 *
 * "xxx,yyy,zzz" : "nozzz"	-> False
 *
 * "xxx,yyy,zzz" : "xxx,noeee"	-> True
 *
 * "bar,zzz"     : "nofoo"      -> True
 *
 * "nofoo,bar"   : "+nofoo"     -> True
 *
 * "bar,zzz"     : "+nofoo"     -> False
 *
 *
 * Returns: 1 if pattern is matching, else 0. This function also returns 0
 *          if @pattern is NULL and @optstr is non-NULL.
 */
int mnt_match_options(const char *optstr, const char *pattern)
{
	const char *p;
	size_t len, optstr_len = 0;

	if (!pattern && !optstr)
		return 1;
	if (!pattern)
		return 0;

	len = strlen(pattern);
	if (optstr)
		optstr_len = strlen(optstr);

	for (p = pattern; p < pattern + len; p++) {
		char *sep = strchr(p, ',');
		size_t plen = sep ? (size_t) (sep - p) :
				    len - (p - pattern);

		if (!plen)
			continue; /* if two ',' appear in a row */

		if (!check_option(optstr, optstr_len, p, plen))
			return 0; /* any match failure means failure */

		p += plen;
	}

	/* no match failures in list means success */
	return 1;
}
Пример #19
0
static int parse(int c, char **argv, int argc, const struct ebt_u_entry *entry,
   unsigned int *flags, struct ebt_entry_watcher **watcher)
{
	struct ebt_log_info *loginfo = (struct ebt_log_info *)(*watcher)->data;
	long int i;
	char *end;

	switch (c) {
	case LOG_PREFIX:
		check_option(flags, OPT_PREFIX);
		if (strlen(optarg) > sizeof(loginfo->prefix) - 1)
			print_error("Prefix too long");
		strcpy(loginfo->prefix, optarg);
		break;

	case LOG_LEVEL:
		check_option(flags, OPT_LEVEL);
		i = strtol(optarg, &end, 16);
		if (*end != '\0' || i < 0 || i > 7)
			loginfo->loglevel = name_to_loglevel(optarg);
		else
			loginfo->loglevel = i;
		if (loginfo->loglevel == 9)
			print_error("Problem with the log-level");
		break;

	case LOG_IP:
		check_option(flags, OPT_IP);
		loginfo->bitmask |= EBT_LOG_IP;
		break;

	case LOG_ARP:
		check_option(flags, OPT_ARP);
		loginfo->bitmask |= EBT_LOG_ARP;
		break;

	case LOG_LOG:
		check_option(flags, OPT_LOG);
		break;
	default:
		return 0;
	}
	return 1;
}
Пример #20
0
int check_option_lag_cmd( char argv ){

	char letter_begin = 'A';
	char letter_end = 'K';
	if ( check_option( argv, letter_begin, letter_end ) != 0 ){
		printf("[!!]ERROR the option 'lag command' is not correct.\n");
		return EXIT_FAILURE;
	}
	return EXIT_SUCCESS;
}
Пример #21
0
void AP_OSD_Screen::draw_wind(uint8_t x, uint8_t y)
{
    AP_AHRS &ahrs = AP::ahrs();
    Vector3f v = ahrs.wind_estimate();
    if (check_option(AP_OSD::OPTION_INVERTED_WIND)) {
        v = -v;
    }
    backend->write(x, y, false, "%c", SYM_WSPD);
    draw_speed_vector(x + 1, y, Vector2f(v.x, v.y), ahrs.yaw_sensor);
}
Пример #22
0
Файл: cut.c Проект: lufb/code
int
main(int argc, char *argv[])
{
    int                     c;
    struct cut_option       g_option;

    static struct option const long_options[] =
    {
        {"help", 0, NULL, 'h'},
        {"delimiter", 1, NULL, 'd'},
        {"fields", 1, NULL, 'f'},
        {"characters", 1, NULL, 'c'},
        {NULL, 0, NULL, 0}
    };
    exit_status = 0;
    program_name = argv[0];
    init_opt(&g_option);
    while((c = getopt_long(argc, argv,
                           "hHd:f:c:", long_options, NULL)) != -1)
    {
        switch(c)
        {
            case 'h':
            case 'H':
                cut_usage_exit(EXIT_SUCESS);
                break;
            case 'd':
                if (optarg)
                    fill_d(&g_option, optarg);
                break;
            case 'f':
                if (optarg)
                    fill_f(&g_option, optarg);
                break;
            case 'c':
                if (optarg)
                    fill_c(&g_option, optarg);
                break;
            default:
                cut_usage_exit(EXIT_FAILURE);
                break;
        }
    }

    check_option(&g_option);
    print_opt(&g_option);

    if(argc - optind != 1)
        cut_usage_exit(EXIT_FAILURE);

    exit_status = cut(&g_option, argv[optind]);

    exit(exit_status);
}
Пример #23
0
int check_option_wait_time( char argv ){

	char letter_begin = 'A';
	char letter_end = 'K';
	if ( check_option( argv, letter_begin, letter_end ) != 0 ){
		printf("[!!]ERROR the option 'waiting time' is not correct.\n");
		return EXIT_FAILURE;
	}
	return EXIT_SUCCESS;

}
static int parse(int c, char **argv, int argc, const struct ebt_u_entry *entry,
   unsigned int *flags, struct ebt_entry_match **match)
{
	struct ebt_802_3_info *info = (struct ebt_802_3_info *) (*match)->data;
	unsigned int i;
	char *end;

	switch (c) {
		case _802_3_SAP:
			check_option(flags, _802_3_SAP);
			if (check_inverse(optarg))
				info->invflags |= EBT_802_3_SAP;

			if (optind > argc)
				print_error("Missing 802.3-sap argument");
			i = strtoul(argv[optind - 1], &end, 16);
			if (i > 255 || *end != '\0') 
				print_error("Problem with specified "
				            "sap hex value, %x",i);
			info->sap = i; /* one byte, so no byte order worries */
			info->bitmask |= EBT_802_3_SAP;
			break;
		case _802_3_TYPE:
			check_option(flags, _802_3_TYPE);
			if (check_inverse(optarg))
				info->invflags |= EBT_802_3_TYPE;
			if (optind > argc)
				print_error("Missing 802.3-type argument");
			i = strtoul(argv[optind - 1], &end, 16);
			if (i > 65535 || *end != '\0') {
				print_error("Problem with the specified "
					    "type hex value, %x",i);
			}
			info->type = htons(i);
			info->bitmask |= EBT_802_3_TYPE;
			break;
		default:
			return 0;
	}
	return 1;
}
Пример #25
0
int main(int argc, char* argv[])
{
  MalibGtkDisplay * disps[4];
  
  MalibSource     * s_cap, * s_conf, * s_gray, * s_snake, * s_haar, * s_jets, * s_face, * s_mark, * s_updt;
  MalibBuffer     * b_cap, * b_conf, * b_gray, * b_snake, * b_haar, * b_jets, * b_face, * b_mark, * b_updt;
  MalibGtkDisplay * d_cap, * d_conf, * d_gray, * d_snake, * d_haar, * d_jets, * d_face, * d_mark, * d_updt;
  MalibGtkDisplay * disp;
  int disp_cap, disp_conf, disp_jets, disp_mark, disp_last, disp_main;
  GrrGui * gui;

  check_option(argc, argv);
  
  malib_init (&argc, &argv);

  s_cap= (MalibSource*) malic_cv_capture_new_with_size (BTTV_DEFAULT_WIDTH, BTTV_DEFAULT_HEIGHT);
  b_cap= (MalibBuffer*) malib_plainbuf_new_with_source (s_cap);
  //disp= malic_cv_gtkdisplay_new_for_embed (s_cap);

  s_haar= (MalibSource*) malic_cv_haar_detect_obj_new_with_buf(b_cap, 0);
  b_haar= (MalibBuffer*) malib_plainbuf_new_with_source (s_haar);
  //disp= malic_cv_gtkdisplay_new_for_embed (s_haar);

  s_jets= (MalibSource*) recog_by_jets_new_with_buf (b_haar, s_haar, jets_fname, masks_fname);
  b_jets= (MalibBuffer*) malib_plainbuf_new_with_source(s_jets);
  //disp= malic_cv_gtkdisplay_new_for_embed (s_jets);

  s_face= (MalibSource*) malic_face_graph_measure_new_with_buf_and_jets (b_jets, ((RecogByJets*)s_jets)->cur_graph,
									 fg_jets_fname, masks_fname,
									 FGRAPH_AND_JETS,
									 MALICRECOG_FACE_DETECT_THRESHOLD);
  b_face= (MalibBuffer*) malib_plainbuf_new_with_source(s_face);
  //disp= malic_cv_gtkdisplay_new_for_embed (s_face);

  s_updt= (MalibSource*) malicrecog_gui_update_new_with_buf(b_face, s_haar, s_jets, s_face);
  b_updt= (MalibBuffer*) malib_plainbuf_new_with_source(s_updt);
  //disp= malic_cv_gtkdisplay_new_for_embed (s_updt);

  MalicMarkerFilter marker_filters[]= {s_jets, s_haar, NULL};

  s_mark= (MalibSource*) malic_marker_new_with_buf_and_filters(b_updt, marker_filters);
  b_mark= (MalibBuffer*) malib_plainbuf_new_with_source(s_face);
  disp= malic_cv_gtkdisplay_new_for_embed (s_mark);

  gui= malicrecog_gui_new(disp, NULL, s_face);
  ((MalicrecogGuiUpdate*)s_updt)->gui= gui;
  
  malic_cv_gtkdisplay_auto_play(disp);

  // now dosen't delte object correctly so still alive s_cap
  malic_cv_reset_capture_propaty (s_cap);
  return 1;
}
Пример #26
0
static int
parse(int c, char **argv, int argc,
   const struct ebt_u_entry *entry, unsigned int *flags,
   struct ebt_entry_target **target)
{
	struct ebt_ftos_t_info *ftosinfo =
	   (struct ebt_ftos_t_info *)(*target)->data;
	char *end;

	switch (c) {
	case FTOS_TRGT:
		check_option(flags, FTOS_TRGT);
		if (FILL_TARGET(optarg, ftosinfo->target))
			print_error("Illegal --ftos-target target");
		break;
	case FTOS_SET:
		check_option(flags, FTOS_SET);
		ftosinfo->ftos = (u_int8_t)strtoul(optarg, &end, 0);
        ftosinfo->ftos_set = OPT_FTOS_SETFTOS;
		if (*end != '\0' || end == optarg)
			print_error("Bad FTOS value '%s'", optarg);
		ftos_supplied = 1;
                break;
    case FTOS_WMM:
        check_option(flags, OPT_FTOS_SETFTOS);
        ftosinfo->ftos_set = FTOS_WMM;
        //printf("LEON DEBUG: wmm-ftos..........\n");
        ftos_supplied = 1;
        break;
    case FTOS_8021Q:
        check_option(flags, OPT_FTOS_8021QFTOS);
        ftosinfo->ftos_set = FTOS_8021Q;
        //printf("LEON DEBUG: 8021q-ftos..........\n");
        ftos_supplied = 1;
        break;
	 default:
		return 0;
	}
	return 1;
}
Пример #27
0
int		my_intersection(int ac, char **av, t_ints *ints)
{
  my_straightline(ac, av, ints);
  if (my_getnbr(av[1]) == 1)
    my_sphere(ac, av, ints);
  else if (my_getnbr(av[1]) == 2)
    my_cylinder(ac, av, ints);
  else if (my_getnbr(av[1]) == 3)
    my_cone(ac, av, ints);
  if (my_getnbr(av[1]) != 1 && my_getnbr(av[1]) != 2 && my_getnbr(av[1]) != 3)
    check_option();
  return (0);
}
Пример #28
0
void scan_options(int n,char **str)
{
  char *out;

  if ((out=check_option(str,n,'l','u')) != NULL)
    sscanf(out,"%lu",&length);
  if ((out=check_option(str,n,'x','u')) != NULL)
    sscanf(out,"%lu",&exclude);
  if ((out=check_option(str,n,'c','s')) != NULL)
    column=out;
  if ((out=check_option(str,n,'M','u')) != NULL) {
    sscanf(out,"%u",&indim);
    dimset=1;
  }
  if ((out=check_option(str,n,'F','s')) != NULL) {
    format=out;
    formatset=1;
  }
  if ((out=check_option(str,n,'m','u')) != NULL) {
    sscanf(out,"%u",&embdim);
    embset=1;
  }
  if ((out=check_option(str,n,'d','u')) != NULL) {
    sscanf(out,"%u",&delay);
    delayset=1;
  }
  if ((out=check_option(str,n,'D','s')) != NULL) {
    multidelay=out;
    mdelayset=1;
  }
  if ((out=check_option(str,n,'V','u')) != NULL)
    sscanf(out,"%u",&verbosity);
  if ((out=check_option(str,n,'o','o')) != NULL) {
    stdo=0;
    if (strlen(out) > 0)
      outfile=out;
  }
}
Пример #29
0
int check_option_display_meth( char argv ){

	int var = 0;
	char letter_begin = 'A';
	char letter_end = 'B';

	if ( check_option( argv, letter_begin, letter_end ) != 0 ){
		var++ ;
	}

	letter_begin = 'Q';
	letter_end = 'R';
	if ( check_option( argv, letter_begin, letter_end ) != 0 ){
		var++ ;
	}

	letter_begin = 'a';
	letter_end = 'b';
	if ( check_option( argv, letter_begin, letter_end ) != 0 ){
		var++ ;
	}

	letter_begin = 'q';
	letter_end = 'r';
	if ( check_option( argv, letter_begin, letter_end ) != 0 ){
		var++ ;
	}


	if ( var == 4 ){
		printf("ERROR the option 'lead command' is not correct.\n");
		return EXIT_FAILURE;
	}

	return EXIT_SUCCESS;

}
Пример #30
0
void scan_options(int n,char **in)
{
  char *out;
  
  if ((out=check_option(in,n,'l','u')) != NULL)
    sscanf(out,"%lu",&LENGTH);
  if ((out=check_option(in,n,'x','u')) != NULL)
    sscanf(out,"%lu",&exclude);
  if ((out=check_option(in,n,'c','s')) != NULL)
    column=out;
  if ((out=check_option(in,n,'m','2')) != NULL) {
    sscanf(out,"%u,%u",&DIM,&EMB);
    dimset=1;
  }
  if ((out=check_option(in,n,'d','u')) != NULL)
    sscanf(out,"%u",&DELAY);
  if ((out=check_option(in,n,'q','u')) != NULL) {
    sscanf(out,"%u",&LDIM);
    projection_set=1;
  }
  if ((out=check_option(in,n,'V','u')) != NULL)
    sscanf(out,"%u",&verbosity);
  if ((out=check_option(in,n,'W','u')) != NULL) {
    sscanf(out,"%u",&what_to_write);
    switch(what_to_write) {
    case 0: write_values=1;break;
    case 1: write_values=0;write_vectors=1;break;
    case 2: write_values=0;write_comp=1;break;
    case 3: write_values=0;write_proj=1;break;
    default: {
      fprintf(stderr,"Wrong value for the -W flag. Exiting!\n");
      exit(127);
    }
    }
  }
  if ((out=check_option(in,n,'o','o')) != NULL) {
    stout=0;
    if (strlen(out) > 0)
      outfile=out;
  }
}