From 00893e79fc62966067af1a106567db96bd170338 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=B6rg=20Frings-F=C3=BCrst?= Date: Sun, 3 Mar 2024 19:11:32 +0100 Subject: New upstream version 1.2 --- tests/getprogname.c | 24 +++++++++++++++++------- 1 file changed, 17 insertions(+), 7 deletions(-) (limited to 'tests/getprogname.c') diff --git a/tests/getprogname.c b/tests/getprogname.c index 62a48004..392a9a2f 100644 --- a/tests/getprogname.c +++ b/tests/getprogname.c @@ -1,5 +1,5 @@ /* Program name management. - Copyright (C) 2016-2022 Free Software Foundation, Inc. + Copyright (C) 2016-2024 Free Software Foundation, Inc. This program is free software: you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by @@ -16,11 +16,10 @@ #include -/* Specification. */ -#include "getprogname.h" +/* Specification. Also get __argv declaration. */ +#include #include /* get program_invocation_name declaration */ -#include /* get __argv declaration */ #ifdef _AIX # include @@ -53,13 +52,12 @@ #if defined __SCO_VERSION__ || defined __sysv5__ # include -# include # include #endif #include "basename-lgpl.h" -#ifndef HAVE_GETPROGNAME /* not Mac OS X, FreeBSD, NetBSD, OpenBSD >= 5.4, Cygwin */ +#ifndef HAVE_GETPROGNAME /* not Mac OS X, FreeBSD, NetBSD, OpenBSD >= 5.4, Solaris >= 11, Cygwin, Android API level >= 21 */ char const * getprogname (void) { @@ -214,7 +212,19 @@ getprogname (void) { char *s = strdup (last_component (buf.ps_pathptr)); if (s) - p = s; + { +# if defined __XPLINK__ && __CHARSET_LIB == 1 + /* The compiler option -qascii is in use. + https://makingdeveloperslivesbetter.wordpress.com/2022/01/07/is-z-os-ascii-or-ebcdic-yes/ + https://www.ibm.com/docs/en/zos/2.5.0?topic=features-macros-related-compiler-option-settings + So, convert the result from EBCDIC to ASCII. + https://www.ibm.com/docs/en/zos/2.5.0?topic=functions-e2a-s-convert-string-from-ebcdic-ascii */ + if (__e2a_s (s) == (size_t)-1) + free (s); + else +# endif + p = s; + } break; } } -- cgit v1.2.3