git: 3dd552426409 - main - ctfdump: Use getprogname()

From: Zhenlei Huang <zlei_at_FreeBSD.org>
Date: Thu, 23 Feb 2023 16:33:45 UTC
The branch main has been updated by zlei:

URL: https://cgit.FreeBSD.org/src/commit/?id=3dd5524264095ed8612c28908e13f80668eff2f9

commit 3dd5524264095ed8612c28908e13f80668eff2f9
Author:     Zhenlei Huang <zlei@FreeBSD.org>
AuthorDate: 2023-02-23 16:28:35 +0000
Commit:     Zhenlei Huang <zlei@FreeBSD.org>
CommitDate: 2023-02-23 16:28:35 +0000

    ctfdump: Use getprogname()
    
    Also remove no longer used function `getpname()`.
    
    Reviewed by:    markj
    MFC after:      3 days
    Differential Revision:  https://reviews.freebsd.org/D38740
---
 cddl/contrib/opensolaris/tools/ctf/common/utils.c | 24 -----------------------
 cddl/contrib/opensolaris/tools/ctf/dump/dump.c    |  2 +-
 2 files changed, 1 insertion(+), 25 deletions(-)

diff --git a/cddl/contrib/opensolaris/tools/ctf/common/utils.c b/cddl/contrib/opensolaris/tools/ctf/common/utils.c
index f74eb8de40fa..fda29486d94b 100644
--- a/cddl/contrib/opensolaris/tools/ctf/common/utils.c
+++ b/cddl/contrib/opensolaris/tools/ctf/common/utils.c
@@ -35,30 +35,6 @@
 
 /*LINTLIBRARY*/
 
-static const char *pname;
-
-#pragma init(getpname)
-const char *
-getpname(void)
-{
-	const char *p, *q;
-
-	if (pname != NULL)
-		return (pname);
-
-	if ((p = getexecname()) != NULL)
-		q = strrchr(p, '/');
-	else
-		q = NULL;
-
-	if (q == NULL)
-		pname = p;
-	else
-		pname = q + 1;
-
-	return (pname);
-}
-
 void
 vdie(const char *format, va_list alist)
 {
diff --git a/cddl/contrib/opensolaris/tools/ctf/dump/dump.c b/cddl/contrib/opensolaris/tools/ctf/dump/dump.c
index 06c00a7b0e7f..5cbf46af1b73 100644
--- a/cddl/contrib/opensolaris/tools/ctf/dump/dump.c
+++ b/cddl/contrib/opensolaris/tools/ctf/dump/dump.c
@@ -856,7 +856,7 @@ print_stats(void)
 static int
 print_usage(FILE *fp, int verbose)
 {
-	(void) fprintf(fp, "Usage: %s [-dfhlsSt] [-u file] file\n", getpname());
+	(void) fprintf(fp, "Usage: %s [-dfhlsSt] [-u file] file\n", getprogname());
 
 	if (verbose) {
 		(void) fprintf(fp,