diff options
author | joseph <joseph@7b3dc134-2b1b-0410-93df-9e9f96275f8d> | 2008-09-26 16:27:00 +0000 |
---|---|---|
committer | joseph <joseph@7b3dc134-2b1b-0410-93df-9e9f96275f8d> | 2008-09-26 16:27:00 +0000 |
commit | b26073ea8b9473fd8f1d1edda0d4a63dc5a9dc83 (patch) | |
tree | a0f50ca1f91de15afce18ffcbc33c2740964ed36 /libc | |
parent | 892052c4f276840e377448b23ce0a98e07ba614c (diff) | |
download | eglibc2-b26073ea8b9473fd8f1d1edda0d4a63dc5a9dc83.tar.gz |
libc:
* aclocal.m4 (ACX_PKGVERSION, ACX_BUGURL): Define.
* configure.in: Use ACX_PKGVERSION and ACX_BUGURL.
* configure: Regenerate.
* config.h.in (PKGVERSION, REPORT_BUGS_TO): Undefine.
* config.make.in (PKGVERSION, REPORT_BUGS_TO): Define.
* catgets/gencat.c (more_help): Use REPORT_BUGS_TO.
(print_version): Use PKGVERSION.
* csu/version.c (banner): Use PKGVERSION and REPORT_BUGS_TO.
* debug/Makefile ($(objpfx)catchsegv, $(objpfx)xtrace): Also
substitute PKGVERSION and REPORT_BUGS_TO.
* debug/catchsegv.sh: Use PKGVERSION and REPORT_BUGS_TO.
* debug/pcprofiledump.c (print_version,
argp_program_version_hook): New.
(more_help): Use REPORT_BUGS_TO.
* debug/xtrace.sh: Use PKGVERSION and REPORT_BUGS_TO.
* elf/Makefile (common-ldd-rewrite): Also substitute PKGVERSION
and REPORT_BUGS_TO.
* elf/dl-close.c (_dl_close_worker): Use REPORT_BUGS_TO.
* elf/ldconfig.c (doc): Use REPORT_BUGS_TO.
(print_version): Use PKGVERSION.
* elf/ldd.bash.in: Use PKGVERSION and REPORT_BUGS_TO.
* elf/sln.c (usage): New.
(main): Support --help and --version.
* elf/sprof.c (doc): Use REPORT_BUGS_TO.
(print_version): Use PKGVERSION.
* iconv/iconv_prog.c (more_help): Use REPORT_BUGS_TO.
(print_version): Use PKGVERSION.
* iconv/iconvconfig.c (more_help): Use REPORT_BUGS_TO.
(print_version): Use PKGVERSION.
* locale/programs/locale.c (doc): Use REPORT_BUGS_TO.
(print_version): Use PKGVERSION.
* locale/programs/localedef.c (more_help): Use REPORT_BUGS_TO.
(print_version): Use PKGVERSION.
* login/programs/pt_chown.c
* malloc/Makefile ($(objpfx)mtrace, $(objpfx)memusage): Also
substitute PKGVERSION and REPORT_BUGS_TO.
* malloc/memusage.sh: Use PKGVERSION and REPORT_BUGS_TO.
* malloc/memusagestat.c (print_version,
argp_program_version_hook): New.
(more_help): Use REPORT_BUGS_TO.
* malloc/mtrace.pl: Use PKGVERSION and REPORT_BUGS_TO.
* manual/Makefile (libc.dvi, libc.pdf, libc.info,
libc/index.html): Depend on pkgvers.texi.
(pkgvers.texi, stamp-pkgvers): New.
* manual/install.texi: Adjust bug database description. Use
REPORT_BUGS_TO.
* manual/libc.texinfo: Include pkgvers.texi. Use PKGVERSION.
* nscd/nscd.c (doc): Use REPORT_BUGS_TO.
(print_version): Use PKGVERSION.
* nss/getent.c (doc): Use REPORT_BUGS_TO.
(print_version): Use PKGVERSION.
* nss/makedb.c (more_help): Use REPORT_BUGS_TO.
(print_version): Use PKGVERSION.
* posix/getconf.c (main): Send --version output to stdout. Use
PKGVERSION. Support --help.
* sunrpc/proto.h (REPORT_BUGS_TO, PKGVERSION): Define for
cross-rpcgen.
* sunrpc/rpc_main.c (usage, options_usage): Take STREAM and STATUS
arguments. All callers changed. Use REPORT_BUGS_TO
(print_version): New.
(parseargs): Support --help and --version.
* sunrpc/rpcinfo.c (usage): Take STREAM argument. All callers
changed. Use REPORT_BUGS_TO.
(print_version): New.
(main): Use getopt_long. Support --help and --version.
* sysdeps/unix/sysv/linux/lddlibc4.c (main): Support --help and
--version.
* timezone/Makefile: Use -DCROSS_ZIC for cross-zic.
($(objpfx)tzselect): Also substitute PKGVERSION and
REPORT_BUGS_TO.
* timezone/tzselect.ksh: Support --help and --version.
* timezone/zdump.c (usage): New.
(main): Use it. Support --help. Print program name and
PKGVERSION in --version output.
* timezone/zic.c (usage): Take STREAM and STATUS arguments. All
callers changed. Use REPORT_BUGS_TO.
(main): Support --help. Print program name and PKGVERSION in
--version output.
localedef:
* configure.ac: Support --with-pkgversion and --with-bugurl.
* configure, config.h.in: Regenerate.
git-svn-id: svn://svn.eglibc.org/trunk@7026 7b3dc134-2b1b-0410-93df-9e9f96275f8d
Diffstat (limited to 'libc')
42 files changed, 568 insertions, 140 deletions
diff --git a/libc/ChangeLog.eglibc b/libc/ChangeLog.eglibc index 6328f5cae..31f82fc96 100644 --- a/libc/ChangeLog.eglibc +++ b/libc/ChangeLog.eglibc @@ -1,3 +1,84 @@ +2008-09-26 Joseph Myers <joseph@codesourcery.com> + + * aclocal.m4 (ACX_PKGVERSION, ACX_BUGURL): Define. + * configure.in: Use ACX_PKGVERSION and ACX_BUGURL. + * configure: Regenerate. + * config.h.in (PKGVERSION, REPORT_BUGS_TO): Undefine. + * config.make.in (PKGVERSION, REPORT_BUGS_TO): Define. + * catgets/gencat.c (more_help): Use REPORT_BUGS_TO. + (print_version): Use PKGVERSION. + * csu/version.c (banner): Use PKGVERSION and REPORT_BUGS_TO. + * debug/Makefile ($(objpfx)catchsegv, $(objpfx)xtrace): Also + substitute PKGVERSION and REPORT_BUGS_TO. + * debug/catchsegv.sh: Use PKGVERSION and REPORT_BUGS_TO. + * debug/pcprofiledump.c (print_version, + argp_program_version_hook): New. + (more_help): Use REPORT_BUGS_TO. + * debug/xtrace.sh: Use PKGVERSION and REPORT_BUGS_TO. + * elf/Makefile (common-ldd-rewrite): Also substitute PKGVERSION + and REPORT_BUGS_TO. + * elf/dl-close.c (_dl_close_worker): Use REPORT_BUGS_TO. + * elf/ldconfig.c (doc): Use REPORT_BUGS_TO. + (print_version): Use PKGVERSION. + * elf/ldd.bash.in: Use PKGVERSION and REPORT_BUGS_TO. + * elf/sln.c (usage): New. + (main): Support --help and --version. + * elf/sprof.c (doc): Use REPORT_BUGS_TO. + (print_version): Use PKGVERSION. + * iconv/iconv_prog.c (more_help): Use REPORT_BUGS_TO. + (print_version): Use PKGVERSION. + * iconv/iconvconfig.c (more_help): Use REPORT_BUGS_TO. + (print_version): Use PKGVERSION. + * locale/programs/locale.c (doc): Use REPORT_BUGS_TO. + (print_version): Use PKGVERSION. + * locale/programs/localedef.c (more_help): Use REPORT_BUGS_TO. + (print_version): Use PKGVERSION. + * login/programs/pt_chown.c + * malloc/Makefile ($(objpfx)mtrace, $(objpfx)memusage): Also + substitute PKGVERSION and REPORT_BUGS_TO. + * malloc/memusage.sh: Use PKGVERSION and REPORT_BUGS_TO. + * malloc/memusagestat.c (print_version, + argp_program_version_hook): New. + (more_help): Use REPORT_BUGS_TO. + * malloc/mtrace.pl: Use PKGVERSION and REPORT_BUGS_TO. + * manual/Makefile (libc.dvi, libc.pdf, libc.info, + libc/index.html): Depend on pkgvers.texi. + (pkgvers.texi, stamp-pkgvers): New. + * manual/install.texi: Adjust bug database description. Use + REPORT_BUGS_TO. + * manual/libc.texinfo: Include pkgvers.texi. Use PKGVERSION. + * nscd/nscd.c (doc): Use REPORT_BUGS_TO. + (print_version): Use PKGVERSION. + * nss/getent.c (doc): Use REPORT_BUGS_TO. + (print_version): Use PKGVERSION. + * nss/makedb.c (more_help): Use REPORT_BUGS_TO. + (print_version): Use PKGVERSION. + * posix/getconf.c (main): Send --version output to stdout. Use + PKGVERSION. Support --help. + * sunrpc/proto.h (REPORT_BUGS_TO, PKGVERSION): Define for + cross-rpcgen. + * sunrpc/rpc_main.c (usage, options_usage): Take STREAM and STATUS + arguments. All callers changed. Use REPORT_BUGS_TO + (print_version): New. + (parseargs): Support --help and --version. + * sunrpc/rpcinfo.c (usage): Take STREAM argument. All callers + changed. Use REPORT_BUGS_TO. + (print_version): New. + (main): Use getopt_long. Support --help and --version. + * sysdeps/unix/sysv/linux/lddlibc4.c (main): Support --help and + --version. + * timezone/Makefile: Use -DCROSS_ZIC for cross-zic. + ($(objpfx)tzselect): Also substitute PKGVERSION and + REPORT_BUGS_TO. + * timezone/tzselect.ksh: Support --help and --version. + * timezone/zdump.c (usage): New. + (main): Use it. Support --help. Print program name and + PKGVERSION in --version output. + * timezone/zic.c (usage): Take STREAM and STATUS arguments. All + callers changed. Use REPORT_BUGS_TO. + (main): Support --help. Print program name and PKGVERSION in + --version output. + 2008-09-24 Joseph Myers <joseph@codesourcery.com> * csu/Makefile ($(objpfx)crti.S, $(objpfx)crtn.S): Remove .file diff --git a/libc/aclocal.m4 b/libc/aclocal.m4 index dbc8b1ef4..21f3474ed 100644 --- a/libc/aclocal.m4 +++ b/libc/aclocal.m4 @@ -123,3 +123,49 @@ AC_CACHE_CHECK(whether $LD is GNU ld, libc_cv_prog_ld_gnu, [LIBC_PROG_FOO_GNU($LD, libc_cv_prog_ld_gnu=yes, libc_cv_prog_ld_gnu=no)]) gnu_ld=$libc_cv_prog_ld_gnu ]) + +# These two macros are taken from GCC's config/acx.m4. +dnl Support the --with-pkgversion configure option. +dnl ACX_PKGVERSION(default-pkgversion) +AC_DEFUN([ACX_PKGVERSION],[ + AC_ARG_WITH(pkgversion, + AS_HELP_STRING([--with-pkgversion=PKG], + [Use PKG in the version string in place of "$1"]), + [case "$withval" in + yes) AC_MSG_ERROR([package version not specified]) ;; + no) PKGVERSION= ;; + *) PKGVERSION="($withval) " ;; + esac], + PKGVERSION="($1) " + ) + AC_SUBST(PKGVERSION) +]) + +dnl Support the --with-bugurl configure option. +dnl ACX_BUGURL(default-bugurl) +AC_DEFUN([ACX_BUGURL],[ + AC_ARG_WITH(bugurl, + AS_HELP_STRING([--with-bugurl=URL], + [Direct users to URL to report a bug]), + [case "$withval" in + yes) AC_MSG_ERROR([bug URL not specified]) ;; + no) BUGURL= + ;; + *) BUGURL="$withval" + ;; + esac], + BUGURL="$1" + ) + case ${BUGURL} in + "") + REPORT_BUGS_TO= + REPORT_BUGS_TEXI= + ;; + *) + REPORT_BUGS_TO="<$BUGURL>" + REPORT_BUGS_TEXI=@uref{`echo "$BUGURL" | sed 's/@/@@/g'`} + ;; + esac; + AC_SUBST(REPORT_BUGS_TO) + AC_SUBST(REPORT_BUGS_TEXI) +]) diff --git a/libc/catgets/gencat.c b/libc/catgets/gencat.c index d9d03fb6a..d3b0f6bae 100644 --- a/libc/catgets/gencat.c +++ b/libc/catgets/gencat.c @@ -225,13 +225,16 @@ parse_opt (int key, char *arg, struct argp_state *state) static char * more_help (int key, const char *text, void *input) { + char *tp = NULL; switch (key) { case ARGP_KEY_HELP_EXTRA: /* We print some extra information. */ - return strdup (gettext ("\ + if (asprintf (&tp, gettext ("\ For bug reporting instructions, please see:\n\ -<http://www.gnu.org/software/libc/bugs.html>.\n")); +%s.\n"), REPORT_BUGS_TO) < 0) + return NULL; + return tp; default: break; } @@ -242,7 +245,7 @@ For bug reporting instructions, please see:\n\ static void print_version (FILE *stream, struct argp_state *state) { - fprintf (stream, "gencat (GNU %s) %s\n", PACKAGE, VERSION); + fprintf (stream, "gencat %s%s\n", PKGVERSION, VERSION); fprintf (stream, gettext ("\ Copyright (C) %s Free Software Foundation, Inc.\n\ This is free software; see the source for copying conditions. There is NO\n\ diff --git a/libc/config.h.in b/libc/config.h.in index b5abb1018..d6d1ef1e8 100644 --- a/libc/config.h.in +++ b/libc/config.h.in @@ -189,6 +189,12 @@ /* Define if __stack_chk_guard canary should be randomized at program startup. */ #undef ENABLE_STACKGUARD_RANDOMIZE +/* Additional package description. */ +#undef PKGVERSION + +/* Bug reporting address. */ +#undef REPORT_BUGS_TO + /* */ diff --git a/libc/config.make.in b/libc/config.make.in index 66e3ca329..ad556caa9 100644 --- a/libc/config.make.in +++ b/libc/config.make.in @@ -127,4 +127,8 @@ PERL = @PERL@ # Additional libraries. LIBGD = @LIBGD@ +# Package versions and bug reporting configuration. +PKGVERSION = @PKGVERSION@ +REPORT_BUGS_TO = @REPORT_BUGS_TO@ + # More variables may be inserted below by configure. diff --git a/libc/configure b/libc/configure index 97f6e0159..70e0b3ae1 100755 --- a/libc/configure +++ b/libc/configure @@ -313,7 +313,7 @@ ac_includes_default="\ # include <unistd.h> #endif" -ac_subst_vars='SHELL PATH_SEPARATOR PACKAGE_NAME PACKAGE_TARNAME PACKAGE_VERSION PACKAGE_STRING PACKAGE_BUGREPORT exec_prefix prefix program_transform_name bindir sbindir libexecdir datadir sysconfdir sharedstatedir localstatedir libdir includedir oldincludedir infodir mandir build_alias host_alias target_alias DEFS ECHO_C ECHO_N ECHO_T LIBS with_fp with_cvs enable_check_abi oldest_abi bindnow force_install all_warnings build build_cpu build_vendor build_os host host_cpu host_vendor host_os subdirs add_ons add_on_subdirs base_machine submachine sysnames sysdeps_add_ons INSTALL_PROGRAM INSTALL_SCRIPT INSTALL_DATA LN_S CC CFLAGS LDFLAGS CPPFLAGS ac_ct_CC OBJEXT BUILD_CC cross_compiling CPP CXX CXXFLAGS ac_ct_CXX AR NM OBJDUMP RANLIB ac_ct_RANLIB MIG AS LD PWD_P MAKE MSGFMT MAKEINFO SED AUTOCONF SYSINCLUDES CXX_SYSINCLUDES libc_cv_gcc_static_libgcc BASH_SHELL libc_cv_have_bash2 KSH libc_cv_have_ksh AWK PERL INSTALL_INFO BISON VERSIONING libc_cv_cc_with_libunwind libc_cv_Bgroup libc_cv_libgcc_s_suffix libc_cv_as_needed ASFLAGS_config libc_cv_z_combreloc libc_cv_z_execstack libc_cv_fpie libc_cv_hashstyle fno_unit_at_a_time libc_cv_ssp libc_cv_gnu89_inline libc_cv_have_initfini no_whole_archive exceptions libc_cv_cc_submachine LIBGD have_libaudit have_libcap have_selinux EGREP sizeof_long_double libc_cv_gcc_unwind_find_fde uname_sysname uname_release uname_version old_glibc_headers libc_cv_slibdir libc_cv_localedir libc_cv_sysconfdir libc_cv_rootsbindir libc_cv_forced_unwind use_ldconfig ldd_rewrite_script elf xcoff static shared pic_default profile omitfp bounded static_nss nopic_initfini DEFINES mach_interface_list VERSION RELEASE LIBOBJS LTLIBOBJS' +ac_subst_vars='SHELL PATH_SEPARATOR PACKAGE_NAME PACKAGE_TARNAME PACKAGE_VERSION PACKAGE_STRING PACKAGE_BUGREPORT exec_prefix prefix program_transform_name bindir sbindir libexecdir datadir sysconfdir sharedstatedir localstatedir libdir includedir oldincludedir infodir mandir build_alias host_alias target_alias DEFS ECHO_C ECHO_N ECHO_T LIBS with_fp with_cvs enable_check_abi oldest_abi bindnow force_install all_warnings PKGVERSION REPORT_BUGS_TO REPORT_BUGS_TEXI build build_cpu build_vendor build_os host host_cpu host_vendor host_os subdirs add_ons add_on_subdirs base_machine submachine sysnames sysdeps_add_ons INSTALL_PROGRAM INSTALL_SCRIPT INSTALL_DATA LN_S CC CFLAGS LDFLAGS CPPFLAGS ac_ct_CC OBJEXT BUILD_CC cross_compiling CPP CXX CXXFLAGS ac_ct_CXX AR NM OBJDUMP RANLIB ac_ct_RANLIB MIG AS LD PWD_P MAKE MSGFMT MAKEINFO SED AUTOCONF SYSINCLUDES CXX_SYSINCLUDES libc_cv_gcc_static_libgcc BASH_SHELL libc_cv_have_bash2 KSH libc_cv_have_ksh AWK PERL INSTALL_INFO BISON VERSIONING libc_cv_cc_with_libunwind libc_cv_Bgroup libc_cv_libgcc_s_suffix libc_cv_as_needed ASFLAGS_config libc_cv_z_combreloc libc_cv_z_execstack libc_cv_fpie libc_cv_hashstyle fno_unit_at_a_time libc_cv_ssp libc_cv_gnu89_inline libc_cv_have_initfini no_whole_archive exceptions libc_cv_cc_submachine LIBGD have_libaudit have_libcap have_selinux EGREP sizeof_long_double libc_cv_gcc_unwind_find_fde uname_sysname uname_release uname_version old_glibc_headers libc_cv_slibdir libc_cv_localedir libc_cv_sysconfdir libc_cv_rootsbindir libc_cv_forced_unwind use_ldconfig ldd_rewrite_script elf xcoff static shared pic_default profile omitfp bounded static_nss nopic_initfini DEFINES mach_interface_list VERSION RELEASE LIBOBJS LTLIBOBJS' ac_subst_files='' # Initialize some variables set by options. @@ -905,6 +905,8 @@ Optional Packages: default] --with-tls enable support for TLS --without-__thread do not use TLS features even when supporting them + --with-pkgversion=PKG Use PKG in the version string in place of "EGLIBC" + --with-bugurl=URL Direct users to URL to report a bug --with-cpu=CPU select code for CPU variant Some influential environment variables: @@ -1692,6 +1694,66 @@ if test "${enable_all_warnings+set}" = set; then fi; + + +# Check whether --with-pkgversion or --without-pkgversion was given. +if test "${with_pkgversion+set}" = set; then + withval="$with_pkgversion" + case "$withval" in + yes) { { echo "$as_me:$LINENO: error: package version not specified" >&5 +echo "$as_me: error: package version not specified" >&2;} + { (exit 1); exit 1; }; } ;; + no) PKGVERSION= ;; + *) PKGVERSION="($withval) " ;; + esac +else + PKGVERSION="(EGLIBC) " + +fi; + + + + +# Check whether --with-bugurl or --without-bugurl was given. +if test "${with_bugurl+set}" = set; then + withval="$with_bugurl" + case "$withval" in + yes) { { echo "$as_me:$LINENO: error: bug URL not specified" >&5 +echo "$as_me: error: bug URL not specified" >&2;} + { (exit 1); exit 1; }; } ;; + no) BUGURL= + ;; + *) BUGURL="$withval" + ;; + esac +else + BUGURL="http://www.eglibc.org/issues/" + +fi; + case ${BUGURL} in + "") + REPORT_BUGS_TO= + REPORT_BUGS_TEXI= + ;; + *) + REPORT_BUGS_TO="<$BUGURL>" + REPORT_BUGS_TEXI=@uref{`echo "$BUGURL" | sed 's/@/@@/g'`} + ;; + esac; + + + + +cat >>confdefs.h <<_ACEOF +#define PKGVERSION "$PKGVERSION" +_ACEOF + + +cat >>confdefs.h <<_ACEOF +#define REPORT_BUGS_TO "$REPORT_BUGS_TO" +_ACEOF + + # Make sure we can run config.sub. $ac_config_sub sun4 >/dev/null 2>&1 || { { echo "$as_me:$LINENO: error: cannot run $ac_config_sub" >&5 @@ -8499,6 +8561,9 @@ s,@oldest_abi@,$oldest_abi,;t t s,@bindnow@,$bindnow,;t t s,@force_install@,$force_install,;t t s,@all_warnings@,$all_warnings,;t t +s,@PKGVERSION@,$PKGVERSION,;t t +s,@REPORT_BUGS_TO@,$REPORT_BUGS_TO,;t t +s,@REPORT_BUGS_TEXI@,$REPORT_BUGS_TEXI,;t t s,@build@,$build,;t t s,@build_cpu@,$build_cpu,;t t s,@build_vendor@,$build_vendor,;t t diff --git a/libc/configure.in b/libc/configure.in index 4225dcef0..c25219ab1 100644 --- a/libc/configure.in +++ b/libc/configure.in @@ -254,6 +254,11 @@ AC_ARG_ENABLE([all-warnings], []) AC_SUBST(all_warnings) +ACX_PKGVERSION([EGLIBC]) +ACX_BUGURL([http://www.eglibc.org/issues/]) +AC_DEFINE_UNQUOTED([PKGVERSION], ["$PKGVERSION"], [Additional package description]) +AC_DEFINE_UNQUOTED([REPORT_BUGS_TO], ["$REPORT_BUGS_TO"], [Bug reporting address]) + AC_CANONICAL_HOST # The way shlib-versions is used to generate soversions.mk uses a diff --git a/libc/csu/version.c b/libc/csu/version.c index 9b4edd834..4435721fd 100644 --- a/libc/csu/version.c +++ b/libc/csu/version.c @@ -24,7 +24,7 @@ static const char __libc_release[] = RELEASE; static const char __libc_version[] = VERSION; static const char banner[] = -"GNU C Library "RELEASE" release version "VERSION", by Roland McGrath et al.\n\ +"GNU C Library "PKGVERSION RELEASE" release version "VERSION", by Roland McGrath et al.\n\ Copyright (C) 2008 Free Software Foundation, Inc.\n\ This is free software; see the source for copying conditions.\n\ There is NO warranty; not even for MERCHANTABILITY or FITNESS FOR A\n\ @@ -35,7 +35,7 @@ Compiled by GNU CC version "__VERSION__".\n" "The oldest ABI supported: " GLIBC_OLDEST_ABI ".\n" #endif "For bug reporting instructions, please see:\n\ -<http://www.gnu.org/software/libc/bugs.html>.\n"; +"REPORT_BUGS_TO".\n"; #include <unistd.h> diff --git a/libc/debug/Makefile b/libc/debug/Makefile index 3c72f920a..9c73bc085 100644 --- a/libc/debug/Makefile +++ b/libc/debug/Makefile @@ -159,7 +159,9 @@ sLIBdir := $(shell echo $(slibdir) | sed 's,lib\(\|64\)$$,\\\\$$LIB,') $(objpfx)catchsegv: catchsegv.sh $(common-objpfx)soversions.mk \ $(common-objpfx)config.make slibpfx=`echo $(slibdir)|sed 's/lib\(64\|\)$$/\\\\\\\\$$LIB/'`; \ - sed -e 's|@VERSION@|$(version)|' -e "s|@SLIB@|$$slibpfx|" $< > $@.new + sed -e 's|@VERSION@|$(version)|' -e "s|@SLIB@|$$slibpfx|" \ + -e 's|@PKGVERSION@|$(PKGVERSION)|' \ + -e 's|@REPORT_BUGS_TO@|$(REPORT_BUGS_TO)|' $< > $@.new chmod 555 $@.new mv -f $@.new $@ @@ -168,7 +170,9 @@ $(objpfx)pcprofiledump: $(objpfx)pcprofiledump.o $(objpfx)xtrace: xtrace.sh rm -f $@.new sed -e 's|@BASH@|$(BASH)|' -e 's|@VERSION@|$(version)|' \ - -e 's|@SLIBDIR@|$(sLIBdir)|' -e 's|@BINDIR@|$(bindir)|' $^ > $@.new \ + -e 's|@SLIBDIR@|$(sLIBdir)|' -e 's|@BINDIR@|$(bindir)|' \ + -e 's|@PKGVERSION@|$(PKGVERSION)|' \ + -e 's|@REPORT_BUGS_TO@|$(REPORT_BUGS_TO)|' $^ > $@.new \ && rm -f $@ && mv $@.new $@ && chmod +x $@ # Depend on libc.so so a DT_NEEDED is generated in the shared objects. diff --git a/libc/debug/catchsegv.sh b/libc/debug/catchsegv.sh index 68fcb6989..7281f29d0 100755 --- a/libc/debug/catchsegv.sh +++ b/libc/debug/catchsegv.sh @@ -35,11 +35,11 @@ if test $# -eq 0; then echo ' --help print this help, then exit' echo ' --version print version number, then exit' echo "For bug reporting instructions, please see:" - echo "<http://www.gnu.org/software/libc/bugs.html>." + echo "@REPORT_BUGS_TO@." exit 0 ;; --v | --ve | --ver | --vers | --versi | --versio | --version) - echo 'catchsegv (GNU libc) @VERSION@' + echo 'catchsegv @PKGVERSION@@VERSION@' echo 'Copyright (C) 2008 Free Software Foundation, Inc. This is free software; see the source for copying conditions. There is NO warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. diff --git a/libc/debug/pcprofiledump.c b/libc/debug/pcprofiledump.c index 62c0d73f4..73c0c3ebf 100644 --- a/libc/debug/pcprofiledump.c +++ b/libc/debug/pcprofiledump.c @@ -66,6 +66,10 @@ static char *more_help (int key, const char *text, void *input); /* Prototype for option handler. */ static error_t parse_opt (int key, char *arg, struct argp_state *state); +/* Name and version of program. */ +static void print_version (FILE *stream, struct argp_state *state); +void (*argp_program_version_hook) (FILE *, struct argp_state *) = print_version; + /* Data structure to communicate with argp functions. */ static struct argp argp = { @@ -197,15 +201,31 @@ parse_opt (int key, char *arg, struct argp_state *state) static char * more_help (int key, const char *text, void *input) { + char *tp = NULL; switch (key) { case ARGP_KEY_HELP_EXTRA: /* We print some extra information. */ - return strdup (gettext ("\ + if (asprintf (&tp, gettext ("\ For bug reporting instructions, please see:\n\ -<http://www.gnu.org/software/libc/bugs.html>.\n")); +%s.\n"), REPORT_BUGS_TO) < 0) + return NULL; + return tp; default: break; } return (char *) text; } + +/* Print the version information. */ +static void +print_version (FILE *stream, struct argp_state *state) +{ + fprintf (stream, "pcprofiledump %s%s\n", PKGVERSION, VERSION); + fprintf (stream, gettext ("\ +Copyright (C) %s Free Software Foundation, Inc.\n\ +This is free software; see the source for copying conditions. There is NO\n\ +warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.\n\ +"), "2008"); + fprintf (stream, gettext ("Written by %s.\n"), "Ulrich Drepper"); +} diff --git a/libc/debug/xtrace.sh b/libc/debug/xtrace.sh index 6902c4f4c..11f4f8127 100755 --- a/libc/debug/xtrace.sh +++ b/libc/debug/xtrace.sh @@ -55,12 +55,12 @@ Mandatory arguments to long options are also mandatory for any corresponding short options. For bug reporting instructions, please see: -<http://www.gnu.org/software/libc/bugs.html>.\n" +%s.\n" "@REPORT_BUGS_TO@" exit 0 } do_version() { - echo 'xtrace (GNU libc) @VERSION@' + echo 'xtrace @PKGVERSION@@VERSION@' printf $"Copyright (C) %s Free Software Foundation, Inc. This is free software; see the source for copying conditions. There is NO warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. diff --git a/libc/elf/Makefile b/libc/elf/Makefile index 16c752f26..4eaa01dfc 100644 --- a/libc/elf/Makefile +++ b/libc/elf/Makefile @@ -355,7 +355,9 @@ endif common-ldd-rewrite = -e 's%@RTLD@%$(slibdir)/$(rtld-installed-name)%g' \ - -e 's%@VERSION@%$(version)%g' + -e 's%@VERSION@%$(version)%g' \ + -e 's%@PKGVERSION@%$(PKGVERSION)%g' \ + -e 's%@REPORT_BUGS_TO@%$(REPORT_BUGS_TO)%g' sh-ldd-rewrite = $(common-ldd-rewrite) -e 's%@BASH@%/bin/sh%g;s/\$$"/"/g' bash-ldd-rewrite = $(common-ldd-rewrite) -e 's%@BASH@%$(BASH)%g' \ -e 's%@TEXTDOMAINDIR@%$(msgcatdir)%g' diff --git a/libc/elf/dl-close.c b/libc/elf/dl-close.c index 46f1a40ad..fb96e0d01 100644 --- a/libc/elf/dl-close.c +++ b/libc/elf/dl-close.c @@ -669,7 +669,7 @@ _dl_close_worker (struct link_map *map) if (any_tls) { if (__builtin_expect (++GL(dl_tls_generation) == 0, 0)) - _dl_fatal_printf ("TLS generation counter wrapped! Please report as described in <http://www.gnu.org/software/libc/bugs.html>.\n"); + _dl_fatal_printf ("TLS generation counter wrapped! Please report as described in "REPORT_BUGS_TO".\n"); if (tls_free_end == GL(dl_tls_static_used)) GL(dl_tls_static_used) = tls_free_start; diff --git a/libc/elf/ldconfig.c b/libc/elf/ldconfig.c index e4dfdf503..03c9a9221 100644 --- a/libc/elf/ldconfig.c +++ b/libc/elf/ldconfig.c @@ -153,7 +153,9 @@ static const struct argp_option options[] = #include <dl-procinfo.c> /* Short description of program. */ -static const char doc[] = N_("Configure Dynamic Linker Run Time Bindings."); +static const char doc[] = N_("Configure Dynamic Linker Run Time Bindings.\v\ +For bug reporting instructions, please see:\n\ +"REPORT_BUGS_TO".\n"); /* Prototype for option handler. */ static error_t parse_opt (int key, char *arg, struct argp_state *state); @@ -292,7 +294,7 @@ parse_opt (int key, char *arg, struct argp_state *state) static void print_version (FILE *stream, struct argp_state *state) { - fprintf (stream, "ldconfig (GNU %s) %s\n", PACKAGE, VERSION); + fprintf (stream, "ldconfig %s%s\n", PKGVERSION, VERSION); fprintf (stream, gettext ("\ Copyright (C) %s Free Software Foundation, Inc.\n\ This is free software; see the source for copying conditions. There is NO\n\ diff --git a/libc/elf/ldd.bash.in b/libc/elf/ldd.bash.in index d5de40c83..7cc1b40a3 100644 --- a/libc/elf/ldd.bash.in +++ b/libc/elf/ldd.bash.in @@ -35,7 +35,7 @@ verbose= while test $# -gt 0; do case "$1" in --vers | --versi | --versio | --version) - echo 'ldd (GNU libc) @VERSION@' + echo 'ldd @PKGVERSION@@VERSION@' printf $"Copyright (C) %s Free Software Foundation, Inc. This is free software; see the source for copying conditions. There is NO warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. @@ -45,7 +45,7 @@ warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. exit 0 ;; --h | --he | --hel | --help) - echo $"Usage: ldd [OPTION]... FILE... + printf $"Usage: ldd [OPTION]... FILE... --help print this help and exit --version print version information and exit -d, --data-relocs process data relocations @@ -53,7 +53,8 @@ warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. -u, --unused print unused direct dependencies -v, --verbose print all information For bug reporting instructions, please see: -<http://www.gnu.org/software/libc/bugs.html>." +%s. +" "@REPORT_BUGS_TO@" exit 0 ;; -d | --d | --da | --dat | --data | --data- | --data-r | --data-re | \ diff --git a/libc/elf/sln.c b/libc/elf/sln.c index 8e66510bb..141dffcf4 100644 --- a/libc/elf/sln.c +++ b/libc/elf/sln.c @@ -28,12 +28,15 @@ #include <string.h> #include <limits.h> +#include "../version.h" + #if !defined S_ISDIR && defined S_IFDIR #define S_ISDIR(m) (((m) & S_IFMT) == S_IFDIR) #endif static int makesymlink (const char *src, const char *dest); static int makesymlinks (const char *file); +static void usage (void); int main (int argc, char **argv) @@ -41,6 +44,13 @@ main (int argc, char **argv) switch (argc) { case 2: + if (!strcmp (argv[1], "--version")) { + printf ("sln %s%s\n", PKGVERSION, VERSION); + return 0; + } else if (!strcmp (argv[1], "--help")) { + usage (); + return 0; + } return makesymlinks (argv [1]); break; @@ -49,12 +59,21 @@ main (int argc, char **argv) break; default: - printf ("Usage: %s src dest|file\n", argv [0]); + usage (); return 1; break; } } +static void +usage (void) +{ + printf ("Usage: sln src dest|file\n\ +\n\ +For bug reporting instructions, please see:\n\ +%s.\n", REPORT_BUGS_TO); +} + static int makesymlinks (file) const char *file; diff --git a/libc/elf/sprof.c b/libc/elf/sprof.c index ce66cf8cc..56b7b155f 100644 --- a/libc/elf/sprof.c +++ b/libc/elf/sprof.c @@ -88,7 +88,7 @@ static const struct argp_option options[] = /* Short description of program. */ static const char doc[] = N_("Read and display shared object profiling data.\v\ For bug reporting instructions, please see:\n\ -<http://www.gnu.org/software/libc/bugs.html>.\n"); +"REPORT_BUGS_TO".\n"); /* Strings for arguments in help texts. */ static const char args_doc[] = N_("SHOBJ [PROFDATA]"); @@ -351,7 +351,7 @@ parse_opt (int key, char *arg, struct argp_state *state) static void print_version (FILE *stream, struct argp_state *state) { - fprintf (stream, "sprof (GNU %s) %s\n", PACKAGE, VERSION); + fprintf (stream, "sprof %s%s\n", PKGVERSION, VERSION); fprintf (stream, gettext ("\ Copyright (C) %s Free Software Foundation, Inc.\n\ This is free software; see the source for copying conditions. There is NO\n\ diff --git a/libc/iconv/iconv_prog.c b/libc/iconv/iconv_prog.c index e64b4b3b4..54df4ed65 100644 --- a/libc/iconv/iconv_prog.c +++ b/libc/iconv/iconv_prog.c @@ -409,13 +409,16 @@ parse_opt (int key, char *arg, struct argp_state *state) static char * more_help (int key, const char *text, void *input) { + char *tp = NULL; switch (key) { case ARGP_KEY_HELP_EXTRA: /* We print some extra information. */ - return strdup (gettext ("\ + if (asprintf (&tp, gettext ("\ For bug reporting instructions, please see:\n\ -<http://www.gnu.org/software/libc/bugs.html>.\n")); +%s.\n"), REPORT_BUGS_TO) < 0) + return NULL; + return tp; default: break; } @@ -427,7 +430,7 @@ For bug reporting instructions, please see:\n\ static void print_version (FILE *stream, struct argp_state *state) { - fprintf (stream, "iconv (GNU %s) %s\n", PACKAGE, VERSION); + fprintf (stream, "iconv %s%s\n", PKGVERSION, VERSION); fprintf (stream, gettext ("\ Copyright (C) %s Free Software Foundation, Inc.\n\ This is free software; see the source for copying conditions. There is NO\n\ diff --git a/libc/iconv/iconvconfig.c b/libc/iconv/iconvconfig.c index 450fd7198..cf7c77a26 100644 --- a/libc/iconv/iconvconfig.c +++ b/libc/iconv/iconvconfig.c @@ -373,13 +373,16 @@ parse_opt (int key, char *arg, struct argp_state *state) static char * more_help (int key, const char *text, void *input) { + char *tp = NULL; switch (key) { case ARGP_KEY_HELP_EXTRA: /* We print some extra information. */ - return strdup (gettext ("\ + if (asprintf (&tp, gettext ("\ For bug reporting instructions, please see:\n\ -<http://www.gnu.org/software/libc/bugs.html>.\n")); +%s.\n"), REPORT_BUGS_TO) < 0) + return NULL; + return tp; default: break; } @@ -391,7 +394,7 @@ For bug reporting instructions, please see:\n\ static void print_version (FILE *stream, struct argp_state *state) { - fprintf (stream, "iconvconfig (GNU %s) %s\n", PACKAGE, VERSION); + fprintf (stream, "iconvconfig %s%s\n", PKGVERSION, VERSION); fprintf (stream, gettext ("\ Copyright (C) %s Free Software Foundation, Inc.\n\ This is free software; see the source for copying conditions. There is NO\n\ diff --git a/libc/locale/programs/locale.c b/libc/locale/programs/locale.c index 5f770a181..1c31bc132 100644 --- a/libc/locale/programs/locale.c +++ b/libc/locale/programs/locale.c @@ -86,7 +86,7 @@ static const struct argp_option options[] = /* Short description of program. */ static const char doc[] = N_("Get locale-specific information.\v\ For bug reporting instructions, please see:\n\ -<http://www.gnu.org/software/libc/bugs.html>.\n"); +"REPORT_BUGS_TO".\n"); /* Strings for arguments in help texts. */ static const char args_doc[] = N_("NAME\n[-a|-m]"); @@ -271,7 +271,7 @@ parse_opt (int key, char *arg, struct argp_state *state) static void print_version (FILE *stream, struct argp_state *state) { - fprintf (stream, "locale (GNU %s) %s\n", PACKAGE, VERSION); + fprintf (stream, "locale %s%s\n", PKGVERSION, VERSION); fprintf (stream, gettext ("\ Copyright (C) %s Free Software Foundation, Inc.\n\ This is free software; see the source for copying conditions. There is NO\n\ diff --git a/libc/locale/programs/localedef.c b/libc/locale/programs/localedef.c index 3fa65cf2a..8791165b1 100644 --- a/libc/locale/programs/localedef.c +++ b/libc/locale/programs/localedef.c @@ -389,7 +389,7 @@ System's directory for character maps : %s\n\ %s"), CHARMAP_PATH, REPERTOIREMAP_PATH, LOCALE_PATH, gettext ("\ For bug reporting instructions, please see:\n\ -<http://www.gnu.org/software/libc/bugs.html>.\n")) < 0) +"REPORT_BUGS_TO".\n")) < 0) return NULL; return cp; default: @@ -402,7 +402,7 @@ For bug reporting instructions, please see:\n\ static void print_version (FILE *stream, struct argp_state *state) { - fprintf (stream, "localedef (GNU %s) %s\n", PACKAGE, VERSION); + fprintf (stream, "localedef %s%s\n", PKGVERSION, VERSION); fprintf (stream, gettext ("\ Copyright (C) %s Free Software Foundation, Inc.\n\ This is free software; see the source for copying conditions. There is NO\n\ diff --git a/libc/login/programs/pt_chown.c b/libc/login/programs/pt_chown.c index 485eddabc..6b780ae40 100644 --- a/libc/login/programs/pt_chown.c +++ b/libc/login/programs/pt_chown.c @@ -55,7 +55,7 @@ static struct argp argp = static void print_version (FILE *stream, struct argp_state *state) { - fprintf (stream, "pt_chown (GNU %s) %s\n", PACKAGE, VERSION); + fprintf (stream, "pt_chown %s%s\n", PKGVERSION, VERSION); fprintf (stream, gettext ("\ Copyright (C) %s Free Software Foundation, Inc.\n\ This is free software; see the source for copying conditions. There is NO\n\ @@ -87,7 +87,7 @@ The owner is set to the current user, the group is set to `%s',\ %s"), TTY_GROUP, S_IRUSR|S_IWUSR|S_IWGRP, gettext ("\ For bug reporting instructions, please see:\n\ -<http://www.gnu.org/software/libc/bugs.html>.\n")); +"REPORT_BUGS_TO".\n")); return cp; default: break; diff --git a/libc/malloc/Makefile b/libc/malloc/Makefile index da72d3b33..a598fc789 100644 --- a/libc/malloc/Makefile +++ b/libc/malloc/Makefile @@ -132,13 +132,17 @@ sLIBdir := $(shell echo $(slibdir) | sed 's,lib\(\|64\)$$,\\\\$$LIB,') $(objpfx)mtrace: mtrace.pl rm -f $@.new sed -e 's|@PERL@|$(PERL)|' -e 's|@XXX@|$(address-width)|' \ - -e 's|@VERSION@|$(version)|' $^ > $@.new \ + -e 's|@VERSION@|$(version)|' \ + -e 's|@PKGVERSION@|$(PKGVERSION)|' \ + -e 's|@REPORT_BUGS_TO@|$(REPORT_BUGS_TO)|' $^ > $@.new \ && rm -f $@ && mv $@.new $@ && chmod +x $@ $(objpfx)memusage: memusage.sh rm -f $@.new sed -e 's|@BASH@|$(BASH)|' -e 's|@VERSION@|$(version)|' \ - -e 's|@SLIBDIR@|$(sLIBdir)|' -e 's|@BINDIR@|$(bindir)|' $^ > $@.new \ + -e 's|@SLIBDIR@|$(sLIBdir)|' -e 's|@BINDIR@|$(bindir)|' \ + -e 's|@PKGVERSION@|$(PKGVERSION)|' \ + -e 's|@REPORT_BUGS_TO@|$(REPORT_BUGS_TO)|' $^ > $@.new \ && rm -f $@ && mv $@.new $@ && chmod +x $@ diff --git a/libc/malloc/memusage.sh b/libc/malloc/memusage.sh index c4e189a83..dfa71a8e8 100755 --- a/libc/malloc/memusage.sh +++ b/libc/malloc/memusage.sh @@ -36,7 +36,7 @@ do_missing_arg() { # Print help message do_help() { - echo $"Usage: memusage [OPTION]... PROGRAM [PROGRAMOPTION]... + printf $"Usage: memusage [OPTION]... PROGRAM [PROGRAMOPTION]... Profile memory usage of PROGRAM. -n,--progname=NAME Name of the program file to profile @@ -62,12 +62,13 @@ Mandatory arguments to long options are also mandatory for any corresponding short options. For bug reporting instructions, please see: -<http://www.gnu.org/software/libc/bugs.html>." +%s. +" "@REPORT_BUGS_TO@" exit 0 } do_version() { - echo 'memusage (GNU libc) @VERSION@' + echo 'memusage @PKGVERSION@@VERSION@' printf $"Copyright (C) %s Free Software Foundation, Inc. This is free software; see the source for copying conditions. There is NO warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. diff --git a/libc/malloc/memusagestat.c b/libc/malloc/memusagestat.c index 779d5c0a5..63961d9fa 100644 --- a/libc/malloc/memusagestat.c +++ b/libc/malloc/memusagestat.c @@ -38,6 +38,7 @@ #include <gdfontl.h> #include <gdfonts.h> +#include "../version.h" /* Default size of the generated image. */ #define XSIZE 800 @@ -73,6 +74,10 @@ static error_t parse_opt (int key, char *arg, struct argp_state *state); /* Function to print some extra text in the help message. */ static char *more_help (int key, const char *text, void *input); +/* Name and version of program. */ +static void print_version (FILE *stream, struct argp_state *state); +void (*argp_program_version_hook) (FILE *, struct argp_state *) = print_version; + /* Data structure to communicate with argp functions. */ static struct argp argp = { @@ -516,22 +521,32 @@ parse_opt (int key, char *arg, struct argp_state *state) static char * more_help (int key, const char *text, void *input) { - char *orig; - char *cp; + char *tp; switch (key) { case ARGP_KEY_HELP_EXTRA: /* We print some extra information. */ - orig = gettext ("\ + if (asprintf (&tp, gettext ("\ For bug reporting instructions, please see:\n\ -<http://www.gnu.org/software/libc/bugs.html>.\n"); - cp = strdup (orig); - if (cp == NULL) - cp = orig; - return cp; +%s.\n"), REPORT_BUGS_TO) < 0) + return NULL; + return tp; default: break; } return (char *) text; } + +/* Print the version information. */ +static void +print_version (FILE *stream, struct argp_state *state) +{ + fprintf (stream, "memusagestat %s%s\n", PKGVERSION, VERSION); + fprintf (stream, gettext ("\ +Copyright (C) %s Free Software Foundation, Inc.\n\ +This is free software; see the source for copying conditions. There is NO\n\ +warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.\n\ +"), "2008"); + fprintf (stream, gettext ("Written by %s.\n"), "Ulrich Drepper"); +} diff --git a/libc/malloc/mtrace.pl b/libc/malloc/mtrace.pl index 782861129..1b5708113 100644 --- a/libc/malloc/mtrace.pl +++ b/libc/malloc/mtrace.pl @@ -22,7 +22,8 @@ eval "exec @PERL@ -S $0 $@" # 02111-1307 USA. $VERSION = "@VERSION@"; -$PACKAGE = "libc"; +$PKGVERSION = "@PKGVERSION@"; +$REPORT_BUGS_TO = '@REPORT_BUGS_TO@'; $progname = $0; sub usage { @@ -31,7 +32,7 @@ sub usage { print " --version print version number, then exit\n"; print "\n"; print "For bug reporting instructions, please see:\n"; - print "<http://www.gnu.org/software/libc/bugs.html>.\n"; + print "$REPORT_BUGS_TO.\n"; exit 0; } @@ -44,7 +45,7 @@ arglist: while (@ARGV) { if ($ARGV[0] eq "--v" || $ARGV[0] eq "--ve" || $ARGV[0] eq "--ver" || $ARGV[0] eq "--vers" || $ARGV[0] eq "--versi" || $ARGV[0] eq "--versio" || $ARGV[0] eq "--version") { - print "mtrace (GNU $PACKAGE) $VERSION\n"; + print "mtrace $PKGVERSION$VERSION\n"; print "Copyright (C) 2008 Free Software Foundation, Inc.\n"; print "This is free software; see the source for copying conditions. There is NO\n"; print "warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.\n"; diff --git a/libc/manual/Makefile b/libc/manual/Makefile index c5866eb9d..3b1785da3 100644 --- a/libc/manual/Makefile +++ b/libc/manual/Makefile @@ -76,11 +76,12 @@ chapters.% top-menu.%: libc-texinfo.sh $(texis) Makefile AWK=$(AWK) $(SHELL) $< '$(chapters)' '$(add-chapters)' '$(appendices)' libc.dvi libc.pdf libc.info: chapters.texi top-menu.texi dir-add.texi \ - libm-err.texi + libm-err.texi pkgvers.texi libc.dvi libc.pdf: texinfo.tex html: libc/index.html -libc/index.html: chapters.texi top-menu.texi dir-add.texi libm-err.texi +libc/index.html: chapters.texi top-menu.texi dir-add.texi libm-err.texi \ + pkgvers.texi $(MAKEINFO) --html libc.texinfo # Generate the summary from the Texinfo source files for each chapter. @@ -109,6 +110,14 @@ stamp-libm-err: libm-err-tab.pl $(wildcard $(foreach dir,$(sysdirs),\ $(move-if-change) libm-err-tmp libm-err.texi touch $@ +# Package version and bug reporting URL. +pkgvers.texi: stamp-pkgvers +stamp-pkgvers: + echo "@set PKGVERSION $(PKGVERSION)" > pkgvers-tmp + echo "@set REPORT_BUGS_TO $(REPORT_BUGS_TO)" >> pkgvers-tmp + $(move-if-change) pkgvers-tmp pkgvers.texi + touch $@ + # Generate Texinfo files from the C source for the example programs. %.c.texi: examples/%.c sed -e 's,[{}],@&,g' \ diff --git a/libc/manual/install.texi b/libc/manual/install.texi index 0cd4d622d..58f2d3d35 100644 --- a/libc/manual/install.texi +++ b/libc/manual/install.texi @@ -476,7 +476,8 @@ remain unfixed for all eternity, if not longer. It is a good idea to verify that the problem has not already been reported. Bugs are documented in two places: The file @file{BUGS} -describes a number of well known bugs and the bug tracking system has a +describes a number of well known bugs and the upstream GNU C library +bug tracking system has a WWW interface at @url{http://sources.redhat.com/bugzilla/}. The WWW interface gives you access to open and closed reports. A closed report @@ -501,7 +502,7 @@ library, you really only need to narrow it down to one library function call, if possible. This should not be too difficult. The final step when you have a simple test case is to report the bug. -Do this using the WWW interface to the bug database. +Do this at @value{REPORT_BUGS_TO}. If you are not sure how a function should behave, and this manual doesn't tell you, that's a bug in the manual. Report that too! If the diff --git a/libc/manual/libc.texinfo b/libc/manual/libc.texinfo index 872028849..85f2f20b2 100644 --- a/libc/manual/libc.texinfo +++ b/libc/manual/libc.texinfo @@ -11,6 +11,8 @@ @end direntry @include dir-add.texi +@include pkgvers.texi + @c This tells texinfo.tex to use the real section titles in xrefs in @c place of the node name, when no section title is explicitly given. @set xref-automatic-section-title @@ -27,7 +29,8 @@ This file documents the GNU C library. This is Edition @value{EDITION}, last updated @value{UPDATED}, -of @cite{The GNU C Library Reference Manual}, for version @value{VERSION}. +of @cite{The GNU C Library Reference Manual}, for version +@value{VERSION} @value{PKGVERSION}. Copyright (C) 1993, 1994, 1995, 1996, 1997, 1998, 1999, 2001, 2002, 2003, 2007, 2008 Free Software Foundation, Inc. @@ -63,6 +66,8 @@ supports it in developing GNU and promoting software freedom.'' @center last updated @value{UPDATED} @sp 1 @center for version @value{VERSION} +@sp 1 +@center @value{PKGVERSION} @page @vskip 0pt plus 1filll @insertcopying @@ -87,6 +92,7 @@ by Etienne Suvasa. @top Main Menu This is Edition @value{EDITION}, last updated @value{UPDATED}, of @cite{The GNU C Library Reference Manual}, for Version @value{VERSION} +@value{PKGVERSION} of the GNU C Library. @end ifnottex diff --git a/libc/nscd/nscd.c b/libc/nscd/nscd.c index aa1490936..4703fe39a 100644 --- a/libc/nscd/nscd.c +++ b/libc/nscd/nscd.c @@ -109,7 +109,9 @@ static const struct argp_option options[] = }; /* Short description of program. */ -static const char doc[] = N_("Name Service Cache Daemon."); +static const char doc[] = N_("Name Service Cache Daemon.\v\ +For bug reporting instructions, please see:\n\ +"REPORT_BUGS_TO".\n"); /* Prototype for option handler. */ static error_t parse_opt (int key, char *arg, struct argp_state *state); @@ -402,7 +404,7 @@ parse_opt (int key, char *arg, struct argp_state *state) static void print_version (FILE *stream, struct argp_state *state) { - fprintf (stream, "nscd (GNU %s) %s\n", PACKAGE, VERSION); + fprintf (stream, "nscd %s%s\n", PKGVERSION, VERSION); fprintf (stream, gettext ("\ Copyright (C) %s Free Software Foundation, Inc.\n\ This is free software; see the source for copying conditions. There is NO\n\ diff --git a/libc/nss/getent.c b/libc/nss/getent.c index 1ca445b7c..f1379ebdd 100644 --- a/libc/nss/getent.c +++ b/libc/nss/getent.c @@ -62,7 +62,7 @@ static const struct argp_option args_options[] = /* Short description of program. */ static const char doc[] = N_("Get entries from administrative database.\v\ For bug reporting instructions, please see:\n\ -<http://www.gnu.org/software/libc/bugs.html>.\n"); +"REPORT_BUGS_TO".\n"); /* Prototype for option handler. */ static error_t parse_option (int key, char *arg, struct argp_state *state); @@ -80,7 +80,7 @@ static struct argp argp = static void print_version (FILE *stream, struct argp_state *state) { - fprintf (stream, "getent (GNU %s) %s\n", PACKAGE, VERSION); + fprintf (stream, "getent %s%s\n", PKGVERSION, VERSION); fprintf (stream, gettext ("\ Copyright (C) %s Free Software Foundation, Inc.\n\ This is free software; see the source for copying conditions. There is NO\n\ diff --git a/libc/nss/makedb.c b/libc/nss/makedb.c index 5390dc137..02aad0c41 100644 --- a/libc/nss/makedb.c +++ b/libc/nss/makedb.c @@ -224,13 +224,16 @@ parse_opt (int key, char *arg, struct argp_state *state) static char * more_help (int key, const char *text, void *input) { + char *tp = NULL; switch (key) { case ARGP_KEY_HELP_EXTRA: /* We print some extra information. */ - return strdup (gettext ("\ + if (asprintf (&tp, gettext ("\ For bug reporting instructions, please see:\n\ -<http://www.gnu.org/software/libc/bugs.html>.\n")); +%s.\n"), REPORT_BUGS_TO) < 0) + return NULL; + return tp; default: break; } @@ -241,7 +244,7 @@ For bug reporting instructions, please see:\n\ static void print_version (FILE *stream, struct argp_state *state) { - fprintf (stream, "makedb (GNU %s) %s\n", PACKAGE, VERSION); + fprintf (stream, "makedb %s%s\n", PKGVERSION, VERSION); fprintf (stream, gettext ("\ Copyright (C) %s Free Software Foundation, Inc.\n\ This is free software; see the source for copying conditions. There is NO\n\ diff --git a/libc/posix/getconf.c b/libc/posix/getconf.c index 618429220..f98c87277 100644 --- a/libc/posix/getconf.c +++ b/libc/posix/getconf.c @@ -1008,13 +1008,28 @@ main (int argc, char *argv[]) if (argc > 1 && strcmp (argv[1], "--version") == 0) { - fprintf (stderr, "getconf (GNU %s) %s\n", PACKAGE, VERSION); - fprintf (stderr, gettext ("\ + printf ("getconf %s%s\n", PKGVERSION, VERSION); + printf (gettext ("\ Copyright (C) %s Free Software Foundation, Inc.\n\ This is free software; see the source for copying conditions. There is NO\n\ warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.\n\ "), "2008"); - fprintf (stderr, gettext ("Written by %s.\n"), "Roland McGrath"); + printf (gettext ("Written by %s.\n"), "Roland McGrath"); + return 0; + } + + if (argc > 1 && strcmp (argv[1], "--help") == 0) + { + printf (gettext ("\ +Usage: getconf [-v SPEC] VAR\n\ + or: getconf [-v SPEC] PATH_VAR PATH\n\ +\n\ +Get the configuration value for variable VAR, or for variable PATH_VAR\n\ +for path PATH. If SPEC is given, give values for compilation\n\ +environment SPEC.\n\ +\n\ +For bug reporting instructions, please see:\n\ +%s.\n"), REPORT_BUGS_TO); return 0; } diff --git a/libc/sunrpc/proto.h b/libc/sunrpc/proto.h index 7c0412b70..934c051b4 100644 --- a/libc/sunrpc/proto.h +++ b/libc/sunrpc/proto.h @@ -70,4 +70,7 @@ extern char *stpcpy (char *, const char *); #define __GNU_LIBRARY__ #endif +#define REPORT_BUGS_TO "" +#define PKGVERSION "" + #endif diff --git a/libc/sunrpc/rpc_main.c b/libc/sunrpc/rpc_main.c index bda432d3c..321cab980 100644 --- a/libc/sunrpc/rpc_main.c +++ b/libc/sunrpc/rpc_main.c @@ -52,6 +52,8 @@ #include "rpc_scan.h" #include "proto.h" +#include "../version.h" + #define EXTEND 1 /* alias for TRUE */ #define DONT_EXTEND 0 /* alias for FALSE */ @@ -132,8 +134,9 @@ static void addarg (const char *cp); static void putarg (int whereto, const char *cp); static void checkfiles (const char *infile, const char *outfile); static int parseargs (int argc, const char *argv[], struct commandline *cmd); -static void usage (void) __attribute__ ((noreturn)); -static void options_usage (void) __attribute__ ((noreturn)); +static void usage (FILE *stream, int status) __attribute__ ((noreturn)); +static void options_usage (FILE *stream, int status) __attribute__ ((noreturn)); +static void print_version (void); static void c_initialize (void); static char *generate_guard (const char *pathname); @@ -185,7 +188,7 @@ main (int argc, const char *argv[]) (void) memset ((char *) &cmd, 0, sizeof (struct commandline)); clear_args (); if (!parseargs (argc, argv, &cmd)) - usage (); + usage (stderr, 1); if (cmd.cflag || cmd.hflag || cmd.lflag || cmd.tflag || cmd.sflag || cmd.mflag || cmd.nflag || cmd.Ssflag || cmd.Scflag) @@ -787,7 +790,7 @@ s_output (int argc, const char *argv[], const char *infile, const char *define, { if (outfilename) unlink (outfilename); - usage (); + usage (stderr, 1); } write_rest (); } @@ -1214,6 +1217,10 @@ parseargs (int argc, const char *argv[], struct commandline *cmd) } cmd->infile = argv[i]; } + else if (!strcmp (argv[i], "--help")) + usage (stdout, 0); + else if (!strcmp (argv[i], "--version")) + print_version (); else { for (j = 1; argv[i][j] != 0; j++) @@ -1438,46 +1445,56 @@ parseargs (int argc, const char *argv[], struct commandline *cmd) } static void -usage (void) +usage (FILE *stream, int status) { - fprintf (stderr, _("usage: %s infile\n"), cmdname); - fprintf (stderr, _("\t%s [-abkCLNTM][-Dname[=value]] [-i size] \ + fprintf (stream, _("usage: %s infile\n"), cmdname); + fprintf (stream, _("\t%s [-abkCLNTM][-Dname[=value]] [-i size] \ [-I [-K seconds]] [-Y path] infile\n"), cmdname); - fprintf (stderr, _("\t%s [-c | -h | -l | -m | -t | -Sc | -Ss | -Sm] \ + fprintf (stream, _("\t%s [-c | -h | -l | -m | -t | -Sc | -Ss | -Sm] \ [-o outfile] [infile]\n"), cmdname); - fprintf (stderr, _("\t%s [-s nettype]* [-o outfile] [infile]\n"), cmdname); - fprintf (stderr, _("\t%s [-n netid]* [-o outfile] [infile]\n"), cmdname); - options_usage (); - exit (1); + fprintf (stream, _("\t%s [-s nettype]* [-o outfile] [infile]\n"), cmdname); + fprintf (stream, _("\t%s [-n netid]* [-o outfile] [infile]\n"), cmdname); + options_usage (stream, status); + exit (status); +} + +static void +options_usage (FILE *stream, int status) +{ + f_print (stream, "options:\n"); + f_print (stream, "-a\t\tgenerate all files, including samples\n"); + f_print (stream, "-b\t\tbackward compatibility mode (generates code for SunOS 4.1)\n"); + f_print (stream, "-c\t\tgenerate XDR routines\n"); + f_print (stream, "-C\t\tANSI C mode\n"); + f_print (stream, "-Dname[=value]\tdefine a symbol (same as #define)\n"); + f_print (stream, "-h\t\tgenerate header file\n"); + f_print (stream, "-i size\t\tsize at which to start generating inline code\n"); + f_print (stream, "-I\t\tgenerate code for inetd support in server (for SunOS 4.1)\n"); + f_print (stream, "-K seconds\tserver exits after K seconds of inactivity\n"); + f_print (stream, "-l\t\tgenerate client side stubs\n"); + f_print (stream, "-L\t\tserver errors will be printed to syslog\n"); + f_print (stream, "-m\t\tgenerate server side stubs\n"); + f_print (stream, "-M\t\tgenerate MT-safe code\n"); + f_print (stream, "-n netid\tgenerate server code that supports named netid\n"); + f_print (stream, "-N\t\tsupports multiple arguments and call-by-value\n"); + f_print (stream, "-o outfile\tname of the output file\n"); + f_print (stream, "-s nettype\tgenerate server code that supports named nettype\n"); + f_print (stream, "-Sc\t\tgenerate sample client code that uses remote procedures\n"); + f_print (stream, "-Ss\t\tgenerate sample server code that defines remote procedures\n"); + f_print (stream, "-Sm \t\tgenerate makefile template \n"); + f_print (stream, "-t\t\tgenerate RPC dispatch table\n"); + f_print (stream, "-T\t\tgenerate code to support RPC dispatch tables\n"); + f_print (stream, "-Y path\t\tdirectory name to find C preprocessor (cpp)\n"); + + f_print (stream, "\n\ +For bug reporting instructions, please see:\n\ +%s.\n", REPORT_BUGS_TO); + exit (status); } static void -options_usage (void) +print_version (void) { - f_print (stderr, "options:\n"); - f_print (stderr, "-a\t\tgenerate all files, including samples\n"); - f_print (stderr, "-b\t\tbackward compatibility mode (generates code for SunOS 4.1)\n"); - f_print (stderr, "-c\t\tgenerate XDR routines\n"); - f_print (stderr, "-C\t\tANSI C mode\n"); - f_print (stderr, "-Dname[=value]\tdefine a symbol (same as #define)\n"); - f_print (stderr, "-h\t\tgenerate header file\n"); - f_print (stderr, "-i size\t\tsize at which to start generating inline code\n"); - f_print (stderr, "-I\t\tgenerate code for inetd support in server (for SunOS 4.1)\n"); - f_print (stderr, "-K seconds\tserver exits after K seconds of inactivity\n"); - f_print (stderr, "-l\t\tgenerate client side stubs\n"); - f_print (stderr, "-L\t\tserver errors will be printed to syslog\n"); - f_print (stderr, "-m\t\tgenerate server side stubs\n"); - f_print (stderr, "-M\t\tgenerate MT-safe code\n"); - f_print (stderr, "-n netid\tgenerate server code that supports named netid\n"); - f_print (stderr, "-N\t\tsupports multiple arguments and call-by-value\n"); - f_print (stderr, "-o outfile\tname of the output file\n"); - f_print (stderr, "-s nettype\tgenerate server code that supports named nettype\n"); - f_print (stderr, "-Sc\t\tgenerate sample client code that uses remote procedures\n"); - f_print (stderr, "-Ss\t\tgenerate sample server code that defines remote procedures\n"); - f_print (stderr, "-Sm \t\tgenerate makefile template \n"); - f_print (stderr, "-t\t\tgenerate RPC dispatch table\n"); - f_print (stderr, "-T\t\tgenerate code to support RPC dispatch tables\n"); - f_print (stderr, "-Y path\t\tdirectory name to find C preprocessor (cpp)\n"); - - exit (1); + printf ("rpcgen %s%s\n", PKGVERSION, VERSION); + exit (0); } diff --git a/libc/sunrpc/rpcinfo.c b/libc/sunrpc/rpcinfo.c index d9da98966..ec21033b4 100644 --- a/libc/sunrpc/rpcinfo.c +++ b/libc/sunrpc/rpcinfo.c @@ -58,6 +58,8 @@ static char sccsid[] = "@(#)rpcinfo.c 1.22 87/08/12 SMI"; #include <locale.h> #include <libintl.h> +#include "../version.h" + #define MAXHOSTLEN 256 #define MIN_VERS ((u_long) 0) @@ -70,7 +72,8 @@ static void pmapdump (int argc, char **argv); static bool_t reply_proc (void *res, struct sockaddr_in *who); static void brdcst (int argc, char **argv) __attribute__ ((noreturn)); static void deletereg (int argc, char **argv); -static void usage (void); +static void usage (FILE *stream); +static void print_version (void); static u_long getprognum (char *arg); static u_long getvers (char *arg); static void get_inet_address (struct sockaddr_in *addr, char *host); @@ -92,6 +95,11 @@ main (int argc, char **argv) int errflg; int function; u_short portnum; + static const struct option long_options[] = { + { "help", no_argument, NULL, 'H' }, + { "version", no_argument, NULL, 'V' }, + { NULL, 0, NULL, 0 } + }; setlocale (LC_ALL, ""); textdomain (_libc_intl_domainname); @@ -99,7 +107,7 @@ main (int argc, char **argv) function = NONE; portnum = 0; errflg = 0; - while ((c = getopt (argc, argv, "ptubdn:")) != -1) + while ((c = getopt_long (argc, argv, "ptubdn:", long_options, NULL)) != -1) { switch (c) { @@ -143,6 +151,14 @@ main (int argc, char **argv) function = DELETES; break; + case 'H': + usage (stdout); + return 0; + + case 'V': + print_version (); + return 0; + case '?': errflg = 1; } @@ -150,7 +166,7 @@ main (int argc, char **argv) if (errflg || function == NONE) { - usage (); + usage (stderr); return 1; } @@ -160,7 +176,7 @@ main (int argc, char **argv) case PMAPDUMP: if (portnum != 0) { - usage (); + usage (stderr); return 1; } pmapdump (argc - optind, argv + optind); @@ -177,7 +193,7 @@ main (int argc, char **argv) case BRDCST: if (portnum != 0) { - usage (); + usage (stderr); return 1; } brdcst (argc - optind, argv + optind); @@ -208,7 +224,7 @@ udpping (portnum, argc, argv) if (argc < 2 || argc > 3) { - usage (); + usage (stderr); exit (1); } prognum = getprognum (argv[1]); @@ -363,7 +379,7 @@ tcpping (portnum, argc, argv) if (argc < 2 || argc > 3) { - usage (); + usage (stderr); exit (1); } prognum = getprognum (argv[1]); @@ -532,7 +548,7 @@ pmapdump (argc, argv) if (argc > 1) { - usage (); + usage (stderr); exit (1); } if (argc == 1) @@ -624,7 +640,7 @@ brdcst (argc, argv) if (argc != 2) { - usage (); + usage (stderr); exit (1); } prognum = getprognum (argv[0]); @@ -650,7 +666,7 @@ deletereg (argc, argv) if (argc != 2) { - usage (); + usage (stderr); exit (1); } if (getuid ()) @@ -669,15 +685,24 @@ deletereg (argc, argv) } static void -usage () +usage (FILE *stream) { fputs (_("Usage: rpcinfo [ -n portnum ] -u host prognum [ versnum ]\n"), - stderr); + stream); fputs (_(" rpcinfo [ -n portnum ] -t host prognum [ versnum ]\n"), - stderr); - fputs (_(" rpcinfo -p [ host ]\n"), stderr); - fputs (_(" rpcinfo -b prognum versnum\n"), stderr); - fputs (_(" rpcinfo -d prognum versnum\n"), stderr); + stream); + fputs (_(" rpcinfo -p [ host ]\n"), stream); + fputs (_(" rpcinfo -b prognum versnum\n"), stream); + fputs (_(" rpcinfo -d prognum versnum\n"), stream); + fprintf (stream, _("\n\ +For bug reporting instructions, please see:\n\ +%s.\n"), REPORT_BUGS_TO); +} + +static void +print_version (void) +{ + printf ("rpcinfo %s%s\n", PKGVERSION, VERSION); } static u_long diff --git a/libc/sysdeps/unix/sysv/linux/lddlibc4.c b/libc/sysdeps/unix/sysv/linux/lddlibc4.c index 7683ec2ef..b7dd660f5 100644 --- a/libc/sysdeps/unix/sysv/linux/lddlibc4.c +++ b/libc/sysdeps/unix/sysv/linux/lddlibc4.c @@ -56,6 +56,25 @@ main (int argc, char *argv[]) if (argc != 2) return 1; + if (!strcmp (argv[1], "--help")) + { + printf (gettext ("Usage: lddlibc4 FILE\n\ +\n\ +For bug reporting instructions, please see:\n\ +%s.\n"), REPORT_BUGS_TO); + return 0; + } + else if (!strcmp (argv[1], "--version")) + { + printf ("lddlibc4 %s%s\n", PKGVERSION, VERSION); + printf (gettext ("\ +Copyright (C) %s Free Software Foundation, Inc.\n\ +This is free software; see the source for copying conditions. There is NO\n\ +warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.\n\ +"), "2008"); + return 0; + } + filename = argv[1]; /* First see whether this is really an a.out binary. */ diff --git a/libc/timezone/Makefile b/libc/timezone/Makefile index 05a48bd0e..1dd5d68cf 100644 --- a/libc/timezone/Makefile +++ b/libc/timezone/Makefile @@ -182,7 +182,7 @@ $(objpfx)zic: $(addprefix $(objpfx), $(zic-objs)) $(addprefix $(objpfx)cross-,$(zic-objs)): $(objpfx)cross-%.o: %.c gcc $< -c $(OUTPUT_OPTION) $(CFLAGS-$*.c) $(CPPFLAGS-$*) \ - $(compile-mkdep-flags) + -DCROSS_ZIC $(compile-mkdep-flags) $(objpfx)cross-zic: $(addprefix $(objpfx)cross-,$(zic-objs)) gcc $(addprefix $(objpfx)cross-,$(zic-objs)) -o $@ @@ -244,7 +244,9 @@ $(testdata)/Asia/Tokyo: asia $(zic-deps) $(objpfx)tzselect: tzselect.ksh $(common-objpfx)config.make sed -e 's%@KSH@%$(KSH)%g' \ - -e 's%@TZDIR@%$(zonedir)%g' < $< > $@.new + -e 's%@TZDIR@%$(zonedir)%g' \ + -e 's%@PKGVERSION@%$(PKGVERSION)%g' \ + -e 's%@REPORT_BUGS_TO@%$(REPORT_BUGS_TO)%g' < $< > $@.new chmod 555 $@.new mv -f $@.new $@ diff --git a/libc/timezone/tzselect.ksh b/libc/timezone/tzselect.ksh index b99af8273..30c8e5c99 100644 --- a/libc/timezone/tzselect.ksh +++ b/libc/timezone/tzselect.ksh @@ -1,6 +1,8 @@ #! @KSH@ -# '@(#)tzselect.ksh 8.1' +VERSION='@(#)tzselect.ksh 8.1' +PKGVERSION='@PKGVERSION@' +REPORT_BUGS_TO='@REPORT_BUGS_TO@' # Ask the user about the time zone, and output the resulting TZ value to stdout. # Interact with the user via stderr and stdin. @@ -45,6 +47,22 @@ exit 1 } +if [ "$1" = "--help" ]; then + cat <<EOF +Usage: tzselect +Select a time zone interactively. + +For bug reporting instructions, please see: +$REPORT_BUGS_TO. +EOF + exit 0 +elif [ "$1" = "--version" ]; then + cat <<EOF +tzselect $PKGVERSION$VERSION +EOF + exit 0 +fi + # Make sure the tables are readable. TZ_COUNTRY_TABLE=$TZDIR/iso3166.tab TZ_ZONE_TABLE=$TZDIR/zone.tab diff --git a/libc/timezone/zdump.c b/libc/timezone/zdump.c index 82c91e485..590b548ad 100644 --- a/libc/timezone/zdump.c +++ b/libc/timezone/zdump.c @@ -6,6 +6,7 @@ static char elsieid[] = "@(#)zdump.c 8.6"; ** You can use this code to help in verifying other implementations. */ +#include "config.h" #include "stdio.h" /* for stdout, stderr, perror */ #include "string.h" /* for strcpy */ #include "sys/types.h" /* for time_t */ @@ -230,6 +231,18 @@ const char * const zone; warned = TRUE; } +static void +usage(const char *progname, FILE *stream, int status) +{ + (void) fprintf(stream, +_("%s: usage is %s [ --version ] [ --help ] [ -v ] [ -c [loyear,]hiyear ] zonename ...\n\ +\n\ +For bug reporting instructions, please see:\n\ +%s.\n"), + progname, progname, REPORT_BUGS_TO); + exit(status); +} + int main(argc, argv) int argc; @@ -264,8 +277,10 @@ char * argv[]; progname = argv[0]; for (i = 1; i < argc; ++i) if (strcmp(argv[i], "--version") == 0) { - (void) printf("%s\n", elsieid); + (void) printf("zdump %s%s\n", PKGVERSION, elsieid); exit(EXIT_SUCCESS); + } else if (strcmp(argv[i], "--help") == 0) { + usage(progname, stdout, EXIT_SUCCESS); } vflag = 0; cutarg = NULL; @@ -275,10 +290,7 @@ char * argv[]; else cutarg = optarg; if ((c != EOF && c != -1) || (optind == argc - 1 && strcmp(argv[optind], "=") == 0)) { - (void) fprintf(stderr, -_("%s: usage is %s [ --version ] [ -v ] [ -c [loyear,]hiyear ] zonename ...\n"), - progname, progname); - exit(EXIT_FAILURE); + usage(progname, stderr, EXIT_FAILURE); } if (vflag) { if (cutarg != NULL) { diff --git a/libc/timezone/zic.c b/libc/timezone/zic.c index 5f8028e48..6f654af19 100644 --- a/libc/timezone/zic.c +++ b/libc/timezone/zic.c @@ -5,6 +5,12 @@ static char elsieid[] = "@(#)zic.c 8.17"; +#ifdef CROSS_ZIC +#define REPORT_BUGS_TO "" +#define PKGVERSION "" +#else +#include "config.h" +#endif #include "private.h" #include "locale.h" #include "tzfile.h" @@ -156,7 +162,7 @@ static void stringzone(char * result, const struct zone * zp, int ntzones); static void setboundaries(void); static zic_t tadd(zic_t t1, long t2); -static void usage(void); +static void usage(FILE *stream, int status); static void writezone(const char * name, const char * string); static int yearistype(int year, const char * type); @@ -454,13 +460,16 @@ const char * const string; } static void -usage(void) +usage(FILE *stream, int status) { - (void) fprintf(stderr, _("%s: usage is %s \ -[ --version ] [ -v ] [ -l localtime ] [ -p posixrules ] \\\n\ -\t[ -d directory ] [ -L leapseconds ] [ -y yearistype ] [ filename ... ]\n"), - progname, progname); - exit(EXIT_FAILURE); + (void) fprintf(stream, _("%s: usage is %s \ +[ --version ] [ --help ] [ -v ] [ -l localtime ] [ -p posixrules ] \\\n\ +\t[ -d directory ] [ -L leapseconds ] [ -y yearistype ] [ filename ... ]\n\ +\n\ +For bug reporting instructions, please see:\n\ +%s.\n"), + progname, progname, REPORT_BUGS_TO); + exit(status); } static const char * psxrules; @@ -496,13 +505,15 @@ char * argv[]; } for (i = 1; i < argc; ++i) if (strcmp(argv[i], "--version") == 0) { - (void) printf("%s\n", elsieid); + (void) printf("zic %s%s\n", PKGVERSION, elsieid); exit(EXIT_SUCCESS); + } else if (strcmp(argv[i], "--help") == 0) { + usage(stdout, EXIT_SUCCESS); } while ((c = getopt(argc, argv, "d:l:p:L:vsy:")) != EOF && c != -1) switch (c) { default: - usage(); + usage(stderr, EXIT_FAILURE); case 'd': if (directory == NULL) directory = optarg; @@ -561,7 +572,7 @@ _("%s: More than one -L option specified\n"), break; } if (optind == argc - 1 && strcmp(argv[optind], "=") == 0) - usage(); /* usage message by request */ + usage(stderr, EXIT_FAILURE); /* usage message by request */ if (directory == NULL) directory = TZDIR; if (yitcommand == NULL) |