[PATCH] argp: [!_LIBC]: remove __argp_basename()

Guilherme Janczak guilherme.janczak@yandex.com
Mon Jul 4 22:51:08 GMT 2022


This function was added in commit
f39941e4127085f2120e40ffefc287f8c4a9548a to make argp portable for usage
in gnulib around 19 years ago, but gnulib's current master patches it
out and uses its own solution:
https://git.savannah.gnu.org/gitweb/?p=gnulib.git;a=blob;f=lib/argp-namefrob.h;h=9c82ac79c215540f986c3e04398edba3ba1b7234;hb=HEAD#l157
https://git.savannah.gnu.org/gitweb/?p=gnulib.git;a=blob;f=lib/argp-help.c;h=39d71685208ad296fc2c3cb6f8a176d406d41f07;hb=HEAD#l1829
---
 argp/argp-help.c     | 8 --------
 argp/argp-namefrob.h | 2 --
 2 files changed, 10 deletions(-)

diff --git a/argp/argp-help.c b/argp/argp-help.c
index 90a2795cef..c22d09a6cb 100644
--- a/argp/argp-help.c
+++ b/argp/argp-help.c
@@ -1808,19 +1808,11 @@ weak_alias (__argp_help, argp_help)
 #endif
 
 #ifndef _LIBC
-char *__argp_basename (char *name)
-{
-  char *short_name = strrchr (name, '/');
-  return short_name ? short_name + 1 : name;
-}
-
 char *
 __argp_short_program_name (void)
 {
 # if HAVE_DECL_PROGRAM_INVOCATION_SHORT_NAME
   return program_invocation_short_name;
-# elif HAVE_DECL_PROGRAM_INVOCATION_NAME
-  return __argp_basename (program_invocation_name);
 # else
   /* FIXME: What now? Miles suggests that it is better to use NULL,
      but currently the value is passed on directly to fputs_unlocked,
diff --git a/argp/argp-namefrob.h b/argp/argp-namefrob.h
index baed8f1999..c36d741c87 100644
--- a/argp/argp-namefrob.h
+++ b/argp/argp-namefrob.h
@@ -134,8 +134,6 @@
 # define putchar_unlocked(x) putchar (x)
 # endif
 
-extern char *__argp_basename (char *name);
-
 #endif /* !_LIBC */
 
 #ifndef __set_errno
-- 
2.35.1



More information about the Libc-alpha mailing list