pkgsrc/shells/bash/patches/patch-af
2016-06-11 12:54:24 +00:00

56 lines
1.3 KiB
Text

$NetBSD: patch-af,v 1.8 2016/06/11 12:54:24 rillig Exp $
Fixes PRIdMAX and PRIuMAX on AIX < 5.1.
--- builtins/printf.def.orig 2014-01-03 15:35:33.000000000 +0000
+++ builtins/printf.def
@@ -95,6 +95,11 @@ $END
# undef PRIdMAX
#endif
+#if defined (_AIX) && !defined (_AIX51)
+ /* AIX defines do not work. Undefine them. */
+# undef PRIdMAX
+# undef PRIuMAX
+#endif
#if !defined (PRIdMAX)
# if HAVE_LONG_LONG
# define PRIdMAX "lld"
@@ -102,6 +107,13 @@ $END
# define PRIdMAX "ld"
# endif
#endif
+#if !defined (PRIuMAX) && defined (_AIX)
+# if HAVE_LONG_LONG
+# define PRIuMAX "llu"
+# else
+# define PRIuMAX "lu"
+# endif
+#endif
#if !defined (errno)
extern int errno;
@@ -594,7 +606,11 @@ printf_builtin (list)
p = pp = getintmax ();
if (p != pp)
{
+#if defined (_AIX) && !defined (_AIX51)
+ f = mklong (start, PRIdMAX, sizeof (intmax_t) - 2);
+#else
f = mklong (start, PRIdMAX, sizeof (PRIdMAX) - 2);
+#endif
PF (f, pp);
}
else
@@ -621,7 +637,11 @@ printf_builtin (list)
p = pp = getuintmax ();
if (p != pp)
{
+#if defined (_AIX) && !defined (_AIX51)
+ f = mklong (start, PRIuMAX, sizeof (uintmax_t) - 2);
+#else
f = mklong (start, PRIdMAX, sizeof (PRIdMAX) - 2);
+#endif
PF (f, pp);
}
else