From 6ec476f29646ca172d01f33e7e7a0c789e877982 Mon Sep 17 00:00:00 2001 From: Pino Toscano Date: Thu, 18 Aug 2016 15:18:22 +0200 Subject: [PATCH 1/4] getprogname: new module This provides a LGPL module for getting the name of the current program, using the same API found on *BSD systems. * lib/getprogname.c, lib/getprogname.h, m4/getprogname.m4: * modules/getprogname: New files. * MODULES.html.sh (Misc): Add getprogname. --- ChangeLog | 9 +++++++++ MODULES.html.sh | 1 + lib/getprogname.c | 45 +++++++++++++++++++++++++++++++++++++++++++++ lib/getprogname.h | 34 ++++++++++++++++++++++++++++++++++ m4/getprogname.m4 | 13 +++++++++++++ modules/getprogname | 28 ++++++++++++++++++++++++++++ 6 files changed, 130 insertions(+) create mode 100644 lib/getprogname.c create mode 100644 lib/getprogname.h create mode 100644 m4/getprogname.m4 create mode 100644 modules/getprogname diff --git a/ChangeLog b/ChangeLog index ba3e048..e2364fb 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,12 @@ +2016-08-18 Pino Toscano + + getprogname: new module + This provides a LGPL module for getting the name of the current + program, using the same API found on *BSD systems. + * lib/getprogname.c, lib/getprogname.h, m4/getprogname.m4: + * modules/getprogname: New files. + * MODULES.html.sh (Misc): Add getprogname. + 2016-09-02 Jim Meyering manywarnings: add -fno-common diff --git a/MODULES.html.sh b/MODULES.html.sh index f124838..ec6f300 100755 --- a/MODULES.html.sh +++ b/MODULES.html.sh @@ -3453,6 +3453,7 @@ func_all_modules () func_module xgetdomainname func_module getloadavg func_module getpagesize + func_module getprogname func_module getusershell func_module lib-symbol-visibility func_module login_tty diff --git a/lib/getprogname.c b/lib/getprogname.c new file mode 100644 index 0000000..ab26283 --- /dev/null +++ b/lib/getprogname.c @@ -0,0 +1,45 @@ +/* Program name management. + Copyright (C) 2016 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 + the Free Software Foundation; either version 2.1 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public License + along with this program. If not, see . */ + +#include + +/* Specification. */ +#include "getprogname.h" + +#include /* get program_invocation_name declaration */ +#include + + +#ifndef HAVE_GETPROGNAME +const char * +getprogname (void) +{ +#if HAVE_DECL_PROGRAM_INVOCATION_SHORT_NAME + return program_invocation_short_name; +#elif HAVE_DECL_PROGRAM_INVOCATION_NAME + const char *base = program_invocation_name; + const char *slash; + + slash = strrchr (base, '/'); + if (slash != NULL) + base = slash + 1; + + return base; +#else + #error "getprogname module not ported to this OS" +#endif +} +#endif diff --git a/lib/getprogname.h b/lib/getprogname.h new file mode 100644 index 0000000..b21e423 --- /dev/null +++ b/lib/getprogname.h @@ -0,0 +1,34 @@ +/* Program name management. + Copyright (C) 2016 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 + the Free Software Foundation; either version 2.1 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public License + along with this program. If not, see . */ + +#ifndef _GL_GETPROGNAME_H +#define _GL_GETPROGNAME_H + +#include + +#ifdef __cplusplus +extern "C" { +#endif + +#ifndef HAVE_GETPROGNAME +extern const char *getprogname (void); +#endif + +#ifdef __cplusplus +} +#endif + +#endif diff --git a/m4/getprogname.m4 b/m4/getprogname.m4 new file mode 100644 index 0000000..3d30550 --- /dev/null +++ b/m4/getprogname.m4 @@ -0,0 +1,13 @@ +# getprogname.m4 - check for getprogname or replacements for it + +# Copyright (C) 2016 Free Software Foundation, Inc. +# This file is free software; the Free Software Foundation +# gives unlimited permission to copy and/or distribute it, +# with or without modifications, as long as this notice is preserved. + +# serial 1 + +AC_DEFUN([gl_FUNC_GETPROGNAME], +[ + AC_CHECK_FUNCS_ONCE([getprogname]) +]) diff --git a/modules/getprogname b/modules/getprogname new file mode 100644 index 0000000..efda4fa --- /dev/null +++ b/modules/getprogname @@ -0,0 +1,28 @@ +Description: +Program name management. + +Files: +lib/getprogname.h +lib/getprogname.c +m4/getprogname.m4 + +Depends-on: +extensions + +configure.ac: +gl_FUNC_GETPROGNAME +AC_REQUIRE([gl_USE_SYSTEM_EXTENSIONS]) +AC_CHECK_DECLS([program_invocation_name], [], [], [#include ]) +AC_CHECK_DECLS([program_invocation_short_name], [], [], [#include ]) + +Makefile.am: +lib_SOURCES += getprogname.h getprogname.c + +Include: +"getprogname.h" + +License: +LGPL + +Maintainer: +All -- 2.7.4 From 5288feeaa04bfb5efc8d89e0b48106028839fdc8 Mon Sep 17 00:00:00 2001 From: Pino Toscano Date: Thu, 18 Aug 2016 15:18:23 +0200 Subject: [PATCH 2/4] Port modules to use getprogname explicitly ... instead of requiring progname to be used (or program_name to be provided). * lib/argmatch.c: Do not include progname.h. [TEST] (program_name): Do not define. [TEST] (main): Call getprogname instead of using program_name. * lib/c-stack.c: Do not include progname.h. (program_name): Do not define. (die): Call getprogname instead of using program_name. * lib/chdir-long.c: Do not include progname.h. [TEST_CHDIR] (main): Do not set program_name. * lib/error.c [!_LIBC]: Include progname.h. [!_LIBC] (program_name): Define using getprogname. * lib/euidaccess.c: Do not include progname.h. [TEST] (main): Do not set program_name. * lib/git-merge-changelog.c: Include getprogname.h instead of progname.h. (usage): Call getprogname instead of using program_name. (main): Likewise. Stop calling set_program_name. * lib/group-member.c: Do not include progname.h. [TEST] (main): Do not set program_name. * modules/argmatch (Depends-on): Add getprogname. * modules/c-stack (Depends-on): Likewise. * modules/error (Depends-on): Likewise. * modules/git-merge-changelog (Depends-on): Likewise. Also remove progname. --- ChangeLog | 28 ++++++++++++++++++++++++++++ lib/argmatch.c | 8 +++----- lib/c-stack.c | 5 ++--- lib/chdir-long.c | 3 --- lib/error.c | 6 +++--- lib/euidaccess.c | 3 --- lib/git-merge-changelog.c | 11 ++++------- lib/group-member.c | 4 ---- modules/argmatch | 1 + modules/c-stack | 1 + modules/error | 1 + modules/git-merge-changelog | 2 +- 12 files changed, 44 insertions(+), 29 deletions(-) diff --git a/ChangeLog b/ChangeLog index e2364fb..d7520ae 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,5 +1,33 @@ 2016-08-18 Pino Toscano + Port modules to use getprogname explicitly, instead of requiring + progname to be used (or program_name to be provided). + * lib/argmatch.c: Do not include progname.h. + [TEST] (program_name): Do not define. + [TEST] (main): Call getprogname instead of using program_name. + * lib/c-stack.c: Do not include progname.h. + (program_name): Do not define. + (die): Call getprogname instead of using program_name. + * lib/chdir-long.c: Do not include progname.h. + [TEST_CHDIR] (main): Do not set program_name. + * lib/error.c [!_LIBC]: Include progname.h. + [!_LIBC] (program_name): Define using getprogname. + * lib/euidaccess.c: Do not include progname.h. + [TEST] (main): Do not set program_name. + * lib/git-merge-changelog.c: Include getprogname.h instead of + progname.h. + (usage): Call getprogname instead of using program_name. + (main): Likewise. Stop calling set_program_name. + * lib/group-member.c: Do not include progname.h. + [TEST] (main): Do not set program_name. + * modules/argmatch (Depends-on): Add getprogname. + * modules/c-stack (Depends-on): Likewise. + * modules/error (Depends-on): Likewise. + * modules/git-merge-changelog (Depends-on): Likewise. + Also remove progname. + +2016-08-18 Pino Toscano + getprogname: new module This provides a LGPL module for getting the name of the current program, using the same API found on *BSD systems. diff --git a/lib/argmatch.c b/lib/argmatch.c index bd1ad71..bf3cddf 100644 --- a/lib/argmatch.c +++ b/lib/argmatch.c @@ -35,6 +35,7 @@ #include "error.h" #include "quotearg.h" #include "quote.h" +#include "getprogname.h" #if USE_UNLOCKED_IO # include "unlocked-io.h" @@ -209,7 +210,6 @@ argmatch_to_argument (const char *value, /* * Based on "getversion.c" by David MacKenzie */ -char *program_name; /* When to make backup files. */ enum backup_type @@ -253,11 +253,9 @@ main (int argc, const char *const *argv) const char *cp; enum backup_type backup_type = no_backups; - program_name = (char *) argv[0]; - if (argc > 2) { - fprintf (stderr, "Usage: %s [VERSION_CONTROL]\n", program_name); + fprintf (stderr, "Usage: %s [VERSION_CONTROL]\n", getprogname ()); exit (1); } @@ -266,7 +264,7 @@ main (int argc, const char *const *argv) backup_args, backup_vals); if (argc == 2) - backup_type = XARGMATCH (program_name, argv[1], + backup_type = XARGMATCH (getprogname (), argv[1], backup_args, backup_vals); printf ("The version control is '%s'\n", diff --git a/lib/c-stack.c b/lib/c-stack.c index baace41..5353c08 100644 --- a/lib/c-stack.c +++ b/lib/c-stack.c @@ -78,6 +78,7 @@ typedef struct sigaltstack stack_t; #include "c-stack.h" #include "exitfail.h" #include "ignore-value.h" +#include "getprogname.h" #if defined SA_ONSTACK && defined SA_SIGINFO # define SIGINFO_WORKS 1 @@ -88,8 +89,6 @@ typedef struct sigaltstack stack_t; # endif #endif -extern char *program_name; - /* The user-specified action to take when a SEGV-related program error or stack overflow occurs. */ static void (* volatile segv_action) (int); @@ -116,7 +115,7 @@ die (int signo) #endif /* !SIGINFO_WORKS && !HAVE_LIBSIGSEGV */ segv_action (signo); message = signo ? program_error_message : stack_overflow_message; - ignore_value (write (STDERR_FILENO, program_name, strlen (program_name))); + ignore_value (write (STDERR_FILENO, getprogname (), strlen (getprogname ()))); ignore_value (write (STDERR_FILENO, ": ", 2)); ignore_value (write (STDERR_FILENO, message, strlen (message))); ignore_value (write (STDERR_FILENO, "\n", 1)); diff --git a/lib/chdir-long.c b/lib/chdir-long.c index 546b4b0..5a039ce 100644 --- a/lib/chdir-long.c +++ b/lib/chdir-long.c @@ -212,8 +212,6 @@ chdir_long (char *dir) # include "closeout.h" # include "error.h" -char *program_name; - int main (int argc, char *argv[]) { @@ -221,7 +219,6 @@ main (int argc, char *argv[]) size_t n = 0; int len; - program_name = argv[0]; atexit (close_stdout); len = getline (&line, &n, stdin); diff --git a/lib/error.c b/lib/error.c index 56ac889..b3b1286 100644 --- a/lib/error.c +++ b/lib/error.c @@ -42,6 +42,8 @@ # define USE_UNLOCKED_IO 0 # define _GL_ATTRIBUTE_FORMAT_PRINTF(a, b) # define _GL_ARG_NONNULL(a) +#else +# include "getprogname.h" #endif #if USE_UNLOCKED_IO @@ -113,9 +115,7 @@ int strerror_r (); # endif # endif -/* The calling program should define program_name and set it to the - name of the executing program. */ -extern char *program_name; +#define program_name getprogname () # if HAVE_STRERROR_R || defined strerror_r # define __strerror_r strerror_r diff --git a/lib/euidaccess.c b/lib/euidaccess.c index 82af941..e9eb0e9 100644 --- a/lib/euidaccess.c +++ b/lib/euidaccess.c @@ -197,8 +197,6 @@ weak_alias (__euidaccess, euidaccess) # include # include -char *program_name; - int main (int argc, char **argv) { @@ -206,7 +204,6 @@ main (int argc, char **argv) int mode; int err; - program_name = argv[0]; if (argc < 3) abort (); file = argv[1]; diff --git a/lib/git-merge-changelog.c b/lib/git-merge-changelog.c index 9d4bd5c..1cbd92b 100644 --- a/lib/git-merge-changelog.c +++ b/lib/git-merge-changelog.c @@ -164,7 +164,6 @@ #include #include -#include "progname.h" #include "error.h" #include "read-file.h" #include "gl_xlist.h" @@ -178,6 +177,7 @@ #include "minmax.h" #include "c-strstr.h" #include "fwriteerror.h" +#include "getprogname.h" #define ASSERT(expr) \ do \ @@ -971,11 +971,11 @@ usage (int status) { if (status != EXIT_SUCCESS) fprintf (stderr, "Try '%s --help' for more information.\n", - program_name); + getprogname ()); else { printf ("Usage: %s [OPTION] O-FILE-NAME A-FILE-NAME B-FILE-NAME\n", - program_name); + getprogname ()); printf ("\n"); printf ("Merges independent modifications of a ChangeLog style file.\n"); printf ("O-FILE-NAME names the original file, the ancestor of the two others.\n"); @@ -1012,9 +1012,6 @@ main (int argc, char *argv[]) bool do_version; bool split_merged_entry; - /* Set program name for messages. */ - set_program_name (argv[0]); - /* Set default values for variables. */ do_help = false; do_version = false; @@ -1041,7 +1038,7 @@ main (int argc, char *argv[]) if (do_version) { /* Version information is requested. */ - printf ("%s\n", program_name); + printf ("%s\n", getprogname ()); printf ("Copyright (C) %s Free Software Foundation, Inc.\n\ License GPLv2+: GNU GPL version 2 or later \n\ This is free software: you are free to change and redistribute it.\n\ diff --git a/lib/group-member.c b/lib/group-member.c index 365e166..6bbab89 100644 --- a/lib/group-member.c +++ b/lib/group-member.c @@ -97,15 +97,11 @@ group_member (gid_t gid) #ifdef TEST -char *program_name; - int main (int argc, char **argv) { int i; - program_name = argv[0]; - for (i = 1; i < argc; i++) { gid_t gid; diff --git a/modules/argmatch b/modules/argmatch index c28ecaf..1ae3756 100644 --- a/modules/argmatch +++ b/modules/argmatch @@ -15,6 +15,7 @@ verify stdbool stdlib memcmp +getprogname configure.ac: diff --git a/modules/c-stack b/modules/c-stack index 83de3f8..dd303bd 100644 --- a/modules/c-stack +++ b/modules/c-stack @@ -15,6 +15,7 @@ unistd raise sigaction libsigsegv +getprogname configure.ac: gl_C_STACK diff --git a/modules/error b/modules/error index c78e7fe..15fb940 100644 --- a/modules/error +++ b/modules/error @@ -12,6 +12,7 @@ lib/error.c m4/error.m4 Depends-on: +getprogname stdio [test $ac_cv_lib_error_at_line = no] strerror [test $ac_cv_lib_error_at_line = no] unistd [test $ac_cv_lib_error_at_line = no] diff --git a/modules/git-merge-changelog b/modules/git-merge-changelog index 266b652..64c472c 100644 --- a/modules/git-merge-changelog +++ b/modules/git-merge-changelog @@ -8,7 +8,6 @@ Depends-on: getopt-gnu stdbool stdlib -progname error read-file xlist @@ -24,6 +23,7 @@ c-strstr fwriteerror memchr memcmp +getprogname configure.ac: -- 2.7.4 From 596bb99cfadc270f240ab0279f0a4852f2c50ec0 Mon Sep 17 00:00:00 2001 From: Pino Toscano Date: Thu, 18 Aug 2016 15:18:24 +0200 Subject: [PATCH 3/4] Port tests away from progname Modules that need the program name already depend on getprogname. * modules/acl-tests (Depends-on): Remove progname. * modules/argmatch (Depends-on): Likewise. * modules/argmatch-tests (Depends-on): Likewise. * modules/argp-tests (Depends-on): Likewise. * modules/argp-version-etc-tests (Depends-on): Likewise. * modules/array-list-tests (Depends-on): Likewise. * modules/array-oset-tests (Depends-on): Likewise. * modules/avltree-list-tests (Depends-on): Likewise. * modules/avltree-oset-tests (Depends-on): Likewise. * modules/avltreehash-list-tests (Depends-on): Likewise. * modules/carray-list-tests (Depends-on): Likewise. * modules/copy-file-tests (Depends-on): Likewise. * modules/exclude-tests (Depends-on): Likewise. * modules/fchownat-tests (Depends-on): Likewise. * modules/fdopendir-tests (Depends-on): Likewise. * modules/filenamecat-tests (Depends-on): Likewise. * modules/fstatat-tests (Depends-on): Likewise. * modules/fstrcmp-tests (Depends-on): Likewise. * modules/linked-list-tests (Depends-on): Likewise. * modules/linkedhash-list-tests (Depends-on): Likewise. * modules/mkdirat-tests (Depends-on): Likewise. * modules/nonblocking-pipe-tests (Depends-on): Likewise. * modules/nonblocking-socket-tests (Depends-on): Likewise. * modules/obstack-printf-tests (Depends-on): Likewise. * modules/openat-tests (Depends-on): Likewise. * modules/parse-datetime-tests (Depends-on): Likewise. * modules/pipe-filter-gi-tests (Depends-on): Likewise. * modules/pipe-filter-ii-tests (Depends-on): Likewise. * modules/quotearg-simple-tests (Depends-on): Likewise. * modules/quotearg-tests (Depends-on): Likewise. * modules/rbtree-list-tests (Depends-on): Likewise. * modules/rbtree-oset-tests (Depends-on): Likewise. * modules/rbtreehash-list-tests (Depends-on): Likewise. * modules/spawn-pipe-tests (Depends-on): Likewise. * modules/system-quote-tests (Depends-on): Likewise. * modules/uniname/uniname-tests (Depends-on): Likewise. * modules/uninorm/nfc-tests (Depends-on): Likewise. * modules/uninorm/nfd-tests (Depends-on): Likewise. * modules/uninorm/nfkc-tests (Depends-on): Likewise. * modules/uninorm/nfkd-tests (Depends-on): Likewise. * modules/unistdio/u16-vsnprintf-tests (Depends-on): Likewise. * modules/unistdio/u16-vsprintf-tests (Depends-on): Likewise. * modules/unistdio/u32-vsnprintf-tests (Depends-on): Likewise. * modules/unistdio/u32-vsprintf-tests (Depends-on): Likewise. * modules/unistdio/u8-vsnprintf-tests (Depends-on): Likewise. * modules/unistdio/u8-vsprintf-tests (Depends-on): Likewise. * modules/unistdio/ulc-vsnprintf-tests (Depends-on): Likewise. * modules/unistdio/ulc-vsprintf-tests (Depends-on): Likewise. * modules/unlinkat-tests (Depends-on): Likewise. * modules/version-etc-tests (Depends-on): Likewise. * modules/xalloc-die-tests (Depends-on): Likewise. * modules/xmemdup0-tests (Depends-on): Likewise. * modules/xprintf-posix-tests (Depends-on): Likewise. * modules/xvasprintf-tests (Depends-on): Likewise. * tests/test-argmatch.c: Do not include progname.h. (main) Stop calling set_program_name. * tests/test-argp-version-etc.c: Likewise. * tests/test-argp.c: Likewise. * tests/test-argv-iter.c: Likewise. * tests/test-array_list.c: Likewise. * tests/test-array_oset.c: Likewise. * tests/test-avltree_list.c: Likewise. * tests/test-avltree_oset.c: Likewise. * tests/test-avltreehash_list.c: Likewise. * tests/test-carray_list.c: Likewise. * tests/test-copy-acl.c: Likewise. * tests/test-copy-file.c: Likewise. * tests/test-exclude.c: Likewise. * tests/test-fchownat.c: Likewise. * tests/test-fdopendir.c: Likewise. * tests/test-filenamecat.c: Likewise. * tests/test-fstatat.c: Likewise. * tests/test-fstrcmp.c: Likewise. * tests/test-linked_list.c: Likewise. * tests/test-linkedhash_list.c: Likewise. * tests/test-mkdirat.c: Likewise. * tests/test-nonblocking-pipe-main.c: Likewise. * tests/test-nonblocking-socket-main.c: Likewise. * tests/test-obstack-printf.c: Likewise. * tests/test-openat.c: Likewise. * tests/test-parse-datetime.c: Likewise. * tests/test-pipe-filter-gi1.c: Likewise. * tests/test-pipe-filter-gi2-main.c: Likewise. * tests/test-pipe-filter-ii1.c: Likewise. * tests/test-pipe-filter-ii2-main.c: Likewise. * tests/test-quotearg-simple.c: Likewise. * tests/test-quotearg.c: Likewise. * tests/test-rbtree_list.c: Likewise. * tests/test-rbtree_oset.c: Likewise. * tests/test-rbtreehash_list.c: Likewise. * tests/test-sameacls.c: Likewise. * tests/test-set-mode-acl.c: Likewise. * tests/test-spawn-pipe-main.c: Likewise. * tests/test-system-quote-main.c: Likewise. * tests/test-unlinkat.c: Likewise. * tests/test-version-etc.c: Likewise. * tests/test-xalloc-die.c: Likewise. * tests/test-xfprintf-posix.c: Likewise. * tests/test-xmemdup0.c: Likewise. * tests/test-xprintf-posix.c: Likewise. * tests/test-xvasprintf.c: Likewise. * tests/uniname/test-uninames.c: Likewise. * tests/uninorm/test-u32-nfc-big.c: Likewise. * tests/uninorm/test-u32-nfd-big.c: Likewise. * tests/uninorm/test-u32-nfkc-big.c: Likewise. * tests/uninorm/test-u32-nfkd-big.c: Likewise. * tests/unistdio/test-u16-vsnprintf1.c: Likewise. * tests/unistdio/test-u16-vsprintf1.c: Likewise. * tests/unistdio/test-u32-vsnprintf1.c: Likewise. * tests/unistdio/test-u32-vsprintf1.c: Likewise. * tests/unistdio/test-u8-vsnprintf1.c: Likewise. * tests/unistdio/test-u8-vsprintf1.c: Likewise. * tests/unistdio/test-ulc-vsnprintf1.c: Likewise. * tests/unistdio/test-ulc-vsprintf1.c: Likewise. * tests/test-c-stack.c: (program_name): Do not define. (main): Do not set program_name. * tests/test-closein.c: Likewise. * tests/test-xstrtol.c: Likewise. * tests/test-yesno.c: Likewise. --- ChangeLog | 124 +++++++++++++++++++++++++++++++++++ modules/acl-tests | 1 - modules/argmatch-tests | 1 - modules/argp-tests | 1 - modules/argp-version-etc-tests | 1 - modules/array-list-tests | 1 - modules/array-oset-tests | 1 - modules/avltree-list-tests | 1 - modules/avltree-oset-tests | 1 - modules/avltreehash-list-tests | 1 - modules/carray-list-tests | 1 - modules/copy-file-tests | 1 - modules/exclude-tests | 1 - modules/fchownat-tests | 1 - modules/fdopendir-tests | 1 - modules/filenamecat-tests | 1 - modules/fstatat-tests | 1 - modules/fstrcmp-tests | 1 - modules/linked-list-tests | 1 - modules/linkedhash-list-tests | 1 - modules/mkdirat-tests | 1 - modules/nonblocking-pipe-tests | 1 - modules/nonblocking-socket-tests | 1 - modules/obstack-printf-tests | 1 - modules/openat-tests | 1 - modules/parse-datetime-tests | 1 - modules/pipe-filter-gi-tests | 1 - modules/pipe-filter-ii-tests | 1 - modules/quotearg-simple-tests | 1 - modules/quotearg-tests | 1 - modules/rbtree-list-tests | 1 - modules/rbtree-oset-tests | 1 - modules/rbtreehash-list-tests | 1 - modules/spawn-pipe-tests | 1 - modules/system-quote-tests | 1 - modules/uniname/uniname-tests | 1 - modules/uninorm/nfc-tests | 1 - modules/uninorm/nfd-tests | 1 - modules/uninorm/nfkc-tests | 1 - modules/uninorm/nfkd-tests | 1 - modules/unistdio/u16-vsnprintf-tests | 1 - modules/unistdio/u16-vsprintf-tests | 1 - modules/unistdio/u32-vsnprintf-tests | 1 - modules/unistdio/u32-vsprintf-tests | 1 - modules/unistdio/u8-vsnprintf-tests | 1 - modules/unistdio/u8-vsprintf-tests | 1 - modules/unistdio/ulc-vsnprintf-tests | 1 - modules/unistdio/ulc-vsprintf-tests | 1 - modules/unlinkat-tests | 1 - modules/version-etc-tests | 1 - modules/xalloc-die-tests | 1 - modules/xmemdup0-tests | 1 - modules/xprintf-posix-tests | 1 - modules/xvasprintf-tests | 1 - tests/test-argmatch.c | 3 - tests/test-argp-version-etc.c | 2 - tests/test-argp.c | 3 - tests/test-argv-iter.c | 1 - tests/test-array_list.c | 3 - tests/test-array_oset.c | 3 - tests/test-avltree_list.c | 3 - tests/test-avltree_oset.c | 3 - tests/test-avltreehash_list.c | 3 - tests/test-c-stack.c | 3 - tests/test-carray_list.c | 3 - tests/test-closein.c | 3 - tests/test-copy-acl.c | 3 - tests/test-copy-file.c | 3 - tests/test-exclude.c | 3 - tests/test-fchownat.c | 3 - tests/test-fdopendir.c | 3 - tests/test-filenamecat.c | 3 - tests/test-fstatat.c | 3 - tests/test-fstrcmp.c | 3 - tests/test-linked_list.c | 3 - tests/test-linkedhash_list.c | 3 - tests/test-mkdirat.c | 3 - tests/test-nonblocking-pipe-main.c | 3 - tests/test-nonblocking-socket-main.c | 3 - tests/test-obstack-printf.c | 3 - tests/test-openat.c | 3 - tests/test-parse-datetime.c | 3 - tests/test-pipe-filter-gi1.c | 3 - tests/test-pipe-filter-gi2-main.c | 3 - tests/test-pipe-filter-ii1.c | 3 - tests/test-pipe-filter-ii2-main.c | 3 - tests/test-quotearg-simple.c | 3 - tests/test-quotearg.c | 3 - tests/test-rbtree_list.c | 3 - tests/test-rbtree_oset.c | 3 - tests/test-rbtreehash_list.c | 3 - tests/test-sameacls.c | 3 - tests/test-set-mode-acl.c | 3 - tests/test-spawn-pipe-main.c | 3 - tests/test-system-quote-main.c | 3 - tests/test-unlinkat.c | 3 - tests/test-version-etc.c | 2 - tests/test-xalloc-die.c | 2 - tests/test-xfprintf-posix.c | 3 - tests/test-xmemdup0.c | 3 - tests/test-xprintf-posix.c | 3 - tests/test-xstrtol.c | 3 - tests/test-xvasprintf.c | 3 - tests/test-yesno.c | 3 - tests/uniname/test-uninames.c | 3 - tests/uninorm/test-u32-nfc-big.c | 2 - tests/uninorm/test-u32-nfd-big.c | 2 - tests/uninorm/test-u32-nfkc-big.c | 2 - tests/uninorm/test-u32-nfkd-big.c | 2 - tests/unistdio/test-u16-vsnprintf1.c | 3 - tests/unistdio/test-u16-vsprintf1.c | 3 - tests/unistdio/test-u32-vsnprintf1.c | 3 - tests/unistdio/test-u32-vsprintf1.c | 3 - tests/unistdio/test-u8-vsnprintf1.c | 3 - tests/unistdio/test-u8-vsprintf1.c | 3 - tests/unistdio/test-ulc-vsnprintf1.c | 3 - tests/unistdio/test-ulc-vsprintf1.c | 3 - 117 files changed, 124 insertions(+), 233 deletions(-) diff --git a/ChangeLog b/ChangeLog index d7520ae..e4a6915 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,5 +1,129 @@ 2016-08-18 Pino Toscano + Port tests away from progname, since modules that need the + program name already depend on getprogname. + * modules/acl-tests (Depends-on): Remove progname. + * modules/argmatch (Depends-on): Likewise. + * modules/argmatch-tests (Depends-on): Likewise. + * modules/argp-tests (Depends-on): Likewise. + * modules/argp-version-etc-tests (Depends-on): Likewise. + * modules/array-list-tests (Depends-on): Likewise. + * modules/array-oset-tests (Depends-on): Likewise. + * modules/avltree-list-tests (Depends-on): Likewise. + * modules/avltree-oset-tests (Depends-on): Likewise. + * modules/avltreehash-list-tests (Depends-on): Likewise. + * modules/carray-list-tests (Depends-on): Likewise. + * modules/copy-file-tests (Depends-on): Likewise. + * modules/exclude-tests (Depends-on): Likewise. + * modules/fchownat-tests (Depends-on): Likewise. + * modules/fdopendir-tests (Depends-on): Likewise. + * modules/filenamecat-tests (Depends-on): Likewise. + * modules/fstatat-tests (Depends-on): Likewise. + * modules/fstrcmp-tests (Depends-on): Likewise. + * modules/linked-list-tests (Depends-on): Likewise. + * modules/linkedhash-list-tests (Depends-on): Likewise. + * modules/mkdirat-tests (Depends-on): Likewise. + * modules/nonblocking-pipe-tests (Depends-on): Likewise. + * modules/nonblocking-socket-tests (Depends-on): Likewise. + * modules/obstack-printf-tests (Depends-on): Likewise. + * modules/openat-tests (Depends-on): Likewise. + * modules/parse-datetime-tests (Depends-on): Likewise. + * modules/pipe-filter-gi-tests (Depends-on): Likewise. + * modules/pipe-filter-ii-tests (Depends-on): Likewise. + * modules/quotearg-simple-tests (Depends-on): Likewise. + * modules/quotearg-tests (Depends-on): Likewise. + * modules/rbtree-list-tests (Depends-on): Likewise. + * modules/rbtree-oset-tests (Depends-on): Likewise. + * modules/rbtreehash-list-tests (Depends-on): Likewise. + * modules/spawn-pipe-tests (Depends-on): Likewise. + * modules/system-quote-tests (Depends-on): Likewise. + * modules/uniname/uniname-tests (Depends-on): Likewise. + * modules/uninorm/nfc-tests (Depends-on): Likewise. + * modules/uninorm/nfd-tests (Depends-on): Likewise. + * modules/uninorm/nfkc-tests (Depends-on): Likewise. + * modules/uninorm/nfkd-tests (Depends-on): Likewise. + * modules/unistdio/u16-vsnprintf-tests (Depends-on): Likewise. + * modules/unistdio/u16-vsprintf-tests (Depends-on): Likewise. + * modules/unistdio/u32-vsnprintf-tests (Depends-on): Likewise. + * modules/unistdio/u32-vsprintf-tests (Depends-on): Likewise. + * modules/unistdio/u8-vsnprintf-tests (Depends-on): Likewise. + * modules/unistdio/u8-vsprintf-tests (Depends-on): Likewise. + * modules/unistdio/ulc-vsnprintf-tests (Depends-on): Likewise. + * modules/unistdio/ulc-vsprintf-tests (Depends-on): Likewise. + * modules/unlinkat-tests (Depends-on): Likewise. + * modules/version-etc-tests (Depends-on): Likewise. + * modules/xalloc-die-tests (Depends-on): Likewise. + * modules/xmemdup0-tests (Depends-on): Likewise. + * modules/xprintf-posix-tests (Depends-on): Likewise. + * modules/xvasprintf-tests (Depends-on): Likewise. + * tests/test-argmatch.c: Do not include progname.h. + (main) Stop calling set_program_name. + * tests/test-argp-version-etc.c: Likewise. + * tests/test-argp.c: Likewise. + * tests/test-argv-iter.c: Likewise. + * tests/test-array_list.c: Likewise. + * tests/test-array_oset.c: Likewise. + * tests/test-avltree_list.c: Likewise. + * tests/test-avltree_oset.c: Likewise. + * tests/test-avltreehash_list.c: Likewise. + * tests/test-carray_list.c: Likewise. + * tests/test-copy-acl.c: Likewise. + * tests/test-copy-file.c: Likewise. + * tests/test-exclude.c: Likewise. + * tests/test-fchownat.c: Likewise. + * tests/test-fdopendir.c: Likewise. + * tests/test-filenamecat.c: Likewise. + * tests/test-fstatat.c: Likewise. + * tests/test-fstrcmp.c: Likewise. + * tests/test-linked_list.c: Likewise. + * tests/test-linkedhash_list.c: Likewise. + * tests/test-mkdirat.c: Likewise. + * tests/test-nonblocking-pipe-main.c: Likewise. + * tests/test-nonblocking-socket-main.c: Likewise. + * tests/test-obstack-printf.c: Likewise. + * tests/test-openat.c: Likewise. + * tests/test-parse-datetime.c: Likewise. + * tests/test-pipe-filter-gi1.c: Likewise. + * tests/test-pipe-filter-gi2-main.c: Likewise. + * tests/test-pipe-filter-ii1.c: Likewise. + * tests/test-pipe-filter-ii2-main.c: Likewise. + * tests/test-quotearg-simple.c: Likewise. + * tests/test-quotearg.c: Likewise. + * tests/test-rbtree_list.c: Likewise. + * tests/test-rbtree_oset.c: Likewise. + * tests/test-rbtreehash_list.c: Likewise. + * tests/test-sameacls.c: Likewise. + * tests/test-set-mode-acl.c: Likewise. + * tests/test-spawn-pipe-main.c: Likewise. + * tests/test-system-quote-main.c: Likewise. + * tests/test-unlinkat.c: Likewise. + * tests/test-version-etc.c: Likewise. + * tests/test-xalloc-die.c: Likewise. + * tests/test-xfprintf-posix.c: Likewise. + * tests/test-xmemdup0.c: Likewise. + * tests/test-xprintf-posix.c: Likewise. + * tests/test-xvasprintf.c: Likewise. + * tests/uniname/test-uninames.c: Likewise. + * tests/uninorm/test-u32-nfc-big.c: Likewise. + * tests/uninorm/test-u32-nfd-big.c: Likewise. + * tests/uninorm/test-u32-nfkc-big.c: Likewise. + * tests/uninorm/test-u32-nfkd-big.c: Likewise. + * tests/unistdio/test-u16-vsnprintf1.c: Likewise. + * tests/unistdio/test-u16-vsprintf1.c: Likewise. + * tests/unistdio/test-u32-vsnprintf1.c: Likewise. + * tests/unistdio/test-u32-vsprintf1.c: Likewise. + * tests/unistdio/test-u8-vsnprintf1.c: Likewise. + * tests/unistdio/test-u8-vsprintf1.c: Likewise. + * tests/unistdio/test-ulc-vsnprintf1.c: Likewise. + * tests/unistdio/test-ulc-vsprintf1.c: Likewise. + * tests/test-c-stack.c: (program_name): Do not define. + (main): Do not set program_name. + * tests/test-closein.c: Likewise. + * tests/test-xstrtol.c: Likewise. + * tests/test-yesno.c: Likewise. + +2016-08-18 Pino Toscano + Port modules to use getprogname explicitly, instead of requiring progname to be used (or program_name to be provided). * lib/argmatch.c: Do not include progname.h. diff --git a/modules/acl-tests b/modules/acl-tests index e755014..3438f14 100644 --- a/modules/acl-tests +++ b/modules/acl-tests @@ -12,7 +12,6 @@ tests/macros.h Depends-on: file-has-acl-tests -progname read-file unistd xalloc diff --git a/modules/argmatch-tests b/modules/argmatch-tests index 85ac3a2..cc02852 100644 --- a/modules/argmatch-tests +++ b/modules/argmatch-tests @@ -3,7 +3,6 @@ tests/test-argmatch.c tests/macros.h Depends-on: -progname configure.ac: diff --git a/modules/argp-tests b/modules/argp-tests index 8f92a4d..ce621d9 100644 --- a/modules/argp-tests +++ b/modules/argp-tests @@ -3,7 +3,6 @@ tests/test-argp.c tests/test-argp-2.sh Depends-on: -progname Makefile.am: TESTS += test-argp test-argp-2.sh diff --git a/modules/argp-version-etc-tests b/modules/argp-version-etc-tests index c4451a2..df10182 100644 --- a/modules/argp-version-etc-tests +++ b/modules/argp-version-etc-tests @@ -4,7 +4,6 @@ tests/test-argp-version-etc-1.sh Depends-on: argp -progname version-etc-fsf Makefile.am: diff --git a/modules/array-list-tests b/modules/array-list-tests index 1e9524d..d80a0e0 100644 --- a/modules/array-list-tests +++ b/modules/array-list-tests @@ -3,7 +3,6 @@ tests/test-array_list.c tests/macros.h Depends-on: -progname configure.ac: diff --git a/modules/array-oset-tests b/modules/array-oset-tests index 5791316..2ccc86f 100644 --- a/modules/array-oset-tests +++ b/modules/array-oset-tests @@ -5,7 +5,6 @@ tests/macros.h Depends-on: xlist array-list -progname configure.ac: diff --git a/modules/avltree-list-tests b/modules/avltree-list-tests index cbd47c7..97fcb3d 100644 --- a/modules/avltree-list-tests +++ b/modules/avltree-list-tests @@ -4,7 +4,6 @@ tests/macros.h Depends-on: array-list -progname configure.ac: diff --git a/modules/avltree-oset-tests b/modules/avltree-oset-tests index a29ad58..2cb98e0 100644 --- a/modules/avltree-oset-tests +++ b/modules/avltree-oset-tests @@ -4,7 +4,6 @@ tests/macros.h Depends-on: array-oset -progname configure.ac: diff --git a/modules/avltreehash-list-tests b/modules/avltreehash-list-tests index eae613e..24605ae 100644 --- a/modules/avltreehash-list-tests +++ b/modules/avltreehash-list-tests @@ -4,7 +4,6 @@ tests/macros.h Depends-on: array-list -progname configure.ac: diff --git a/modules/carray-list-tests b/modules/carray-list-tests index 4f13705..d3e7da1 100644 --- a/modules/carray-list-tests +++ b/modules/carray-list-tests @@ -4,7 +4,6 @@ tests/macros.h Depends-on: array-list -progname configure.ac: diff --git a/modules/copy-file-tests b/modules/copy-file-tests index cc06a0b..c6eaf70 100644 --- a/modules/copy-file-tests +++ b/modules/copy-file-tests @@ -8,7 +8,6 @@ tests/macros.h Depends-on: acl acl-tests -progname read-file xalloc diff --git a/modules/exclude-tests b/modules/exclude-tests index cf0f69b..f0dffe8 100644 --- a/modules/exclude-tests +++ b/modules/exclude-tests @@ -12,7 +12,6 @@ tests/test-exclude8.sh Depends-on: argmatch error -progname test-framework-sh Makefile.am: diff --git a/modules/fchownat-tests b/modules/fchownat-tests index 7b9991e..4e289bd 100644 --- a/modules/fchownat-tests +++ b/modules/fchownat-tests @@ -11,7 +11,6 @@ ignore-value mgetgroups nanosleep openat-h -progname stat-time symlink diff --git a/modules/fdopendir-tests b/modules/fdopendir-tests index 9dd53cc..6bd6711 100644 --- a/modules/fdopendir-tests +++ b/modules/fdopendir-tests @@ -7,7 +7,6 @@ Depends-on: open opendir closedir -progname configure.ac: diff --git a/modules/filenamecat-tests b/modules/filenamecat-tests index 93ccac1..14d3c17 100644 --- a/modules/filenamecat-tests +++ b/modules/filenamecat-tests @@ -3,7 +3,6 @@ tests/test-filenamecat.c Depends-on: stdbool -progname configure.ac: diff --git a/modules/fstatat-tests b/modules/fstatat-tests index 25dc559..461d891 100644 --- a/modules/fstatat-tests +++ b/modules/fstatat-tests @@ -9,7 +9,6 @@ Depends-on: getcwd-lgpl ignore-value openat-h -progname symlink configure.ac: diff --git a/modules/fstrcmp-tests b/modules/fstrcmp-tests index b82f414..fa2183c 100644 --- a/modules/fstrcmp-tests +++ b/modules/fstrcmp-tests @@ -4,7 +4,6 @@ tests/macros.h Depends-on: stdbool -progname configure.ac: diff --git a/modules/linked-list-tests b/modules/linked-list-tests index d6fd5aa..c34e49e 100644 --- a/modules/linked-list-tests +++ b/modules/linked-list-tests @@ -4,7 +4,6 @@ tests/macros.h Depends-on: array-list -progname configure.ac: diff --git a/modules/linkedhash-list-tests b/modules/linkedhash-list-tests index 5109149..6972bfd 100644 --- a/modules/linkedhash-list-tests +++ b/modules/linkedhash-list-tests @@ -4,7 +4,6 @@ tests/macros.h Depends-on: array-list -progname configure.ac: diff --git a/modules/mkdirat-tests b/modules/mkdirat-tests index 103a5ac..b2f3bef 100644 --- a/modules/mkdirat-tests +++ b/modules/mkdirat-tests @@ -6,7 +6,6 @@ tests/macros.h Depends-on: ignore-value -progname symlink configure.ac: diff --git a/modules/nonblocking-pipe-tests b/modules/nonblocking-pipe-tests index eccf839..fa3b771 100644 --- a/modules/nonblocking-pipe-tests +++ b/modules/nonblocking-pipe-tests @@ -13,7 +13,6 @@ stdbool unistd nonblocking wait-process -progname pipe-posix dup2 environ diff --git a/modules/nonblocking-socket-tests b/modules/nonblocking-socket-tests index 9c3a614..2eb883e 100644 --- a/modules/nonblocking-socket-tests +++ b/modules/nonblocking-socket-tests @@ -16,7 +16,6 @@ unistd sys_socket nonblocking wait-process -progname environ posix_spawnp netinet_in diff --git a/modules/obstack-printf-tests b/modules/obstack-printf-tests index f1c99ca..2790e69 100644 --- a/modules/obstack-printf-tests +++ b/modules/obstack-printf-tests @@ -4,7 +4,6 @@ tests/signature.h tests/macros.h Depends-on: -progname xalloc configure.ac: diff --git a/modules/openat-tests b/modules/openat-tests index c42d843..0b7370d 100644 --- a/modules/openat-tests +++ b/modules/openat-tests @@ -5,7 +5,6 @@ tests/signature.h tests/macros.h Depends-on: -progname symlink configure.ac: diff --git a/modules/parse-datetime-tests b/modules/parse-datetime-tests index 04feed2..7c62b80 100644 --- a/modules/parse-datetime-tests +++ b/modules/parse-datetime-tests @@ -3,7 +3,6 @@ tests/test-parse-datetime.c tests/macros.h Depends-on: -progname setenv configure.ac: diff --git a/modules/pipe-filter-gi-tests b/modules/pipe-filter-gi-tests index e5da562..ef6ace3 100644 --- a/modules/pipe-filter-gi-tests +++ b/modules/pipe-filter-gi-tests @@ -13,7 +13,6 @@ c-ctype read-file full-write usleep -progname configure.ac: diff --git a/modules/pipe-filter-ii-tests b/modules/pipe-filter-ii-tests index 236de13..63d35ab 100644 --- a/modules/pipe-filter-ii-tests +++ b/modules/pipe-filter-ii-tests @@ -12,7 +12,6 @@ binary-io c-ctype read-file full-write -progname configure.ac: diff --git a/modules/quotearg-simple-tests b/modules/quotearg-simple-tests index 5354c4b..3c932f0 100644 --- a/modules/quotearg-simple-tests +++ b/modules/quotearg-simple-tests @@ -6,7 +6,6 @@ tests/zerosize-ptr.h m4/mmap-anon.m4 Depends-on: -progname stdint configure.ac: diff --git a/modules/quotearg-tests b/modules/quotearg-tests index 1af4eff..885d459 100644 --- a/modules/quotearg-tests +++ b/modules/quotearg-tests @@ -13,7 +13,6 @@ m4/codeset.m4 Depends-on: gettext -progname stdint setenv unsetenv diff --git a/modules/rbtree-list-tests b/modules/rbtree-list-tests index c4262ab..6651b48 100644 --- a/modules/rbtree-list-tests +++ b/modules/rbtree-list-tests @@ -4,7 +4,6 @@ tests/macros.h Depends-on: array-list -progname configure.ac: diff --git a/modules/rbtree-oset-tests b/modules/rbtree-oset-tests index db69078..366faf2 100644 --- a/modules/rbtree-oset-tests +++ b/modules/rbtree-oset-tests @@ -4,7 +4,6 @@ tests/macros.h Depends-on: array-oset -progname configure.ac: diff --git a/modules/rbtreehash-list-tests b/modules/rbtreehash-list-tests index 446e44d..d27b2bc 100644 --- a/modules/rbtreehash-list-tests +++ b/modules/rbtreehash-list-tests @@ -4,7 +4,6 @@ tests/macros.h Depends-on: array-list -progname configure.ac: diff --git a/modules/spawn-pipe-tests b/modules/spawn-pipe-tests index e17eece..f7831d5 100644 --- a/modules/spawn-pipe-tests +++ b/modules/spawn-pipe-tests @@ -6,7 +6,6 @@ tests/macros.h Depends-on: close -progname configure.ac: diff --git a/modules/system-quote-tests b/modules/system-quote-tests index 7b6967b..eb69bbd 100644 --- a/modules/system-quote-tests +++ b/modules/system-quote-tests @@ -10,7 +10,6 @@ tests/macros.h Depends-on: stdbool unistd -progname popen pclose diff --git a/modules/uniname/uniname-tests b/modules/uniname/uniname-tests index 14ccc4e..296b237 100644 --- a/modules/uniname/uniname-tests +++ b/modules/uniname/uniname-tests @@ -7,7 +7,6 @@ tests/uniname/NameAliases.txt Depends-on: xalloc -progname configure.ac: diff --git a/modules/uninorm/nfc-tests b/modules/uninorm/nfc-tests index 9a571ea..a32548c 100644 --- a/modules/uninorm/nfc-tests +++ b/modules/uninorm/nfc-tests @@ -16,7 +16,6 @@ unistr/u16-cmp unistr/u32-cmp unistr/u32-strlen xalloc -progname configure.ac: AC_CHECK_DECLS_ONCE([alarm]) diff --git a/modules/uninorm/nfd-tests b/modules/uninorm/nfd-tests index 047c8a7..2aa5a70 100644 --- a/modules/uninorm/nfd-tests +++ b/modules/uninorm/nfd-tests @@ -16,7 +16,6 @@ unistr/u16-cmp unistr/u32-cmp unistr/u32-strlen xalloc -progname configure.ac: AC_CHECK_DECLS_ONCE([alarm]) diff --git a/modules/uninorm/nfkc-tests b/modules/uninorm/nfkc-tests index 3d8b1a9..52a75d5 100644 --- a/modules/uninorm/nfkc-tests +++ b/modules/uninorm/nfkc-tests @@ -16,7 +16,6 @@ unistr/u16-cmp unistr/u32-cmp unistr/u32-strlen xalloc -progname configure.ac: AC_CHECK_DECLS_ONCE([alarm]) diff --git a/modules/uninorm/nfkd-tests b/modules/uninorm/nfkd-tests index d3cb5d9..2705c63 100644 --- a/modules/uninorm/nfkd-tests +++ b/modules/uninorm/nfkd-tests @@ -16,7 +16,6 @@ unistr/u16-cmp unistr/u32-cmp unistr/u32-strlen xalloc -progname configure.ac: AC_CHECK_DECLS_ONCE([alarm]) diff --git a/modules/unistdio/u16-vsnprintf-tests b/modules/unistdio/u16-vsnprintf-tests index cb17e77..6d25e27 100644 --- a/modules/unistdio/u16-vsnprintf-tests +++ b/modules/unistdio/u16-vsnprintf-tests @@ -5,7 +5,6 @@ tests/macros.h Depends-on: xalloc -progname configure.ac: diff --git a/modules/unistdio/u16-vsprintf-tests b/modules/unistdio/u16-vsprintf-tests index 1eff147..4755783 100644 --- a/modules/unistdio/u16-vsprintf-tests +++ b/modules/unistdio/u16-vsprintf-tests @@ -5,7 +5,6 @@ tests/macros.h Depends-on: xalloc -progname configure.ac: diff --git a/modules/unistdio/u32-vsnprintf-tests b/modules/unistdio/u32-vsnprintf-tests index d1536b5..d272f76 100644 --- a/modules/unistdio/u32-vsnprintf-tests +++ b/modules/unistdio/u32-vsnprintf-tests @@ -5,7 +5,6 @@ tests/macros.h Depends-on: xalloc -progname configure.ac: diff --git a/modules/unistdio/u32-vsprintf-tests b/modules/unistdio/u32-vsprintf-tests index 37fdaab..37d2f35 100644 --- a/modules/unistdio/u32-vsprintf-tests +++ b/modules/unistdio/u32-vsprintf-tests @@ -5,7 +5,6 @@ tests/macros.h Depends-on: xalloc -progname configure.ac: diff --git a/modules/unistdio/u8-vsnprintf-tests b/modules/unistdio/u8-vsnprintf-tests index 98f8157..1084051 100644 --- a/modules/unistdio/u8-vsnprintf-tests +++ b/modules/unistdio/u8-vsnprintf-tests @@ -5,7 +5,6 @@ tests/macros.h Depends-on: xalloc -progname configure.ac: diff --git a/modules/unistdio/u8-vsprintf-tests b/modules/unistdio/u8-vsprintf-tests index ca8a20d..328242a 100644 --- a/modules/unistdio/u8-vsprintf-tests +++ b/modules/unistdio/u8-vsprintf-tests @@ -5,7 +5,6 @@ tests/macros.h Depends-on: xalloc -progname configure.ac: diff --git a/modules/unistdio/ulc-vsnprintf-tests b/modules/unistdio/ulc-vsnprintf-tests index 307b73f..112456b 100644 --- a/modules/unistdio/ulc-vsnprintf-tests +++ b/modules/unistdio/ulc-vsnprintf-tests @@ -5,7 +5,6 @@ tests/macros.h Depends-on: xalloc -progname configure.ac: diff --git a/modules/unistdio/ulc-vsprintf-tests b/modules/unistdio/ulc-vsprintf-tests index 7f96872..147dc9b 100644 --- a/modules/unistdio/ulc-vsprintf-tests +++ b/modules/unistdio/ulc-vsprintf-tests @@ -5,7 +5,6 @@ tests/macros.h Depends-on: xalloc -progname configure.ac: diff --git a/modules/unlinkat-tests b/modules/unlinkat-tests index 266ead7..b0f3537 100644 --- a/modules/unlinkat-tests +++ b/modules/unlinkat-tests @@ -7,7 +7,6 @@ tests/macros.h Depends-on: ignore-value -progname symlink unlinkdir diff --git a/modules/version-etc-tests b/modules/version-etc-tests index 54936db..d67bd22 100644 --- a/modules/version-etc-tests +++ b/modules/version-etc-tests @@ -3,7 +3,6 @@ tests/test-version-etc.c tests/test-version-etc.sh Depends-on: -progname version-etc-fsf Makefile.am: diff --git a/modules/xalloc-die-tests b/modules/xalloc-die-tests index e611f80..e13ecea 100644 --- a/modules/xalloc-die-tests +++ b/modules/xalloc-die-tests @@ -3,7 +3,6 @@ tests/test-xalloc-die.c tests/test-xalloc-die.sh Depends-on: -progname test-framework-sh Makefile.am: diff --git a/modules/xmemdup0-tests b/modules/xmemdup0-tests index 13311f0..5bb5b76 100644 --- a/modules/xmemdup0-tests +++ b/modules/xmemdup0-tests @@ -3,7 +3,6 @@ tests/test-xmemdup0.c tests/macros.h Depends-on: -progname configure.ac: diff --git a/modules/xprintf-posix-tests b/modules/xprintf-posix-tests index a8b2984..1e5cc3d 100644 --- a/modules/xprintf-posix-tests +++ b/modules/xprintf-posix-tests @@ -10,7 +10,6 @@ tests/macros.h Depends-on: stdint -progname configure.ac: diff --git a/modules/xvasprintf-tests b/modules/xvasprintf-tests index 77d536e..7e14844 100644 --- a/modules/xvasprintf-tests +++ b/modules/xvasprintf-tests @@ -3,7 +3,6 @@ tests/test-xvasprintf.c tests/macros.h Depends-on: -progname configure.ac: diff --git a/tests/test-argmatch.c b/tests/test-argmatch.c index 9a3a4a9..8974943 100644 --- a/tests/test-argmatch.c +++ b/tests/test-argmatch.c @@ -23,7 +23,6 @@ #include -#include "progname.h" #include "macros.h" /* Some packages define ARGMATCH_DIE and ARGMATCH_DIE_DECL in , and @@ -63,8 +62,6 @@ static const enum backup_type backup_vals[] = int main (int argc, char *argv[]) { - set_program_name (argv[0]); - /* Not found. */ ASSERT (ARGMATCH ("klingon", backup_args, backup_vals) == -1); diff --git a/tests/test-argp-version-etc.c b/tests/test-argp-version-etc.c index 9940604..cfef0d9 100644 --- a/tests/test-argp-version-etc.c +++ b/tests/test-argp-version-etc.c @@ -18,7 +18,6 @@ #include #include "argp-version-etc.h" #include "argp.h" -#include "progname.h" static char doc[] = "test for the argp-version-etc module"; @@ -42,7 +41,6 @@ const char *authors[] = int main (int argc, char **argv) { - set_program_name (argv[0]); argp_version_setup ("test-argp-version-etc", authors); return argp_parse (&test_argp, argc, argv, 0, NULL, NULL); } diff --git a/tests/test-argp.c b/tests/test-argp.c index d786953..0f5495e 100644 --- a/tests/test-argp.c +++ b/tests/test-argp.c @@ -25,7 +25,6 @@ #if HAVE_STRINGS_H # include #endif -#include "progname.h" struct test_args { @@ -459,8 +458,6 @@ main (int argc, char **argv) struct argp_child argp_children[3], group1_children[2], group2_children[2]; test_fp *fun; - set_program_name (argv[0]); - group1_children[0] = group1_1_child; group1_children[1].argp = NULL; group1_argp.children = group1_children; diff --git a/tests/test-argv-iter.c b/tests/test-argv-iter.c index f4ce9e6..e7fc602 100644 --- a/tests/test-argv-iter.c +++ b/tests/test-argv-iter.c @@ -47,7 +47,6 @@ write_nul_delimited_argv (char **argv) int main (void) { - /* set_program_name (argv[0]); placate overzealous "syntax-check" test. */ static char one[] = "1"; static char two[] = "2"; static char three[] = "3"; diff --git a/tests/test-array_list.c b/tests/test-array_list.c index 88e2bb2..efdd579 100644 --- a/tests/test-array_list.c +++ b/tests/test-array_list.c @@ -21,7 +21,6 @@ #include -#include "progname.h" #include "macros.h" static const char *objects[15] = @@ -50,8 +49,6 @@ main (int argc, char *argv[]) { gl_list_t list1, list2; - set_program_name (argv[0]); - /* Allow the user to provide a non-default random seed on the command line. */ if (argc > 1) srand (atoi (argv[1])); diff --git a/tests/test-array_oset.c b/tests/test-array_oset.c index 2cf05eb..08a6102 100644 --- a/tests/test-array_oset.c +++ b/tests/test-array_oset.c @@ -24,7 +24,6 @@ #include "gl_xlist.h" #include "gl_array_list.h" -#include "progname.h" #include "macros.h" static const char *objects[30] = @@ -73,8 +72,6 @@ main (int argc, char *argv[]) gl_oset_t set1; gl_list_t set2; - set_program_name (argv[0]); - /* Allow the user to provide a non-default random seed on the command line. */ if (argc > 1) srand (atoi (argv[1])); diff --git a/tests/test-avltree_list.c b/tests/test-avltree_list.c index 039fbe8..21a1088 100644 --- a/tests/test-avltree_list.c +++ b/tests/test-avltree_list.c @@ -22,7 +22,6 @@ #include #include "gl_array_list.h" -#include "progname.h" #include "macros.h" extern void gl_avltree_list_check_invariants (gl_list_t list); @@ -62,8 +61,6 @@ main (int argc, char *argv[]) { gl_list_t list1, list2, list3; - set_program_name (argv[0]); - /* Allow the user to provide a non-default random seed on the command line. */ if (argc > 1) srand (atoi (argv[1])); diff --git a/tests/test-avltree_oset.c b/tests/test-avltree_oset.c index 9d0ceab..c134a22 100644 --- a/tests/test-avltree_oset.c +++ b/tests/test-avltree_oset.c @@ -23,7 +23,6 @@ #include #include "gl_array_oset.h" -#include "progname.h" #include "macros.h" extern void gl_avltree_oset_check_invariants (gl_oset_t set); @@ -72,8 +71,6 @@ main (int argc, char *argv[]) { gl_oset_t set1, set2; - set_program_name (argv[0]); - /* Allow the user to provide a non-default random seed on the command line. */ if (argc > 1) srand (atoi (argv[1])); diff --git a/tests/test-avltreehash_list.c b/tests/test-avltreehash_list.c index fcbe3d1..ff46f19 100644 --- a/tests/test-avltreehash_list.c +++ b/tests/test-avltreehash_list.c @@ -24,7 +24,6 @@ #include #include "gl_array_list.h" -#include "progname.h" #include "macros.h" extern void gl_avltreehash_list_check_invariants (gl_list_t list); @@ -89,8 +88,6 @@ main (int argc, char *argv[]) { gl_list_t list1, list2, list3; - set_program_name (argv[0]); - /* Allow the user to provide a non-default random seed on the command line. */ if (argc > 1) srand (atoi (argv[1])); diff --git a/tests/test-c-stack.c b/tests/test-c-stack.c index 073f1c6..238fc11 100644 --- a/tests/test-c-stack.c +++ b/tests/test-c-stack.c @@ -30,8 +30,6 @@ #include "macros.h" -char *program_name; - static volatile int * recurse_1 (volatile int n, volatile int *p) { @@ -60,7 +58,6 @@ main (int argc, char **argv) setrlimit (RLIMIT_STACK, &rl); #endif - program_name = argv[0]; if (c_stack_action (NULL) == 0) { if (1 < argc) diff --git a/tests/test-carray_list.c b/tests/test-carray_list.c index 46c1fee..828e2ba 100644 --- a/tests/test-carray_list.c +++ b/tests/test-carray_list.c @@ -22,7 +22,6 @@ #include #include "gl_array_list.h" -#include "progname.h" #include "macros.h" static const char *objects[15] = @@ -58,8 +57,6 @@ main (int argc, char *argv[]) { gl_list_t list1, list2, list3; - set_program_name (argv[0]); - /* Allow the user to provide a non-default random seed on the command line. */ if (argc > 1) srand (atoi (argv[1])); diff --git a/tests/test-closein.c b/tests/test-closein.c index 77fd69c..8710a4d 100644 --- a/tests/test-closein.c +++ b/tests/test-closein.c @@ -27,8 +27,6 @@ #include "binary-io.h" #include "ignore-value.h" -char *program_name; - /* With no arguments, do nothing. With arguments, attempt to consume first 6 bytes of stdin. In either case, let exit() take care of closing std streams and changing exit status if ferror(stdin). */ @@ -37,7 +35,6 @@ main (int argc, char **argv) { char buf[7]; atexit (close_stdin); - program_name = argv[0]; /* close_stdin currently relies on ftell, but mingw ftell is unreliable on text mode input. */ diff --git a/tests/test-copy-acl.c b/tests/test-copy-acl.c index 93bcf42..1dfd2e2 100644 --- a/tests/test-copy-acl.c +++ b/tests/test-copy-acl.c @@ -27,7 +27,6 @@ #include #include -#include "progname.h" #include "macros.h" int @@ -40,8 +39,6 @@ main (int argc, char *argv[]) int mode; int fd2; - set_program_name (argv[0]); - ASSERT (argc == 3); file1 = argv[1]; diff --git a/tests/test-copy-file.c b/tests/test-copy-file.c index 57bd930..47e8872 100644 --- a/tests/test-copy-file.c +++ b/tests/test-copy-file.c @@ -22,7 +22,6 @@ #include -#include "progname.h" #include "macros.h" int @@ -32,8 +31,6 @@ main (int argc, char *argv[]) const char *file2; int null_stderr; - set_program_name (argv[0]); - ASSERT (argc == 3); file1 = argv[1]; diff --git a/tests/test-exclude.c b/tests/test-exclude.c index 9b20ba5..7a13faf 100644 --- a/tests/test-exclude.c +++ b/tests/test-exclude.c @@ -24,7 +24,6 @@ #include #include "exclude.h" -#include "progname.h" #include "error.h" #include "argmatch.h" @@ -75,8 +74,6 @@ main (int argc, char **argv) int exclude_options = 0; struct exclude *exclude = new_exclude (); - set_program_name (argv[0]); - if (argc == 1) error (1, 0, "usage: %s file -- words...", argv[0]); diff --git a/tests/test-fchownat.c b/tests/test-fchownat.c index 926a2a9..9536047 100644 --- a/tests/test-fchownat.c +++ b/tests/test-fchownat.c @@ -32,7 +32,6 @@ SIGNATURE_CHECK (fchownat, int, (int, char const *, uid_t, gid_t, int)); #include "mgetgroups.h" #include "openat.h" -#include "progname.h" #include "stat-time.h" #include "ignore-value.h" #include "macros.h" @@ -64,8 +63,6 @@ main (int argc _GL_UNUSED, char *argv[]) int result1; /* Skip because of no chown/symlink support. */ int result2; /* Skip because of no lchown support. */ - set_program_name (argv[0]); - /* Clean up any trash from prior testsuite runs. */ ignore_value (system ("rm -rf " BASE "*")); diff --git a/tests/test-fdopendir.c b/tests/test-fdopendir.c index 683b55c..4f190eb 100644 --- a/tests/test-fdopendir.c +++ b/tests/test-fdopendir.c @@ -27,7 +27,6 @@ SIGNATURE_CHECK (fdopendir, DIR *, (int)); #include #include -#include "progname.h" #include "macros.h" int @@ -36,8 +35,6 @@ main (int argc _GL_UNUSED, char *argv[]) DIR *d; int fd; - set_program_name (argv[0]); - /* A non-directory cannot be turned into a directory stream. */ fd = open ("test-fdopendir.tmp", O_RDONLY | O_CREAT, 0600); ASSERT (0 <= fd); diff --git a/tests/test-filenamecat.c b/tests/test-filenamecat.c index 79f752f..06e551a 100644 --- a/tests/test-filenamecat.c +++ b/tests/test-filenamecat.c @@ -26,7 +26,6 @@ #include #include -#include "progname.h" int main (int argc _GL_UNUSED, char *argv[]) @@ -49,8 +48,6 @@ main (int argc _GL_UNUSED, char *argv[]) unsigned int i; bool fail = false; - set_program_name (argv[0]); - for (i = 0; i < sizeof tests / sizeof tests[0]; i++) { char *base_in_result; diff --git a/tests/test-fstatat.c b/tests/test-fstatat.c index fdcf51c..ace54b8 100644 --- a/tests/test-fstatat.c +++ b/tests/test-fstatat.c @@ -31,7 +31,6 @@ SIGNATURE_CHECK (fstatat, int, (int, char const *, struct stat *, int)); #include #include "openat.h" -#include "progname.h" #include "same-inode.h" #include "ignore-value.h" #include "macros.h" @@ -72,8 +71,6 @@ main (int argc _GL_UNUSED, char *argv[]) { int result; - set_program_name (argv[0]); - /* Remove any leftovers from a previous partial run. */ ignore_value (system ("rm -rf " BASE "*")); diff --git a/tests/test-fstrcmp.c b/tests/test-fstrcmp.c index c109444..7782686 100644 --- a/tests/test-fstrcmp.c +++ b/tests/test-fstrcmp.c @@ -22,7 +22,6 @@ #include -#include "progname.h" #include "macros.h" static bool @@ -66,8 +65,6 @@ check_fstrcmp (const char *string1, const char *string2, double expected) int main (int argc, char *argv[]) { - set_program_name (argv[0]); - ASSERT (check_fstrcmp ("Langstrumpf", "Langstrumpf", 1.0)); ASSERT (check_fstrcmp ("Levenshtein", "Levenstein", 20./21.)); ASSERT (check_fstrcmp ("Levenstein", "Levenshtein", 20./21.)); diff --git a/tests/test-linked_list.c b/tests/test-linked_list.c index da38df5..ffade79 100644 --- a/tests/test-linked_list.c +++ b/tests/test-linked_list.c @@ -22,7 +22,6 @@ #include #include "gl_array_list.h" -#include "progname.h" #include "macros.h" static const char *objects[15] = @@ -58,8 +57,6 @@ main (int argc, char *argv[]) { gl_list_t list1, list2, list3; - set_program_name (argv[0]); - /* Allow the user to provide a non-default random seed on the command line. */ if (argc > 1) srand (atoi (argv[1])); diff --git a/tests/test-linkedhash_list.c b/tests/test-linkedhash_list.c index 946df5d..5da90c2 100644 --- a/tests/test-linkedhash_list.c +++ b/tests/test-linkedhash_list.c @@ -24,7 +24,6 @@ #include #include "gl_array_list.h" -#include "progname.h" #include "macros.h" static const char *objects[15] = @@ -85,8 +84,6 @@ main (int argc, char *argv[]) { gl_list_t list1, list2, list3; - set_program_name (argv[0]); - /* Allow the user to provide a non-default random seed on the command line. */ if (argc > 1) srand (atoi (argv[1])); diff --git a/tests/test-mkdirat.c b/tests/test-mkdirat.c index 4aedae5..1cfab8e 100644 --- a/tests/test-mkdirat.c +++ b/tests/test-mkdirat.c @@ -30,7 +30,6 @@ SIGNATURE_CHECK (mkdirat, int, (int, char const *, mode_t)); #include #include -#include "progname.h" #include "ignore-value.h" #include "macros.h" @@ -52,8 +51,6 @@ main (int argc _GL_UNUSED, char *argv[]) { int result; - set_program_name (argv[0]); - /* Clean up any trash from prior testsuite runs. */ ignore_value (system ("rm -rf " BASE "*")); diff --git a/tests/test-nonblocking-pipe-main.c b/tests/test-nonblocking-pipe-main.c index c350678..3d6be82 100644 --- a/tests/test-nonblocking-pipe-main.c +++ b/tests/test-nonblocking-pipe-main.c @@ -32,7 +32,6 @@ #include "nonblocking.h" #include "wait-process.h" -#include "progname.h" #include "macros.h" #include "test-nonblocking-pipe.h" @@ -48,8 +47,6 @@ main (int argc, char *argv[]) int child; int exitcode; - set_program_name (argv[0]); - child_path = argv[1]; test = atoi (argv[2]); diff --git a/tests/test-nonblocking-socket-main.c b/tests/test-nonblocking-socket-main.c index 045b7ae..d08014a 100644 --- a/tests/test-nonblocking-socket-main.c +++ b/tests/test-nonblocking-socket-main.c @@ -33,7 +33,6 @@ #include "nonblocking.h" #include "wait-process.h" -#include "progname.h" #include "macros.h" #include "socket-server.h" @@ -52,8 +51,6 @@ main (int argc, char *argv[]) int server_socket; int exitcode; - set_program_name (argv[0]); - child_path = argv[1]; test = atoi (argv[2]); diff --git a/tests/test-obstack-printf.c b/tests/test-obstack-printf.c index b8e176d..0c63dc4 100644 --- a/tests/test-obstack-printf.c +++ b/tests/test-obstack-printf.c @@ -32,7 +32,6 @@ SIGNATURE_CHECK (obstack_vprintf, int, (struct obstack *, char const *, #include #include -#include "progname.h" #include "macros.h" #define obstack_chunk_alloc xmalloc @@ -130,8 +129,6 @@ test_obstack_printf () int main (int argc, char *argv[]) { - set_program_name (argv[0]); - test_obstack_vprintf (); test_obstack_printf (); return 0; diff --git a/tests/test-openat.c b/tests/test-openat.c index 4bdee9b..06a7b4d 100644 --- a/tests/test-openat.c +++ b/tests/test-openat.c @@ -29,7 +29,6 @@ SIGNATURE_CHECK (openat, int, (int, char const *, int, ...)); #include #include -#include "progname.h" #include "macros.h" #define BASE "test-openat.t" @@ -63,8 +62,6 @@ main (int argc _GL_UNUSED, char *argv[]) { int result; - set_program_name (argv[0]); - /* Test behaviour for invalid file descriptors. */ { errno = 0; diff --git a/tests/test-parse-datetime.c b/tests/test-parse-datetime.c index 16a2136..c94fdf3 100644 --- a/tests/test-parse-datetime.c +++ b/tests/test-parse-datetime.c @@ -24,7 +24,6 @@ #include #include -#include "progname.h" #include "macros.h" #ifdef DEBUG @@ -121,8 +120,6 @@ main (int argc _GL_UNUSED, char **argv) long gmtoff; time_t ref_time = 1304250918; - set_program_name (argv[0]); - /* Set the time zone to US Eastern time with the 2012 rules. This should disable any leap second support. Otherwise, there will be a problem with glibc on sites that default to leap seconds; see diff --git a/tests/test-pipe-filter-gi1.c b/tests/test-pipe-filter-gi1.c index a2c2915..939374b 100644 --- a/tests/test-pipe-filter-gi1.c +++ b/tests/test-pipe-filter-gi1.c @@ -22,7 +22,6 @@ #include "binary-io.h" #include "c-ctype.h" #include "read-file.h" -#include "progname.h" #include "macros.h" @@ -75,8 +74,6 @@ main (int argc, char *argv[]) size_t input_size; char *input; - set_program_name (argv[0]); - ASSERT (argc == 3); tr_program = argv[1]; diff --git a/tests/test-pipe-filter-gi2-main.c b/tests/test-pipe-filter-gi2-main.c index 865d1c3..b7738b9 100644 --- a/tests/test-pipe-filter-gi2-main.c +++ b/tests/test-pipe-filter-gi2-main.c @@ -27,7 +27,6 @@ #include #include "full-write.h" -#include "progname.h" #include "macros.h" /* 0.1 sec pause */ @@ -73,8 +72,6 @@ main (int argc, char **argv) struct pipe_filter_gi *f; const char *path[] = { NULL, NULL }; - set_program_name (argv[0]); - ASSERT (argc == 2); /* Test writing to a nonexistent program traps sooner or later. */ diff --git a/tests/test-pipe-filter-ii1.c b/tests/test-pipe-filter-ii1.c index 5096673..7155733 100644 --- a/tests/test-pipe-filter-ii1.c +++ b/tests/test-pipe-filter-ii1.c @@ -22,7 +22,6 @@ #include "binary-io.h" #include "c-ctype.h" #include "read-file.h" -#include "progname.h" #include "macros.h" @@ -97,8 +96,6 @@ main (int argc, char *argv[]) size_t input_size; char *input; - set_program_name (argv[0]); - ASSERT (argc == 3); tr_program = argv[1]; diff --git a/tests/test-pipe-filter-ii2-main.c b/tests/test-pipe-filter-ii2-main.c index 60a3752..b0f069e 100644 --- a/tests/test-pipe-filter-ii2-main.c +++ b/tests/test-pipe-filter-ii2-main.c @@ -27,7 +27,6 @@ #include #include "full-write.h" -#include "progname.h" #include "macros.h" struct locals @@ -87,8 +86,6 @@ main (int argc, char **argv) { const char *path[] = { NULL, NULL }; - set_program_name (argv[0]); - ASSERT (argc == 2); /* Test writing to a nonexistent program traps sooner or later. */ diff --git a/tests/test-quotearg-simple.c b/tests/test-quotearg-simple.c index 6bb4b35..65584da 100644 --- a/tests/test-quotearg-simple.c +++ b/tests/test-quotearg-simple.c @@ -27,7 +27,6 @@ #include #include "localcharset.h" -#include "progname.h" #include "macros.h" #include "zerosize-ptr.h" @@ -251,8 +250,6 @@ main (int argc _GL_UNUSED, char *argv[]) int i; bool ascii_only = MB_CUR_MAX == 1 && !isprint ((unsigned char) LQ[0]); - set_program_name (argv[0]); - /* This part of the program is hard-wired to the C locale since it does not call setlocale. However, according to POSIX, the use of 8-bit bytes in a character context in the C locale gives diff --git a/tests/test-quotearg.c b/tests/test-quotearg.c index d39c892..e43573d 100644 --- a/tests/test-quotearg.c +++ b/tests/test-quotearg.c @@ -26,7 +26,6 @@ #include #include -#include "progname.h" #include "gettext.h" #include "macros.h" @@ -63,8 +62,6 @@ static struct result_groups locale_results[] = { int main (int argc _GL_UNUSED, char *argv[]) { - set_program_name (argv[0]); - #if ENABLE_NLS /* Clean up environment. */ unsetenv ("LANGUAGE"); diff --git a/tests/test-rbtree_list.c b/tests/test-rbtree_list.c index 62a56bf..d138e2f 100644 --- a/tests/test-rbtree_list.c +++ b/tests/test-rbtree_list.c @@ -22,7 +22,6 @@ #include #include "gl_array_list.h" -#include "progname.h" #include "macros.h" extern void gl_rbtree_list_check_invariants (gl_list_t list); @@ -62,8 +61,6 @@ main (int argc, char *argv[]) { gl_list_t list1, list2, list3; - set_program_name (argv[0]); - /* Allow the user to provide a non-default random seed on the command line. */ if (argc > 1) srand (atoi (argv[1])); diff --git a/tests/test-rbtree_oset.c b/tests/test-rbtree_oset.c index 9b4c517..9155301 100644 --- a/tests/test-rbtree_oset.c +++ b/tests/test-rbtree_oset.c @@ -23,7 +23,6 @@ #include #include "gl_array_oset.h" -#include "progname.h" #include "macros.h" extern void gl_rbtree_oset_check_invariants (gl_oset_t set); @@ -72,8 +71,6 @@ main (int argc, char *argv[]) { gl_oset_t set1, set2; - set_program_name (argv[0]); - /* Allow the user to provide a non-default random seed on the command line. */ if (argc > 1) srand (atoi (argv[1])); diff --git a/tests/test-rbtreehash_list.c b/tests/test-rbtreehash_list.c index 8bd9856..12fddf1 100644 --- a/tests/test-rbtreehash_list.c +++ b/tests/test-rbtreehash_list.c @@ -24,7 +24,6 @@ #include #include "gl_array_list.h" -#include "progname.h" #include "macros.h" extern void gl_rbtreehash_list_check_invariants (gl_list_t list); @@ -89,8 +88,6 @@ main (int argc, char *argv[]) { gl_list_t list1, list2, list3; - set_program_name (argv[0]); - /* Allow the user to provide a non-default random seed on the command line. */ if (argc > 1) srand (atoi (argv[1])); diff --git a/tests/test-sameacls.c b/tests/test-sameacls.c index 4f78e09..aa34ae6 100644 --- a/tests/test-sameacls.c +++ b/tests/test-sameacls.c @@ -33,7 +33,6 @@ # include #endif -#include "progname.h" #include "read-file.h" #include "xalloc.h" #include "macros.h" @@ -44,8 +43,6 @@ main (int argc, char *argv[]) const char *file1; const char *file2; - set_program_name (argv[0]); - ASSERT (argc == 3); file1 = argv[1]; diff --git a/tests/test-set-mode-acl.c b/tests/test-set-mode-acl.c index 028a09b..d50dbff 100644 --- a/tests/test-set-mode-acl.c +++ b/tests/test-set-mode-acl.c @@ -22,7 +22,6 @@ #include -#include "progname.h" #include "macros.h" int @@ -31,8 +30,6 @@ main (int argc, char *argv[]) const char *file; int mode; - set_program_name (argv[0]); - ASSERT (argc == 3); file = argv[1]; diff --git a/tests/test-spawn-pipe-main.c b/tests/test-spawn-pipe-main.c index 2275238..6986eef 100644 --- a/tests/test-spawn-pipe-main.c +++ b/tests/test-spawn-pipe-main.c @@ -18,7 +18,6 @@ #include "spawn-pipe.h" #include "wait-process.h" -#include "progname.h" #include #include @@ -80,8 +79,6 @@ main (int argc, char *argv[]) int test; int fd; - set_program_name (argv[0]); - if (argc != 3) { fprintf (stderr, "%s: need 2 arguments\n", argv[0]); diff --git a/tests/test-system-quote-main.c b/tests/test-system-quote-main.c index 091f4c8..8eb6a17 100644 --- a/tests/test-system-quote-main.c +++ b/tests/test-system-quote-main.c @@ -36,7 +36,6 @@ # include #endif -#include "progname.h" #include "macros.h" #define EXPECTED_DATA_FILE "t-sq-data.tmp" @@ -318,8 +317,6 @@ main (int argc, char *argv[]) { char *prog; - set_program_name (argv[0]); - if (argc != 2) { fprintf (stderr, "%s: need 1 argument\n", argv[0]); diff --git a/tests/test-unlinkat.c b/tests/test-unlinkat.c index c55a2e2..f6c7b6d 100644 --- a/tests/test-unlinkat.c +++ b/tests/test-unlinkat.c @@ -30,7 +30,6 @@ SIGNATURE_CHECK (unlinkat, int, (int, char const *, int)); #include #include -#include "progname.h" #include "unlinkdir.h" #include "ignore-value.h" #include "macros.h" @@ -63,8 +62,6 @@ main (int argc _GL_UNUSED, char *argv[]) int result1; int result2; - set_program_name (argv[0]); - /* Remove any leftovers from a previous partial run. */ ignore_value (system ("rm -rf " BASE "*")); diff --git a/tests/test-version-etc.c b/tests/test-version-etc.c index 4382c76..66404a3 100644 --- a/tests/test-version-etc.c +++ b/tests/test-version-etc.c @@ -19,14 +19,12 @@ #include "version-etc.h" -#include "progname.h" #define AUTHORS "Sergey Poznyakoff", "Eric Blake" int main (int argc _GL_UNUSED, char **argv) { - set_program_name (argv[0]); version_etc (stdout, "test-version-etc", "dummy", "0", AUTHORS, (const char *) NULL); return 0; diff --git a/tests/test-xalloc-die.c b/tests/test-xalloc-die.c index 9329750..f681ca5 100644 --- a/tests/test-xalloc-die.c +++ b/tests/test-xalloc-die.c @@ -19,12 +19,10 @@ #include #include "xalloc.h" -#include "progname.h" int main (int argc _GL_UNUSED, char **argv) { - set_program_name (argv[0]); xalloc_die (); return 0; } diff --git a/tests/test-xfprintf-posix.c b/tests/test-xfprintf-posix.c index 1477d14..2b2c2e7 100644 --- a/tests/test-xfprintf-posix.c +++ b/tests/test-xfprintf-posix.c @@ -25,7 +25,6 @@ #include #include -#include "progname.h" #include "macros.h" #include "test-fprintf-posix.h" @@ -33,8 +32,6 @@ int main (int argc _GL_UNUSED, char *argv[]) { - set_program_name (argv[0]); - test_function (xfprintf); return 0; } diff --git a/tests/test-xmemdup0.c b/tests/test-xmemdup0.c index bbe94ca..6f00512 100644 --- a/tests/test-xmemdup0.c +++ b/tests/test-xmemdup0.c @@ -23,7 +23,6 @@ #include #include -#include "progname.h" #include "macros.h" int @@ -32,8 +31,6 @@ main (int argc, char **argv) char buffer[10] = { 'a', 'b', 'c', 'd', '\0', 'f', 'g', 'h', 'i', 'j' }; - set_program_name (argv[0]); - /* Empty string. */ { char *result = xmemdup0 (NULL, 0); diff --git a/tests/test-xprintf-posix.c b/tests/test-xprintf-posix.c index ceddf1a..420b409 100644 --- a/tests/test-xprintf-posix.c +++ b/tests/test-xprintf-posix.c @@ -24,7 +24,6 @@ #include #include -#include "progname.h" #include "macros.h" #include "test-printf-posix.h" @@ -32,8 +31,6 @@ int main (int argc _GL_UNUSED, char *argv[]) { - set_program_name (argv[0]); - test_function (xprintf); return 0; } diff --git a/tests/test-xstrtol.c b/tests/test-xstrtol.c index fef45e5..d145282 100644 --- a/tests/test-xstrtol.c +++ b/tests/test-xstrtol.c @@ -29,8 +29,6 @@ # define __spec "ld" #endif -char *program_name; - /* Don't show the program name in error messages. */ static void print_no_progname (void) @@ -43,7 +41,6 @@ main (int argc, char **argv) strtol_error s_err; int i; - program_name = argv[0]; error_print_progname = print_no_progname; for (i = 1; i < argc; i++) diff --git a/tests/test-xvasprintf.c b/tests/test-xvasprintf.c index 985fe2e..14d7efa 100644 --- a/tests/test-xvasprintf.c +++ b/tests/test-xvasprintf.c @@ -31,7 +31,6 @@ #include #include -#include "progname.h" #include "macros.h" static char * @@ -129,8 +128,6 @@ test_xasprintf (void) int main (int argc _GL_UNUSED, char *argv[]) { - set_program_name (argv[0]); - test_xvasprintf (); test_xasprintf (); diff --git a/tests/test-yesno.c b/tests/test-yesno.c index 1d8e6b9..2d59a60 100644 --- a/tests/test-yesno.c +++ b/tests/test-yesno.c @@ -27,8 +27,6 @@ #include "closein.h" #include "binary-io.h" -char *program_name; - /* Test yesno. Without arguments, read one line. If first argument is zero, close stdin before attempting to read one line. Otherwise, read the number of lines specified by first @@ -37,7 +35,6 @@ int main (int argc, char **argv) { int i = 1; - program_name = argv[0]; /* yesno recommends that all clients use close_stdin in main. */ atexit (close_stdin); diff --git a/tests/uniname/test-uninames.c b/tests/uniname/test-uninames.c index b032472..3b345e5 100644 --- a/tests/uniname/test-uninames.c +++ b/tests/uniname/test-uninames.c @@ -23,7 +23,6 @@ #include "xalloc.h" #include "uniname.h" -#include "progname.h" /* The names according to the UnicodeData.txt file, modified to contain the Hangul syllable names, as described in the Unicode 3.0 book. */ @@ -367,8 +366,6 @@ main (int argc, char *argv[]) int error = 0; int i; - set_program_name (argv[0]); - for (i = 1; i < argc && strcmp (argv[i], "--") != 0; i++) fill_names (argv[i]); diff --git a/tests/uninorm/test-u32-nfc-big.c b/tests/uninorm/test-u32-nfc-big.c index 7ca55ec..6502238 100644 --- a/tests/uninorm/test-u32-nfc-big.c +++ b/tests/uninorm/test-u32-nfc-big.c @@ -25,7 +25,6 @@ #include #include "unistr.h" -#include "progname.h" #include "test-u32-normalize-big.h" static int @@ -102,7 +101,6 @@ main (int argc, char *argv[]) { struct normalization_test_file file; - set_program_name (argv[0]); read_normalization_test_file (argv[1], &file); test_specific (&file, check); diff --git a/tests/uninorm/test-u32-nfd-big.c b/tests/uninorm/test-u32-nfd-big.c index 5cff4a8..7d1f9c2 100644 --- a/tests/uninorm/test-u32-nfd-big.c +++ b/tests/uninorm/test-u32-nfd-big.c @@ -25,7 +25,6 @@ #include #include "unistr.h" -#include "progname.h" #include "test-u32-normalize-big.h" static int @@ -102,7 +101,6 @@ main (int argc, char *argv[]) { struct normalization_test_file file; - set_program_name (argv[0]); read_normalization_test_file (argv[1], &file); test_specific (&file, check); diff --git a/tests/uninorm/test-u32-nfkc-big.c b/tests/uninorm/test-u32-nfkc-big.c index 5fcabe3..109f59c 100644 --- a/tests/uninorm/test-u32-nfkc-big.c +++ b/tests/uninorm/test-u32-nfkc-big.c @@ -25,7 +25,6 @@ #include #include "unistr.h" -#include "progname.h" #include "test-u32-normalize-big.h" static int @@ -99,7 +98,6 @@ main (int argc, char *argv[]) { struct normalization_test_file file; - set_program_name (argv[0]); read_normalization_test_file (argv[1], &file); test_specific (&file, check); diff --git a/tests/uninorm/test-u32-nfkd-big.c b/tests/uninorm/test-u32-nfkd-big.c index 43edc8b..109f449 100644 --- a/tests/uninorm/test-u32-nfkd-big.c +++ b/tests/uninorm/test-u32-nfkd-big.c @@ -25,7 +25,6 @@ #include #include "unistr.h" -#include "progname.h" #include "test-u32-normalize-big.h" static int @@ -99,7 +98,6 @@ main (int argc, char *argv[]) { struct normalization_test_file file; - set_program_name (argv[0]); read_normalization_test_file (argv[1], &file); test_specific (&file, check); diff --git a/tests/unistdio/test-u16-vsnprintf1.c b/tests/unistdio/test-u16-vsnprintf1.c index 8dddb68..b5d63e2 100644 --- a/tests/unistdio/test-u16-vsnprintf1.c +++ b/tests/unistdio/test-u16-vsnprintf1.c @@ -29,7 +29,6 @@ #include "unistr.h" #include "xalloc.h" -#include "progname.h" #include "macros.h" #include "test-u16-printf1.h" @@ -63,8 +62,6 @@ test_vsnprintf () int main (int argc, char *argv[]) { - set_program_name (argv[0]); - test_vsnprintf (); return 0; diff --git a/tests/unistdio/test-u16-vsprintf1.c b/tests/unistdio/test-u16-vsprintf1.c index 9fa953f..52279c6 100644 --- a/tests/unistdio/test-u16-vsprintf1.c +++ b/tests/unistdio/test-u16-vsprintf1.c @@ -29,7 +29,6 @@ #include "unistr.h" #include "xalloc.h" -#include "progname.h" #include "macros.h" #include "test-u16-printf1.h" @@ -63,8 +62,6 @@ test_vsprintf () int main (int argc, char *argv[]) { - set_program_name (argv[0]); - test_vsprintf (); return 0; diff --git a/tests/unistdio/test-u32-vsnprintf1.c b/tests/unistdio/test-u32-vsnprintf1.c index 5edb476..d3765ab 100644 --- a/tests/unistdio/test-u32-vsnprintf1.c +++ b/tests/unistdio/test-u32-vsnprintf1.c @@ -29,7 +29,6 @@ #include "unistr.h" #include "xalloc.h" -#include "progname.h" #include "macros.h" #include "test-u32-printf1.h" @@ -63,8 +62,6 @@ test_vsnprintf () int main (int argc, char *argv[]) { - set_program_name (argv[0]); - test_vsnprintf (); return 0; diff --git a/tests/unistdio/test-u32-vsprintf1.c b/tests/unistdio/test-u32-vsprintf1.c index a4fa42f..f9e7d64 100644 --- a/tests/unistdio/test-u32-vsprintf1.c +++ b/tests/unistdio/test-u32-vsprintf1.c @@ -29,7 +29,6 @@ #include "unistr.h" #include "xalloc.h" -#include "progname.h" #include "macros.h" #include "test-u32-printf1.h" @@ -63,8 +62,6 @@ test_vsprintf () int main (int argc, char *argv[]) { - set_program_name (argv[0]); - test_vsprintf (); return 0; diff --git a/tests/unistdio/test-u8-vsnprintf1.c b/tests/unistdio/test-u8-vsnprintf1.c index d174a91..1d61caa 100644 --- a/tests/unistdio/test-u8-vsnprintf1.c +++ b/tests/unistdio/test-u8-vsnprintf1.c @@ -29,7 +29,6 @@ #include "unistr.h" #include "xalloc.h" -#include "progname.h" #include "macros.h" #include "test-u8-printf1.h" @@ -63,8 +62,6 @@ test_vsnprintf () int main (int argc, char *argv[]) { - set_program_name (argv[0]); - test_vsnprintf (); return 0; diff --git a/tests/unistdio/test-u8-vsprintf1.c b/tests/unistdio/test-u8-vsprintf1.c index a7b35d1..4a3ac76 100644 --- a/tests/unistdio/test-u8-vsprintf1.c +++ b/tests/unistdio/test-u8-vsprintf1.c @@ -29,7 +29,6 @@ #include "unistr.h" #include "xalloc.h" -#include "progname.h" #include "macros.h" #include "test-u8-printf1.h" @@ -63,8 +62,6 @@ test_vsprintf () int main (int argc, char *argv[]) { - set_program_name (argv[0]); - test_vsprintf (); return 0; diff --git a/tests/unistdio/test-ulc-vsnprintf1.c b/tests/unistdio/test-ulc-vsnprintf1.c index 6042c3c..fa9d23c 100644 --- a/tests/unistdio/test-ulc-vsnprintf1.c +++ b/tests/unistdio/test-ulc-vsnprintf1.c @@ -27,7 +27,6 @@ #include #include "xalloc.h" -#include "progname.h" #include "macros.h" #include "test-ulc-printf1.h" @@ -56,8 +55,6 @@ test_vsnprintf () int main (int argc, char *argv[]) { - set_program_name (argv[0]); - test_vsnprintf (); return 0; diff --git a/tests/unistdio/test-ulc-vsprintf1.c b/tests/unistdio/test-ulc-vsprintf1.c index e9966ed..06a18d7 100644 --- a/tests/unistdio/test-ulc-vsprintf1.c +++ b/tests/unistdio/test-ulc-vsprintf1.c @@ -27,7 +27,6 @@ #include #include "xalloc.h" -#include "progname.h" #include "macros.h" #include "test-ulc-printf1.h" @@ -56,8 +55,6 @@ test_vsprintf () int main (int argc, char *argv[]) { - set_program_name (argv[0]); - test_vsprintf (); return 0; -- 2.7.4 From b2516b889df41d162b8314609312a8b5f2dc9948 Mon Sep 17 00:00:00 2001 From: Pino Toscano Date: Thu, 18 Aug 2016 15:18:25 +0200 Subject: [PATCH 4/4] main.mk: remove sc_program_name There is no more need to use set_program_name in tools (getprogname is enough for most of the cases). * cfg.mk (local-checks-to-skip): Remove sc_program_name. * top/maint.mk (sc_program_name): Remove. --- ChangeLog | 8 ++++++++ cfg.mk | 1 - top/maint.mk | 9 --------- 3 files changed, 8 insertions(+), 10 deletions(-) diff --git a/ChangeLog b/ChangeLog index e4a6915..0d1d566 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,5 +1,13 @@ 2016-08-18 Pino Toscano + main.mk: remove sc_program_name, since there is no more need to + use set_program_name in tools (getprogname is enough for most + of the cases). + * cfg.mk (local-checks-to-skip): Remove sc_program_name. + * top/maint.mk (sc_program_name): Remove. + +2016-08-18 Pino Toscano + Port tests away from progname, since modules that need the program name already depend on getprogname. * modules/acl-tests (Depends-on): Remove progname. diff --git a/cfg.mk b/cfg.mk index 5b9456b..75d9329 100644 --- a/cfg.mk +++ b/cfg.mk @@ -27,7 +27,6 @@ local-checks-to-skip = \ sc_makefile_at_at_check \ sc_makefile_path_separator_check \ sc_obsolete_symbols \ - sc_program_name \ sc_prohibit_HAVE_MBRTOWC \ sc_prohibit_S_IS_definition \ sc_prohibit_always_true_header_tests \ diff --git a/top/maint.mk b/top/maint.mk index 868e10f..c32f8b6 100644 --- a/top/maint.mk +++ b/top/maint.mk @@ -717,15 +717,6 @@ sc_changelog: $(_sc_search_regexp) # Ensure that each .c file containing a "main" function also -# calls set_program_name. -sc_program_name: - @require='set_program_name *\(.*\);' \ - in_vc_files='\.c$$' \ - containing='\