From 81afa98cb906bf226765fff31a0c952a99eb204e Mon Sep 17 00:00:00 2001 From: Martin Mares Date: Wed, 31 May 2006 18:04:36 +0200 Subject: [PATCH] die() now uses the right program name when printing an error message. --- ChangeLog | 3 +++ common.c | 4 ++-- lspci.c | 2 ++ pciutils.h | 2 ++ setpci.c | 4 +++- 5 files changed, 12 insertions(+), 3 deletions(-) diff --git a/ChangeLog b/ChangeLog index 85f5655..45545e1 100644 --- 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 * README: Mention the public GIT tree. diff --git a/common.c b/common.c index 2bfd1b8..7d52530 100644 --- a/common.c +++ b/common.c @@ -1,7 +1,7 @@ /* * The PCI Utilities -- Common Functions * - * Copyright (c) 1997--2003 Martin Mares + * Copyright (c) 1997--2006 Martin Mares * * 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 581ee65..f5fd7cd 100644 --- 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[] = "\ diff --git a/pciutils.h b/pciutils.h index 537de6f..d6669af 100644 --- a/pciutils.h +++ b/pciutils.h @@ -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); diff --git a/setpci.c b/setpci.c index a7b57c0..8f2841c 100644 --- a/setpci.c +++ b/setpci.c @@ -1,7 +1,7 @@ /* * The PCI Utilities -- Manipulate PCI Configuration Registers * - * Copyright (c) 1998--2004 Martin Mares + * Copyright (c) 1998--2006 Martin Mares * * 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 { -- 2.39.2