diff options
| author | Jörg Frings-Fürst <debian@jff.email> | 2024-03-03 19:11:45 +0100 | 
|---|---|---|
| committer | Jörg Frings-Fürst <debian@jff.email> | 2024-03-03 19:11:45 +0100 | 
| commit | 7cf710f6587e71a193a55d84dd6d8ae1a8a69ce0 (patch) | |
| tree | db628840acea83dbccaf5676b89579a80e02ef51 /tests/getprogname.c | |
| parent | d83e85a2e6064c36f6ad3c848e39d8b8c101c4f7 (diff) | |
| parent | 00893e79fc62966067af1a106567db96bd170338 (diff) | |
Update upstream source from tag 'upstream/1.2'
Update to upstream version '1.2'
with Debian dir 16dafe941db3036235f48227f29c6a73587c376d
Diffstat (limited to 'tests/getprogname.c')
| -rw-r--r-- | tests/getprogname.c | 24 | 
1 files changed, 17 insertions, 7 deletions
| 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 <config.h> -/* Specification.  */ -#include "getprogname.h" +/* Specification.  Also get __argv declaration.  */ +#include <stdlib.h>  #include <errno.h> /* get program_invocation_name declaration */ -#include <stdlib.h> /* get __argv declaration */  #ifdef _AIX  # include <unistd.h> @@ -53,13 +52,12 @@  #if defined __SCO_VERSION__ || defined __sysv5__  # include <fcntl.h> -# include <stdlib.h>  # include <string.h>  #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;                  }              } | 
