Exemple #1
0
int main(int argc, char *argv[])
{
  // parse command line
  int option_index = 0;

  while(1)
  {
    const int c = getopt_long(argc, argv, "", long_options, &option_index);
    if(c < 0)
      break;

    switch(c)
    {
      case 0:
      {
        switch(option_index)
        {
          case OPTION_VERSION:
            break;
   
          case OPTION_HELP:
            break;
        }
      }
      default:
      {
// print help and exit
        printf("Error.\n");
        return 0;
      }
    }
  }

  if(optind < argc)
  {
    if(system_load(argv[optind], 0x200) < 0)
    {
      printf("Could not load program: %s\n", argv[optind]);
      return 0;
    }
  }
  else
  {
    printf("No filename.\n");
  }

  system_run(0x200);

  return 0;
}
Exemple #2
0
int network_ifchange(const char* name, const char* cmd)
{
        log_info("Network: Running %s %s", cmd, name);
        char* const argv[] = { "/usr/bin/sudo", cmd, (char*) name, NULL};
        return system_run(argv);
}