diff options
Diffstat (limited to 'lib/getprogname.c')
-rw-r--r-- | lib/getprogname.c | 16 |
1 files changed, 14 insertions, 2 deletions
diff --git a/lib/getprogname.c b/lib/getprogname.c index 279d79f..392a9a2 100644 --- a/lib/getprogname.c +++ b/lib/getprogname.c @@ -1,5 +1,5 @@ /* Program name management. - Copyright (C) 2016-2023 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 @@ -212,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; } } |