summaryrefslogtreecommitdiffstats
path: root/usr.sbin/pciconf
diff options
context:
space:
mode:
authorjmg <jmg@FreeBSD.org>2003-06-20 23:59:25 +0000
committerjmg <jmg@FreeBSD.org>2003-06-20 23:59:25 +0000
commit21a5088ba447f31d0bcbde3106550ea863b801af (patch)
tree0ed522f9ad5b62a64abb28af26404706c34ef6e1 /usr.sbin/pciconf
parent5580f806795f952f8676517f36e98223ff9cc6b7 (diff)
downloadFreeBSD-src-21a5088ba447f31d0bcbde3106550ea863b801af.zip
FreeBSD-src-21a5088ba447f31d0bcbde3106550ea863b801af.tar.gz
make pciconf understand it's own output as stated in the manpage.
pciconf -r none8@pci1:12:2: 0x0 now works. PR: bin/10312 Submitted by: Castor Fu
Diffstat (limited to 'usr.sbin/pciconf')
-rw-r--r--usr.sbin/pciconf/pciconf.c18
1 files changed, 13 insertions, 5 deletions
diff --git a/usr.sbin/pciconf/pciconf.c b/usr.sbin/pciconf/pciconf.c
index 764fd3d..0dc9dcc 100644
--- a/usr.sbin/pciconf/pciconf.c
+++ b/usr.sbin/pciconf/pciconf.c
@@ -425,9 +425,17 @@ load_vendors(void)
static struct pcisel
getsel(const char *str)
{
- char *ep = (char*) str;
+ char *ep = strchr(str, '@');
+ char *epbase;
struct pcisel sel;
-
+
+ if (ep == NULL)
+ ep = (char *)str;
+ else
+ ep++;
+
+ epbase = ep;
+
if (strncmp(ep, "pci", 3) == 0) {
ep += 3;
sel.pc_bus = strtoul(ep, &ep, 0);
@@ -440,10 +448,10 @@ getsel(const char *str)
ep++;
sel.pc_func = strtoul(ep, &ep, 0);
}
+ if (*ep == ':')
+ ep++;
}
- if (*ep == ':')
- ep++;
- if (*ep || ep == str)
+ if (*ep != '\x0' || ep == epbase)
errx(1, "cannot parse selector %s", str);
return sel;
}
OpenPOWER on IntegriCloud