* tests/test-getcwd.c (main): Avoid buffer underflow.
* tests/test-getdate.c (main): String literals are not safe with
putenv, so use setenv. Declare unused argument.
* modules/getdate-tests (Depends-on): Add setenv.
* tests/test-argv-iter.c (main): Declare unused argument. Avoid
problems with string literals in char *.
* tests/test-hash.c (main): Avoid shadowing declaration.
(insert_new): Treat string literals as char const *.
* tests/test-getopt.h (test_getopt): Likewise.
(getopt_loop): Alter types to minimize casting elsewhere.
* tests/test-getopt_long.h (test_getopt_long, getopt_long_loop)
(test_getopt_long_posix): Likewise.
(do_getopt_long): Add wrapper to minimize casting.
* tests/test-atexit.c (clear_temp_file): Use void.
* tests/test-areadlink-with-size.c (main): Declare unused
arguments.
* tests/test-areadlink.c (main): Likewise.
* tests/test-areadlinkat-with-size.c (main): Likewise.
* tests/test-areadlinkat.c (main): Likewise.
* tests/test-canonicalize-lgpl.c (main): Likewise.
* tests/test-canonicalize.c (main): Likewise.
* tests/test-dirent-safer.c (main): Likewise.
* tests/test-dirname.c (main): Likewise.
* tests/test-dup2.c (main): Likewise.
* tests/test-fchdir.c (main): Likewise.
* tests/test-fcntl-h.c (main): Likewise.
* tests/test-fcntl-safer.c (main): Likewise.
* tests/test-fdopendir.c (main): Likewise.
* tests/test-fdutimensat.c (main): Likewise.
* tests/test-fflush.c (main): Likewise.
* tests/test-filenamecat.c (main): Likewise.
* tests/test-filevercmp.c (main): Likewise.
* tests/test-fopen-safer.c (main): Likewise.
* tests/test-fopen.c (main): Likewise.
* tests/test-fpending.c (main): Likewise.
* tests/test-fpurge.c (main): Likewise.
* tests/test-freading.c (main): Likewise.
* tests/test-fstatat.c (main): Likewise.
* tests/test-fsync.c (main): Likewise.
* tests/test-futimens.c (main): Likewise.
* tests/test-getndelim2.c (main): Likewise.
* tests/test-gettimeofday.c (main): Likewise.
* tests/test-getopt.c (main): Likewise.
* tests/test-i-ring.c (main): Likewise.
* tests/test-inttypes.c (main): Likewise.
* tests/test-link.c (main): Likewise.
* tests/test-lstat.c (main): Likewise.
* tests/test-math.c (main): Likewise.
* tests/test-md5.c (main): Likewise.
* tests/test-memchr2.c (main): Likewise.
* tests/test-memrchr.c (main): Likewise.
* tests/test-mkdir.c (main): Likewise.
* tests/test-mkdirat.c (main): Likewise.
* tests/test-mkfifoat.c (main): Likewise.
* tests/test-open.c (main): Likewise.
* tests/test-openat-safer.c (main): Likewise.
* tests/test-openat.c (main): Likewise.
* tests/test-quotearg.c (main): Likewise.
* tests/test-rawmemchr.c (main): Likewise.
* tests/test-readlink.c (main): Likewise.
* tests/test-remove.c (main): Likewise.
* tests/test-rename.c (main): Likewise.
* tests/test-renameat.c (main): Likewise.
* tests/test-rmdir.c (main): Likewise.
* tests/test-sha1.c (main): Likewise.
* tests/test-signal.c (main): Likewise.
* tests/test-sigaction.c (main): Likewise.
* tests/test-stat.c (main): Likewise.
* tests/test-stat-time.c (main): Likewise.
* tests/test-stddef.c (main): Likewise.
* tests/test-stdint.c (main): Likewise.
* tests/test-stdio.c (main): Likewise.
* tests/test-stdlib.c (main): Likewise.
* tests/test-strchrnul.c (main): Likewise.
* tests/test-strerror.c (main): Likewise.
* tests/test-string.c (main): Likewise.
* tests/test-strtod.c (main): Likewise.
* tests/test-strverscmp.c (main): Likewise.
* tests/test-symlink.c (main): Likewise.
* tests/test-symlinkat.c (main): Likewise.
* tests/test-sys_stat.c (main): Likewise.
* tests/test-sys_time.c (main): Likewise.
* tests/test-time.c (main): Likewise.
* tests/test-unistd.c (main): Likewise.
* tests/test-unlink.c (main): Likewise.
* tests/test-unlinkat.c (main): Likewise.
* tests/test-utimens.c (main): Likewise.
* tests/test-utimensat.c (main): Likewise.
* tests/test-version-etc.c (main): Likewise.
* tests/test-wchar.c (main): Likewise.
* tests/test-wctype.c (main): Likewise.
* tests/test-xprintf-posix.c (main): Likewise.
* tests/test-posixtm.c (main): Likewise.
(STREQ): Delete unused macro.
* tests/test-linkat.c (main): Declare unused arguments. Avoid
shadowed variables.
* tests/test-memchr.c (main): Likewise.
Signed-off-by: Eric Blake <ebb9@byu.net>
+2009-10-22 Eric Blake <ebb9@byu.net>
+
+ tests: avoid several compiler warnings
+ * tests/test-getcwd.c (main): Avoid buffer underflow.
+ * tests/test-getdate.c (main): String literals are not safe with
+ putenv, so use setenv. Declare unused argument.
+ * modules/getdate-tests (Depends-on): Add setenv.
+ * tests/test-argv-iter.c (main): Declare unused argument. Avoid
+ problems with string literals in char *.
+ * tests/test-hash.c (main): Avoid shadowing declaration.
+ (insert_new): Treat string literals as char const *.
+ * tests/test-getopt.h (test_getopt): Likewise.
+ (getopt_loop): Alter types to minimize casting elsewhere.
+ * tests/test-getopt_long.h (test_getopt_long, getopt_long_loop)
+ (test_getopt_long_posix): Likewise.
+ (do_getopt_long): Add wrapper to minimize casting.
+ * tests/test-atexit.c (clear_temp_file): Use void.
+ * tests/test-areadlink-with-size.c (main): Declare unused
+ arguments.
+ * tests/test-areadlink.c (main): Likewise.
+ * tests/test-areadlinkat-with-size.c (main): Likewise.
+ * tests/test-areadlinkat.c (main): Likewise.
+ * tests/test-canonicalize-lgpl.c (main): Likewise.
+ * tests/test-canonicalize.c (main): Likewise.
+ * tests/test-dirent-safer.c (main): Likewise.
+ * tests/test-dirname.c (main): Likewise.
+ * tests/test-dup2.c (main): Likewise.
+ * tests/test-fchdir.c (main): Likewise.
+ * tests/test-fcntl-h.c (main): Likewise.
+ * tests/test-fcntl-safer.c (main): Likewise.
+ * tests/test-fdopendir.c (main): Likewise.
+ * tests/test-fdutimensat.c (main): Likewise.
+ * tests/test-fflush.c (main): Likewise.
+ * tests/test-filenamecat.c (main): Likewise.
+ * tests/test-filevercmp.c (main): Likewise.
+ * tests/test-fopen-safer.c (main): Likewise.
+ * tests/test-fopen.c (main): Likewise.
+ * tests/test-fpending.c (main): Likewise.
+ * tests/test-fpurge.c (main): Likewise.
+ * tests/test-freading.c (main): Likewise.
+ * tests/test-fstatat.c (main): Likewise.
+ * tests/test-fsync.c (main): Likewise.
+ * tests/test-futimens.c (main): Likewise.
+ * tests/test-getndelim2.c (main): Likewise.
+ * tests/test-gettimeofday.c (main): Likewise.
+ * tests/test-getopt.c (main): Likewise.
+ * tests/test-i-ring.c (main): Likewise.
+ * tests/test-inttypes.c (main): Likewise.
+ * tests/test-link.c (main): Likewise.
+ * tests/test-lstat.c (main): Likewise.
+ * tests/test-math.c (main): Likewise.
+ * tests/test-md5.c (main): Likewise.
+ * tests/test-memchr2.c (main): Likewise.
+ * tests/test-memrchr.c (main): Likewise.
+ * tests/test-mkdir.c (main): Likewise.
+ * tests/test-mkdirat.c (main): Likewise.
+ * tests/test-mkfifoat.c (main): Likewise.
+ * tests/test-open.c (main): Likewise.
+ * tests/test-openat-safer.c (main): Likewise.
+ * tests/test-openat.c (main): Likewise.
+ * tests/test-quotearg.c (main): Likewise.
+ * tests/test-rawmemchr.c (main): Likewise.
+ * tests/test-readlink.c (main): Likewise.
+ * tests/test-remove.c (main): Likewise.
+ * tests/test-rename.c (main): Likewise.
+ * tests/test-renameat.c (main): Likewise.
+ * tests/test-rmdir.c (main): Likewise.
+ * tests/test-sha1.c (main): Likewise.
+ * tests/test-signal.c (main): Likewise.
+ * tests/test-sigaction.c (main): Likewise.
+ * tests/test-stat.c (main): Likewise.
+ * tests/test-stat-time.c (main): Likewise.
+ * tests/test-stddef.c (main): Likewise.
+ * tests/test-stdint.c (main): Likewise.
+ * tests/test-stdio.c (main): Likewise.
+ * tests/test-stdlib.c (main): Likewise.
+ * tests/test-strchrnul.c (main): Likewise.
+ * tests/test-strerror.c (main): Likewise.
+ * tests/test-string.c (main): Likewise.
+ * tests/test-strtod.c (main): Likewise.
+ * tests/test-strverscmp.c (main): Likewise.
+ * tests/test-symlink.c (main): Likewise.
+ * tests/test-symlinkat.c (main): Likewise.
+ * tests/test-sys_stat.c (main): Likewise.
+ * tests/test-sys_time.c (main): Likewise.
+ * tests/test-time.c (main): Likewise.
+ * tests/test-unistd.c (main): Likewise.
+ * tests/test-unlink.c (main): Likewise.
+ * tests/test-unlinkat.c (main): Likewise.
+ * tests/test-utimens.c (main): Likewise.
+ * tests/test-utimensat.c (main): Likewise.
+ * tests/test-version-etc.c (main): Likewise.
+ * tests/test-wchar.c (main): Likewise.
+ * tests/test-wctype.c (main): Likewise.
+ * tests/test-xprintf-posix.c (main): Likewise.
+ * tests/test-posixtm.c (main): Likewise.
+ (STREQ): Delete unused macro.
+ * tests/test-linkat.c (main): Declare unused arguments. Avoid
+ shadowed variables.
+ * tests/test-memchr.c (main): Likewise.
+
2009-10-21 Eric Blake <ebb9@byu.net>
areadlinkat: avoid failure on older glibc
Depends-on:
progname
+setenv
configure.ac:
#include "test-areadlink.h"
int
-main ()
+main (void)
{
/* Remove any leftovers from a previous partial run. */
ASSERT (system ("rm -rf " BASE "*") == 0);
}
int
-main ()
+main (void)
{
/* Remove any leftovers from a previous partial run. */
ASSERT (system ("rm -rf " BASE "*") == 0);
}
int
-main ()
+main (void)
{
int result;
}
int
-main ()
+main (void)
{
int result;
}
int
-main ()
+main (void)
{
/* set_program_name (argv[0]); placate overzealous "syntax-check" test. */
+ static char one[] = "1";
+ static char two[] = "2";
+ static char three[] = "3";
static char *av[][4] = {
{NULL},
- {"1", NULL},
- {"1", "2", NULL},
- {"1", "2", "3", NULL}
+ {one, NULL},
+ {one, two, NULL},
+ {one, two, three, NULL}
};
int use_stream;
#define TEMPFILE "t-atexit.tmp"
static void
-clear_temp_file ()
+clear_temp_file (void)
{
unlink (TEMPFILE);
}
#define BASE "t-can-lgpl.tmp"
int
-main ()
+main (void)
{
#ifdef GNULIB_CANONICALIZE
/* No need to test canonicalize-lgpl module if canonicalize is also
#define BASE "t-can.tmp"
int
-main ()
+main (void)
{
/* Setup some hierarchy to be used by this test. Start by removing
any leftovers from a previous partial run. */
while (0)
int
-main ()
+main (void)
{
int i;
DIR *dp;
/* Test the gnulib dirname module.
- Copyright (C) 2005, 2006, 2007 Free Software Foundation, Inc.
+ Copyright (C) 2005, 2006, 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
};
int
-main ()
+main (void)
{
struct test *t;
bool ok = true;
}
int
-main ()
+main (void)
{
const char *file = "test-dup2.tmp";
char buffer[1];
while (0)
int
-main ()
+main (void)
{
char *cwd = getcwd (NULL, 0);
int fd = open (".", O_RDONLY);
int fd = FD_CLOEXEC;
int
-main ()
+main (void)
{
return 0;
}
#include "test-open.h"
int
-main ()
+main (void)
{
return test_open ();
}
while (0)
int
-main ()
+main (void)
{
DIR *d;
int fd;
}
int
-main ()
+main (void)
{
int result1; /* Skip because of no symlink support. */
int result2; /* Skip because of no futimens support. */
/* Test of POSIX compatible fflush() function.
- 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 <unistd.h>
int
-main (int argc, char *argv[])
+main (void)
{
FILE *f;
char buffer[10];
#include "progname.h"
int
-main (int argc, char *argv[])
+main (int argc _UNUSED_PARAMETER_, char *argv[])
{
static char const *const tests[][3] =
{
};
int
-main (int argc, char **argv)
+main (void)
{
const char *const *i;
#include "test-fopen.h"
int
-main ()
+main (void)
{
return test_fopen ();
}
#include "test-fopen.h"
int
-main ()
+main (void)
{
return test_fopen ();
}
/* Ensure that __fpending works.
- Copyright (C) 2004, 2007-2008 Free Software Foundation, Inc.
+ Copyright (C) 2004, 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 ()
+main (void)
{
ASSERT (__fpending (stdout) == 0);
#define TESTFILE "t-fpurge.tmp"
int
-main ()
+main (void)
{
int check_filepos;
/* Test of freading() 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
#define TESTFILE "t-freading.tmp"
int
-main ()
+main (void)
{
FILE *fp;
}
int
-main ()
+main (void)
{
int result;
ASSERT (test_stat_func (do_stat) == 0);
/* Test of fsync() 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 ()
+main (void)
{
int fd;
const char *file = "test-fsync.txt";
#include "test-futimens.h"
int
-main ()
+main (void)
{
/* Clean up any trash from prior testsuite runs. */
ASSERT (system ("rm -rf " BASE "*") == 0);
free (pwd2);
{
size_t len = strlen (pwd1);
- size_t i = len - 10;
+ ssize_t i = len - 10;
if (i < 0)
i = 0;
pwd2 = malloc (len + 2);
};
int
-main (int argc, char **argv)
+main (int argc _UNUSED_PARAMETER_, char **argv)
{
struct timespec result;
struct timespec result2;
&& result.tv_nsec == result2.tv_nsec);
/* Check that some "next Monday", "last Wednesday", etc. are correct. */
- putenv ("TZ=UTC0");
+ setenv ("TZ", "UTC0", 1);
for (i = 0; day_table[i]; i++)
{
unsigned int thur2 = 7 * 24 * 3600; /* 2nd thursday */
/* Test of getndelim2() 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)
{
FILE *f;
char *line = NULL;
#endif
int
-main ()
+main (void)
{
unsetenv ("POSIXLY_CORRECT");
/* Written by Bruno Haible <bruno@clisp.org>, 2009. */
static void
-getopt_loop (int argc, char **argv,
+getopt_loop (int argc, const char **argv,
const char *options,
int *a_seen, int *b_seen,
const char **p_value, const char **q_value,
int c;
opterr = 0;
- while ((c = getopt (argc, argv, options)) != -1)
+ while ((c = getopt (argc, (char **) argv, options)) != -1)
{
switch (c)
{
const char *non_options[10];
int unrecognized = 0;
int argc = 0;
- char *argv[10];
+ const char *argv[10];
argv[argc++] = "program";
argv[argc++] = "-a";
const char *non_options[10];
int unrecognized = 0;
int argc = 0;
- char *argv[10];
+ const char *argv[10];
argv[argc++] = "program";
argv[argc++] = "-b";
const char *non_options[10];
int unrecognized = 0;
int argc = 0;
- char *argv[10];
+ const char *argv[10];
argv[argc++] = "program";
argv[argc++] = "-ba";
const char *non_options[10];
int unrecognized = 0;
int argc = 0;
- char *argv[10];
+ const char *argv[10];
argv[argc++] = "program";
argv[argc++] = "-ab";
const char *non_options[10];
int unrecognized = 0;
int argc = 0;
- char *argv[10];
+ const char *argv[10];
argv[argc++] = "program";
argv[argc++] = "-pfoo";
const char *non_options[10];
int unrecognized = 0;
int argc = 0;
- char *argv[10];
+ const char *argv[10];
argv[argc++] = "program";
argv[argc++] = "-p";
const char *non_options[10];
int unrecognized = 0;
int argc = 0;
- char *argv[10];
+ const char *argv[10];
argv[argc++] = "program";
argv[argc++] = "-ab";
const char *non_options[10];
int unrecognized = 0;
int argc = 0;
- char *argv[10];
+ const char *argv[10];
argv[argc++] = "program";
argv[argc++] = "-pfoo";
const char *non_options[10];
int unrecognized = 0;
int argc = 0;
- char *argv[10];
+ const char *argv[10];
argv[argc++] = "program";
argv[argc++] = "-p";
const char *non_options[10];
int unrecognized = 0;
int argc = 0;
- char *argv[10];
+ const char *argv[10];
argv[argc++] = "program";
argv[argc++] = "-p";
const char *non_options[10];
int unrecognized = 0;
int argc = 0;
- char *argv[10];
+ const char *argv[10];
argv[argc++] = "program";
argv[argc++] = "-p";
const char *non_options[10];
int unrecognized = 0;
int argc = 0;
- char *argv[10];
+ const char *argv[10];
argv[argc++] = "program";
argv[argc++] = "donald";
const char *non_options[10];
int unrecognized = 0;
int argc = 0;
- char *argv[20];
+ const char *argv[20];
argv[argc++] = "program";
argv[argc++] = "donald";
const char *non_options[10];
int unrecognized = 0;
int argc = 0;
- char *argv[10];
+ const char *argv[10];
argv[argc++] = "program";
argv[argc++] = "donald";
const char *non_options[10];
int unrecognized = 0;
int argc = 0;
- char *argv[20];
+ const char *argv[20];
argv[argc++] = "program";
argv[argc++] = "donald";
const char *non_options[10];
int unrecognized = 0;
int argc = 0;
- char *argv[10];
+ const char *argv[10];
argv[argc++] = "program";
argv[argc++] = "donald";
const char *non_options[10];
int unrecognized = 0;
int argc = 0;
- char *argv[10];
+ const char *argv[10];
argv[argc++] = "program";
argv[argc++] = "donald";
const char *non_options[10];
int unrecognized = 0;
int argc = 0;
- char *argv[10];
+ const char *argv[10];
argv[argc++] = "program";
argv[argc++] = "-+";
const char *non_options[10];
int unrecognized = 0;
int argc = 0;
- char *argv[20];
+ const char *argv[20];
argv[argc++] = "program";
argv[argc++] = "donald";
const char *non_options[10];
int unrecognized = 0;
int argc = 0;
- char *argv[10];
+ const char *argv[10];
argv[argc++] = "program";
argv[argc++] = "donald";
};
static void
-getopt_long_loop (int argc, char **argv,
+getopt_long_loop (int argc, const char **argv,
const char *options, const struct option *long_options,
const char **p_value, const char **q_value,
int *non_options_count, const char **non_options,
int c;
opterr = 0;
- while ((c = getopt_long (argc, argv, options, long_options, &option_index))
+ while ((c = getopt_long (argc, (char **) argv, options, long_options,
+ &option_index))
!= -1)
{
switch (c)
}
}
+/* Reduce casting, so we can use string literals elsewhere.
+ getopt_long takes an array of char*, but luckily does not modify
+ those elements, so we can pass const char*. */
+static int
+do_getopt_long (int argc, const char **argv, const char *shortopts,
+ const struct option *longopts, int *longind)
+{
+ return getopt_long (argc, (char **) argv, shortopts, longopts, longind);
+}
+
static void
test_getopt_long (void)
{
/* Test disambiguation of options. */
{
int argc = 0;
- char *argv[10];
+ const char *argv[10];
int option_index;
int c;
argv[argc++] = "--x";
optind = 1;
opterr = 0;
- c = getopt_long (argc, argv, "ab", long_options_required, &option_index);
+ c = do_getopt_long (argc, argv, "ab", long_options_required, &option_index);
ASSERT (c == '?');
ASSERT (optopt == 0);
}
{
int argc = 0;
- char *argv[10];
+ const char *argv[10];
int option_index;
int c;
argv[argc++] = "--xt";
optind = 1;
opterr = 0;
- c = getopt_long (argc, argv, "ab", long_options_required, &option_index);
+ c = do_getopt_long (argc, argv, "ab", long_options_required, &option_index);
ASSERT (c == '?');
ASSERT (optopt == 0);
}
{
int argc = 0;
- char *argv[10];
+ const char *argv[10];
int option_index;
int c;
argv[argc++] = "--xtr";
optind = 1;
opterr = 0;
- c = getopt_long (argc, argv, "ab", long_options_required, &option_index);
+ c = do_getopt_long (argc, argv, "ab", long_options_required, &option_index);
ASSERT (c == '?');
ASSERT (optopt == 0);
}
{
int argc = 0;
- char *argv[10];
+ const char *argv[10];
int option_index;
int c;
argv[argc++] = "--xtra";
optind = 1;
opterr = 0;
- c = getopt_long (argc, argv, "ab", long_options_required, &option_index);
+ c = do_getopt_long (argc, argv, "ab", long_options_required, &option_index);
ASSERT (c == 1001);
}
{
int argc = 0;
- char *argv[10];
+ const char *argv[10];
int option_index;
int c;
argv[argc++] = "--xtre";
optind = 1;
opterr = 0;
- c = getopt_long (argc, argv, "ab", long_options_required, &option_index);
+ c = do_getopt_long (argc, argv, "ab", long_options_required, &option_index);
ASSERT (c == '?');
ASSERT (optopt == 0);
}
{
int argc = 0;
- char *argv[10];
+ const char *argv[10];
int option_index;
int c;
argv[argc++] = "--xtrem";
optind = 1;
opterr = 0;
- c = getopt_long (argc, argv, "ab", long_options_required, &option_index);
+ c = do_getopt_long (argc, argv, "ab", long_options_required, &option_index);
ASSERT (c == '?');
ASSERT (optopt == 0);
}
{
int argc = 0;
- char *argv[10];
+ const char *argv[10];
int option_index;
int c;
argv[argc++] = "--xtreme";
optind = 1;
opterr = 0;
- c = getopt_long (argc, argv, "ab", long_options_required, &option_index);
+ c = do_getopt_long (argc, argv, "ab", long_options_required, &option_index);
ASSERT (c == 1002);
}
{
int argc = 0;
- char *argv[10];
+ const char *argv[10];
int option_index;
int c;
argv[argc++] = "--xtremel";
optind = 1;
opterr = 0;
- c = getopt_long (argc, argv, "ab", long_options_required, &option_index);
+ c = do_getopt_long (argc, argv, "ab", long_options_required, &option_index);
ASSERT (c == 1003);
}
{
int argc = 0;
- char *argv[10];
+ const char *argv[10];
int option_index;
int c;
argv[argc++] = "--xtremely";
optind = 1;
opterr = 0;
- c = getopt_long (argc, argv, "ab", long_options_required, &option_index);
+ c = do_getopt_long (argc, argv, "ab", long_options_required, &option_index);
ASSERT (c == 1003);
}
const char *non_options[10];
int unrecognized = 0;
int argc = 0;
- char *argv[10];
+ const char *argv[10];
a_seen = 0;
b_seen = 0;
const char *non_options[10];
int unrecognized = 0;
int argc = 0;
- char *argv[10];
+ const char *argv[10];
a_seen = 0;
b_seen = 0;
const char *non_options[10];
int unrecognized = 0;
int argc = 0;
- char *argv[10];
+ const char *argv[10];
a_seen = 0;
b_seen = 0;
const char *non_options[10];
int unrecognized = 0;
int argc = 0;
- char *argv[10];
+ const char *argv[10];
a_seen = 0;
b_seen = 0;
const char *non_options[10];
int unrecognized = 0;
int argc = 0;
- char *argv[10];
+ const char *argv[10];
a_seen = 0;
b_seen = 0;
const char *non_options[10];
int unrecognized = 0;
int argc = 0;
- char *argv[10];
+ const char *argv[10];
a_seen = 0;
b_seen = 0;
const char *non_options[10];
int unrecognized = 0;
int argc = 0;
- char *argv[10];
+ const char *argv[10];
a_seen = 0;
b_seen = 0;
const char *non_options[10];
int unrecognized = 0;
int argc = 0;
- char *argv[10];
+ const char *argv[10];
a_seen = 0;
b_seen = 0;
const char *non_options[10];
int unrecognized = 0;
int argc = 0;
- char *argv[10];
+ const char *argv[10];
a_seen = 0;
b_seen = 0;
const char *non_options[10];
int unrecognized = 0;
int argc = 0;
- char *argv[10];
+ const char *argv[10];
a_seen = 0;
b_seen = 0;
const char *non_options[10];
int unrecognized = 0;
int argc = 0;
- char *argv[10];
+ const char *argv[10];
a_seen = 0;
b_seen = 0;
const char *non_options[10];
int unrecognized = 0;
int argc = 0;
- char *argv[10];
+ const char *argv[10];
a_seen = 0;
b_seen = 0;
const char *non_options[10];
int unrecognized = 0;
int argc = 0;
- char *argv[20];
+ const char *argv[20];
a_seen = 0;
b_seen = 0;
const char *non_options[10];
int unrecognized = 0;
int argc = 0;
- char *argv[10];
+ const char *argv[10];
a_seen = 0;
b_seen = 0;
const char *non_options[10];
int unrecognized = 0;
int argc = 0;
- char *argv[20];
+ const char *argv[20];
a_seen = 0;
b_seen = 0;
const char *non_options[10];
int unrecognized = 0;
int argc = 0;
- char *argv[10];
+ const char *argv[10];
a_seen = 0;
b_seen = 0;
const char *non_options[10];
int unrecognized = 0;
int argc = 0;
- char *argv[10];
+ const char *argv[10];
a_seen = 0;
b_seen = 0;
const char *non_options[10];
int unrecognized = 0;
int argc = 0;
- char *argv[10];
+ const char *argv[10];
a_seen = 0;
b_seen = 0;
const char *non_options[10];
int unrecognized = 0;
int argc = 0;
- char *argv[20];
+ const char *argv[20];
a_seen = 0;
b_seen = 0;
const char *non_options[10];
int unrecognized = 0;
int argc = 0;
- char *argv[10];
+ const char *argv[10];
a_seen = 0;
b_seen = 0;
test_getopt_long_posix (void)
{
int c = 3;
- char *v[4] = {"test", "-r", "foo", NULL};
- struct option l[] = {{NULL}};
+ const char *v[4] = {"test", "-r", "foo", NULL};
+ struct option l[] = {{NULL, 0, NULL, 0}};
int start;
int result;
for (start = OPTIND_MIN; start <= 1; start++)
{
optind = start;
- result = getopt_long (c, v, "r::", l, NULL);
+ result = do_getopt_long (c, v, "r::", l, NULL);
}
ASSERT (result == 'r');
ASSERT (optarg == 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;
}
static void
-insert_new (Hash_table *ht, void *ent)
+insert_new (Hash_table *ht, const void *ent)
{
void *e = hash_insert (ht, ent);
ASSERT (e == ent);
size_t n = hash_get_n_entries (ht);
if (n)
{
- size_t k = rand () % n;
+ size_t kk = rand () % n;
void const *p;
void *v;
- for (p = hash_get_first (ht); k;
- --k, p = hash_get_next (ht, p))
+ for (p = hash_get_first (ht); kk;
+ --kk, p = hash_get_next (ht, p))
{
/* empty */
}
/* Test the simple ring buffer.
- 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
while (0)
int
-main ()
+main (void)
{
int o;
I_ring ir;
/* Test of <inttypes.h> substitute.
- Copyright (C) 2006-2007 Free Software Foundation, Inc.
+ Copyright (C) 2006-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
;
int
-main ()
+main (void)
{
return 0;
}
#include "test-link.h"
int
-main (int argc, char **argv)
+main (void)
{
/* Remove any garbage left from previous partial runs. */
ASSERT (system ("rm -rf " BASE "*") == 0);
}
int
-main ()
+main (void)
{
int i;
int dfd;
do the other variant after the loop. */
for (i = 0; i < 32; i++)
{
- int flag = (i & 0x10 ? AT_SYMLINK_FOLLOW : 0);
int fd1 = (i & 8) ? dfd : AT_FDCWD;
char *file1 = file_name_concat ((i & 4) ? ".." : cwd, BASE "xx", NULL);
int fd2 = (i & 2) ? dfd : AT_FDCWD;
char *file2 = file_name_concat ((i & 1) ? ".." : cwd, BASE "xx", NULL);
+ flag = (i & 0x10 ? AT_SYMLINK_FOLLOW : 0);
ASSERT (sprintf (strchr (file1, '\0') - 2, "%02d", i) == 2);
ASSERT (sprintf (strchr (file2, '\0') - 2, "%02d", i + 1) == 2);
}
int
-main ()
+main (void)
{
return test_lstat_func (do_lstat, true);
}
/* Test of <math.h> substitute.
- 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
}
int
-main ()
+main (void)
{
double d = NAN;
double zero = 0.0;
/*
- * Copyright (C) 2005 Free Software Foundation
+ * Copyright (C) 2005, 2009 Free Software Foundation
* Written by Simon Josefsson
*
* This program is free software: you can redistribute it and/or modify
#include "md5.h"
int
-main (int argc, char *argv[])
+main (void)
{
/* Test vectors from RFC 1321. */
#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;
#define MEMCHR2 (char *) memchr2
int
-main ()
+main (void)
{
size_t n = 0x100000;
char *input = malloc (n);
#define MEMRCHR (char *) memrchr
int
-main ()
+main (void)
{
size_t n = 0x100000;
char *input = malloc (n);
#include "test-mkdir.h"
int
-main ()
+main (void)
{
/* Clean up any trash from prior testsuite runs. */
ASSERT (system ("rm -rf " BASE "*") == 0);
}
int
-main ()
+main (void)
{
int result;
}
int
-main ()
+main (void)
{
int i;
test_func funcs[2] = { mkfifoat, test_mknodat };
#include "test-open.h"
int
-main ()
+main (void)
{
return test_open ();
}
#define witness "test-openat-safer.txt"
int
-main ()
+main (void)
{
int i;
int j;
while (0)
int
-main ()
+main (void)
{
/* FIXME - add more tests. For example, share /dev/null and
trailing slash tests with test-open, and do more checks for
#include "intprops.h"
-#define STREQ(a, b) (strcmp (a, b) == 0)
-
#define ASSERT(expr) \
do \
{ \
};
int
-main (int argc, char **argv)
+main (void)
{
unsigned int i;
int fail = 0;
}
int
-main (int argc, char *argv[])
+main (int argc _UNUSED_PARAMETER_, char *argv[])
{
int i;
bool ascii_only = MB_CUR_MAX == 1 && !isprint ((unsigned char) LQ[0]);
/*
- * Copyright (C) 2008 Free Software Foundation
+ * Copyright (C) 2008, 2009 Free Software Foundation
* Written by Eric Blake and Bruno Haible
*
* This program is free software: you can redistribute it and/or modify
#define RAWMEMCHR (char *) rawmemchr
int
-main ()
+main (void)
{
size_t n = 0x100000;
char *input = malloc (n + 1);
#include "test-readlink.h"
int
-main ()
+main (void)
{
/* Remove any leftovers from a previous partial run. */
ASSERT (system ("rm -rf " BASE "*") == 0);
#define BASE "test-remove.t"
int
-main ()
+main (void)
{
/* Remove any leftovers from a previous partial run. */
ASSERT (system ("rm -rf " BASE "*") == 0);
#include "test-rename.h"
int
-main (int argc, char **argv)
+main (void)
{
/* Remove any garbage left from previous partial runs. */
ASSERT (system ("rm -rf " BASE "*") == 0);
}
int
-main ()
+main (void)
{
int i;
int dfd;
#include "test-rmdir.h"
int
-main ()
+main (void)
{
return test_rmdir_func (rmdir, true);
}
#include "sha1.h"
int
-main (int argc, char *argv[])
+main (void)
{
const char *in1 = "abcdefgh";
const char *out1 = "\x42\x5a\xf1\x2a\x07\x43\x50\x2b"
/* Test of sigaction() 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
}
int
-main (int argc, char *argv[])
+main (void)
{
struct sigaction sa;
struct sigaction old_sa;
volatile sig_atomic_t s;
-int main ()
+int
+main (void)
{
return s;
}
}
int
-main ()
+main (void)
{
struct stat statinfo[NFILES];
struct timespec modtimes[NFILES];
}
int
-main ()
+main (void)
{
return test_stat_func (do_stat);
}
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)
/*
- * Copyright (C) 2008 Free Software Foundation
+ * Copyright (C) 2008, 2009 Free Software Foundation
* Written by Eric Blake and Bruno Haible
*
* This program is free software: you can redistribute it and/or modify
while (0)
int
-main ()
+main (void)
{
size_t n = 0x100000;
char *input = malloc (n + 1);
/* 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;
}
/*
- * Copyright (C) 2008 Free Software Foundation
+ * Copyright (C) 2008, 2009 Free Software Foundation
* Written by Eric Blake
*
* This program is free software: you can redistribute it and/or modify
double zero = 0.0;
int
-main ()
+main (void)
{
int status = 0;
/* Subject sequence empty or invalid. */
/* 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);
#include "test-symlink.h"
int
-main ()
+main (void)
{
/* Remove any leftovers from a previous partial run. */
ASSERT (system ("rm -rf " BASE "*") == 0);
}
int
-main ()
+main (void)
{
char buf[80];
int result;
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;
}
#include "test-unlink.h"
int
-main ()
+main (void)
{
return test_unlink_func (unlink, true);
}
}
int
-main ()
+main (void)
{
/* FIXME: Add tests of fd other than ".". */
int result1;
}
int
-main ()
+main (void)
{
int result1; /* Skip because of no symlink support. */
int result2; /* Skip because of no futimens support. */
}
int
-main ()
+main (void)
{
int result1; /* Skip because of no symlink support. */
int result2; /* Skip because of no lutimens support. */
#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;
}
wint_t e = WEOF;
int
-main ()
+main (void)
{
/* Check that the isw* functions exist as functions or as macros. */
(void) iswalnum (0);
/* Test of error-checking xprintf() function with POSIX compatible formatting.
- 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
#include "test-printf-posix.h"
int
-main (int argc, char *argv[])
+main (int argc _UNUSED_PARAMETER_, char *argv[])
{
set_program_name (argv[0]);