mirror of
https://github.com/gnif/LookingGlass.git
synced 2024-11-25 14:57:20 +00:00
[c-host] update to use new option validator and tidy up output
This commit is contained in:
parent
86c7286aad
commit
2ddae623b8
@ -121,19 +121,19 @@ static int shmOpenDev(const char * shmDevice)
|
||||
return fd;
|
||||
}
|
||||
|
||||
static bool shmDeviceValidator(struct OptionValue * value)
|
||||
static bool shmDeviceValidator(struct OptionValue * value, const char ** error)
|
||||
{
|
||||
char * name = uioGetName(value->v.x_string);
|
||||
if (!name)
|
||||
{
|
||||
printf("Failed to get the uio device name for: %s\n", value->v.x_string);
|
||||
*error = "Failed to get the uio device name";
|
||||
return false;
|
||||
}
|
||||
|
||||
if (strcmp(name, "KVMFR") != 0)
|
||||
{
|
||||
free(name);
|
||||
printf("Device is not a KVMFR device \"%s\" reports as: %s\n", value->v.x_string, name);
|
||||
*error = "Device is not a KVMFR device";
|
||||
return false;
|
||||
}
|
||||
|
||||
@ -143,7 +143,7 @@ static bool shmDeviceValidator(struct OptionValue * value)
|
||||
|
||||
static void shmDevicePrintHelp()
|
||||
{
|
||||
printf("Valid devices are:\n");
|
||||
printf("Valid devices are:\n\n");
|
||||
DIR * d = opendir("/sys/class/uio");
|
||||
if (!d)
|
||||
return;
|
||||
@ -159,7 +159,7 @@ static void shmDevicePrintHelp()
|
||||
continue;
|
||||
|
||||
if (strcmp(name, "KVMFR") == 0)
|
||||
printf(" %s\n", dir->d_name);
|
||||
printf(" * %s\n", dir->d_name);
|
||||
|
||||
free(name);
|
||||
}
|
||||
|
@ -276,6 +276,12 @@ int app_main(int argc, char * argv[])
|
||||
return -1;
|
||||
}
|
||||
|
||||
if (!option_validate())
|
||||
{
|
||||
option_free();
|
||||
return -1;
|
||||
}
|
||||
|
||||
// perform platform specific initialization
|
||||
if (!app_init())
|
||||
return -1;
|
||||
|
Loading…
Reference in New Issue
Block a user