beautify -s and -S section

This commit is contained in:
Pete Hildebrandt 2011-01-19 01:13:13 +01:00
parent 5161286873
commit 12ee0f3dd1
1 changed files with 52 additions and 56 deletions

View File

@ -428,67 +428,63 @@ void parse_command_line(int argc, char* argv[], int count, struct usb_device*dev
#endif
// using first available device
for (i=from;i<=upto;i++)
{
switch (c)
{
for (i=from; i <= upto; i++) {
switch(c) {
case 's':
case 'S':
for(status=0; status<count; status++)
{
if (c == 'S') {
if (numeric==0)
printf("Gembird #%d is USB bus/device %s/%s. ",
status,
dev[status]->bus->dirname,
dev[status]->filename);
else
printf("%d %s %s\n",
status,
dev[status]->bus->dirname,
dev[status]->filename);
}
else {
if (numeric==0)
printf("Gembird #%d is USB device %s.",
status,dev[status]->filename);
else
printf("%d %s\n",
status,
dev[status]->filename);
for (status=0; status<count; status++) {
if (c == 'S') {
if (numeric == 0)
printf("Gembird #%d is USB bus/device %s/%s. ",
status,
dev[status]->bus->dirname,
dev[status]->filename);
else
printf("%d %s %s\n",
status,
dev[status]->bus->dirname,
dev[status]->filename);
}
id = get_id(dev[status]);
if (id==PRODUCT_ID_SISPM || id==PRODUCT_ID_SISPM_FLASH_NEW)
{
if (numeric==0)
printf("This device is a 4-socket SiS-PM.\n");
else
printf("4\n");
}
else
{
if (numeric==0)
printf("This device is a 1-socket mSiS-PM.\n");
else
printf("1\n");
}
sudev = get_handle(dev[status]);
id = get_id(dev[status]);
if(sudev==NULL)
fprintf(stderr, "No access to Gembird #%d USB device %s\n",
status, dev[status]->filename );
else
if(verbose && numeric==0) printf("Accessing Gembird #%d USB device %s\n",
status, dev[status]->filename );
else {
if (numeric == 0)
printf("Gembird #%d is USB device %s. ",
status,dev[status]->filename);
else
printf("%d %s\n",
status,
dev[status]->filename);
}
id = get_id(dev[status]);
if ((id == PRODUCT_ID_SISPM) || (id == PRODUCT_ID_SISPM_FLASH_NEW)) {
if (numeric == 0)
printf("This device is a 4-socket SiS-PM.\n");
else
printf("4\n");
}
else {
if (numeric == 0)
printf("This device is a 1-socket mSiS-PM.\n");
else
printf("1\n");
}
sudev = get_handle(dev[status]);
id = get_id(dev[status]);
if(sudev==NULL)
fprintf(stderr, "No access to Gembird #%d USB device %s\n",
status, dev[status]->filename );
else
if(verbose && (numeric == 0))
printf("Accessing Gembird #%d USB device %s\n",
status, dev[status]->filename );
if (numeric==0)
printf("This device has a serial number of %s\n",get_serial(sudev));
else
printf("%s\n",get_serial(sudev));
usb_close(sudev);
printf("\n");
if (numeric == 0)
printf("This device has a serial number of %s\n",get_serial(sudev));
else
printf("%s\n",get_serial(sudev));
usb_close(sudev);
printf("\n");
}
break;
break;
// select device...
// replace previous (first is default) device by selected one
case 'd': // by id