From 450975f5927c3072eb875a3485cea1c5f3bedcd4 Mon Sep 17 00:00:00 2001 From: Pascal Rigaux Date: Thu, 20 Mar 2008 15:24:29 +0000 Subject: when faking probe (ie -p, -u, --dmidecode), do not do real probe on other bus (eg: do not probe pci and usb if using --dmidecode) --- lspcidrake.c | 17 +++++++++++------ 1 file changed, 11 insertions(+), 6 deletions(-) (limited to 'lspcidrake.c') diff --git a/lspcidrake.c b/lspcidrake.c index a24bcf3..2e32f51 100644 --- a/lspcidrake.c +++ b/lspcidrake.c @@ -52,6 +52,7 @@ static void print_dmi_entries(struct dmi_entries entries) { int main(int argc, char **argv) { char ** ptr = argv; + int fake = 0; while (ptr && *ptr) { if (!strcmp(*ptr, "-h") || !strcmp(*ptr, "--help")) { @@ -65,19 +66,23 @@ int main(int argc, char **argv) { } if (!strcmp(*ptr, "-v")) verboze = 1; - else if (!strcmp(*ptr, "-u")) + else if (!strcmp(*ptr, "-u")) { proc_usb_path = *++ptr; - else if (!strcmp(*ptr, "-p")) + fake = 1; + } else if (!strcmp(*ptr, "-p")) { proc_pci_path = *++ptr; - else if (!strcmp(*ptr, "--dmidecode")) + fake = 1; + } else if (!strcmp(*ptr, "--dmidecode")) { dmidecode_file = *++ptr; + fake = 1; + } ptr++; } - printit(pci_probe(), print_pci_class); - printit(usb_probe(), print_usb_class); + if (!fake || proc_pci_path) printit(pci_probe(), print_pci_class); + if (!fake || proc_usb_path) printit(usb_probe(), print_usb_class); - if (geteuid() == 0 || dmidecode_file) { + if (!fake && geteuid() == 0 || dmidecode_file) { struct dmi_entries dmi_entries = dmi_probe(); print_dmi_entries(dmi_entries); dmi_entries_free(dmi_entries); -- cgit v1.2.1