-#!/usr/bin/awk -f
+#!/bin/sh
+exec awk -f "$0" "$@"
# pmccabe2html - pmccabe to html converter
-# Copyright (C) 2007, 2008 Free Software Foundation, Inc.
+# Copyright (C) 2007, 2008, 2009 Free Software Foundation, Inc.
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
-#!/usr/bin/perl -T
+eval '(exit $?0)' && eval 'exec perl -wST "$0" ${1+"$@"}'
+ & eval 'exec perl -wST "$0" $argv:q'
+ if 0;
# Detect instances of "if (p) free (p);".
# Likewise for "if (p != NULL) free (p);". And with braces.
# Also detect "if (NULL != p) free (p);".
EOF
## Local Variables:
+## mode: perl
## indent-tabs-mode: nil
## eval: (add-hook 'write-file-hooks 'time-stamp)
## time-stamp-start: "my $VERSION = '"
-# fseeko.m4 serial 4
-dnl Copyright (C) 2007-2008 Free Software Foundation, Inc.
+# fseeko.m4 serial 6
+dnl Copyright (C) 2007-2009 Free Software Foundation, Inc.
dnl This file is free software; the Free Software Foundation
dnl gives unlimited permission to copy and/or distribute it,
dnl with or without modifications, as long as this notice is preserved.
AC_CACHE_CHECK([for fseeko], [gl_cv_func_fseeko],
[
- AC_TRY_LINK([#include <stdio.h>], [fseeko (stdin, 0, 0);],
+ AC_LINK_IFELSE([AC_LANG_PROGRAM([[#include <stdio.h>
+]], [fseeko (stdin, 0, 0);])],
[gl_cv_func_fseeko=yes], [gl_cv_func_fseeko=no])
])
if test $gl_cv_func_fseeko = no; then
AC_LIBOBJ([fseeko])
AC_REQUIRE([gl_STDIO_H_DEFAULTS])
REPLACE_FSEEKO=1
+ dnl If we are also using the fseek module, then fseek needs replacing, too.
+ m4_ifdef([gl_REPLACE_FSEEK], [gl_REPLACE_FSEEK])
])
AC_PROG_MKDIR_P
gl_FUNC_PERROR
gl_STRING_MODULE_INDICATOR([perror])
- gl_PMCCABE2HTML
AC_CHECK_DECLS([program_invocation_name], [], [], [#include <errno.h>])
AC_CHECK_DECLS([program_invocation_short_name], [], [], [#include <errno.h>])
gl_FUNC_READ_FILE
m4/netdb_h.m4
m4/netinet_in_h.m4
m4/perror.m4
- m4/pmccabe2html.m4
m4/printf.m4
m4/read-file.m4
m4/readline.m4
-# inet_ntop.m4 serial 9
+# inet_ntop.m4 serial 10
dnl Copyright (C) 2005, 2006, 2008, 2009 Free Software Foundation, Inc.
dnl This file is free software; the Free Software Foundation
dnl gives unlimited permission to copy and/or distribute it,
gl_REPLACE_ARPA_INET_H
- dnl The AC_SEARCH_LIBS call is a hack to persuade the Solaris 8 linker to
- dnl find inet_ntop.
- dnl
- dnl It is the responsibility of gl_INET_NTOP's caller to arrange for
- dnl -lnsl if it is needed. Normally -lnsl is not needed on Solaris 8,
- dnl since inet_ntop is needed only by getaddrinfo, and getaddrinfo
- dnl isn't built on Solaris 8.
+ dnl Most platforms that provide inet_ntop define it in libc.
+ dnl Solaris 8..10 provide inet_ntop in libnsl instead.
gl_save_LIBS=$LIBS
AC_SEARCH_LIBS([inet_ntop], [nsl], [],
[AC_REPLACE_FUNCS([inet_ntop])])
LIBS=$gl_save_LIBS
+ INET_NTOP_LIB=
+ if test "$ac_cv_search_inet_ntop" != "none needed"; then
+ INET_NTOP_LIB="$ac_cv_search_inet_ntop"
+ fi
+ AC_SUBST([INET_NTOP_LIB])
gl_PREREQ_INET_NTOP
])
-# inet_pton.m4 serial 7
+# inet_pton.m4 serial 8
dnl Copyright (C) 2006, 2008, 2009 Free Software Foundation, Inc.
dnl This file is free software; the Free Software Foundation
dnl gives unlimited permission to copy and/or distribute it,
gl_REPLACE_ARPA_INET_H
- AC_REPLACE_FUNCS([inet_pton])
+ dnl Most platforms that provide inet_pton define it in libc.
+ dnl Solaris 8..10 provide inet_pton in libnsl instead.
+ gl_save_LIBS=$LIBS
+ AC_SEARCH_LIBS([inet_pton], [nsl], [],
+ [AC_REPLACE_FUNCS([inet_pton])])
+ LIBS=$gl_save_LIBS
+ INET_PTON_LIB=
+ if test "$ac_cv_search_inet_pton" != "none needed"; then
+ INET_PTON_LIB="$ac_cv_search_inet_pton"
+ fi
+ AC_SUBST([INET_PTON_LIB])
+
gl_PREREQ_INET_PTON
])
+++ /dev/null
-# pmccabe2html.m4 serial 2
-dnl Copyright (C) 2008, 2009 Free Software Foundation, Inc.
-dnl This file is free software; the Free Software Foundation
-dnl gives unlimited permission to copy and/or distribute it,
-dnl with or without modifications, as long as this notice is preserved.
-
-dnl From Simon Josefsson
-
-# Usage: gl_PMCCABE2HTML([]).
-AC_DEFUN([gl_PMCCABE2HTML],
-[
- AC_REQUIRE([AC_PROG_AWK])
- AC_PATH_PROG([PMCCABE], [pmccabe], [false])
-])
-# ungetc.m4 serial 1
+# ungetc.m4 serial 2
dnl Copyright (C) 2009 Free Software Foundation, Inc.
dnl This file is free software; the Free Software Foundation
dnl gives unlimited permission to copy and/or distribute it,
[gl_cv_func_ungetc_works],
[AC_RUN_IFELSE([AC_LANG_PROGRAM([[
#include <stdio.h>
- ]], [FILE *f; long l;
+ ]], [FILE *f;
if (!(f = fopen ("conftest.tmp", "w+"))) return 1;
if (fputs ("abc", f) < 0) return 2;
rewind (f);
#if WINDOWS_SOCKETS
/* This includes winsock2.h on MinGW. */
-#include <sys/socket.h>
+# include <sys/socket.h>
-#include "close-hook.h"
+# include "close-hook.h"
/* Get set_winsock_errno, FD_TO_SOCKET etc. */
-#include "w32sock.h"
+# include "w32sock.h"
static int
close_fd_maybe_socket (int fd, const struct close_hook *remaining_list)
static int initialized_sockets_version /* = 0 */;
-#endif
+#endif /* WINDOWS_SOCKETS */
int
-gl_sockets_startup (int version)
+gl_sockets_startup (int version _UNUSED_PARAMETER_)
{
#if WINDOWS_SOCKETS
if (version > initialized_sockets_version)
fflush(), and which detect pipes. */
# define fseeko rpl_fseeko
extern int fseeko (FILE *fp, off_t offset, int whence);
-# define fseek(fp, offset, whence) fseeko (fp, (off_t)(offset), whence)
+# if !@GNULIB_FSEEK@
+# undef fseek
+# define fseek(f,o,w) \
+ (GL_LINK_WARNING ("fseek cannot handle files larger than 4 GB " \
+ "on 32-bit platforms - " \
+ "use fseeko function for handling of large files"), \
+ fseeko (f, o, w))
+# endif
# endif
#elif defined GNULIB_POSIXCHECK
# undef fseeko
# if @REPLACE_FTELLO@
# define ftello rpl_ftello
extern off_t ftello (FILE *fp);
-# define ftell(fp) ftello (fp)
+# if !@GNULIB_FTELL@
+# undef ftell
+# define ftell(f) \
+ (GL_LINK_WARNING ("ftell cannot handle files larger than 4 GB " \
+ "on 32-bit platforms - " \
+ "use ftello function for handling of large files"), \
+ ftello (f))
+# endif
# endif
#elif defined GNULIB_POSIXCHECK
# undef ftello
struct stat. This means that rpl_stat will not be used if the user
does (stat)(a,b). Oh well. */
# undef stat
-# define stat(name, st) rpl_stat (name, st)
+# ifdef _LARGE_FILES
+ /* With _LARGE_FILES defined, AIX (only) defines stat to stat64,
+ so we have to replace stat64() instead of stat(). */
+# define stat stat64
+# undef stat64
+# define stat64(name, st) rpl_stat (name, st)
+# else /* !_LARGE_FILES */
+# define stat(name, st) rpl_stat (name, st)
+# endif /* !_LARGE_FILES */
extern int stat (const char *name, struct stat *buf);
# endif
#elif defined GNULIB_POSIXCHECK
/* Test of <arpa/inet.h> substitute.
- Copyright (C) 2007 Free Software Foundation, Inc.
+ Copyright (C) 2007, 2009 Free Software Foundation, Inc.
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
#include <arpa/inet.h>
int
-main ()
+main (void)
{
return 0;
}
# define EAI_SERVICE 0
#endif
-int simple (char *host, char *service)
+static int
+simple (char const *host, char const *service)
{
char buf[BUFSIZ];
static int skip = 0;
/* Test of getdelim() function.
- Copyright (C) 2007-2008 Free Software Foundation, Inc.
+ Copyright (C) 2007-2009 Free Software Foundation, Inc.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
while (0)
int
-main (int argc, char **argv)
+main (void)
{
FILE *f;
char *line = NULL;
/* Test of getline() function.
- Copyright (C) 2007-2008 Free Software Foundation, Inc.
+ Copyright (C) 2007-2009 Free Software Foundation, Inc.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
while (0)
int
-main (int argc, char **argv)
+main (void)
{
FILE *f;
char *line = NULL;
/*
- * Copyright (C) 2005, 2007 Free Software Foundation
+ * Copyright (C) 2005, 2007, 2009 Free Software Foundation
* Written by Jim Meyering.
*
* This program is free software: you can redistribute it and/or modify
#include <string.h>
int
-main (int argc, char *argv[])
+main (void)
{
time_t t = 0;
struct tm *lt;
#define MEMCHR (char *) memchr
int
-main ()
+main (void)
{
size_t n = 0x100000;
char *input = malloc (n);
if (page_boundary != NULL)
{
- int n;
-
for (n = 1; n <= 500; n++)
{
char *mem = page_boundary - n;
ASSERT (MEMCHR (mem, 'U', n) == NULL);
{
- int i;
+ size_t i;
for (i = 0; i < n; i++)
{
/* Test of <netinet/in.h> substitute.
- Copyright (C) 2007 Free Software Foundation, Inc.
+ Copyright (C) 2007, 2009 Free Software Foundation, Inc.
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
#include <netinet/in.h>
int
-main ()
+main (void)
{
return 0;
}
/* Test of select() substitute, reading from stdin.
- Copyright (C) 2008 Free Software Foundation, Inc.
+ Copyright (C) 2008, 2009 Free Software Foundation, Inc.
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
#include <unistd.h>
int
-main ()
+main (void)
{
printf ("Applying select() from standard input. Press Ctrl-C to abort.\n");
for (;;)
/* Funny socket code. */
static int
-open_server_socket ()
+open_server_socket (void)
{
int s, x;
struct sockaddr_in ia;
/* Do them all. */
int
-main ()
+main (void)
{
int result;
#include "sockets.h"
int
-main (int argc, char *argv[])
+main (void)
{
int err;
verify (sizeof NULL == sizeof (void *));
int
-main ()
+main (void)
{
return 0;
}
/* Test of <stdint.h> substitute.
- Copyright (C) 2006-2008 Free Software Foundation, Inc.
+ Copyright (C) 2006-2009 Free Software Foundation, Inc.
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
int
-main ()
+main (void)
{
return 0;
}
verify (sizeof NULL == sizeof (void *));
int
-main ()
+main (void)
{
return 0;
}
verify (sizeof NULL == sizeof (void *));
int
-main ()
+main (void)
{
/* Check that some macros are defined and different integer constants. */
switch (exitcode)
/* Test of strerror() function.
- Copyright (C) 2007-2008 Free Software Foundation, Inc.
+ Copyright (C) 2007-2009 Free Software Foundation, Inc.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
while (0)
int
-main (int argc, char **argv)
+main (void)
{
char *str;
verify (sizeof NULL == sizeof (void *));
int
-main ()
+main (void)
{
return 0;
}
struct timeval t1;
int
-main ()
+main (void)
{
/* Check that FD_ZERO can be used. This should not yield a warning
such as "warning: implicit declaration of function 'memset'". */
#endif
int
-main ()
+main (void)
{
struct sockaddr_storage x;
sa_family_t i;
struct timespec t2;
int
-main ()
+main (void)
{
return 0;
}
/* Test of <sys/time.h> substitute.
- Copyright (C) 2007 Free Software Foundation, Inc.
+ Copyright (C) 2007, 2009 Free Software Foundation, Inc.
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
struct timeval a;
int
-main ()
+main (void)
{
return 0;
}
verify (sizeof NULL == sizeof (void *));
int
-main ()
+main (void)
{
return 0;
}
#endif
int
-main ()
+main (void)
{
return 0;
}
#define AUTHORS "Sergey Poznyakoff", "Eric Blake"
int
-main (int argc, char **argv)
+main (int argc _UNUSED_PARAMETER_, char **argv)
{
set_program_name (argv[0]);
version_etc (stdout, "test-version-etc", "dummy", "0", AUTHORS,
verify (sizeof NULL == sizeof (void *));
int
-main ()
+main (void)
{
return 0;
}
-# fseeko.m4 serial 4
-dnl Copyright (C) 2007-2008 Free Software Foundation, Inc.
+# fseeko.m4 serial 6
+dnl Copyright (C) 2007-2009 Free Software Foundation, Inc.
dnl This file is free software; the Free Software Foundation
dnl gives unlimited permission to copy and/or distribute it,
dnl with or without modifications, as long as this notice is preserved.
AC_CACHE_CHECK([for fseeko], [gl_cv_func_fseeko],
[
- AC_TRY_LINK([#include <stdio.h>], [fseeko (stdin, 0, 0);],
+ AC_LINK_IFELSE([AC_LANG_PROGRAM([[#include <stdio.h>
+]], [fseeko (stdin, 0, 0);])],
[gl_cv_func_fseeko=yes], [gl_cv_func_fseeko=no])
])
if test $gl_cv_func_fseeko = no; then
AC_LIBOBJ([fseeko])
AC_REQUIRE([gl_STDIO_H_DEFAULTS])
REPLACE_FSEEKO=1
+ dnl If we are also using the fseek module, then fseek needs replacing, too.
+ m4_ifdef([gl_REPLACE_FSEEK], [gl_REPLACE_FSEEK])
])
-# ungetc.m4 serial 1
+# ungetc.m4 serial 2
dnl Copyright (C) 2009 Free Software Foundation, Inc.
dnl This file is free software; the Free Software Foundation
dnl gives unlimited permission to copy and/or distribute it,
[gl_cv_func_ungetc_works],
[AC_RUN_IFELSE([AC_LANG_PROGRAM([[
#include <stdio.h>
- ]], [FILE *f; long l;
+ ]], [FILE *f;
if (!(f = fopen ("conftest.tmp", "w+"))) return 1;
if (fputs ("abc", f) < 0) return 2;
rewind (f);
#if WINDOWS_SOCKETS
/* This includes winsock2.h on MinGW. */
-#include <sys/socket.h>
+# include <sys/socket.h>
-#include "close-hook.h"
+# include "close-hook.h"
/* Get set_winsock_errno, FD_TO_SOCKET etc. */
-#include "w32sock.h"
+# include "w32sock.h"
static int
close_fd_maybe_socket (int fd, const struct close_hook *remaining_list)
static int initialized_sockets_version /* = 0 */;
-#endif
+#endif /* WINDOWS_SOCKETS */
int
-gl_sockets_startup (int version)
+gl_sockets_startup (int version _UNUSED_PARAMETER_)
{
#if WINDOWS_SOCKETS
if (version > initialized_sockets_version)
fflush(), and which detect pipes. */
# define fseeko rpl_fseeko
extern int fseeko (FILE *fp, off_t offset, int whence);
-# define fseek(fp, offset, whence) fseeko (fp, (off_t)(offset), whence)
+# if !@GNULIB_FSEEK@
+# undef fseek
+# define fseek(f,o,w) \
+ (GL_LINK_WARNING ("fseek cannot handle files larger than 4 GB " \
+ "on 32-bit platforms - " \
+ "use fseeko function for handling of large files"), \
+ fseeko (f, o, w))
+# endif
# endif
#elif defined GNULIB_POSIXCHECK
# undef fseeko
# if @REPLACE_FTELLO@
# define ftello rpl_ftello
extern off_t ftello (FILE *fp);
-# define ftell(fp) ftello (fp)
+# if !@GNULIB_FTELL@
+# undef ftell
+# define ftell(f) \
+ (GL_LINK_WARNING ("ftell cannot handle files larger than 4 GB " \
+ "on 32-bit platforms - " \
+ "use ftello function for handling of large files"), \
+ ftello (f))
+# endif
# endif
#elif defined GNULIB_POSIXCHECK
# undef ftello
struct stat. This means that rpl_stat will not be used if the user
does (stat)(a,b). Oh well. */
# undef stat
-# define stat(name, st) rpl_stat (name, st)
+# ifdef _LARGE_FILES
+ /* With _LARGE_FILES defined, AIX (only) defines stat to stat64,
+ so we have to replace stat64() instead of stat(). */
+# define stat stat64
+# undef stat64
+# define stat64(name, st) rpl_stat (name, st)
+# else /* !_LARGE_FILES */
+# define stat(name, st) rpl_stat (name, st)
+# endif /* !_LARGE_FILES */
extern int stat (const char *name, struct stat *buf);
# endif
#elif defined GNULIB_POSIXCHECK
#define MEMCHR (char *) memchr
int
-main ()
+main (void)
{
size_t n = 0x100000;
char *input = malloc (n);
if (page_boundary != NULL)
{
- int n;
-
for (n = 1; n <= 500; n++)
{
char *mem = page_boundary - n;
ASSERT (MEMCHR (mem, 'U', n) == NULL);
{
- int i;
+ size_t i;
for (i = 0; i < n; i++)
{
#include "sockets.h"
int
-main (int argc, char *argv[])
+main (void)
{
int err;
verify (sizeof NULL == sizeof (void *));
int
-main ()
+main (void)
{
return 0;
}
/* Test of <stdint.h> substitute.
- Copyright (C) 2006-2008 Free Software Foundation, Inc.
+ Copyright (C) 2006-2009 Free Software Foundation, Inc.
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
int
-main ()
+main (void)
{
return 0;
}
verify (sizeof NULL == sizeof (void *));
int
-main ()
+main (void)
{
return 0;
}
verify (sizeof NULL == sizeof (void *));
int
-main ()
+main (void)
{
/* Check that some macros are defined and different integer constants. */
switch (exitcode)
verify (sizeof NULL == sizeof (void *));
int
-main ()
+main (void)
{
return 0;
}
/* Test of strverscmp() function.
- Copyright (C) 2008 Free Software Foundation, Inc.
+ Copyright (C) 2008, 2009 Free Software Foundation, Inc.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
while (0)
int
-main (int argc, char **argv)
+main (void)
{
ASSERT (strverscmp ("", "") == 0);
ASSERT (strverscmp ("a", "a") == 0);
#endif
int
-main ()
+main (void)
{
struct sockaddr_storage x;
sa_family_t i;
struct timespec t2;
int
-main ()
+main (void)
{
return 0;
}
verify (sizeof NULL == sizeof (void *));
int
-main ()
+main (void)
{
return 0;
}
#endif
int
-main ()
+main (void)
{
return 0;
}
verify (sizeof NULL == sizeof (void *));
int
-main ()
+main (void)
{
return 0;
}
# define SWAP(n) (n)
#endif
-#define BLOCKSIZE 4096
+#define BLOCKSIZE 32768
#if BLOCKSIZE % 64 != 0
# error "invalid BLOCKSIZE"
#endif
md5_stream (FILE *stream, void *resblock)
{
struct md5_ctx ctx;
- char buffer[BLOCKSIZE + 72];
size_t sum;
+ char *buffer = malloc (BLOCKSIZE + 72);
+ if (!buffer)
+ return 1;
+
/* Initialize the computation context. */
md5_init_ctx (&ctx);
exit the loop after a partial read due to e.g., EAGAIN
or EWOULDBLOCK. */
if (ferror (stream))
- return 1;
+ {
+ free (buffer);
+ return 1;
+ }
goto process_partial_block;
}
/* Construct result in desired memory. */
md5_finish_ctx (&ctx, resblock);
+ free (buffer);
return 0;
}
#endif
{ echo '$(ME): use STREQ in place of the above uses of str''cmp' \
1>&2; exit 1; } || :
+# Pass EXIT_*, not number, to usage, exit, and error (when exiting)
+sc_prohibit_magic_number_exit:
+ @re='\<(usage|exit) ?\([0-9]|\<error ?\([1-9][0-9]*,' \
+ msg='use EXIT_* values rather than magic number' \
+ $(_prohibit_regexp)
+
# Using EXIT_SUCCESS as the first argument to error is misleading,
# since when that parameter is 0, error does not exit. Use `0' instead.
sc_error_exit_success: