/**
* $Id: pciinspect.c 743 2012-06-18 06:10:35Z elkner $
*
* * CDDL HEADER START
*
* The contents of this file are subject to the terms of the
* Common Development and Distribution License (the "License").
* You may not use this file except in compliance with the License.
*
* You can obtain a copy of the license at
* See the License for the specific language governing permissions
* and limitations under the License.
*
* When distributing Covered Code, include this CDDL HEADER in each file.
* If applicable, add the following below this CDDL HEADER, with the
* fields enclosed by brackets "[]" replaced with your own identifying
* information: Portions Copyright [yyyy] [name of copyright owner]
*
* All Rights reserved.
* CDDL HEADER END
*/
/*
* Copyright (c) 2011,2012 by Jens Elkner,
* Otto-von-Guericke Universitaet Magdeburg. All rights reserved.
*/
#include <stdio.h>
#include <stdlib.h>
#include <unistd.h>
#include <string.h>
#include <pciaccess.h>
#include <time.h>
#include <errno.h>
static void
int i = 39;
buf[i--] = '\0';
for (; i >= 0; i--) {
if (i > 0 && i % 5 == 0) {
buf[--i] = '.';
}
val >>= 1L;
}
}
static void
int b = 0;
for (;i >= 0 && b != from; i--, b++) {
if (res[i] == '.') {
res[i] = ' ';
i--;
}
res[i] = ' ';
}
if (i > 0 && res[i] == '.') {
res[i--] = ' ';
}
to++;
for (;i >= 0 && b < to; i--, b++) {
if (res[i] == '.') {
i--;
}
}
for (; i >= 0 && res[i] != '='; i--) {
res[i] = ' ';
}
}
static void
usage() {
"PCI config base inspector. Following commands are supported:\n\n"
"\nNumbers might be entered as decimal, hexadecimal (prefix '0x'),\n"
"or binary (suffix 'b').\n");
}
char *idx;
char *k;
return B_FALSE;
}
*num = 0;
if (*k == '.') {
continue;
}
if (*k != '0' && *k != '1') {
return B_FALSE;
}
*num <<= 1;
*num |= *k - '0';
}
return B_TRUE;
}
}
static void
while(run) {
break;
}
continue;
}
switch (token[0]) {
case 'r':
for (i=0; i < count; i++) {
data = 0;
buf2[0] = '\0';
}
}
break;
case 'x':
{
}
}
buf2[0] = '\0';
break;
case 'c':
break;
case 'q':
run = 0;
break;
}
}
}
}
int
{
if (argc < 3) {
usage();
exit(1);
}
usage();
exit(2);
}
val = pci_system_init();
if (val) {
perror("Couldn't initialize PCI system");
}
match.device_class = 0;
match.device_class_mask = 0;
errno = 0;
exit(3);
}
count++;
} else {
perror("allocating space for device");
break;
}
}
if (count == 0) {
} else {
if (count == 1) {
} else {
}
}
return (EXIT_SUCCESS);
}