From a42c0dad03f243301be7a7f06f1853dd4cdc6ef2 Mon Sep 17 00:00:00 2001 From: Martin Mares Date: Sat, 3 Jun 2006 19:41:18 +0200 Subject: [PATCH] Fixed formatting of programming interfaces. --- ChangeLog | 3 +++ lib/names.c | 25 +++++++++++++++---------- lib/pci.h | 2 +- 3 files changed, 19 insertions(+), 11 deletions(-) diff --git a/ChangeLog b/ChangeLog index 7fd6a51..8bb7b85 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,5 +1,8 @@ 2006-06-03 Martin Mares + * lib/names.c (pci_lookup_name): If PCI_LOOKUP_NO_NUMBERS is given, + pci_access->numeric_ids is ignored. + * lspci.c: Introduced the -nn switch. Thanks to David N. Welton for the idea. diff --git a/lib/names.c b/lib/names.c index cfda85d..646a9c0 100644 --- a/lib/names.c +++ b/lib/names.c @@ -1,7 +1,7 @@ /* * The PCI Library -- ID to Name Translation * - * Copyright (c) 1997--2005 Martin Mares + * Copyright (c) 1997--2006 Martin Mares * * Can be freely distributed and used under the terms of the GNU GPL. */ @@ -383,10 +383,13 @@ pci_lookup_name(struct pci_access *a, char *buf, int size, int flags, ...) va_start(args, flags); - if (a->numeric_ids > 1) - flags |= PCI_LOOKUP_MIXED; - else if (a->numeric_ids) - flags |= PCI_LOOKUP_NUMERIC; + if (!(flags & PCI_LOOKUP_NO_NUMBERS)) + { + if (a->numeric_ids > 1) + flags |= PCI_LOOKUP_MIXED; + else if (a->numeric_ids) + flags |= PCI_LOOKUP_NUMERIC; + } if (flags & PCI_LOOKUP_MIXED) flags &= ~PCI_LOOKUP_NUMERIC; @@ -451,12 +454,14 @@ pci_lookup_name(struct pci_access *a, char *buf, int size, int flags, ...) { /* IDE controllers have complex prog-if semantics */ sprintf(pifbuf, "%s%s%s%s%s", - (ipif & 0x80) ? "Master " : "", - (ipif & 0x08) ? "SecP " : "", - (ipif & 0x04) ? "SecO " : "", - (ipif & 0x02) ? "PriP " : "", - (ipif & 0x01) ? "PriO " : ""); + (ipif & 0x80) ? " Master" : "", + (ipif & 0x08) ? " SecP" : "", + (ipif & 0x04) ? " SecO" : "", + (ipif & 0x02) ? " PriP" : "", + (ipif & 0x01) ? " PriO" : ""); pif = pifbuf; + if (*pif) + pif++; } return format_name(buf, size, flags, pif, numbuf, "ProgIf"); default: diff --git a/lib/pci.h b/lib/pci.h index 8618df5..22c336b 100644 --- a/lib/pci.h +++ b/lib/pci.h @@ -1,7 +1,7 @@ /* * The PCI Library * - * Copyright (c) 1997--2005 Martin Mares + * Copyright (c) 1997--2006 Martin Mares * * Can be freely distributed and used under the terms of the GNU GPL. */ -- 2.39.2