Esempio n. 1
0
void epos_init_arg(epos_node_p node, int argc, char **argv, const char* 
  prefix) {
  can_device_p can_dev = malloc(sizeof(can_device_t));
  can_init_arg(can_dev, argc, argv, 0);

  config_t config;
  if (config_init_arg(&config, argc, argv, (prefix) ? prefix : 
      EPOS_CONFIG_ARG_PREFIX)) {
    config_print_help(stdout, &epos_default_config, EPOS_CONFIG_ARG_PREFIX);
    config_print_help(stdout, &can_default_config, CAN_CONFIG_ARG_PREFIX);
    exit(0);
  }
    
  epos_init(node, can_dev, &config);

  config_destroy(&config);
}
Esempio n. 2
0
File: era.c Progetto: kralf/era-libs
int era_init_arg(era_arm_p arm, int argc, char **argv, const char* prefix,
    const char* args) {
  int result;
  can_device_p can_dev = malloc(sizeof(can_device_t));

  if (!(result = can_init_arg(can_dev, argc, argv, 0, args))) {
    era_config_t config;
    if (result = era_config_init_arg(&config, argc, argv, (prefix) ? prefix :
        ERA_ARG_PREFIX, args)) {
      config_print_usage(stdout, argv[0], args, result);
      era_config_print_help(stdout, &era_config_default, ERA_ARG_PREFIX);
      config_print_help(stdout, &can_default_config, CAN_ARG_PREFIX);
    }
    else
      era_init(arm, can_dev, &config);

    era_config_destroy(&config);
  }
  else
    era_config_print_help(stdout, &era_config_default, ERA_ARG_PREFIX);

  return result;
}