]> mj.ucw.cz Git - pciutils.git/commitdiff
die() now uses the right program name when printing an error message.
authorMartin Mares <mj@ucw.cz>
Wed, 31 May 2006 16:04:36 +0000 (18:04 +0200)
committerMartin Mares <mj@ucw.cz>
Wed, 31 May 2006 16:04:36 +0000 (18:04 +0200)
ChangeLog
common.c
lspci.c
pciutils.h
setpci.c

index 85f56559664a36ef35c0794d46ae90ff1f7e3c12..45545e13ca67fa98ab5de157f4e0d7becafb6c3b 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -2,6 +2,9 @@
 
        * setpci.c (main): Don't crash when an invalid width is specified.
 
+       * lspci.c, setpci.c, common.c: die() now uses the right program
+       name when printing an error message.
+
 2006-05-19  Martin Mares  <mj@ucw.cz>
 
        * README: Mention the public GIT tree.
index 2bfd1b8b9c17bf3821a73a7962ed1a79acf053ef..7d52530e59873db82626d18ea5793b5d950529c0 100644 (file)
--- a/common.c
+++ b/common.c
@@ -1,7 +1,7 @@
 /*
  *     The PCI Utilities -- Common Functions
  *
- *     Copyright (c) 1997--2003 Martin Mares <mj@ucw.cz>
+ *     Copyright (c) 1997--2006 Martin Mares <mj@ucw.cz>
  *
  *     Can be freely distributed and used under the terms of the GNU GPL.
  */
@@ -20,7 +20,7 @@ die(char *msg, ...)
   va_list args;
 
   va_start(args, msg);
-  fputs("lspci: ", stderr);
+  fprintf(stderr, "%s: ", program_name);
   vfprintf(stderr, msg, args);
   fputc('\n', stderr);
   exit(1);
diff --git a/lspci.c b/lspci.c
index 581ee65aab342772a8d0577514aba49097495478..f5fd7cdef4e5b05453faf4368c1f1758a11a345c 100644 (file)
--- a/lspci.c
+++ b/lspci.c
@@ -25,6 +25,8 @@ static int machine_readable;          /* Generate machine-readable output */
 static int map_mode;                   /* Bus mapping mode enabled */
 static int show_domains;               /* Show domain numbers (0=disabled, 1=auto-detected, 2=requested) */
 
+const char program_name[] = "lspci";
+
 static char options[] = "nvbxs:d:ti:mgMD" GENERIC_OPTIONS ;
 
 static char help_msg[] = "\
index 537de6f141c31b20e2f8c71d4ac60940520d3945..d6669af6ba131d35e1b2ce25be69739bbe310097 100644 (file)
@@ -15,6 +15,8 @@
 
 #define PCIUTILS_VERSION PCILIB_VERSION
 
+extern const char program_name[];
+
 void die(char *msg, ...) NONRET;
 void *xmalloc(unsigned int howmuch);
 void *xrealloc(void *ptr, unsigned int howmuch);
index a7b57c05911f5279cbdbb838e77375a3e34274d0..8f2841c6529a046a59875d1a4fc2fcd9cee40b98 100644 (file)
--- a/setpci.c
+++ b/setpci.c
@@ -1,7 +1,7 @@
 /*
  *     The PCI Utilities -- Manipulate PCI Configuration Registers
  *
- *     Copyright (c) 1998--2004 Martin Mares <mj@ucw.cz>
+ *     Copyright (c) 1998--2006 Martin Mares <mj@ucw.cz>
  *
  *     Can be freely distributed and used under the terms of the GNU GPL.
  */
@@ -18,6 +18,8 @@ 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 {