X-Git-Url: http://mj.ucw.cz/gitweb/?a=blobdiff_plain;f=setpci.c;h=3ebbaeedeaed127bcb78fdd22bb1a81e726db000;hb=daf2ef4e78d6559bd7a3242113b082134b9f2ea7;hp=9c781760063141f6890e1973e46593721d065c8b;hpb=84c8d1bba90d5f9857b0724ebf6a35045ca3f30f;p=pciutils.git diff --git a/setpci.c b/setpci.c index 9c78176..3ebbaee 100644 --- a/setpci.c +++ b/setpci.c @@ -1,7 +1,7 @@ /* * The PCI Utilities -- Manipulate PCI Configuration Registers * - * Copyright (c) 1998--2003 Martin Mares + * Copyright (c) 1998--2008 Martin Mares * * Can be freely distributed and used under the terms of the GNU GPL. */ @@ -12,12 +12,15 @@ #include #include +#define PCIUTILS_SETPCI #include "pciutils.h" static int force; /* Don't complain if no devices match */ static int verbose; /* Verbosity level */ static int demo_mode; /* Only show */ +const char program_name[] = "setpci"; + static struct pci_access *pacc; struct value { @@ -244,7 +247,7 @@ static const struct reg_name pci_reg_names[] = { { 0x00, 0, NULL } }; -static void NONRET +static void NONRET PCI_PRINTF(1,2) usage(char *msg, ...) { va_list args; @@ -256,11 +259,17 @@ usage(char *msg, ...) fprintf(stderr, "\n\n"); } fprintf(stderr, -"Usage: setpci [] (+ [=]*)*\n\ --f\t\tDon't complain if there's nothing to do\n\ --v\t\tBe verbose\n\ --D\t\tList changes, don't commit them\n" +"Usage: setpci [] (+ [=]*)*\n" +"\n" +"General options:\n" +"-f\t\tDon't complain if there's nothing to do\n" +"-v\t\tBe verbose\n" +"-D\t\tList changes, don't commit them\n" +"\n" +"PCI access options:\n" GENERIC_HELP +"\n" +"Setting commands:\n" ":\t-s [[[]:][]:][][.[]]\n" "\t|\t-d []:[]\n" ":\t\t[.(B|W|L)]\n" @@ -435,7 +444,7 @@ next: case 'L': op->width = 4; break; default: - usage("Invalid width \"%s\"", *e); + usage("Invalid width \"%c\"", *e); } } else @@ -454,7 +463,7 @@ next: ll = r->offset; op->width = r->width; } - if (ll > 0x100 || ll + op->width*((n < 0) ? 1 : n) > 0x100) + if (ll > 0x1000 || ll + op->width*((n < 0) ? 1 : n) > 0x1000) die("Register number out of range!"); if (ll & (op->width - 1)) die("Unaligned register address!");