Skip to content

Commit e71d09a

Browse files
committed
Clean up printf arg-control test, per Kurt Roeckx.
1 parent 4199414 commit e71d09a

File tree

2 files changed

+17
-21
lines changed

2 files changed

+17
-21
lines changed

config/c-library.m4

Lines changed: 9 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
# Macros that test various C library quirks
2-
# $PostgreSQL: pgsql/config/c-library.m4,v 1.30 2005/02/22 03:55:50 momjian Exp $
2+
# $PostgreSQL: pgsql/config/c-library.m4,v 1.31 2005/02/24 01:34:45 tgl Exp $
33

44

55
# PGAC_VAR_INT_TIMEZONE
@@ -273,25 +273,23 @@ esac])# PGAC_FUNC_SNPRINTF_LONG_LONG_INT_FORMAT
273273
# Determine if printf supports %1$ argument selection, e.g. %5$ selects
274274
# the fifth argument after the printf print string.
275275
# This is not in the C99 standard, but in the Single Unix Specification (SUS).
276-
# It is used in our langauge translation strings.
276+
# It is used in our language translation strings.
277277
#
278278
AC_DEFUN([PGAC_FUNC_PRINTF_ARG_CONTROL],
279-
[AC_MSG_CHECKING([printf supports argument control])
279+
[AC_MSG_CHECKING([whether printf supports argument control])
280280
AC_CACHE_VAL(pgac_cv_printf_arg_control,
281281
[AC_TRY_RUN([#include <stdio.h>
282+
#include <string.h>
282283
283-
int does_printf_have_arg_control()
284+
int main()
284285
{
285286
char buf[100];
286287
287288
/* can it swap arguments? */
288-
snprintf(buf, 100, "%2$d|%1$d", 3, 4);
289-
if (strcmp(buf, "4|3") != 0)
290-
return 0;
291-
return 1;
292-
}
293-
main() {
294-
exit(! does_printf_have_arg_control());
289+
snprintf(buf, 100, "%2\$d %1\$d", 3, 4);
290+
if (strcmp(buf, "4 3") != 0)
291+
return 1;
292+
return 0;
295293
}],
296294
[pgac_cv_printf_arg_control=yes],
297295
[pgac_cv_printf_arg_control=no],

configure

Lines changed: 8 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -12162,8 +12162,8 @@ fi
1216212162
done
1216312163

1216412164

12165-
echo "$as_me:$LINENO: checking printf supports argument control" >&5
12166-
echo $ECHO_N "checking printf supports argument control... $ECHO_C" >&6
12165+
echo "$as_me:$LINENO: checking whether printf supports argument control" >&5
12166+
echo $ECHO_N "checking whether printf supports argument control... $ECHO_C" >&6
1216712167
if test "${pgac_cv_printf_arg_control+set}" = set; then
1216812168
echo $ECHO_N "(cached) $ECHO_C" >&6
1216912169
else
@@ -12174,19 +12174,17 @@ else
1217412174
#line $LINENO "configure"
1217512175
#include "confdefs.h"
1217612176
#include <stdio.h>
12177+
#include <string.h>
1217712178

12178-
int does_printf_have_arg_control()
12179+
int main()
1217912180
{
1218012181
char buf[100];
1218112182

1218212183
/* can it swap arguments? */
12183-
snprintf(buf, 100, "%2$d|%1$d", 3, 4);
12184-
if (strcmp(buf, "4|3") != 0)
12185-
return 0;
12186-
return 1;
12187-
}
12188-
main() {
12189-
exit(! does_printf_have_arg_control());
12184+
snprintf(buf, 100, "%2\$d %1\$d", 3, 4);
12185+
if (strcmp(buf, "4 3") != 0)
12186+
return 1;
12187+
return 0;
1219012188
}
1219112189
_ACEOF
1219212190
rm -f conftest$ac_exeext

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy