git: 96200385228e - stable/12 - ctfdump: Use getprogname()

From: Zhenlei Huang <zlei_at_FreeBSD.org>
Date: Sun, 26 Feb 2023 01:59:38 UTC
The branch stable/12 has been updated by zlei:

URL: https://cgit.FreeBSD.org/src/commit/?id=96200385228ea9c749e455dae50cca1d42818325

commit 96200385228ea9c749e455dae50cca1d42818325
Author:     Zhenlei Huang <zlei@FreeBSD.org>
AuthorDate: 2023-02-23 16:28:35 +0000
Commit:     Zhenlei Huang <zlei@FreeBSD.org>
CommitDate: 2023-02-26 01:55:23 +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
    
    (cherry picked from commit 3dd5524264095ed8612c28908e13f80668eff2f9)
    (cherry picked from commit 994eb2fb8a901c883f2bd24fa29c6cd513cb4340)
---
 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 b9db1a870165..38509ec36343 100644
--- a/cddl/contrib/opensolaris/tools/ctf/common/utils.c
+++ b/cddl/contrib/opensolaris/tools/ctf/common/utils.c
@@ -36,30 +36,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
 vwarn(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 740485ddff03..f3e8120192da 100644
--- a/cddl/contrib/opensolaris/tools/ctf/dump/dump.c
+++ b/cddl/contrib/opensolaris/tools/ctf/dump/dump.c
@@ -767,7 +767,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,