summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAlan Coopersmith <alan.coopersmith@sun.com>2008-10-15 18:23:03 -0700
committerAlan Coopersmith <alan.coopersmith@sun.com>2008-10-15 18:23:03 -0700
commit4c0d050c72a38e66a7b4ccb134e7e872eb0bf557 (patch)
tree58d6e88204b2e791eeeacd8bcf87578476c36c46
parent64d0c836d547847b752da6539792b94c803f206b (diff)
scanpci: add -v flag to enable verbose mode like old scanpci
-rw-r--r--src/scanpci.c19
1 files changed, 18 insertions, 1 deletions
diff --git a/src/scanpci.c b/src/scanpci.c
index c8a6adf..c640258 100644
--- a/src/scanpci.c
+++ b/src/scanpci.c
@@ -181,6 +181,23 @@ int main( int argc, char ** argv )
struct pci_device_iterator * iter;
struct pci_device * dev;
int ret;
+ int verbose = 0;
+ int c;
+ int errors = 0;
+
+ while ((c = getopt(argc, argv, "v")) != -1) {
+ switch (c) {
+ case 'v':
+ verbose = 1;
+ break;
+ case '?':
+ errors++;
+ }
+ }
+ if (errors != 0) {
+ fprintf(stderr, "usage: %s [-v]\n", argv[0]);
+ exit(2);
+ }
ret = pci_system_init();
if (ret != 0)
@@ -189,7 +206,7 @@ int main( int argc, char ** argv )
iter = pci_slot_match_iterator_create( NULL );
while ( (dev = pci_device_next( iter )) != NULL ) {
- print_pci_device( dev, 1 );
+ print_pci_device( dev, verbose );
}
pci_system_cleanup();