]> mj.ucw.cz Git - pciutils.git/blobdiff - setpci.c
Fixed a minor bug in lib/configure and released as 3.0.2.
[pciutils.git] / setpci.c
index 9c781760063141f6890e1973e46593721d065c8b..3ebbaeedeaed127bcb78fdd22bb1a81e726db000 100644 (file)
--- a/setpci.c
+++ b/setpci.c
@@ -1,7 +1,7 @@
 /*
  *     The PCI Utilities -- Manipulate PCI Configuration Registers
  *
- *     Copyright (c) 1998--2003 Martin Mares <mj@ucw.cz>
+ *     Copyright (c) 1998--2008 Martin Mares <mj@ucw.cz>
  *
  *     Can be freely distributed and used under the terms of the GNU GPL.
  */
 #include <stdarg.h>
 #include <unistd.h>
 
+#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 [<options>] (<device>+ <reg>[=<values>]*)*\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 [<options>] (<device>+ <reg>[=<values>]*)*\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"
 "<device>:\t-s [[[<domain>]:][<bus>]:][<slot>][.[<func>]]\n"
 "\t|\t-d [<vendor>]:[<device>]\n"
 "<reg>:\t\t<number>[.(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!");