aboutsummaryrefslogtreecommitdiffstats
path: root/contrib/libs/libidn/gl/getprogname.c
diff options
context:
space:
mode:
authorrobot-contrib <robot-contrib@yandex-team.com>2024-02-02 12:59:30 +0300
committerAlexander Smirnov <alex@ydb.tech>2024-02-09 19:17:15 +0300
commitb07d0f5a11bc9e99d00f4e09eeee6112e88c9ce4 (patch)
treef7ca8545e0de0fff895c8ce12e42653171063dd2 /contrib/libs/libidn/gl/getprogname.c
parentd299e8854d8ffcea39aa93e6c807bdb93a0821ae (diff)
downloadydb-b07d0f5a11bc9e99d00f4e09eeee6112e88c9ce4.tar.gz
Update contrib/libs/libidn to 1.42
Diffstat (limited to 'contrib/libs/libidn/gl/getprogname.c')
-rw-r--r--contrib/libs/libidn/gl/getprogname.c24
1 files changed, 17 insertions, 7 deletions
diff --git a/contrib/libs/libidn/gl/getprogname.c b/contrib/libs/libidn/gl/getprogname.c
index 547a684feb..38d033c189 100644
--- a/contrib/libs/libidn/gl/getprogname.c
+++ b/contrib/libs/libidn/gl/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;
}
}