Beispiel #1
0
void	cleanup(globals_t *g)
{
	printf(" shutting down..." EOL);
	cleanup_devices(&g->output_devices);
	sockets_cleanup();
	free_pcapture(g->capture_device);
}
Beispiel #2
0
int __connman_device_init(const char *device, const char *nodevice)
{
	DBG("");

	if (device != NULL)
		device_filter = g_strsplit(device, ",", -1);

	if (nodevice != NULL)
		nodevice_filter = g_strsplit(nodevice, ",", -1);

	cleanup_devices();

	return 0;
}
Beispiel #3
0
int __connman_device_init(const char *device, const char *nodevice)
{
	DBG("");

	if (device)
		device_filter = g_strsplit(device, ",", -1);

	if (nodevice)
		nodevice_filter = g_strsplit(nodevice, ",", -1);

	/* wpa_supplicant interfaces must be removed prior to bringing wifi
	 * interfaces down. Otherwise supplicant gets into INTERFACE_DISABLED
	 * state and wifi won't work. */
	wifi_cleanup();
	cleanup_devices();

	return 0;
}
Beispiel #4
0
int main()
{
    int result = 0;

    signal(SIGINT, ctrlc);

    if (setup_devices()) {
        printf("Error initializing devices.\n");
        result = 1;
        goto done;
    }

    loop();

  done:
    cleanup_devices();
    return result;
}
Beispiel #5
0
Datei: ngaro.c Projekt: js4/ngaro
/******************************************************
 *|F| int main(int argc, char **argv)
 ******************************************************/
int main(int argc, char **argv)
{
  int a, i, trace, endian;

  printf("Video @ %i\n", VIDEO_BASE);

  trace = 0;
  endian = 0;

  strcpy(vm.filename, "retroImage");

  init_vm();
  init_devices();

  vm.shrink = 0;

  /* Parse the command line arguments */
  for (i = 1; i < argc; i++)
  {
    if (strcmp(argv[i], "--trace") == 0)
    {
      trace = 1;
    }
    else if (strcmp(argv[i], "--endian") == 0)
    {
      endian = 1;
    }
    else if (strcmp(argv[i], "--shrink") == 0)
    {
      vm.shrink = 1;
    }
    else if (strcmp(argv[i], "--help") == 0)
    {
      fprintf(stderr, "%s [options] [imagename]\n", argv[0]);
      fprintf(stderr, "Valid options are:\n");
      fprintf(stderr, "   --trace    Execution trace\n");
      fprintf(stderr, "   --endian   Load an image with a different endianness\n");
      fprintf(stderr, "   --shrink   Only save used heap during save operation\n");
      exit(0);
    }
    else
    {
      strcpy(vm.filename, argv[i]);
    }
  }


  /* Load the image */
  a = vm_load_image(vm.filename);

  /* Swap endian if --endian was passed */
  if (endian == 1)
    swapEndian();


  /* Process the image */
  if (trace == 0)
  {
    for (vm.ip = 0; vm.ip < IMAGE_SIZE; vm.ip++)
    {
      vm_process(vm.image[vm.ip]);
      update_display(0);
    }
  }
  else
  {
    for (vm.ip = 0; vm.ip < IMAGE_SIZE; vm.ip++)
    {
      display_instruction();
      vm_process(vm.image[vm.ip]);
      update_display(0);
    }
  }

  /* Once done, cleanup */
  cleanup_devices();
  return 0;
}