2 * The PCI Utilities -- Common Functions
4 * Copyright (c) 1997--2006 Martin Mares <mj@ucw.cz>
6 * Can be freely distributed and used under the terms of the GNU GPL.
23 fprintf(stderr, "%s: ", program_name);
24 vfprintf(stderr, msg, args);
30 xmalloc(unsigned int howmuch)
32 void *p = malloc(howmuch);
34 die("Unable to allocate %d bytes of memory", howmuch);
39 xrealloc(void *ptr, unsigned int howmuch)
41 void *p = realloc(ptr, howmuch);
43 die("Unable to allocate %d bytes of memory", howmuch);
48 parse_generic_option(int i, struct pci_access *pacc, char *optarg)
52 #ifdef PCI_HAVE_PM_LINUX_PROC
54 pacc->method_params[PCI_ACCESS_PROC_BUS_PCI] = optarg;
55 pacc->method = PCI_ACCESS_PROC_BUS_PCI;
58 #ifdef PCI_HAVE_PM_INTEL_CONF
60 if (!strcmp(optarg, "1"))
61 pacc->method = PCI_ACCESS_I386_TYPE1;
62 else if (!strcmp(optarg, "2"))
63 pacc->method = PCI_ACCESS_I386_TYPE2;
65 die("Unknown hardware configuration type %s", optarg);
68 #ifdef PCI_HAVE_PM_DUMP
70 pacc->method_params[PCI_ACCESS_DUMP] = optarg;
71 pacc->method = PCI_ACCESS_DUMP;