From 6bb247de74710097cc3920a729cc2758b327779e Mon Sep 17 00:00:00 2001 From: RichardG867 Date: Thu, 17 Oct 2024 18:36:31 -0300 Subject: [PATCH] pcireg: Don't print full path in usage --- pcireg/pcireg.c | 18 ++++++++++++------ 1 file changed, 12 insertions(+), 6 deletions(-) diff --git a/pcireg/pcireg.c b/pcireg/pcireg.c index 4c3789f..55bcc49 100644 --- a/pcireg/pcireg.c +++ b/pcireg/pcireg.c @@ -1521,26 +1521,32 @@ main(int argc, char **argv) /* Print usage if there are too few parameters or if the first one looks invalid. */ if ((argc <= 1) || (strlen(argv[1]) < 2) || ((argv[1][0] != '-') && (argv[1][0] != '/'))) { + ch = strrchr(argv[0], '\\'); + if (!(ch++)) { + ch = strrchr(argv[0], '/'); + if (!(ch++)) + ch = argv[0]; + } usage: - printf("%s -s [-d]\n", argv[0]); + printf("%s -s [-d]\n", ch); printf("∟ Display all devices on the PCI bus. Specify -d to dump registers as well.\n"); #if defined(MSDOS) printf("\n"); - printf("%s -t [-m] [-8]\n", argv[0]); + printf("%s -t [-m] [-8]\n", ch); printf("∟ Display BIOS IRQ steering table. Specify -m to look for a Microsoft $PIR\n"); printf(" table instead of calling PCI BIOS. Specify -8 to display as 86Box code.\n"); #endif printf("\n"); - printf("%s -i [bus] device [function]\n", argv[0]); + printf("%s -i [bus] device [function]\n", ch); printf("∟ Show information about the specified device.\n"); printf("\n"); - printf("%s -r [bus] device [function] register\n", argv[0]); + printf("%s -r [bus] device [function] register\n", ch); printf("∟ Read the specified register.\n"); printf("\n"); - printf("%s -w [bus] device [function] register value\n", argv[0]); + printf("%s -w [bus] device [function] register value\n", ch); printf("∟ Write byte, word or dword to the specified register.\n"); printf("\n"); - printf("%s {-d|-dw|-dl} [bus] device [function [register]]\n", argv[0]); + printf("%s {-d|-dw|-dl} [bus] device [function [register]]\n", ch); printf("∟ Dump registers as bytes (-d), words (-dw) or dwords (-dl). Optionally\n"); printf(" specify the register to start from (requires bus to be specified as well).\n"); printf("\n");