2 * $Id: common.c,v 1.2 2002/03/30 15:39:24 mj Exp $
4 * Linux PCI Utilities -- Common Functions
6 * Copyright (c) 1997--1999 Martin Mares <mj@ucw.cz>
8 * Can be freely distributed and used under the terms of the GNU GPL.
19 void __attribute__((noreturn))
25 fputs("lspci: ", stderr);
26 vfprintf(stderr, msg, args);
32 xmalloc(unsigned int howmuch)
34 void *p = malloc(howmuch);
36 die("Unable to allocate %d bytes of memory", howmuch);
41 parse_generic_option(int i, struct pci_access *pacc, char *optarg)
45 #ifdef HAVE_PM_LINUX_PROC
47 pacc->method_params[PCI_ACCESS_PROC_BUS_PCI] = optarg;
48 pacc->method = PCI_ACCESS_PROC_BUS_PCI;
51 #ifdef HAVE_PM_INTEL_CONF
53 if (!strcmp(optarg, "1"))
54 pacc->method = PCI_ACCESS_I386_TYPE1;
55 else if (!strcmp(optarg, "2"))
56 pacc->method = PCI_ACCESS_I386_TYPE2;
58 die("Unknown hardware configuration type %s", optarg);
61 #ifdef HAVE_PM_SYSCALLS
63 pacc->method = PCI_ACCESS_SYSCALLS;
68 pacc->method_params[PCI_ACCESS_DUMP] = optarg;
69 pacc->method = PCI_ACCESS_DUMP;