├── ABOUT-NLS ├── AUTHORS ├── COPYING ├── ChangeLog ├── ChangeLog.O ├── GNUmakefile ├── INSTALL ├── Makefile.am ├── Makefile.in ├── NEWS ├── README ├── README-dev ├── README-release ├── THANKS ├── TODO ├── aclocal.m4 ├── build-aux ├── announce-gen ├── compile ├── config.guess ├── config.rpath ├── config.sub ├── depcomp ├── do-release-commit-and-tag ├── gendocs.sh ├── gitlog-to-changelog ├── gnu-web-doc-update ├── gnupload ├── install-sh ├── mdate-sh ├── missing ├── prefix-gnulib-mk ├── snippet │ ├── _Noreturn.h │ ├── arg-nonnull.h │ ├── c++defs.h │ └── warn-on-use.h ├── test-driver ├── texinfo.tex ├── update-copyright ├── useless-if-before-free └── vc-list-files ├── config.in ├── configure ├── configure.ac ├── contrib ├── de_franconian_po.txt └── evolution.txt ├── doc ├── fdl.texi ├── hello.info ├── hello.texi ├── local.mk ├── stamp-vti └── version.texi ├── hello.1 ├── lib ├── basename-lgpl.c ├── basename.c ├── c-ctype.c ├── c-ctype.h ├── c-strcase.h ├── c-strcasecmp.c ├── c-strcaseeq.h ├── c-strncasecmp.c ├── close-stream.c ├── close-stream.h ├── closeout.c ├── closeout.h ├── config.charset ├── dirname-lgpl.c ├── dirname.c ├── dirname.h ├── dosname.h ├── errno.in.h ├── error.c ├── error.h ├── exitfail.c ├── exitfail.h ├── fpending.c ├── fpending.h ├── getopt.c ├── getopt.in.h ├── getopt1.c ├── getopt_int.h ├── gettext.h ├── gnulib.mk ├── intprops.h ├── local.mk ├── localcharset.c ├── localcharset.h ├── malloc.c ├── mbrtowc.c ├── mbsinit.c ├── mbsrtowcs-impl.h ├── mbsrtowcs-state.c ├── mbsrtowcs.c ├── memchr.c ├── memchr.valgrind ├── msvc-inval.c ├── msvc-inval.h ├── msvc-nothrow.c ├── msvc-nothrow.h ├── progname.c ├── progname.h ├── quote.h ├── quotearg.c ├── quotearg.h ├── ref-add.sin ├── ref-del.sin ├── stdbool.in.h ├── stddef.in.h ├── stdio.in.h ├── stdlib.in.h ├── streq.h ├── strerror-override.c ├── strerror-override.h ├── strerror.c ├── string.in.h ├── stripslash.c ├── strndup.c ├── strnlen.c ├── strnlen1.c ├── strnlen1.h ├── sys_types.in.h ├── unistd.c ├── unistd.in.h ├── verify.h ├── wchar.in.h ├── wctype-h.c ├── wctype.in.h ├── xalloc-die.c ├── xalloc-oversized.h ├── xalloc.h ├── xmalloc.c ├── xstrndup.c └── xstrndup.h ├── m4 ├── 00gnulib.m4 ├── absolute-header.m4 ├── close-stream.m4 ├── closeout.m4 ├── codeset.m4 ├── configmake.m4 ├── dirname.m4 ├── double-slash-root.m4 ├── errno_h.m4 ├── error.m4 ├── extensions.m4 ├── extern-inline.m4 ├── fcntl-o.m4 ├── fpending.m4 ├── getopt.m4 ├── gettext.m4 ├── glibc21.m4 ├── gnulib-cache.m4 ├── gnulib-common.m4 ├── gnulib-comp.m4 ├── iconv.m4 ├── include_next.m4 ├── intlmacosx.m4 ├── lib-ld.m4 ├── lib-link.m4 ├── lib-prefix.m4 ├── localcharset.m4 ├── locale-fr.m4 ├── locale-ja.m4 ├── locale-zh.m4 ├── malloc.m4 ├── mbrtowc.m4 ├── mbsinit.m4 ├── mbsrtowcs.m4 ├── mbstate_t.m4 ├── memchr.m4 ├── mmap-anon.m4 ├── msvc-inval.m4 ├── msvc-nothrow.m4 ├── nls.m4 ├── nocrash.m4 ├── non-recursive-gnulib-prefix-hack.m4 ├── off_t.m4 ├── po.m4 ├── progtest.m4 ├── quotearg.m4 ├── ssize_t.m4 ├── stdbool.m4 ├── stddef_h.m4 ├── stdio_h.m4 ├── stdlib_h.m4 ├── strerror.m4 ├── string_h.m4 ├── strndup.m4 ├── strnlen.m4 ├── sys_socket_h.m4 ├── sys_types_h.m4 ├── unistd_h.m4 ├── warn-on-use.m4 ├── wchar_h.m4 ├── wchar_t.m4 ├── wctype_h.m4 ├── wint_t.m4 ├── xalloc.m4 └── xstrndup.m4 ├── maint.mk ├── man └── hello.x ├── po ├── ChangeLog ├── LINGUAS ├── Makefile.in.in ├── Makevars ├── POTFILES.in ├── Rules-quot ├── bg.gmo ├── bg.po ├── boldquot.sed ├── ca.gmo ├── ca.po ├── da.gmo ├── da.po ├── de.gmo ├── de.po ├── el.gmo ├── el.po ├── en@boldquot.header ├── en@quot.header ├── eo.gmo ├── eo.po ├── es.gmo ├── es.po ├── et.gmo ├── et.po ├── eu.gmo ├── eu.po ├── fa.gmo ├── fa.po ├── fi.gmo ├── fi.po ├── fr.gmo ├── fr.po ├── ga.gmo ├── ga.po ├── gl.gmo ├── gl.po ├── he.gmo ├── he.po ├── hello.pot ├── hr.gmo ├── hr.po ├── hu.gmo ├── hu.po ├── id.gmo ├── id.po ├── insert-header.sin ├── it.gmo ├── it.po ├── ja.gmo ├── ja.po ├── ka.gmo ├── ka.po ├── ko.gmo ├── ko.po ├── lv.gmo ├── lv.po ├── ms.gmo ├── ms.po ├── nb.gmo ├── nb.po ├── nl.gmo ├── nl.po ├── nn.gmo ├── nn.po ├── pl.gmo ├── pl.po ├── pt.gmo ├── pt.po ├── pt_BR.gmo ├── pt_BR.po ├── quot.sed ├── remove-potcdate.sin ├── ro.gmo ├── ro.po ├── ru.gmo ├── ru.po ├── sk.gmo ├── sk.po ├── sl.gmo ├── sl.po ├── sr.gmo ├── sr.po ├── stamp-po ├── sv.gmo ├── sv.po ├── th.gmo ├── th.po ├── tr.gmo ├── tr.po ├── uk.gmo ├── uk.po ├── vi.gmo ├── vi.po ├── zh_CN.gmo ├── zh_CN.po ├── zh_TW.gmo └── zh_TW.po ├── src ├── hello.c └── system.h └── tests ├── greeting-1 ├── greeting-2 ├── hello-1 ├── last-1 └── traditional-1 /AUTHORS: -------------------------------------------------------------------------------- 1 | Authors of GNU Hello. 2 | 3 | Copyright (C) 1999, 2005, 2006, 2014 Free Software Foundation, Inc. 4 | 5 | Copying and distribution of this file, with or without modification, 6 | are permitted in any medium without royalty provided the copyright 7 | notice and this notice are preserved. 8 | 9 | The following contributions warranted legal paper exchanges with the 10 | Free Software Foundation. See also the ChangeLog and THANKS files. 11 | 12 | Mike Haertel 13 | David MacKenzie 14 | Jan Brittenson 15 | Roland McGrath 16 | Charles Hannum 17 | Bruce Korb hello.c, configure.ac. 18 | Karl Eichwalder all files. 19 | Karl Berry all files. 20 | The King releases. 21 | -------------------------------------------------------------------------------- /ChangeLog.O: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/rajeshsola/gnu-hello/274bd5b954066558a5ead00d3cceefe21ecdba9b/ChangeLog.O -------------------------------------------------------------------------------- /NEWS: -------------------------------------------------------------------------------- 1 | * Noteworthy changes in release ?.? (????-??-??) [?] 2 | 3 | * Noteworthy changes in release 2.10 (2014-11-16) [stable] 4 | 5 | Most importantly this release include the 'Hello, World' message to be 6 | part of translations. The translation bug was introduced in release 2.9. 7 | 8 | Other changes in this release include; Make use of none-recursive build. 9 | Removal of user-defined new-style. Include an example how to add a 10 | section to a manual page, such as BUGS. Rather than 'fprintf (stderr' 11 | use libc 'error()' reporting facility. Start using 'make 12 | update-copyright' facility. Generate ChangeLog from git commit logs. 13 | Avoid manual page generation errors when cross-compiling. 14 | 15 | * Noteworthy changes in release 2.9 (2013-10-10) [stable] 16 | 17 | A series of patches from Sami Kerola has modernized and improved the 18 | build system, added the possibility of user-defined new-style 19 | greetings, and added support for Unicode. 20 | 21 | Various translations have been updated (thanks to the Translation Project). 22 | 23 | * Noteworthy changes in release 2.8 (2012-04-19) [stable] 24 | 25 | The build system has been overhauled to be more in line with 26 | mainstream modern GNU practice, and various translations have been 27 | updated (thanks to the Translation Project!). 28 | 29 | Version 2.7 (28 March 2011) 30 | * Distribution: 31 | . gettext 0.18.1. 32 | . help2man 1.39.2. 33 | . updated -translations. 34 | 35 | Version 2.6 (7 April 2010) 36 | * Distribution: 37 | . make distribution of .tar.xz as well as .tar.gz. 38 | . gettext 0.17. 39 | . gnulib updates. 40 | . use gnulib's srclist-update to keep other common files in sync. 41 | . updated translations. 42 | 43 | Version 2.5 (7 February 2010) 44 | * Distribution: 45 | . gnulib updates. 46 | . autoconf 2.65, automake 1.11.1. 47 | (Especially including the make dist security fix.) 48 | . follow latest recommendations for --help and --version. 49 | . updated translations. 50 | 51 | Version 2.4 (9 December 2008) 52 | * last greeting option wins; before, the precedence was randomly hardwired. 53 | * FDL version 1.3+ for the documentation. 54 | * Distribution: 55 | . gnulib updates. 56 | . automake 1.10.2. 57 | . Include en@quot and en@boldquot support. 58 | . Remove obsolete translations de_DE and es_AR. 59 | . new (old) translations: ms (Malay), ro (Romansh), th (Thai). 60 | 61 | Version 2.3 (29 June 2007) 62 | * GPL version 3. 63 | 64 | Version 2.2 (23 November 2006) 65 | * Remove creeping non-feature of reading mail; simplify code accordingly. 66 | * Many improvements to the tests to make them more useful examples. 67 | * --help and --version exit immediately, as specified by GNU standards. 68 | * Distribution: 69 | . use gnulib for shared source files, such as texinfo.tex and getopt.c. 70 | . update for automake 1.10, autoconf 2.61, gettext 0.16. 71 | . new bg (Bulgarian) translation; many updated translations. 72 | 73 | Version 2.1.2 (20 July 2002) 74 | * Updated translations: es, fr, fi, nb, pt_BR, ru, sk, uk. 75 | * New translations: eu, fa, es_AR, ga, ka, ro, sr, zh_CN. 76 | 77 | Version 2.1.1 (9 June 2002) 78 | * Bugfixes: 79 | . Display the bug reporting address. 80 | 81 | Version 2.1.0 (22 May 2002) 82 | * Automake support. 83 | * Experimental NLS ("Native Language Support"). 84 | * Translations for ca, da, de, el, eo, es, et, fi, fr, gl, he, hr, hu, 85 | id, it, ja, ko, lv, nb, nl, nn, pl, pt, pt_BR, ru, sk, sl, sv, tr, and uk. 86 | * Test suite. 87 | * Add a contrib directory. 88 | * Manual page, produced with 'help2man'. 89 | * Create proper copyright statement for all output formats. 90 | * New greeting message ('-n', '--next-generation'). 91 | * Bugfixes: 92 | . GNU hello ('-m') does not loop forever if MAIL environment variable is 93 | not set. 94 | 95 | Version 1.3 (22 May 1993) 96 | * GNU hello now exits immediately and successfully after printing its 97 | version number and/or usage message under the `--version' (or `-v') and 98 | `--help' (or `-h') options. 99 | 100 | Version 1.2 (21 May 1993) 101 | * GNU hello can now read your mail with the `-m' (or `--mail') option. 102 | 103 | Version 1.1 (16 September 1992) 104 | * There is a new, improved greeting message. 105 | You can use the new `--traditional' option to get the old behavior. 106 | 107 | * Zork output compatibility has been added. 108 | 109 | * There is now a `NEWS' file (this one), giving a history of 110 | user-visible changes. 111 | -------------------------------------------------------------------------------- /README: -------------------------------------------------------------------------------- 1 | This is the README file for the GNU Hello distribution. 2 | Hello prints a friendly greeting. It also serves as a sample GNU 3 | package, showing practices that may be useful for GNU projects. 4 | 5 | Copyright (C) 1992, 1993, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 6 | 2002, 2004, 2005, 2006, 2010, 2013, 2014 Free Software Foundation, 7 | Inc. 8 | 9 | Copying and distribution of this file, with or without modification, 10 | are permitted in any medium without royalty provided the copyright 11 | notice and this notice are preserved. 12 | 13 | See the files ./INSTALL* for building and installation instructions. 14 | 15 | Primary distribution point: ftp://ftp.gnu.org/gnu/hello/ 16 | automatic redirection: http://ftpmirror.gnu.org/hello 17 | list of mirrors for manual selection: http://www.gnu.org/prep/ftp.html 18 | 19 | Home page: http://www.gnu.org/software/hello/ 20 | 21 | Developer page: http://savannah.gnu.org/projects/hello/ 22 | - please file bug reports, patches and feature requests here if 23 | possible (otherwise, feel free to use the mailing list) 24 | - significant contributions require a copyright assignment to the Free 25 | Software Foundation. The maintainer will be happy to answer 26 | questions about the process. 27 | 28 | Mailing list: bug-hello@gnu.org 29 | - please use this list for all discussion 30 | - archived at: http://lists.gnu.org/pipermail/bug-hello 31 | - anyone is welcome to join the list; to do so, visit 32 | http://lists.gnu.org/mailman/listinfo/bug-hello 33 | 34 | Bug reports: 35 | Please include enough information for the maintainers to reproduce the 36 | problem. Generally speaking, that means: 37 | - the contents of any input files necessary to reproduce the bug 38 | and command line invocations of the program(s) involved (crucial!). 39 | - a description of the problem and any samples of the erroneous output. 40 | - the version number of the program(s) involved (use --version). 41 | - hardware, operating system, and compiler versions (uname -a). 42 | - unusual options you gave to configure, if any (see config.status). 43 | - anything else that you think would be helpful. 44 | 45 | Patching process: 46 | - All changes must be sent to mailing list. 47 | - Changes are reviewed by maintainers. 48 | - Maintainer does not review own changes. 49 | * In case of single maintainer, or unresponsive co-maintainer, mailing 50 | list subscribers may perform the review. 51 | - Review means either a patch approval, comments to author, or a reject. 52 | * Approved patches are taken to upstream git. 53 | * Commented patches will require work before they can be approved. 54 | Comments can be untechnical, such as a change author must submit a 55 | copyright assignment to FSF. 56 | * Authors are encouraged to discontinue work with rejected changes, as 57 | the reject is permanent. 58 | - Maintainers keep track of rejected changes so that developers can avoid 59 | proposing the same in future. 60 | 61 | Patches are most welcome; if possible, please make them in git-am 62 | format, and include a suitable commit message. 63 | 64 | See README-dev for information on the development environment -- any 65 | interested parties are welcome. If you're a programmer and wish to 66 | contribute, this should get you started. If you're not a programmer, 67 | your help in writing test cases, checking the documentation against the 68 | implementation, translating the program strings to other languages, 69 | etc., would still be very much appreciated. 70 | 71 | The basic Hello algorithm was described by B.W. Kernighan and 72 | D.M. Ritchie. The GNU implementation is substantially more complex, in 73 | order to be a canonical example of a GNU package. Many people have 74 | contributed; please see the AUTHORS and ChangeLog files. 75 | 76 | GNU Hello is free software. See the file COPYING for copying conditions. 77 | -------------------------------------------------------------------------------- /README-dev: -------------------------------------------------------------------------------- 1 | This README.dev file describes the development environment. 2 | 3 | Copyright (C) 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 4 | 2011, 2012, 2014 Free Software Foundation, Inc. 5 | 6 | Copying and distribution of this file, with or without modification, 7 | are permitted in any medium without royalty provided the copyright 8 | notice and this notice are preserved. 9 | 10 | The development sources are available through git at Savannah: 11 | 12 | https://savannah.gnu.org/git/?group=hello 13 | 14 | 15 | Autotools 16 | --------- 17 | 18 | This distribution uses whatever versions of Automake, Autoconf and 19 | Gettext are listed in NEWS; usually the latest ones released. If you 20 | are getting the sources from git (or change configure.ac), you'll 21 | need to have these tools installed to (re)build. You'll also need 22 | help2man. All of these programs are available from 23 | ftp://ftp.gnu.org/gnu. 24 | 25 | 26 | Building 27 | -------- 28 | 29 | After getting the git sources, and installing the tools above, you 30 | can run 31 | 32 | ./bootstrap 33 | 34 | to do a fresh build. After that first time, running make should suffice. 35 | 36 | When modifying the sources, or making a distribution, more is needed, as 37 | follows: 38 | 39 | 40 | Gnulib 41 | ------ 42 | 43 | This distribution also uses Gnulib (http://www.gnu.org/software/gnulib) 44 | to share common files, stored as a submodule in git. 45 | 46 | 47 | Gettext 48 | ------- 49 | 50 | When updating gettext, besides the normal installation on the system, it 51 | is necessary to run gettextize -f in this hierarchy to update the po/ 52 | infrastructure. After doing so, rerun gnulib-tool --import since 53 | otherwise older files will have been imported. See the Gnulib manual 54 | for more information. 55 | -------------------------------------------------------------------------------- /README-release: -------------------------------------------------------------------------------- 1 | Here are most of the steps we (maintainers) follow when making a release. 2 | 3 | * Start from a clean, up-to-date git directory on "master": 4 | 5 | make -k maintainer-clean || { ./configure && make maintainer-clean; } 6 | git checkout master 7 | git pull origin master 8 | 9 | * Ensure that the latest stable versions of autoconf, automake, etc. 10 | are in your PATH. See the buildreq list in bootstrap.conf for 11 | the complete list of tools. 12 | 13 | * Ensure that you have no uncommitted diffs. This should produce no 14 | output: 15 | 16 | git diff 17 | 18 | * Ensure that you've pushed all changes that belong in the release: 19 | 20 | git push origin master 21 | 22 | * Check that the NixOS/Hydra autobuilder is reporting all is well: 23 | 24 | http://hydra.nixos.org/jobset/gnu/@PACKAGE@-master 25 | 26 | * Run the following command to download any new translations: 27 | 28 | ./bootstrap && ./configure 29 | 30 | * Pre-release testing: ensure that the following command succeeds: 31 | 32 | make check syntax-check distcheck 33 | 34 | * To (i) set the date, version number, and release TYPE on line 3 of 35 | NEWS, (ii) commit that, and (iii) tag the release, run 36 | 37 | # "TYPE" must be stable, beta or alpha 38 | make release-commit RELEASE='X.Y TYPE' 39 | 40 | * Run the following to create release tarballs. Your choice selects the 41 | corresponding upload-to destination in the emitted gnupload command. 42 | The different destinations are specified in cfg.mk. See the definitions 43 | of gnu_ftp_host-{alpha,beta,stable}. 44 | 45 | make release RELEASE='X.Y TYPE' 46 | 47 | * Test the tarball. Copy it to a few odd-ball systems and ensure that 48 | it builds and passes all tests. 49 | 50 | * While that's happening, write the release announcement that you will 51 | soon post. Start with the template, $HOME/announce-@PACKAGE@-X.Y 52 | that was just created by that "make" command. 53 | 54 | Once all the builds and tests have passed, 55 | 56 | * Run the gnupload command that was suggested by your "make release" 57 | run above, or run 58 | 59 | make upload RELEASE='X.Y TYPE' 60 | 61 | * Wait a few minutes (maybe up to 30?) and then use the release URLs to 62 | download all tarball/signature pairs and use gpg --verify to ensure 63 | that they're all valid. 64 | 65 | * Push the NEWS-updating changes and the new tag: 66 | 67 | v=$(cat .prev-version) 68 | git push origin master tag v$v 69 | 70 | * Announce it on Savannah first, so you can include the savannah.org 71 | announcement link in the email message. 72 | 73 | Go to the news-submission form: 74 | 75 | https://savannah.gnu.org/news/submit.php?group=@PACKAGE@ 76 | 77 | If it does not work, then enable "News" for the project via this link: 78 | 79 | https://savannah.gnu.org/project/admin/editgroupfeatures.php?group=@PACKAGE@ 80 | 81 | Write something like the following: 82 | 83 | Subject: @PACKAGE@-X.Y released [stable] 84 | +verbatim+ 85 | ...paste the announcement here... 86 | -verbatim- 87 | 88 | Then go here to approve it: 89 | 90 | https://savannah.gnu.org/news/approve.php?group=@PACKAGE@ 91 | 92 | * Send the announcement email message. 93 | 94 | * After each non-alpha release, run 95 | 96 | make web-manual-update 97 | 98 | to update the on-line manual accessible at 99 | 100 | http://www.gnu.org/software/@PACKAGE@/manual/ 101 | -------------------------------------------------------------------------------- /THANKS: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/rajeshsola/gnu-hello/274bd5b954066558a5ead00d3cceefe21ecdba9b/THANKS -------------------------------------------------------------------------------- /TODO: -------------------------------------------------------------------------------- 1 | GNU hello --- TODO 2 | 3 | Todo: 4 | 5 | * submit a new hello.pot. 6 | 7 | end of file TODO 8 | -------------------------------------------------------------------------------- /build-aux/snippet/_Noreturn.h: -------------------------------------------------------------------------------- 1 | #if !defined _Noreturn && __STDC_VERSION__ < 201112 2 | # if (3 <= __GNUC__ || (__GNUC__ == 2 && 8 <= __GNUC_MINOR__) \ 3 | || 0x5110 <= __SUNPRO_C) 4 | # define _Noreturn __attribute__ ((__noreturn__)) 5 | # elif 1200 <= _MSC_VER 6 | # define _Noreturn __declspec (noreturn) 7 | # else 8 | # define _Noreturn 9 | # endif 10 | #endif 11 | -------------------------------------------------------------------------------- /build-aux/snippet/arg-nonnull.h: -------------------------------------------------------------------------------- 1 | /* A C macro for declaring that specific arguments must not be NULL. 2 | Copyright (C) 2009-2014 Free Software Foundation, Inc. 3 | 4 | This program is free software: you can redistribute it and/or modify it 5 | under the terms of the GNU General Public License as published 6 | by the Free Software Foundation; either version 3 of the License, or 7 | (at your option) any later version. 8 | 9 | This program is distributed in the hope that it will be useful, 10 | but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 12 | General Public License for more details. 13 | 14 | You should have received a copy of the GNU General Public License 15 | along with this program. If not, see . */ 16 | 17 | /* _GL_ARG_NONNULL((n,...,m)) tells the compiler and static analyzer tools 18 | that the values passed as arguments n, ..., m must be non-NULL pointers. 19 | n = 1 stands for the first argument, n = 2 for the second argument etc. */ 20 | #ifndef _GL_ARG_NONNULL 21 | # if (__GNUC__ == 3 && __GNUC_MINOR__ >= 3) || __GNUC__ > 3 22 | # define _GL_ARG_NONNULL(params) __attribute__ ((__nonnull__ params)) 23 | # else 24 | # define _GL_ARG_NONNULL(params) 25 | # endif 26 | #endif 27 | -------------------------------------------------------------------------------- /build-aux/vc-list-files: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | # List version-controlled file names. 3 | 4 | # Print a version string. 5 | scriptversion=2011-05-16.22; # UTC 6 | 7 | # Copyright (C) 2006-2014 Free Software Foundation, Inc. 8 | 9 | # This program is free software: you can redistribute it and/or modify 10 | # it under the terms of the GNU General Public License as published by 11 | # the Free Software Foundation, either version 3 of the License, or 12 | # (at your option) any later version. 13 | 14 | # This program is distributed in the hope that it will be useful, 15 | # but WITHOUT ANY WARRANTY; without even the implied warranty of 16 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 17 | # GNU General Public License for more details. 18 | 19 | # You should have received a copy of the GNU General Public License 20 | # along with this program. If not, see . 21 | 22 | 23 | # List the specified version-controlled files. 24 | # With no argument, list them all. With a single DIRECTORY argument, 25 | # list the version-controlled files in that directory. 26 | 27 | # If there's an argument, it must be a single, "."-relative directory name. 28 | # cvsu is part of the cvsutils package: http://www.red-bean.com/cvsutils/ 29 | 30 | postprocess= 31 | case $1 in 32 | --help) cat <. 44 | EOF 45 | exit ;; 46 | 47 | --version) 48 | year=`echo "$scriptversion" | sed 's/[^0-9].*//'` 49 | cat < 53 | This is free software: you are free to change and redistribute it. 54 | There is NO WARRANTY, to the extent permitted by law. 55 | EOF 56 | exit ;; 57 | 58 | -C) 59 | test "$2" = . || postprocess="| sed 's|^|$2/|'" 60 | cd "$2" || exit 1 61 | shift; shift ;; 62 | esac 63 | 64 | test $# = 0 && set . 65 | 66 | for dir 67 | do 68 | if test -d .git; then 69 | test "x$dir" = x. \ 70 | && dir= sed_esc= \ 71 | || { dir="$dir/"; sed_esc=`echo "$dir"|env sed 's,\([\\/]\),\\\\\1,g'`; } 72 | # Ignore git symlinks - either they point into the tree, in which case 73 | # we don't need to visit the target twice, or they point somewhere 74 | # else (often into a submodule), in which case the content does not 75 | # belong to this package. 76 | eval exec git ls-tree -r 'HEAD:"$dir"' \ 77 | \| sed -n '"s/^100[^ ]*./$sed_esc/p"' $postprocess 78 | elif test -d .hg; then 79 | eval exec hg locate '"$dir/*"' $postprocess 80 | elif test -d .bzr; then 81 | test "$postprocess" = '' && postprocess="| sed 's|^\./||'" 82 | eval exec bzr ls -R --versioned '"$dir"' $postprocess 83 | elif test -d CVS; then 84 | test "$postprocess" = '' && postprocess="| sed 's|^\./||'" 85 | if test -x build-aux/cvsu; then 86 | eval build-aux/cvsu --find --types=AFGM '"$dir"' $postprocess 87 | elif (cvsu --help) >/dev/null 2>&1; then 88 | eval cvsu --find --types=AFGM '"$dir"' $postprocess 89 | else 90 | eval awk -F/ \''{ \ 91 | if (!$1 && $3 !~ /^-/) { \ 92 | f=FILENAME; \ 93 | if (f ~ /CVS\/Entries$/) \ 94 | f = substr(f, 1, length(f)-11); \ 95 | print f $2; \ 96 | }}'\'' \ 97 | `find "$dir" -name Entries -print` /dev/null' $postprocess 98 | fi 99 | elif test -d .svn; then 100 | eval exec svn list -R '"$dir"' $postprocess 101 | else 102 | echo "$0: Failed to determine type of version control used in `pwd`" 1>&2 103 | exit 1 104 | fi 105 | done 106 | 107 | # Local variables: 108 | # eval: (add-hook 'write-file-hooks 'time-stamp) 109 | # time-stamp-start: "scriptversion=" 110 | # time-stamp-format: "%:y-%02m-%02d.%02H" 111 | # time-stamp-time-zone: "UTC" 112 | # time-stamp-end: "; # UTC" 113 | # End: 114 | -------------------------------------------------------------------------------- /configure.ac: -------------------------------------------------------------------------------- 1 | dnl Process this file with autoconf to produce a configure script. 2 | dnl 3 | dnl This file is free software; as a special exception the author gives 4 | dnl unlimited permission to copy and/or distribute it, with or without 5 | dnl modifications, as long as this notice is preserved. 6 | dnl 7 | dnl This program is distributed in the hope that it will be useful, but 8 | dnl WITHOUT ANY WARRANTY, to the extent permitted by law; without even the 9 | dnl implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. 10 | 11 | AC_INIT([GNU Hello], 12 | [m4_esyscmd([build-aux/git-version-gen .tarball-version])], 13 | [bug-hello@gnu.org], [], 14 | [http://www.gnu.org/software/hello/]) 15 | 16 | dnl Must come before AM_INIT_AUTOMAKE. 17 | AC_CONFIG_AUX_DIR([build-aux]) 18 | AM_INIT_AUTOMAKE([ 19 | 1.11.1 20 | readme-alpha 21 | subdir-objects 22 | ]) 23 | 24 | dnl Minimum Autoconf version required. 25 | AC_PREREQ([2.62]) 26 | 27 | dnl Where to generate output; srcdir location. 28 | AC_CONFIG_HEADERS([config.h:config.in])dnl Keep filename to 8.3 for MS-DOS. 29 | AC_CONFIG_SRCDIR([src/hello.c]) 30 | 31 | dnl Checks for programs. 32 | dnl We need a C compiler. 33 | AC_PROG_CC 34 | 35 | dnl Since we use gnulib: gl_EARLY must be called as soon as possible after 36 | dnl the C compiler is checked. The others could be later, but we just 37 | dnl keep everything together. 38 | gl_EARLY 39 | gl_INIT 40 | 41 | dnl Copyright will apply as long as these sources are in use, e.g., are 42 | dnl being compiled, which is reasonable year to claim the copyright. 43 | AC_DEFINE([COPYRIGHT_YEAR], [m4_esyscmd([date +%Y])], [year in copyright message]) 44 | 45 | dnl Are we building from git checked-out sources, or a tarball ? 46 | dnl This is used in "Makefile.am" to avoid re-generating the manpage 47 | dnl when building from tarballs. 48 | AM_CONDITIONAL([BUILD_FROM_GIT], [test -d "$srcdir/.git"]) 49 | AM_CONDITIONAL([GIT_CROSS_COMPILING], 50 | [test -d "$srcdir/.git" && test $cross_compiling = yes]) 51 | 52 | dnl GNU help2man creates man pages from --help output; in many cases, this 53 | dnl is sufficient, and obviates the need to maintain man pages separately. 54 | dnl However, this means invoking executables, which we generally cannot do 55 | dnl when cross-compiling, so we test to avoid that (the variable 56 | dnl "cross_compiling" is set by AC_PROG_CC). 57 | AS_IF([test $cross_compiling = no], [ 58 | AM_MISSING_PROG([HELP2MAN], [help2man]) 59 | ], [ 60 | HELP2MAN=: 61 | ]) 62 | 63 | dnl i18n support from GNU gettext. 64 | AM_GNU_GETTEXT_VERSION([0.18.1]) 65 | AM_GNU_GETTEXT([external]) 66 | 67 | AC_CONFIG_FILES([Makefile 68 | po/Makefile.in]) 69 | AC_OUTPUT 70 | -------------------------------------------------------------------------------- /contrib/de_franconian_po.txt: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/rajeshsola/gnu-hello/274bd5b954066558a5ead00d3cceefe21ecdba9b/contrib/de_franconian_po.txt -------------------------------------------------------------------------------- /contrib/evolution.txt: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/rajeshsola/gnu-hello/274bd5b954066558a5ead00d3cceefe21ecdba9b/contrib/evolution.txt -------------------------------------------------------------------------------- /doc/local.mk: -------------------------------------------------------------------------------- 1 | # Make hello documentation. -*-Makefile-*- 2 | # This is included by the top-level Makefile.am. 3 | 4 | # Copyright (C) 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 5 | # 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011, 2012, 2013, 2014 Free 6 | # Software Foundation, Inc. 7 | 8 | # This program is free software: you can redistribute it and/or modify 9 | # it under the terms of the GNU General Public License as published by 10 | # the Free Software Foundation, either version 3 of the License, or 11 | # (at your option) any later version. 12 | 13 | # This program is distributed in the hope that it will be useful, 14 | # but WITHOUT ANY WARRANTY; without even the implied warranty of 15 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 16 | # GNU General Public License for more details. 17 | 18 | # You should have received a copy of the GNU General Public License 19 | # along with this program. If not, see . 20 | 21 | info_TEXINFOS = doc/hello.texi 22 | 23 | doc_hello_TEXINFOS = \ 24 | doc/fdl.texi 25 | -------------------------------------------------------------------------------- /doc/stamp-vti: -------------------------------------------------------------------------------- 1 | @set UPDATED 19 July 2014 2 | @set UPDATED-MONTH July 2014 3 | @set EDITION 2.10 4 | @set VERSION 2.10 5 | -------------------------------------------------------------------------------- /doc/version.texi: -------------------------------------------------------------------------------- 1 | @set UPDATED 19 July 2014 2 | @set UPDATED-MONTH July 2014 3 | @set EDITION 2.10 4 | @set VERSION 2.10 5 | -------------------------------------------------------------------------------- /hello.1: -------------------------------------------------------------------------------- 1 | .\" DO NOT MODIFY THIS FILE! It was generated by help2man 1.46.4. 2 | .TH HELLO "1" "November 2014" "hello 2.10" "User Commands" 3 | .SH NAME 4 | hello - friendly greeting program 5 | .SH SYNOPSIS 6 | .B hello 7 | [\fI\,OPTION\/\fR]... 8 | .SH DESCRIPTION 9 | Print a friendly, customizable greeting. 10 | .TP 11 | \fB\-h\fR, \fB\-\-help\fR 12 | display this help and exit 13 | .TP 14 | \fB\-v\fR, \fB\-\-version\fR 15 | display version information and exit 16 | .TP 17 | \fB\-t\fR, \fB\-\-traditional\fR 18 | use traditional greeting 19 | .TP 20 | \fB\-g\fR, \fB\-\-greeting\fR=\fI\,TEXT\/\fR 21 | use TEXT as the greeting message 22 | .SH "ADDITIONAL INFORMATION" 23 | See 24 | .UR http://git.savannah.gnu.org/cgit/hello.git/tree/man/hello.x 25 | man/hello.x 26 | .UE 27 | how to add addtional information to a manual page. 28 | .SH "REPORTING BUGS" 29 | Report bugs to: bug\-hello@gnu.org 30 | .br 31 | GNU Hello home page: 32 | .br 33 | General help using GNU software: 34 | .SH COPYRIGHT 35 | Copyright \(co 2014 Free Software Foundation, Inc. 36 | License GPLv3+: GNU GPL version 3 or later 37 | .br 38 | This is free software: you are free to change and redistribute it. 39 | There is NO WARRANTY, to the extent permitted by law. 40 | .SH "SEE ALSO" 41 | The full documentation for 42 | .B hello 43 | is maintained as a Texinfo manual. If the 44 | .B info 45 | and 46 | .B hello 47 | programs are properly installed at your site, the command 48 | .IP 49 | .B info hello 50 | .PP 51 | should give you access to the complete manual. 52 | -------------------------------------------------------------------------------- /lib/basename-lgpl.c: -------------------------------------------------------------------------------- 1 | /* basename.c -- return the last element in a file name 2 | 3 | Copyright (C) 1990, 1998-2001, 2003-2006, 2009-2014 Free Software 4 | Foundation, Inc. 5 | 6 | This program is free software: you can redistribute it and/or modify 7 | it under the terms of the GNU General Public License as published by 8 | the Free Software Foundation; either version 3 of the License, or 9 | (at your option) any later version. 10 | 11 | This program is distributed in the hope that it will be useful, 12 | but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14 | GNU General Public License for more details. 15 | 16 | You should have received a copy of the GNU General Public License 17 | along with this program. If not, see . */ 18 | 19 | #include 20 | 21 | #include "dirname.h" 22 | 23 | #include 24 | 25 | /* Return the address of the last file name component of NAME. If 26 | NAME has no relative file name components because it is a file 27 | system root, return the empty string. */ 28 | 29 | char * 30 | last_component (char const *name) 31 | { 32 | char const *base = name + FILE_SYSTEM_PREFIX_LEN (name); 33 | char const *p; 34 | bool saw_slash = false; 35 | 36 | while (ISSLASH (*base)) 37 | base++; 38 | 39 | for (p = base; *p; p++) 40 | { 41 | if (ISSLASH (*p)) 42 | saw_slash = true; 43 | else if (saw_slash) 44 | { 45 | base = p; 46 | saw_slash = false; 47 | } 48 | } 49 | 50 | return (char *) base; 51 | } 52 | 53 | /* Return the length of the basename NAME. Typically NAME is the 54 | value returned by base_name or last_component. Act like strlen 55 | (NAME), except omit all trailing slashes. */ 56 | 57 | size_t 58 | base_len (char const *name) 59 | { 60 | size_t len; 61 | size_t prefix_len = FILE_SYSTEM_PREFIX_LEN (name); 62 | 63 | for (len = strlen (name); 1 < len && ISSLASH (name[len - 1]); len--) 64 | continue; 65 | 66 | if (DOUBLE_SLASH_IS_DISTINCT_ROOT && len == 1 67 | && ISSLASH (name[0]) && ISSLASH (name[1]) && ! name[2]) 68 | return 2; 69 | 70 | if (FILE_SYSTEM_DRIVE_PREFIX_CAN_BE_RELATIVE && prefix_len 71 | && len == prefix_len && ISSLASH (name[prefix_len])) 72 | return prefix_len + 1; 73 | 74 | return len; 75 | } 76 | -------------------------------------------------------------------------------- /lib/basename.c: -------------------------------------------------------------------------------- 1 | /* basename.c -- return the last element in a file name 2 | 3 | Copyright (C) 1990, 1998-2001, 2003-2006, 2009-2014 Free Software 4 | Foundation, Inc. 5 | 6 | This program is free software: you can redistribute it and/or modify 7 | it under the terms of the GNU General Public License as published by 8 | the Free Software Foundation; either version 3 of the License, or 9 | (at your option) any later version. 10 | 11 | This program is distributed in the hope that it will be useful, 12 | but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14 | GNU General Public License for more details. 15 | 16 | You should have received a copy of the GNU General Public License 17 | along with this program. If not, see . */ 18 | 19 | #include 20 | 21 | #include "dirname.h" 22 | 23 | #include 24 | #include "xalloc.h" 25 | #include "xstrndup.h" 26 | 27 | char * 28 | base_name (char const *name) 29 | { 30 | char const *base = last_component (name); 31 | size_t length; 32 | 33 | /* If there is no last component, then name is a file system root or the 34 | empty string. */ 35 | if (! *base) 36 | return xstrndup (name, base_len (name)); 37 | 38 | /* Collapse a sequence of trailing slashes into one. */ 39 | length = base_len (base); 40 | if (ISSLASH (base[length])) 41 | length++; 42 | 43 | /* On systems with drive letters, "a/b:c" must return "./b:c" rather 44 | than "b:c" to avoid confusion with a drive letter. On systems 45 | with pure POSIX semantics, this is not an issue. */ 46 | if (FILE_SYSTEM_PREFIX_LEN (base)) 47 | { 48 | char *p = xmalloc (length + 3); 49 | p[0] = '.'; 50 | p[1] = '/'; 51 | memcpy (p + 2, base, length); 52 | p[length + 2] = '\0'; 53 | return p; 54 | } 55 | 56 | /* Finally, copy the basename. */ 57 | return xstrndup (base, length); 58 | } 59 | -------------------------------------------------------------------------------- /lib/c-strcase.h: -------------------------------------------------------------------------------- 1 | /* Case-insensitive string comparison functions in C locale. 2 | Copyright (C) 1995-1996, 2001, 2003, 2005, 2009-2014 Free Software 3 | Foundation, Inc. 4 | 5 | This program is free software; you can redistribute it and/or modify 6 | it under the terms of the GNU General Public License as published by 7 | the Free Software Foundation; either version 3, or (at your option) 8 | any later version. 9 | 10 | This program is distributed in the hope that it will be useful, 11 | but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 | GNU General Public License for more details. 14 | 15 | You should have received a copy of the GNU General Public License 16 | along with this program; if not, see . */ 17 | 18 | #ifndef C_STRCASE_H 19 | #define C_STRCASE_H 20 | 21 | #include 22 | 23 | 24 | /* The functions defined in this file assume the "C" locale and a character 25 | set without diacritics (ASCII-US or EBCDIC-US or something like that). 26 | Even if the "C" locale on a particular system is an extension of the ASCII 27 | character set (like on BeOS, where it is UTF-8, or on AmigaOS, where it 28 | is ISO-8859-1), the functions in this file recognize only the ASCII 29 | characters. More precisely, one of the string arguments must be an ASCII 30 | string; the other one can also contain non-ASCII characters (but then 31 | the comparison result will be nonzero). */ 32 | 33 | 34 | #ifdef __cplusplus 35 | extern "C" { 36 | #endif 37 | 38 | 39 | /* Compare strings S1 and S2, ignoring case, returning less than, equal to or 40 | greater than zero if S1 is lexicographically less than, equal to or greater 41 | than S2. */ 42 | extern int c_strcasecmp (const char *s1, const char *s2) _GL_ATTRIBUTE_PURE; 43 | 44 | /* Compare no more than N characters of strings S1 and S2, ignoring case, 45 | returning less than, equal to or greater than zero if S1 is 46 | lexicographically less than, equal to or greater than S2. */ 47 | extern int c_strncasecmp (const char *s1, const char *s2, size_t n) 48 | _GL_ATTRIBUTE_PURE; 49 | 50 | 51 | #ifdef __cplusplus 52 | } 53 | #endif 54 | 55 | 56 | #endif /* C_STRCASE_H */ 57 | -------------------------------------------------------------------------------- /lib/c-strcasecmp.c: -------------------------------------------------------------------------------- 1 | /* c-strcasecmp.c -- case insensitive string comparator in C locale 2 | Copyright (C) 1998-1999, 2005-2006, 2009-2014 Free Software Foundation, Inc. 3 | 4 | This program is free software; you can redistribute it and/or modify 5 | it under the terms of the GNU General Public License as published by 6 | the Free Software Foundation; either version 3, or (at your option) 7 | any later version. 8 | 9 | This program is distributed in the hope that it will be useful, 10 | but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 | GNU General Public License for more details. 13 | 14 | You should have received a copy of the GNU General Public License 15 | along with this program; if not, see . */ 16 | 17 | #include 18 | 19 | /* Specification. */ 20 | #include "c-strcase.h" 21 | 22 | #include 23 | 24 | #include "c-ctype.h" 25 | 26 | int 27 | c_strcasecmp (const char *s1, const char *s2) 28 | { 29 | register const unsigned char *p1 = (const unsigned char *) s1; 30 | register const unsigned char *p2 = (const unsigned char *) s2; 31 | unsigned char c1, c2; 32 | 33 | if (p1 == p2) 34 | return 0; 35 | 36 | do 37 | { 38 | c1 = c_tolower (*p1); 39 | c2 = c_tolower (*p2); 40 | 41 | if (c1 == '\0') 42 | break; 43 | 44 | ++p1; 45 | ++p2; 46 | } 47 | while (c1 == c2); 48 | 49 | if (UCHAR_MAX <= INT_MAX) 50 | return c1 - c2; 51 | else 52 | /* On machines where 'char' and 'int' are types of the same size, the 53 | difference of two 'unsigned char' values - including the sign bit - 54 | doesn't fit in an 'int'. */ 55 | return (c1 > c2 ? 1 : c1 < c2 ? -1 : 0); 56 | } 57 | -------------------------------------------------------------------------------- /lib/c-strncasecmp.c: -------------------------------------------------------------------------------- 1 | /* c-strncasecmp.c -- case insensitive string comparator in C locale 2 | Copyright (C) 1998-1999, 2005-2006, 2009-2014 Free Software Foundation, Inc. 3 | 4 | This program is free software; you can redistribute it and/or modify 5 | it under the terms of the GNU General Public License as published by 6 | the Free Software Foundation; either version 3, or (at your option) 7 | any later version. 8 | 9 | This program is distributed in the hope that it will be useful, 10 | but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 | GNU General Public License for more details. 13 | 14 | You should have received a copy of the GNU General Public License 15 | along with this program; if not, see . */ 16 | 17 | #include 18 | 19 | /* Specification. */ 20 | #include "c-strcase.h" 21 | 22 | #include 23 | 24 | #include "c-ctype.h" 25 | 26 | int 27 | c_strncasecmp (const char *s1, const char *s2, size_t n) 28 | { 29 | register const unsigned char *p1 = (const unsigned char *) s1; 30 | register const unsigned char *p2 = (const unsigned char *) s2; 31 | unsigned char c1, c2; 32 | 33 | if (p1 == p2 || n == 0) 34 | return 0; 35 | 36 | do 37 | { 38 | c1 = c_tolower (*p1); 39 | c2 = c_tolower (*p2); 40 | 41 | if (--n == 0 || c1 == '\0') 42 | break; 43 | 44 | ++p1; 45 | ++p2; 46 | } 47 | while (c1 == c2); 48 | 49 | if (UCHAR_MAX <= INT_MAX) 50 | return c1 - c2; 51 | else 52 | /* On machines where 'char' and 'int' are types of the same size, the 53 | difference of two 'unsigned char' values - including the sign bit - 54 | doesn't fit in an 'int'. */ 55 | return (c1 > c2 ? 1 : c1 < c2 ? -1 : 0); 56 | } 57 | -------------------------------------------------------------------------------- /lib/close-stream.c: -------------------------------------------------------------------------------- 1 | /* Close a stream, with nicer error checking than fclose's. 2 | 3 | Copyright (C) 1998-2002, 2004, 2006-2014 Free Software Foundation, Inc. 4 | 5 | This program is free software: you can redistribute it and/or modify 6 | it under the terms of the GNU General Public License as published by 7 | the Free Software Foundation; either version 3 of the License, or 8 | (at your option) any later version. 9 | 10 | This program is distributed in the hope that it will be useful, 11 | but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 | GNU General Public License for more details. 14 | 15 | You should have received a copy of the GNU General Public License 16 | along with this program. If not, see . */ 17 | 18 | #include 19 | 20 | #include "close-stream.h" 21 | 22 | #include 23 | #include 24 | 25 | #include "fpending.h" 26 | 27 | #if USE_UNLOCKED_IO 28 | # include "unlocked-io.h" 29 | #endif 30 | 31 | /* Close STREAM. Return 0 if successful, EOF (setting errno) 32 | otherwise. A failure might set errno to 0 if the error number 33 | cannot be determined. 34 | 35 | A failure with errno set to EPIPE may or may not indicate an error 36 | situation worth signaling to the user. See the documentation of the 37 | close_stdout_set_ignore_EPIPE function for details. 38 | 39 | If a program writes *anything* to STREAM, that program should close 40 | STREAM and make sure that it succeeds before exiting. Otherwise, 41 | suppose that you go to the extreme of checking the return status 42 | of every function that does an explicit write to STREAM. The last 43 | printf can succeed in writing to the internal stream buffer, and yet 44 | the fclose(STREAM) could still fail (due e.g., to a disk full error) 45 | when it tries to write out that buffered data. Thus, you would be 46 | left with an incomplete output file and the offending program would 47 | exit successfully. Even calling fflush is not always sufficient, 48 | since some file systems (NFS and CODA) buffer written/flushed data 49 | until an actual close call. 50 | 51 | Besides, it's wasteful to check the return value from every call 52 | that writes to STREAM -- just let the internal stream state record 53 | the failure. That's what the ferror test is checking below. */ 54 | 55 | int 56 | close_stream (FILE *stream) 57 | { 58 | const bool some_pending = (__fpending (stream) != 0); 59 | const bool prev_fail = (ferror (stream) != 0); 60 | const bool fclose_fail = (fclose (stream) != 0); 61 | 62 | /* Return an error indication if there was a previous failure or if 63 | fclose failed, with one exception: ignore an fclose failure if 64 | there was no previous error, no data remains to be flushed, and 65 | fclose failed with EBADF. That can happen when a program like cp 66 | is invoked like this 'cp a b >&-' (i.e., with standard output 67 | closed) and doesn't generate any output (hence no previous error 68 | and nothing to be flushed). */ 69 | 70 | if (prev_fail || (fclose_fail && (some_pending || errno != EBADF))) 71 | { 72 | if (! fclose_fail) 73 | errno = 0; 74 | return EOF; 75 | } 76 | 77 | return 0; 78 | } 79 | -------------------------------------------------------------------------------- /lib/close-stream.h: -------------------------------------------------------------------------------- 1 | #include 2 | int close_stream (FILE *stream); 3 | -------------------------------------------------------------------------------- /lib/closeout.h: -------------------------------------------------------------------------------- 1 | /* Close standard output and standard error. 2 | 3 | Copyright (C) 1998, 2000, 2003-2004, 2006, 2008-2014 Free Software 4 | Foundation, Inc. 5 | 6 | This program is free software: you can redistribute it and/or modify 7 | it under the terms of the GNU General Public License as published by 8 | the Free Software Foundation; either version 3 of the License, or 9 | (at your option) any later version. 10 | 11 | This program is distributed in the hope that it will be useful, 12 | but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14 | GNU General Public License for more details. 15 | 16 | You should have received a copy of the GNU General Public License 17 | along with this program. If not, see . */ 18 | 19 | #ifndef CLOSEOUT_H 20 | # define CLOSEOUT_H 1 21 | 22 | # include 23 | 24 | # ifdef __cplusplus 25 | extern "C" { 26 | # endif 27 | 28 | void close_stdout_set_file_name (const char *file); 29 | void close_stdout_set_ignore_EPIPE (bool ignore); 30 | void close_stdout (void); 31 | 32 | # ifdef __cplusplus 33 | } 34 | # endif 35 | 36 | #endif 37 | -------------------------------------------------------------------------------- /lib/dirname-lgpl.c: -------------------------------------------------------------------------------- 1 | /* dirname.c -- return all but the last element in a file name 2 | 3 | Copyright (C) 1990, 1998, 2000-2001, 2003-2006, 2009-2014 Free Software 4 | Foundation, Inc. 5 | 6 | This program is free software: you can redistribute it and/or modify 7 | it under the terms of the GNU General Public License as published by 8 | the Free Software Foundation; either version 3 of the License, or 9 | (at your option) any later version. 10 | 11 | This program is distributed in the hope that it will be useful, 12 | but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14 | GNU General Public License for more details. 15 | 16 | You should have received a copy of the GNU General Public License 17 | along with this program. If not, see . */ 18 | 19 | #include 20 | 21 | #include "dirname.h" 22 | 23 | #include 24 | #include 25 | 26 | /* Return the length of the prefix of FILE that will be used by 27 | dir_name. If FILE is in the working directory, this returns zero 28 | even though 'dir_name (FILE)' will return ".". Works properly even 29 | if there are trailing slashes (by effectively ignoring them). */ 30 | 31 | size_t 32 | dir_len (char const *file) 33 | { 34 | size_t prefix_length = FILE_SYSTEM_PREFIX_LEN (file); 35 | size_t length; 36 | 37 | /* Advance prefix_length beyond important leading slashes. */ 38 | prefix_length += (prefix_length != 0 39 | ? (FILE_SYSTEM_DRIVE_PREFIX_CAN_BE_RELATIVE 40 | && ISSLASH (file[prefix_length])) 41 | : (ISSLASH (file[0]) 42 | ? ((DOUBLE_SLASH_IS_DISTINCT_ROOT 43 | && ISSLASH (file[1]) && ! ISSLASH (file[2]) 44 | ? 2 : 1)) 45 | : 0)); 46 | 47 | /* Strip the basename and any redundant slashes before it. */ 48 | for (length = last_component (file) - file; 49 | prefix_length < length; length--) 50 | if (! ISSLASH (file[length - 1])) 51 | break; 52 | return length; 53 | } 54 | 55 | 56 | /* In general, we can't use the builtin 'dirname' function if available, 57 | since it has different meanings in different environments. 58 | In some environments the builtin 'dirname' modifies its argument. 59 | 60 | Return the leading directories part of FILE, allocated with malloc. 61 | Works properly even if there are trailing slashes (by effectively 62 | ignoring them). Return NULL on failure. 63 | 64 | If lstat (FILE) would succeed, then { chdir (dir_name (FILE)); 65 | lstat (base_name (FILE)); } will access the same file. Likewise, 66 | if the sequence { chdir (dir_name (FILE)); 67 | rename (base_name (FILE), "foo"); } succeeds, you have renamed FILE 68 | to "foo" in the same directory FILE was in. */ 69 | 70 | char * 71 | mdir_name (char const *file) 72 | { 73 | size_t length = dir_len (file); 74 | bool append_dot = (length == 0 75 | || (FILE_SYSTEM_DRIVE_PREFIX_CAN_BE_RELATIVE 76 | && length == FILE_SYSTEM_PREFIX_LEN (file) 77 | && file[2] != '\0' && ! ISSLASH (file[2]))); 78 | char *dir = malloc (length + append_dot + 1); 79 | if (!dir) 80 | return NULL; 81 | memcpy (dir, file, length); 82 | if (append_dot) 83 | dir[length++] = '.'; 84 | dir[length] = '\0'; 85 | return dir; 86 | } 87 | -------------------------------------------------------------------------------- /lib/dirname.c: -------------------------------------------------------------------------------- 1 | /* dirname.c -- return all but the last element in a file name 2 | 3 | Copyright (C) 1990, 1998, 2000-2001, 2003-2006, 2009-2014 Free Software 4 | Foundation, Inc. 5 | 6 | This program is free software: you can redistribute it and/or modify 7 | it under the terms of the GNU General Public License as published by 8 | the Free Software Foundation; either version 3 of the License, or 9 | (at your option) any later version. 10 | 11 | This program is distributed in the hope that it will be useful, 12 | but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14 | GNU General Public License for more details. 15 | 16 | You should have received a copy of the GNU General Public License 17 | along with this program. If not, see . */ 18 | 19 | #include 20 | 21 | #include "dirname.h" 22 | 23 | #include 24 | #include 25 | #include "xalloc.h" 26 | 27 | /* Just like mdir_name (dirname-lgpl.c), except, rather than 28 | returning NULL upon malloc failure, here, we report the 29 | "memory exhausted" condition and exit. */ 30 | 31 | char * 32 | dir_name (char const *file) 33 | { 34 | char *result = mdir_name (file); 35 | if (!result) 36 | xalloc_die (); 37 | return result; 38 | } 39 | -------------------------------------------------------------------------------- /lib/dirname.h: -------------------------------------------------------------------------------- 1 | /* Take file names apart into directory and base names. 2 | 3 | Copyright (C) 1998, 2001, 2003-2006, 2009-2014 Free Software Foundation, 4 | Inc. 5 | 6 | This program is free software: you can redistribute it and/or modify 7 | it under the terms of the GNU General Public License as published by 8 | the Free Software Foundation; either version 3 of the License, or 9 | (at your option) any later version. 10 | 11 | This program is distributed in the hope that it will be useful, 12 | but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14 | GNU General Public License for more details. 15 | 16 | You should have received a copy of the GNU General Public License 17 | along with this program. If not, see . */ 18 | 19 | #ifndef DIRNAME_H_ 20 | # define DIRNAME_H_ 1 21 | 22 | # include 23 | # include 24 | # include "dosname.h" 25 | 26 | # ifndef DIRECTORY_SEPARATOR 27 | # define DIRECTORY_SEPARATOR '/' 28 | # endif 29 | 30 | # ifndef DOUBLE_SLASH_IS_DISTINCT_ROOT 31 | # define DOUBLE_SLASH_IS_DISTINCT_ROOT 0 32 | # endif 33 | 34 | #ifdef __cplusplus 35 | extern "C" { 36 | #endif 37 | 38 | # if GNULIB_DIRNAME 39 | char *base_name (char const *file); 40 | char *dir_name (char const *file); 41 | # endif 42 | 43 | char *mdir_name (char const *file); 44 | size_t base_len (char const *file) _GL_ATTRIBUTE_PURE; 45 | size_t dir_len (char const *file) _GL_ATTRIBUTE_PURE; 46 | char *last_component (char const *file) _GL_ATTRIBUTE_PURE; 47 | 48 | bool strip_trailing_slashes (char *file); 49 | 50 | #ifdef __cplusplus 51 | } /* extern "C" */ 52 | #endif 53 | 54 | #endif /* not DIRNAME_H_ */ 55 | -------------------------------------------------------------------------------- /lib/dosname.h: -------------------------------------------------------------------------------- 1 | /* File names on MS-DOS/Windows systems. 2 | 3 | Copyright (C) 2000-2001, 2004-2006, 2009-2014 Free Software Foundation, Inc. 4 | 5 | This program is free software: you can redistribute it and/or modify 6 | it under the terms of the GNU General Public License as published by 7 | the Free Software Foundation; either version 3 of the License, or 8 | (at your option) any later version. 9 | 10 | This program is distributed in the hope that it will be useful, 11 | but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 | GNU General Public License for more details. 14 | 15 | You should have received a copy of the GNU General Public License 16 | along with this program. If not, see . 17 | 18 | From Paul Eggert and Jim Meyering. */ 19 | 20 | #ifndef _DOSNAME_H 21 | #define _DOSNAME_H 22 | 23 | #if (defined _WIN32 || defined __WIN32__ || \ 24 | defined __MSDOS__ || defined __CYGWIN__ || \ 25 | defined __EMX__ || defined __DJGPP__) 26 | /* This internal macro assumes ASCII, but all hosts that support drive 27 | letters use ASCII. */ 28 | # define _IS_DRIVE_LETTER(C) (((unsigned int) (C) | ('a' - 'A')) - 'a' \ 29 | <= 'z' - 'a') 30 | # define FILE_SYSTEM_PREFIX_LEN(Filename) \ 31 | (_IS_DRIVE_LETTER ((Filename)[0]) && (Filename)[1] == ':' ? 2 : 0) 32 | # ifndef __CYGWIN__ 33 | # define FILE_SYSTEM_DRIVE_PREFIX_CAN_BE_RELATIVE 1 34 | # endif 35 | # define ISSLASH(C) ((C) == '/' || (C) == '\\') 36 | #else 37 | # define FILE_SYSTEM_PREFIX_LEN(Filename) 0 38 | # define ISSLASH(C) ((C) == '/') 39 | #endif 40 | 41 | #ifndef FILE_SYSTEM_DRIVE_PREFIX_CAN_BE_RELATIVE 42 | # define FILE_SYSTEM_DRIVE_PREFIX_CAN_BE_RELATIVE 0 43 | #endif 44 | 45 | #if FILE_SYSTEM_DRIVE_PREFIX_CAN_BE_RELATIVE 46 | # define IS_ABSOLUTE_FILE_NAME(F) ISSLASH ((F)[FILE_SYSTEM_PREFIX_LEN (F)]) 47 | # else 48 | # define IS_ABSOLUTE_FILE_NAME(F) \ 49 | (ISSLASH ((F)[0]) || FILE_SYSTEM_PREFIX_LEN (F) != 0) 50 | #endif 51 | #define IS_RELATIVE_FILE_NAME(F) (! IS_ABSOLUTE_FILE_NAME (F)) 52 | 53 | #endif /* DOSNAME_H_ */ 54 | -------------------------------------------------------------------------------- /lib/error.h: -------------------------------------------------------------------------------- 1 | /* Declaration for error-reporting function 2 | Copyright (C) 1995-1997, 2003, 2006, 2008-2014 Free Software Foundation, 3 | Inc. 4 | This file is part of the GNU C Library. 5 | 6 | This program is free software: you can redistribute it and/or modify 7 | it under the terms of the GNU General Public License as published by 8 | the Free Software Foundation; either version 3 of the License, or 9 | (at your option) any later version. 10 | 11 | This program is distributed in the hope that it will be useful, 12 | but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14 | GNU General Public License for more details. 15 | 16 | You should have received a copy of the GNU General Public License 17 | along with this program. If not, see . */ 18 | 19 | #ifndef _ERROR_H 20 | #define _ERROR_H 1 21 | 22 | /* The __attribute__ feature is available in gcc versions 2.5 and later. 23 | The __-protected variants of the attributes 'format' and 'printf' are 24 | accepted by gcc versions 2.6.4 (effectively 2.7) and later. 25 | We enable _GL_ATTRIBUTE_FORMAT only if these are supported too, because 26 | gnulib and libintl do '#define printf __printf__' when they override 27 | the 'printf' function. */ 28 | #if __GNUC__ > 2 || (__GNUC__ == 2 && __GNUC_MINOR__ >= 7) 29 | # define _GL_ATTRIBUTE_FORMAT(spec) __attribute__ ((__format__ spec)) 30 | #else 31 | # define _GL_ATTRIBUTE_FORMAT(spec) /* empty */ 32 | #endif 33 | 34 | #ifdef __cplusplus 35 | extern "C" { 36 | #endif 37 | 38 | /* Print a message with 'fprintf (stderr, FORMAT, ...)'; 39 | if ERRNUM is nonzero, follow it with ": " and strerror (ERRNUM). 40 | If STATUS is nonzero, terminate the program with 'exit (STATUS)'. */ 41 | 42 | extern void error (int __status, int __errnum, const char *__format, ...) 43 | _GL_ATTRIBUTE_FORMAT ((__printf__, 3, 4)); 44 | 45 | extern void error_at_line (int __status, int __errnum, const char *__fname, 46 | unsigned int __lineno, const char *__format, ...) 47 | _GL_ATTRIBUTE_FORMAT ((__printf__, 5, 6)); 48 | 49 | /* If NULL, error will flush stdout, then print on stderr the program 50 | name, a colon and a space. Otherwise, error will call this 51 | function without parameters instead. */ 52 | extern void (*error_print_progname) (void); 53 | 54 | /* This variable is incremented each time 'error' is called. */ 55 | extern unsigned int error_message_count; 56 | 57 | /* Sometimes we want to have at most one error per line. This 58 | variable controls whether this mode is selected or not. */ 59 | extern int error_one_per_line; 60 | 61 | #ifdef __cplusplus 62 | } 63 | #endif 64 | 65 | #endif /* error.h */ 66 | -------------------------------------------------------------------------------- /lib/exitfail.c: -------------------------------------------------------------------------------- 1 | /* Failure exit status 2 | 3 | Copyright (C) 2002-2003, 2005-2007, 2009-2014 Free Software Foundation, Inc. 4 | 5 | This program is free software: you can redistribute it and/or modify 6 | it under the terms of the GNU General Public License as published by 7 | the Free Software Foundation; either version 3 of the License, or 8 | (at your option) any later version. 9 | 10 | This program is distributed in the hope that it will be useful, 11 | but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 | GNU General Public License for more details. 14 | 15 | You should have received a copy of the GNU General Public License 16 | along with this program. If not, see . */ 17 | 18 | #include 19 | 20 | #include "exitfail.h" 21 | 22 | #include 23 | 24 | int volatile exit_failure = EXIT_FAILURE; 25 | -------------------------------------------------------------------------------- /lib/exitfail.h: -------------------------------------------------------------------------------- 1 | /* Failure exit status 2 | 3 | Copyright (C) 2002, 2009-2014 Free Software Foundation, Inc. 4 | 5 | This program is free software: you can redistribute it and/or modify 6 | it under the terms of the GNU General Public License as published by 7 | the Free Software Foundation; either version 3 of the License, or 8 | (at your option) any later version. 9 | 10 | This program is distributed in the hope that it will be useful, 11 | but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 | GNU General Public License for more details. 14 | 15 | You should have received a copy of the GNU General Public License 16 | along with this program. If not, see . */ 17 | 18 | extern int volatile exit_failure; 19 | -------------------------------------------------------------------------------- /lib/fpending.c: -------------------------------------------------------------------------------- 1 | /* fpending.c -- return the number of pending output bytes on a stream 2 | Copyright (C) 2000, 2004, 2006-2007, 2009-2014 Free Software Foundation, 3 | Inc. 4 | 5 | This program is free software: you can redistribute it and/or modify 6 | it under the terms of the GNU General Public License as published by 7 | the Free Software Foundation; either version 3 of the License, or 8 | (at your option) any later version. 9 | 10 | This program is distributed in the hope that it will be useful, 11 | but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 | GNU General Public License for more details. 14 | 15 | You should have received a copy of the GNU General Public License 16 | along with this program. If not, see . */ 17 | 18 | /* Written by Jim Meyering. */ 19 | 20 | #include 21 | 22 | #include "fpending.h" 23 | 24 | /* Return the number of pending (aka buffered, unflushed) 25 | bytes on the stream, FP, that is open for writing. */ 26 | size_t 27 | __fpending (FILE *fp) 28 | { 29 | return PENDING_OUTPUT_N_BYTES; 30 | } 31 | -------------------------------------------------------------------------------- /lib/fpending.h: -------------------------------------------------------------------------------- 1 | /* Declare __fpending. 2 | 3 | Copyright (C) 2000, 2003, 2005-2006, 2009-2014 Free Software Foundation, 4 | Inc. 5 | 6 | This program is free software: you can redistribute it and/or modify 7 | it under the terms of the GNU General Public License as published by 8 | the Free Software Foundation; either version 3 of the License, or 9 | (at your option) any later version. 10 | 11 | This program is distributed in the hope that it will be useful, 12 | but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14 | GNU General Public License for more details. 15 | 16 | You should have received a copy of the GNU General Public License 17 | along with this program. If not, see . 18 | 19 | Written by Jim Meyering. */ 20 | 21 | #include 22 | #include 23 | #if HAVE_STDIO_EXT_H 24 | # include 25 | #endif 26 | 27 | #if !HAVE_DECL___FPENDING 28 | size_t __fpending (FILE *) _GL_ATTRIBUTE_PURE; 29 | #endif 30 | -------------------------------------------------------------------------------- /lib/local.mk: -------------------------------------------------------------------------------- 1 | include lib/gnulib.mk 2 | 3 | # Allow "make distdir" to succeed before "make all" has run. 4 | dist-hook: $(noinst_LIBRARIES) 5 | .PHONY: dist-hook 6 | -------------------------------------------------------------------------------- /lib/localcharset.h: -------------------------------------------------------------------------------- 1 | /* Determine a canonical name for the current locale's character encoding. 2 | Copyright (C) 2000-2003, 2009-2014 Free Software Foundation, Inc. 3 | This file is part of the GNU CHARSET Library. 4 | 5 | This program is free software; you can redistribute it and/or modify 6 | it under the terms of the GNU General Public License as published by 7 | the Free Software Foundation; either version 3, or (at your option) 8 | any later version. 9 | 10 | This program is distributed in the hope that it will be useful, 11 | but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 | GNU General Public License for more details. 14 | 15 | You should have received a copy of the GNU General Public License along 16 | with this program; if not, see . */ 17 | 18 | #ifndef _LOCALCHARSET_H 19 | #define _LOCALCHARSET_H 20 | 21 | 22 | #ifdef __cplusplus 23 | extern "C" { 24 | #endif 25 | 26 | 27 | /* Determine the current locale's character encoding, and canonicalize it 28 | into one of the canonical names listed in config.charset. 29 | The result must not be freed; it is statically allocated. 30 | If the canonical name cannot be determined, the result is a non-canonical 31 | name. */ 32 | extern const char * locale_charset (void); 33 | 34 | 35 | #ifdef __cplusplus 36 | } 37 | #endif 38 | 39 | 40 | #endif /* _LOCALCHARSET_H */ 41 | -------------------------------------------------------------------------------- /lib/malloc.c: -------------------------------------------------------------------------------- 1 | /* malloc() function that is glibc compatible. 2 | 3 | Copyright (C) 1997-1998, 2006-2007, 2009-2014 Free Software Foundation, Inc. 4 | 5 | This program is free software; you can redistribute it and/or modify 6 | it under the terms of the GNU General Public License as published by 7 | the Free Software Foundation; either version 3, or (at your option) 8 | any later version. 9 | 10 | This program is distributed in the hope that it will be useful, 11 | but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 | GNU General Public License for more details. 14 | 15 | You should have received a copy of the GNU General Public License 16 | along with this program; if not, see . */ 17 | 18 | /* written by Jim Meyering and Bruno Haible */ 19 | 20 | #define _GL_USE_STDLIB_ALLOC 1 21 | #include 22 | /* Only the AC_FUNC_MALLOC macro defines 'malloc' already in config.h. */ 23 | #ifdef malloc 24 | # define NEED_MALLOC_GNU 1 25 | # undef malloc 26 | /* Whereas the gnulib module 'malloc-gnu' defines HAVE_MALLOC_GNU. */ 27 | #elif GNULIB_MALLOC_GNU && !HAVE_MALLOC_GNU 28 | # define NEED_MALLOC_GNU 1 29 | #endif 30 | 31 | #include 32 | 33 | #include 34 | 35 | /* Allocate an N-byte block of memory from the heap. 36 | If N is zero, allocate a 1-byte block. */ 37 | 38 | void * 39 | rpl_malloc (size_t n) 40 | { 41 | void *result; 42 | 43 | #if NEED_MALLOC_GNU 44 | if (n == 0) 45 | n = 1; 46 | #endif 47 | 48 | result = malloc (n); 49 | 50 | #if !HAVE_MALLOC_POSIX 51 | if (result == NULL) 52 | errno = ENOMEM; 53 | #endif 54 | 55 | return result; 56 | } 57 | -------------------------------------------------------------------------------- /lib/mbsinit.c: -------------------------------------------------------------------------------- 1 | /* Test for initial conversion state. 2 | Copyright (C) 2008-2014 Free Software Foundation, Inc. 3 | Written by Bruno Haible , 2008. 4 | 5 | This program is free software: you can redistribute it and/or modify 6 | it under the terms of the GNU General Public License as published by 7 | the Free Software Foundation; either version 3 of the License, or 8 | (at your option) any later version. 9 | 10 | This program is distributed in the hope that it will be useful, 11 | but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 | GNU General Public License for more details. 14 | 15 | You should have received a copy of the GNU General Public License 16 | along with this program. If not, see . */ 17 | 18 | #include 19 | 20 | /* Specification. */ 21 | #include 22 | 23 | #include "verify.h" 24 | 25 | #if (defined _WIN32 || defined __WIN32__) && !defined __CYGWIN__ 26 | 27 | /* On native Windows, 'mbstate_t' is defined as 'int'. */ 28 | 29 | int 30 | mbsinit (const mbstate_t *ps) 31 | { 32 | return ps == NULL || *ps == 0; 33 | } 34 | 35 | #else 36 | 37 | /* Platforms that lack mbsinit() also lack mbrlen(), mbrtowc(), mbsrtowcs() 38 | and wcrtomb(), wcsrtombs(). 39 | We assume that 40 | - sizeof (mbstate_t) >= 4, 41 | - only stateless encodings are supported (such as UTF-8 and EUC-JP, but 42 | not ISO-2022 variants), 43 | - for each encoding, the number of bytes for a wide character is <= 4. 44 | (This maximum is attained for UTF-8, GB18030, EUC-TW.) 45 | We define the meaning of mbstate_t as follows: 46 | - In mb -> wc direction, mbstate_t's first byte contains the number of 47 | buffered bytes (in the range 0..3), followed by up to 3 buffered bytes. 48 | - In wc -> mb direction, mbstate_t contains no information. In other 49 | words, it is always in the initial state. */ 50 | 51 | verify (sizeof (mbstate_t) >= 4); 52 | 53 | int 54 | mbsinit (const mbstate_t *ps) 55 | { 56 | const char *pstate = (const char *)ps; 57 | 58 | return pstate == NULL || pstate[0] == 0; 59 | } 60 | 61 | #endif 62 | -------------------------------------------------------------------------------- /lib/mbsrtowcs-impl.h: -------------------------------------------------------------------------------- 1 | /* Convert string to wide string. 2 | Copyright (C) 2008-2014 Free Software Foundation, Inc. 3 | Written by Bruno Haible , 2008. 4 | 5 | This program is free software: you can redistribute it and/or modify 6 | it under the terms of the GNU General Public License as published by 7 | the Free Software Foundation; either version 3 of the License, or 8 | (at your option) any later version. 9 | 10 | This program is distributed in the hope that it will be useful, 11 | but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 | GNU General Public License for more details. 14 | 15 | You should have received a copy of the GNU General Public License 16 | along with this program. If not, see . */ 17 | 18 | size_t 19 | mbsrtowcs (wchar_t *dest, const char **srcp, size_t len, mbstate_t *ps) 20 | { 21 | if (ps == NULL) 22 | ps = &_gl_mbsrtowcs_state; 23 | { 24 | const char *src = *srcp; 25 | 26 | if (dest != NULL) 27 | { 28 | wchar_t *destptr = dest; 29 | 30 | for (; len > 0; destptr++, len--) 31 | { 32 | size_t src_avail; 33 | size_t ret; 34 | 35 | /* An optimized variant of 36 | src_avail = strnlen1 (src, MB_LEN_MAX); */ 37 | if (src[0] == '\0') 38 | src_avail = 1; 39 | else if (src[1] == '\0') 40 | src_avail = 2; 41 | else if (src[2] == '\0') 42 | src_avail = 3; 43 | else if (MB_LEN_MAX <= 4 || src[3] == '\0') 44 | src_avail = 4; 45 | else 46 | src_avail = 4 + strnlen1 (src + 4, MB_LEN_MAX - 4); 47 | 48 | /* Parse the next multibyte character. */ 49 | ret = mbrtowc (destptr, src, src_avail, ps); 50 | 51 | if (ret == (size_t)(-2)) 52 | /* Encountered a multibyte character that extends past a '\0' byte 53 | or that is longer than MB_LEN_MAX bytes. Cannot happen. */ 54 | abort (); 55 | 56 | if (ret == (size_t)(-1)) 57 | goto bad_input; 58 | if (ret == 0) 59 | { 60 | src = NULL; 61 | /* Here mbsinit (ps). */ 62 | break; 63 | } 64 | src += ret; 65 | } 66 | 67 | *srcp = src; 68 | return destptr - dest; 69 | } 70 | else 71 | { 72 | /* Ignore dest and len, don't store *srcp at the end, and 73 | don't clobber *ps. */ 74 | mbstate_t state = *ps; 75 | size_t totalcount = 0; 76 | 77 | for (;; totalcount++) 78 | { 79 | size_t src_avail; 80 | size_t ret; 81 | 82 | /* An optimized variant of 83 | src_avail = strnlen1 (src, MB_LEN_MAX); */ 84 | if (src[0] == '\0') 85 | src_avail = 1; 86 | else if (src[1] == '\0') 87 | src_avail = 2; 88 | else if (src[2] == '\0') 89 | src_avail = 3; 90 | else if (MB_LEN_MAX <= 4 || src[3] == '\0') 91 | src_avail = 4; 92 | else 93 | src_avail = 4 + strnlen1 (src + 4, MB_LEN_MAX - 4); 94 | 95 | /* Parse the next multibyte character. */ 96 | ret = mbrtowc (NULL, src, src_avail, &state); 97 | 98 | if (ret == (size_t)(-2)) 99 | /* Encountered a multibyte character that extends past a '\0' byte 100 | or that is longer than MB_LEN_MAX bytes. Cannot happen. */ 101 | abort (); 102 | 103 | if (ret == (size_t)(-1)) 104 | goto bad_input2; 105 | if (ret == 0) 106 | { 107 | /* Here mbsinit (&state). */ 108 | break; 109 | } 110 | src += ret; 111 | } 112 | 113 | return totalcount; 114 | } 115 | 116 | bad_input: 117 | *srcp = src; 118 | bad_input2: 119 | errno = EILSEQ; 120 | return (size_t)(-1); 121 | } 122 | } 123 | -------------------------------------------------------------------------------- /lib/mbsrtowcs-state.c: -------------------------------------------------------------------------------- 1 | /* Convert string to wide string. 2 | Copyright (C) 2008-2014 Free Software Foundation, Inc. 3 | Written by Bruno Haible , 2008. 4 | 5 | This program is free software: you can redistribute it and/or modify 6 | it under the terms of the GNU General Public License as published by 7 | the Free Software Foundation; either version 3 of the License, or 8 | (at your option) any later version. 9 | 10 | This program is distributed in the hope that it will be useful, 11 | but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 | GNU General Public License for more details. 14 | 15 | You should have received a copy of the GNU General Public License 16 | along with this program. If not, see . */ 17 | 18 | #include 19 | 20 | #include 21 | 22 | /* Internal state used by the functions mbsrtowcs() and mbsnrtowcs(). */ 23 | mbstate_t _gl_mbsrtowcs_state 24 | /* The state must initially be in the "initial state"; so, zero-initialize it. 25 | On most systems, putting it into BSS is sufficient. Not so on Mac OS X 10.3, 26 | see . 27 | When it needs an initializer, use 0 or {0} as initializer? 0 only works 28 | when mbstate_t is a scalar type (such as when gnulib defines it, or on 29 | AIX, IRIX, mingw). {0} works as an initializer in all cases: for a struct 30 | or union type, but also for a scalar type (ISO C 99, 6.7.8.(11)). */ 31 | #if defined __ELF__ 32 | /* On ELF systems, variables in BSS behave well. */ 33 | #else 34 | /* Use braces, to be on the safe side. */ 35 | = { 0 } 36 | #endif 37 | ; 38 | -------------------------------------------------------------------------------- /lib/mbsrtowcs.c: -------------------------------------------------------------------------------- 1 | /* Convert string to wide string. 2 | Copyright (C) 2008-2014 Free Software Foundation, Inc. 3 | Written by Bruno Haible , 2008. 4 | 5 | This program is free software: you can redistribute it and/or modify 6 | it under the terms of the GNU General Public License as published by 7 | the Free Software Foundation; either version 3 of the License, or 8 | (at your option) any later version. 9 | 10 | This program is distributed in the hope that it will be useful, 11 | but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 | GNU General Public License for more details. 14 | 15 | You should have received a copy of the GNU General Public License 16 | along with this program. If not, see . */ 17 | 18 | #include 19 | 20 | /* Specification. */ 21 | #include 22 | 23 | #include 24 | #include 25 | #include 26 | 27 | #include "strnlen1.h" 28 | 29 | 30 | extern mbstate_t _gl_mbsrtowcs_state; 31 | 32 | #include "mbsrtowcs-impl.h" 33 | -------------------------------------------------------------------------------- /lib/memchr.valgrind: -------------------------------------------------------------------------------- 1 | # Suppress a valgrind message about use of uninitialized memory in memchr(). 2 | # POSIX states that when the character is found, memchr must not read extra 3 | # bytes in an overestimated length (for example, where memchr is used to 4 | # implement strnlen). However, we use a safe word read to provide a speedup. 5 | { 6 | memchr-value4 7 | Memcheck:Value4 8 | fun:rpl_memchr 9 | } 10 | { 11 | memchr-value8 12 | Memcheck:Value8 13 | fun:rpl_memchr 14 | } 15 | -------------------------------------------------------------------------------- /lib/msvc-inval.c: -------------------------------------------------------------------------------- 1 | /* Invalid parameter handler for MSVC runtime libraries. 2 | Copyright (C) 2011-2014 Free Software Foundation, Inc. 3 | 4 | This program is free software; you can redistribute it and/or modify 5 | it under the terms of the GNU General Public License as published by 6 | the Free Software Foundation; either version 3, or (at your option) 7 | any later version. 8 | 9 | This program is distributed in the hope that it will be useful, 10 | but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 | GNU General Public License for more details. 13 | 14 | You should have received a copy of the GNU General Public License along 15 | with this program; if not, see . */ 16 | 17 | #include 18 | 19 | /* Specification. */ 20 | #include "msvc-inval.h" 21 | 22 | #if HAVE_MSVC_INVALID_PARAMETER_HANDLER \ 23 | && !(MSVC_INVALID_PARAMETER_HANDLING == SANE_LIBRARY_HANDLING) 24 | 25 | /* Get _invalid_parameter_handler type and _set_invalid_parameter_handler 26 | declaration. */ 27 | # include 28 | 29 | # if MSVC_INVALID_PARAMETER_HANDLING == DEFAULT_HANDLING 30 | 31 | static void __cdecl 32 | gl_msvc_invalid_parameter_handler (const wchar_t *expression, 33 | const wchar_t *function, 34 | const wchar_t *file, 35 | unsigned int line, 36 | uintptr_t dummy) 37 | { 38 | } 39 | 40 | # else 41 | 42 | /* Get declarations of the native Windows API functions. */ 43 | # define WIN32_LEAN_AND_MEAN 44 | # include 45 | 46 | # if defined _MSC_VER 47 | 48 | static void __cdecl 49 | gl_msvc_invalid_parameter_handler (const wchar_t *expression, 50 | const wchar_t *function, 51 | const wchar_t *file, 52 | unsigned int line, 53 | uintptr_t dummy) 54 | { 55 | RaiseException (STATUS_GNULIB_INVALID_PARAMETER, 0, 0, NULL); 56 | } 57 | 58 | # else 59 | 60 | /* An index to thread-local storage. */ 61 | static DWORD tls_index; 62 | static int tls_initialized /* = 0 */; 63 | 64 | /* Used as a fallback only. */ 65 | static struct gl_msvc_inval_per_thread not_per_thread; 66 | 67 | struct gl_msvc_inval_per_thread * 68 | gl_msvc_inval_current (void) 69 | { 70 | if (!tls_initialized) 71 | { 72 | tls_index = TlsAlloc (); 73 | tls_initialized = 1; 74 | } 75 | if (tls_index == TLS_OUT_OF_INDEXES) 76 | /* TlsAlloc had failed. */ 77 | return ¬_per_thread; 78 | else 79 | { 80 | struct gl_msvc_inval_per_thread *pointer = 81 | (struct gl_msvc_inval_per_thread *) TlsGetValue (tls_index); 82 | if (pointer == NULL) 83 | { 84 | /* First call. Allocate a new 'struct gl_msvc_inval_per_thread'. */ 85 | pointer = 86 | (struct gl_msvc_inval_per_thread *) 87 | malloc (sizeof (struct gl_msvc_inval_per_thread)); 88 | if (pointer == NULL) 89 | /* Could not allocate memory. Use the global storage. */ 90 | pointer = ¬_per_thread; 91 | TlsSetValue (tls_index, pointer); 92 | } 93 | return pointer; 94 | } 95 | } 96 | 97 | static void __cdecl 98 | gl_msvc_invalid_parameter_handler (const wchar_t *expression, 99 | const wchar_t *function, 100 | const wchar_t *file, 101 | unsigned int line, 102 | uintptr_t dummy) 103 | { 104 | struct gl_msvc_inval_per_thread *current = gl_msvc_inval_current (); 105 | if (current->restart_valid) 106 | longjmp (current->restart, 1); 107 | else 108 | /* An invalid parameter notification from outside the gnulib code. 109 | Give the caller a chance to intervene. */ 110 | RaiseException (STATUS_GNULIB_INVALID_PARAMETER, 0, 0, NULL); 111 | } 112 | 113 | # endif 114 | 115 | # endif 116 | 117 | static int gl_msvc_inval_initialized /* = 0 */; 118 | 119 | void 120 | gl_msvc_inval_ensure_handler (void) 121 | { 122 | if (gl_msvc_inval_initialized == 0) 123 | { 124 | _set_invalid_parameter_handler (gl_msvc_invalid_parameter_handler); 125 | gl_msvc_inval_initialized = 1; 126 | } 127 | } 128 | 129 | #endif 130 | -------------------------------------------------------------------------------- /lib/msvc-nothrow.c: -------------------------------------------------------------------------------- 1 | /* Wrappers that don't throw invalid parameter notifications 2 | with MSVC runtime libraries. 3 | Copyright (C) 2011-2014 Free Software Foundation, Inc. 4 | 5 | This program is free software; you can redistribute it and/or modify 6 | it under the terms of the GNU General Public License as published by 7 | the Free Software Foundation; either version 3, or (at your option) 8 | any later version. 9 | 10 | This program is distributed in the hope that it will be useful, 11 | but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 | GNU General Public License for more details. 14 | 15 | You should have received a copy of the GNU General Public License along 16 | with this program; if not, see . */ 17 | 18 | #include 19 | 20 | /* Specification. */ 21 | #include "msvc-nothrow.h" 22 | 23 | /* Get declarations of the native Windows API functions. */ 24 | #define WIN32_LEAN_AND_MEAN 25 | #include 26 | 27 | #include "msvc-inval.h" 28 | 29 | #undef _get_osfhandle 30 | 31 | #if HAVE_MSVC_INVALID_PARAMETER_HANDLER 32 | intptr_t 33 | _gl_nothrow_get_osfhandle (int fd) 34 | { 35 | intptr_t result; 36 | 37 | TRY_MSVC_INVAL 38 | { 39 | result = _get_osfhandle (fd); 40 | } 41 | CATCH_MSVC_INVAL 42 | { 43 | result = (intptr_t) INVALID_HANDLE_VALUE; 44 | } 45 | DONE_MSVC_INVAL; 46 | 47 | return result; 48 | } 49 | #endif 50 | -------------------------------------------------------------------------------- /lib/msvc-nothrow.h: -------------------------------------------------------------------------------- 1 | /* Wrappers that don't throw invalid parameter notifications 2 | with MSVC runtime libraries. 3 | Copyright (C) 2011-2014 Free Software Foundation, Inc. 4 | 5 | This program is free software; you can redistribute it and/or modify 6 | it under the terms of the GNU General Public License as published by 7 | the Free Software Foundation; either version 3, or (at your option) 8 | any later version. 9 | 10 | This program is distributed in the hope that it will be useful, 11 | but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 | GNU General Public License for more details. 14 | 15 | You should have received a copy of the GNU General Public License along 16 | with this program; if not, see . */ 17 | 18 | #ifndef _MSVC_NOTHROW_H 19 | #define _MSVC_NOTHROW_H 20 | 21 | /* With MSVC runtime libraries with the "invalid parameter handler" concept, 22 | functions like fprintf(), dup2(), or close() crash when the caller passes 23 | an invalid argument. But POSIX wants error codes (such as EINVAL or EBADF) 24 | instead. 25 | This file defines wrappers that turn such an invalid parameter notification 26 | into an error code. */ 27 | 28 | #if (defined _WIN32 || defined __WIN32__) && ! defined __CYGWIN__ 29 | 30 | /* Get original declaration of _get_osfhandle. */ 31 | # include 32 | 33 | # if HAVE_MSVC_INVALID_PARAMETER_HANDLER 34 | 35 | /* Override _get_osfhandle. */ 36 | extern intptr_t _gl_nothrow_get_osfhandle (int fd); 37 | # define _get_osfhandle _gl_nothrow_get_osfhandle 38 | 39 | # endif 40 | 41 | #endif 42 | 43 | #endif /* _MSVC_NOTHROW_H */ 44 | -------------------------------------------------------------------------------- /lib/progname.c: -------------------------------------------------------------------------------- 1 | /* Program name management. 2 | Copyright (C) 2001-2003, 2005-2014 Free Software Foundation, Inc. 3 | Written by Bruno Haible , 2001. 4 | 5 | This program is free software: you can redistribute it and/or modify 6 | it under the terms of the GNU General Public License as published by 7 | the Free Software Foundation; either version 3 of the License, or 8 | (at your option) any later version. 9 | 10 | This program is distributed in the hope that it will be useful, 11 | but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 | GNU General Public License for more details. 14 | 15 | You should have received a copy of the GNU General Public License 16 | along with this program. If not, see . */ 17 | 18 | 19 | #include 20 | 21 | /* Specification. */ 22 | #undef ENABLE_RELOCATABLE /* avoid defining set_program_name as a macro */ 23 | #include "progname.h" 24 | 25 | #include /* get program_invocation_name declaration */ 26 | #include 27 | #include 28 | #include 29 | 30 | 31 | /* String containing name the program is called with. 32 | To be initialized by main(). */ 33 | const char *program_name = NULL; 34 | 35 | /* Set program_name, based on argv[0]. 36 | argv0 must be a string allocated with indefinite extent, and must not be 37 | modified after this call. */ 38 | void 39 | set_program_name (const char *argv0) 40 | { 41 | /* libtool creates a temporary executable whose name is sometimes prefixed 42 | with "lt-" (depends on the platform). It also makes argv[0] absolute. 43 | But the name of the temporary executable is a detail that should not be 44 | visible to the end user and to the test suite. 45 | Remove this "/.libs/" or "/.libs/lt-" prefix here. */ 46 | const char *slash; 47 | const char *base; 48 | 49 | /* Sanity check. POSIX requires the invoking process to pass a non-NULL 50 | argv[0]. */ 51 | if (argv0 == NULL) 52 | { 53 | /* It's a bug in the invoking program. Help diagnosing it. */ 54 | fputs ("A NULL argv[0] was passed through an exec system call.\n", 55 | stderr); 56 | abort (); 57 | } 58 | 59 | slash = strrchr (argv0, '/'); 60 | base = (slash != NULL ? slash + 1 : argv0); 61 | if (base - argv0 >= 7 && strncmp (base - 7, "/.libs/", 7) == 0) 62 | { 63 | argv0 = base; 64 | if (strncmp (base, "lt-", 3) == 0) 65 | { 66 | argv0 = base + 3; 67 | /* On glibc systems, remove the "lt-" prefix from the variable 68 | program_invocation_short_name. */ 69 | #if HAVE_DECL_PROGRAM_INVOCATION_SHORT_NAME 70 | program_invocation_short_name = (char *) argv0; 71 | #endif 72 | } 73 | } 74 | 75 | /* But don't strip off a leading / in general, because when the user 76 | runs 77 | /some/hidden/place/bin/cp foo foo 78 | he should get the error message 79 | /some/hidden/place/bin/cp: `foo' and `foo' are the same file 80 | not 81 | cp: `foo' and `foo' are the same file 82 | */ 83 | 84 | program_name = argv0; 85 | 86 | /* On glibc systems, the error() function comes from libc and uses the 87 | variable program_invocation_name, not program_name. So set this variable 88 | as well. */ 89 | #if HAVE_DECL_PROGRAM_INVOCATION_NAME 90 | program_invocation_name = (char *) argv0; 91 | #endif 92 | } 93 | -------------------------------------------------------------------------------- /lib/progname.h: -------------------------------------------------------------------------------- 1 | /* Program name management. 2 | Copyright (C) 2001-2004, 2006, 2009-2014 Free Software Foundation, Inc. 3 | Written by Bruno Haible , 2001. 4 | 5 | This program is free software: you can redistribute it and/or modify 6 | it under the terms of the GNU General Public License as published by 7 | the Free Software Foundation; either version 3 of the License, or 8 | (at your option) any later version. 9 | 10 | This program is distributed in the hope that it will be useful, 11 | but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 | GNU General Public License for more details. 14 | 15 | You should have received a copy of the GNU General Public License 16 | along with this program. If not, see . */ 17 | 18 | #ifndef _PROGNAME_H 19 | #define _PROGNAME_H 20 | 21 | /* Programs using this file should do the following in main(): 22 | set_program_name (argv[0]); 23 | */ 24 | 25 | 26 | #ifdef __cplusplus 27 | extern "C" { 28 | #endif 29 | 30 | 31 | /* String containing name the program is called with. */ 32 | extern const char *program_name; 33 | 34 | /* Set program_name, based on argv[0]. 35 | argv0 must be a string allocated with indefinite extent, and must not be 36 | modified after this call. */ 37 | extern void set_program_name (const char *argv0); 38 | 39 | #if ENABLE_RELOCATABLE 40 | 41 | /* Set program_name, based on argv[0], and original installation prefix and 42 | directory, for relocatability. */ 43 | extern void set_program_name_and_installdir (const char *argv0, 44 | const char *orig_installprefix, 45 | const char *orig_installdir); 46 | #undef set_program_name 47 | #define set_program_name(ARG0) \ 48 | set_program_name_and_installdir (ARG0, INSTALLPREFIX, INSTALLDIR) 49 | 50 | /* Return the full pathname of the current executable, based on the earlier 51 | call to set_program_name_and_installdir. Return NULL if unknown. */ 52 | extern char *get_full_program_name (void); 53 | 54 | #endif 55 | 56 | 57 | #ifdef __cplusplus 58 | } 59 | #endif 60 | 61 | 62 | #endif /* _PROGNAME_H */ 63 | -------------------------------------------------------------------------------- /lib/quote.h: -------------------------------------------------------------------------------- 1 | /* quote.h - prototypes for quote.c 2 | 3 | Copyright (C) 1998-2001, 2003, 2009-2014 Free Software Foundation, Inc. 4 | 5 | This program is free software: you can redistribute it and/or modify 6 | it under the terms of the GNU General Public License as published by 7 | the Free Software Foundation; either version 3 of the License, or 8 | (at your option) any later version. 9 | 10 | This program is distributed in the hope that it will be useful, 11 | but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 | GNU General Public License for more details. 14 | 15 | You should have received a copy of the GNU General Public License 16 | along with this program. If not, see . */ 17 | 18 | #ifndef QUOTE_H_ 19 | # define QUOTE_H_ 1 20 | 21 | # include 22 | 23 | /* The quoting options used by quote_n and quote. Its type is incomplete, 24 | so it's useful only in expressions like '"e_quoting_options'. */ 25 | extern struct quoting_options quote_quoting_options; 26 | 27 | /* Return an unambiguous printable representation of ARG (of size 28 | ARGSIZE), allocated in slot N, suitable for diagnostics. If 29 | ARGSIZE is SIZE_MAX, use the string length of the argument for 30 | ARGSIZE. */ 31 | char const *quote_n_mem (int n, char const *arg, size_t argsize); 32 | 33 | /* Return an unambiguous printable representation of ARG (of size 34 | ARGSIZE), suitable for diagnostics. If ARGSIZE is SIZE_MAX, use 35 | the string length of the argument for ARGSIZE. */ 36 | char const *quote_mem (char const *arg, size_t argsize); 37 | 38 | /* Return an unambiguous printable representation of ARG, allocated in 39 | slot N, suitable for diagnostics. */ 40 | char const *quote_n (int n, char const *arg); 41 | 42 | /* Return an unambiguous printable representation of ARG, suitable for 43 | diagnostics. */ 44 | char const *quote (char const *arg); 45 | 46 | #endif /* !QUOTE_H_ */ 47 | -------------------------------------------------------------------------------- /lib/ref-add.sin: -------------------------------------------------------------------------------- 1 | # Add this package to a list of references stored in a text file. 2 | # 3 | # Copyright (C) 2000, 2009-2014 Free Software Foundation, Inc. 4 | # 5 | # This program is free software; you can redistribute it and/or modify 6 | # it under the terms of the GNU General Public License as published by 7 | # the Free Software Foundation; either version 3, or (at your option) 8 | # any later version. 9 | # 10 | # This program is distributed in the hope that it will be useful, 11 | # but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 | # GNU General Public License for more details. 14 | # 15 | # You should have received a copy of the GNU General Public License along 16 | # with this program; if not, see . 17 | # 18 | # Written by Bruno Haible . 19 | # 20 | /^# Packages using this file: / { 21 | s/# Packages using this file:// 22 | ta 23 | :a 24 | s/ @PACKAGE@ / @PACKAGE@ / 25 | tb 26 | s/ $/ @PACKAGE@ / 27 | :b 28 | s/^/# Packages using this file:/ 29 | } 30 | -------------------------------------------------------------------------------- /lib/ref-del.sin: -------------------------------------------------------------------------------- 1 | # Remove this package from a list of references stored in a text file. 2 | # 3 | # Copyright (C) 2000, 2009-2014 Free Software Foundation, Inc. 4 | # 5 | # This program is free software; you can redistribute it and/or modify 6 | # it under the terms of the GNU General Public License as published by 7 | # the Free Software Foundation; either version 3, or (at your option) 8 | # any later version. 9 | # 10 | # This program is distributed in the hope that it will be useful, 11 | # but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 | # GNU General Public License for more details. 14 | # 15 | # You should have received a copy of the GNU General Public License along 16 | # with this program; if not, see . 17 | # 18 | # Written by Bruno Haible . 19 | # 20 | /^# Packages using this file: / { 21 | s/# Packages using this file:// 22 | s/ @PACKAGE@ / / 23 | s/^/# Packages using this file:/ 24 | } 25 | -------------------------------------------------------------------------------- /lib/stddef.in.h: -------------------------------------------------------------------------------- 1 | /* A substitute for POSIX 2008 , for platforms that have issues. 2 | 3 | Copyright (C) 2009-2014 Free Software Foundation, Inc. 4 | 5 | This program is free software; you can redistribute it and/or modify 6 | it under the terms of the GNU General Public License as published by 7 | the Free Software Foundation; either version 3, or (at your option) 8 | any later version. 9 | 10 | This program is distributed in the hope that it will be useful, 11 | but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 | GNU General Public License for more details. 14 | 15 | You should have received a copy of the GNU General Public License 16 | along with this program; if not, see . */ 17 | 18 | /* Written by Eric Blake. */ 19 | 20 | /* 21 | * POSIX 2008 for platforms that have issues. 22 | * 23 | */ 24 | 25 | #if __GNUC__ >= 3 26 | @PRAGMA_SYSTEM_HEADER@ 27 | #endif 28 | @PRAGMA_COLUMNS@ 29 | 30 | #if defined __need_wchar_t || defined __need_size_t \ 31 | || defined __need_ptrdiff_t || defined __need_NULL \ 32 | || defined __need_wint_t 33 | /* Special invocation convention inside gcc header files. In 34 | particular, gcc provides a version of that blindly 35 | redefines NULL even when __need_wint_t was defined, even though 36 | wint_t is not normally provided by . Hence, we must 37 | remember if special invocation has ever been used to obtain wint_t, 38 | in which case we need to clean up NULL yet again. */ 39 | 40 | # if !(defined _@GUARD_PREFIX@_STDDEF_H && defined _GL_STDDEF_WINT_T) 41 | # ifdef __need_wint_t 42 | # undef _@GUARD_PREFIX@_STDDEF_H 43 | # define _GL_STDDEF_WINT_T 44 | # endif 45 | # @INCLUDE_NEXT@ @NEXT_STDDEF_H@ 46 | # endif 47 | 48 | #else 49 | /* Normal invocation convention. */ 50 | 51 | # ifndef _@GUARD_PREFIX@_STDDEF_H 52 | 53 | /* The include_next requires a split double-inclusion guard. */ 54 | 55 | # @INCLUDE_NEXT@ @NEXT_STDDEF_H@ 56 | 57 | # ifndef _@GUARD_PREFIX@_STDDEF_H 58 | # define _@GUARD_PREFIX@_STDDEF_H 59 | 60 | /* On NetBSD 5.0, the definition of NULL lacks proper parentheses. */ 61 | #if @REPLACE_NULL@ 62 | # undef NULL 63 | # ifdef __cplusplus 64 | /* ISO C++ says that the macro NULL must expand to an integer constant 65 | expression, hence '((void *) 0)' is not allowed in C++. */ 66 | # if __GNUG__ >= 3 67 | /* GNU C++ has a __null macro that behaves like an integer ('int' or 68 | 'long') but has the same size as a pointer. Use that, to avoid 69 | warnings. */ 70 | # define NULL __null 71 | # else 72 | # define NULL 0L 73 | # endif 74 | # else 75 | # define NULL ((void *) 0) 76 | # endif 77 | #endif 78 | 79 | /* Some platforms lack wchar_t. */ 80 | #if !@HAVE_WCHAR_T@ 81 | # define wchar_t int 82 | #endif 83 | 84 | # endif /* _@GUARD_PREFIX@_STDDEF_H */ 85 | # endif /* _@GUARD_PREFIX@_STDDEF_H */ 86 | #endif /* __need_XXX */ 87 | -------------------------------------------------------------------------------- /lib/strerror-override.h: -------------------------------------------------------------------------------- 1 | /* strerror-override.h --- POSIX compatible system error routine 2 | 3 | Copyright (C) 2010-2014 Free Software Foundation, Inc. 4 | 5 | This program is free software: you can redistribute it and/or modify 6 | it under the terms of the GNU General Public License as published by 7 | the Free Software Foundation; either version 3 of the License, or 8 | (at your option) any later version. 9 | 10 | This program is distributed in the hope that it will be useful, 11 | but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 | GNU General Public License for more details. 14 | 15 | You should have received a copy of the GNU General Public License 16 | along with this program. If not, see . */ 17 | 18 | #ifndef _GL_STRERROR_OVERRIDE_H 19 | # define _GL_STRERROR_OVERRIDE_H 20 | 21 | # include 22 | # include 23 | 24 | /* Reasonable buffer size that should never trigger ERANGE; if this 25 | proves too small, we intentionally abort(), to remind us to fix 26 | this value. */ 27 | # define STACKBUF_LEN 256 28 | 29 | /* If ERRNUM maps to an errno value defined by gnulib, return a string 30 | describing the error. Otherwise return NULL. */ 31 | # if REPLACE_STRERROR_0 \ 32 | || GNULIB_defined_ESOCK \ 33 | || GNULIB_defined_ESTREAMS \ 34 | || GNULIB_defined_EWINSOCK \ 35 | || GNULIB_defined_ENOMSG \ 36 | || GNULIB_defined_EIDRM \ 37 | || GNULIB_defined_ENOLINK \ 38 | || GNULIB_defined_EPROTO \ 39 | || GNULIB_defined_EMULTIHOP \ 40 | || GNULIB_defined_EBADMSG \ 41 | || GNULIB_defined_EOVERFLOW \ 42 | || GNULIB_defined_ENOTSUP \ 43 | || GNULIB_defined_ENETRESET \ 44 | || GNULIB_defined_ECONNABORTED \ 45 | || GNULIB_defined_ESTALE \ 46 | || GNULIB_defined_EDQUOT \ 47 | || GNULIB_defined_ECANCELED \ 48 | || GNULIB_defined_EOWNERDEAD \ 49 | || GNULIB_defined_ENOTRECOVERABLE \ 50 | || GNULIB_defined_EILSEQ 51 | extern const char *strerror_override (int errnum) _GL_ATTRIBUTE_CONST; 52 | # else 53 | # define strerror_override(ignored) NULL 54 | # endif 55 | 56 | #endif /* _GL_STRERROR_OVERRIDE_H */ 57 | -------------------------------------------------------------------------------- /lib/strerror.c: -------------------------------------------------------------------------------- 1 | /* strerror.c --- POSIX compatible system error routine 2 | 3 | Copyright (C) 2007-2014 Free Software Foundation, Inc. 4 | 5 | This program is free software: you can redistribute it and/or modify 6 | it under the terms of the GNU General Public License as published by 7 | the Free Software Foundation; either version 3 of the License, or 8 | (at your option) any later version. 9 | 10 | This program is distributed in the hope that it will be useful, 11 | but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 | GNU General Public License for more details. 14 | 15 | You should have received a copy of the GNU General Public License 16 | along with this program. If not, see . */ 17 | 18 | #include 19 | 20 | /* Specification. */ 21 | #include 22 | 23 | #include 24 | #include 25 | #include 26 | #include 27 | 28 | #include "intprops.h" 29 | #include "strerror-override.h" 30 | #include "verify.h" 31 | 32 | /* Use the system functions, not the gnulib overrides in this file. */ 33 | #undef sprintf 34 | 35 | char * 36 | strerror (int n) 37 | #undef strerror 38 | { 39 | static char buf[STACKBUF_LEN]; 40 | size_t len; 41 | 42 | /* Cast away const, due to the historical signature of strerror; 43 | callers should not be modifying the string. */ 44 | const char *msg = strerror_override (n); 45 | if (msg) 46 | return (char *) msg; 47 | 48 | msg = strerror (n); 49 | 50 | /* Our strerror_r implementation might use the system's strerror 51 | buffer, so all other clients of strerror have to see the error 52 | copied into a buffer that we manage. This is not thread-safe, 53 | even if the system strerror is, but portable programs shouldn't 54 | be using strerror if they care about thread-safety. */ 55 | if (!msg || !*msg) 56 | { 57 | static char const fmt[] = "Unknown error %d"; 58 | verify (sizeof buf >= sizeof (fmt) + INT_STRLEN_BOUND (n)); 59 | sprintf (buf, fmt, n); 60 | errno = EINVAL; 61 | return buf; 62 | } 63 | 64 | /* Fix STACKBUF_LEN if this ever aborts. */ 65 | len = strlen (msg); 66 | if (sizeof buf <= len) 67 | abort (); 68 | 69 | return memcpy (buf, msg, len + 1); 70 | } 71 | -------------------------------------------------------------------------------- /lib/stripslash.c: -------------------------------------------------------------------------------- 1 | /* stripslash.c -- remove redundant trailing slashes from a file name 2 | 3 | Copyright (C) 1990, 2001, 2003-2006, 2009-2014 Free Software Foundation, 4 | Inc. 5 | 6 | This program is free software: you can redistribute it and/or modify 7 | it under the terms of the GNU General Public License as published by 8 | the Free Software Foundation; either version 3 of the License, or 9 | (at your option) any later version. 10 | 11 | This program is distributed in the hope that it will be useful, 12 | but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14 | GNU General Public License for more details. 15 | 16 | You should have received a copy of the GNU General Public License 17 | along with this program. If not, see . */ 18 | 19 | #include 20 | 21 | #include "dirname.h" 22 | 23 | /* Remove trailing slashes from FILE. Return true if a trailing slash 24 | was removed. This is useful when using file name completion from a 25 | shell that adds a "/" after directory names (such as tcsh and 26 | bash), because on symlinks to directories, several system calls 27 | have different semantics according to whether a trailing slash is 28 | present. */ 29 | 30 | bool 31 | strip_trailing_slashes (char *file) 32 | { 33 | char *base = last_component (file); 34 | char *base_lim; 35 | bool had_slash; 36 | 37 | /* last_component returns "" for file system roots, but we need to turn 38 | "///" into "/". */ 39 | if (! *base) 40 | base = file; 41 | base_lim = base + base_len (base); 42 | had_slash = (*base_lim != '\0'); 43 | *base_lim = '\0'; 44 | return had_slash; 45 | } 46 | -------------------------------------------------------------------------------- /lib/strndup.c: -------------------------------------------------------------------------------- 1 | /* A replacement function, for systems that lack strndup. 2 | 3 | Copyright (C) 1996-1998, 2001-2003, 2005-2007, 2009-2014 Free Software 4 | Foundation, Inc. 5 | 6 | This program is free software; you can redistribute it and/or modify it 7 | under the terms of the GNU General Public License as published by the 8 | Free Software Foundation; either version 3, or (at your option) any 9 | later version. 10 | 11 | This program is distributed in the hope that it will be useful, 12 | but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14 | GNU General Public License for more details. 15 | 16 | You should have received a copy of the GNU General Public License 17 | along with this program; if not, see . */ 18 | 19 | #include 20 | 21 | #include 22 | 23 | #include 24 | 25 | char * 26 | strndup (char const *s, size_t n) 27 | { 28 | size_t len = strnlen (s, n); 29 | char *new = malloc (len + 1); 30 | 31 | if (new == NULL) 32 | return NULL; 33 | 34 | new[len] = '\0'; 35 | return memcpy (new, s, len); 36 | } 37 | -------------------------------------------------------------------------------- /lib/strnlen.c: -------------------------------------------------------------------------------- 1 | /* Find the length of STRING, but scan at most MAXLEN characters. 2 | Copyright (C) 2005-2007, 2009-2014 Free Software Foundation, Inc. 3 | Written by Simon Josefsson. 4 | 5 | This program is free software; you can redistribute it and/or modify 6 | it under the terms of the GNU General Public License as published by 7 | the Free Software Foundation; either version 3, or (at your option) 8 | any later version. 9 | 10 | This program is distributed in the hope that it will be useful, 11 | but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 | GNU General Public License for more details. 14 | 15 | You should have received a copy of the GNU General Public License 16 | along with this program; if not, see . */ 17 | 18 | #include 19 | 20 | #include 21 | 22 | /* Find the length of STRING, but scan at most MAXLEN characters. 23 | If no '\0' terminator is found in that many characters, return MAXLEN. */ 24 | 25 | size_t 26 | strnlen (const char *string, size_t maxlen) 27 | { 28 | const char *end = memchr (string, '\0', maxlen); 29 | return end ? (size_t) (end - string) : maxlen; 30 | } 31 | -------------------------------------------------------------------------------- /lib/strnlen1.c: -------------------------------------------------------------------------------- 1 | /* Find the length of STRING + 1, but scan at most MAXLEN bytes. 2 | Copyright (C) 2005-2006, 2009-2014 Free Software Foundation, Inc. 3 | 4 | This program is free software: you can redistribute it and/or modify 5 | it under the terms of the GNU General Public License as published by 6 | the Free Software Foundation; either version 3 of the License, or 7 | (at your option) any later version. 8 | 9 | This program is distributed in the hope that it will be useful, 10 | but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 | GNU General Public License for more details. 13 | 14 | You should have received a copy of the GNU General Public License 15 | along with this program. If not, see . */ 16 | 17 | #include 18 | 19 | /* Specification. */ 20 | #include "strnlen1.h" 21 | 22 | #include 23 | 24 | /* Find the length of STRING + 1, but scan at most MAXLEN bytes. 25 | If no '\0' terminator is found in that many characters, return MAXLEN. */ 26 | /* This is the same as strnlen (string, maxlen - 1) + 1. */ 27 | size_t 28 | strnlen1 (const char *string, size_t maxlen) 29 | { 30 | const char *end = (const char *) memchr (string, '\0', maxlen); 31 | if (end != NULL) 32 | return end - string + 1; 33 | else 34 | return maxlen; 35 | } 36 | -------------------------------------------------------------------------------- /lib/strnlen1.h: -------------------------------------------------------------------------------- 1 | /* Find the length of STRING + 1, but scan at most MAXLEN bytes. 2 | Copyright (C) 2005, 2009-2014 Free Software Foundation, Inc. 3 | 4 | This program is free software: you can redistribute it and/or modify 5 | it under the terms of the GNU General Public License as published by 6 | the Free Software Foundation; either version 3 of the License, or 7 | (at your option) any later version. 8 | 9 | This program is distributed in the hope that it will be useful, 10 | but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 | GNU General Public License for more details. 13 | 14 | You should have received a copy of the GNU General Public License 15 | along with this program. If not, see . */ 16 | 17 | #ifndef _STRNLEN1_H 18 | #define _STRNLEN1_H 19 | 20 | #include 21 | 22 | 23 | #ifdef __cplusplus 24 | extern "C" { 25 | #endif 26 | 27 | 28 | /* Find the length of STRING + 1, but scan at most MAXLEN bytes. 29 | If no '\0' terminator is found in that many characters, return MAXLEN. */ 30 | /* This is the same as strnlen (string, maxlen - 1) + 1. */ 31 | extern size_t strnlen1 (const char *string, size_t maxlen) 32 | _GL_ATTRIBUTE_PURE; 33 | 34 | 35 | #ifdef __cplusplus 36 | } 37 | #endif 38 | 39 | 40 | #endif /* _STRNLEN1_H */ 41 | -------------------------------------------------------------------------------- /lib/sys_types.in.h: -------------------------------------------------------------------------------- 1 | /* Provide a more complete sys/types.h. 2 | 3 | Copyright (C) 2011-2014 Free Software Foundation, Inc. 4 | 5 | This program is free software; you can redistribute it and/or modify 6 | it under the terms of the GNU General Public License as published by 7 | the Free Software Foundation; either version 3, or (at your option) 8 | any later version. 9 | 10 | This program is distributed in the hope that it will be useful, 11 | but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 | GNU General Public License for more details. 14 | 15 | You should have received a copy of the GNU General Public License 16 | along with this program; if not, see . */ 17 | 18 | #if __GNUC__ >= 3 19 | @PRAGMA_SYSTEM_HEADER@ 20 | #endif 21 | @PRAGMA_COLUMNS@ 22 | 23 | #ifndef _@GUARD_PREFIX@_SYS_TYPES_H 24 | 25 | /* The include_next requires a split double-inclusion guard. */ 26 | # define _GL_INCLUDING_SYS_TYPES_H 27 | #@INCLUDE_NEXT@ @NEXT_SYS_TYPES_H@ 28 | # undef _GL_INCLUDING_SYS_TYPES_H 29 | 30 | #ifndef _@GUARD_PREFIX@_SYS_TYPES_H 31 | #define _@GUARD_PREFIX@_SYS_TYPES_H 32 | 33 | /* Override off_t if Large File Support is requested on native Windows. */ 34 | #if @WINDOWS_64_BIT_OFF_T@ 35 | /* Same as int64_t in . */ 36 | # if defined _MSC_VER 37 | # define off_t __int64 38 | # else 39 | # define off_t long long int 40 | # endif 41 | /* Indicator, for gnulib internal purposes. */ 42 | # define _GL_WINDOWS_64_BIT_OFF_T 1 43 | #endif 44 | 45 | /* MSVC 9 defines size_t in , not in . */ 46 | /* But avoid namespace pollution on glibc systems. */ 47 | #if ((defined _WIN32 || defined __WIN32__) && ! defined __CYGWIN__) \ 48 | && ! defined __GLIBC__ 49 | # include 50 | #endif 51 | 52 | #endif /* _@GUARD_PREFIX@_SYS_TYPES_H */ 53 | #endif /* _@GUARD_PREFIX@_SYS_TYPES_H */ 54 | -------------------------------------------------------------------------------- /lib/unistd.c: -------------------------------------------------------------------------------- 1 | #include 2 | #define _GL_UNISTD_INLINE _GL_EXTERN_INLINE 3 | #include "unistd.h" 4 | -------------------------------------------------------------------------------- /lib/wctype-h.c: -------------------------------------------------------------------------------- 1 | /* Normally this would be wctype.c, but that name's already taken. */ 2 | #include 3 | #define _GL_WCTYPE_INLINE _GL_EXTERN_INLINE 4 | #include "wctype.h" 5 | -------------------------------------------------------------------------------- /lib/xalloc-die.c: -------------------------------------------------------------------------------- 1 | /* Report a memory allocation failure and exit. 2 | 3 | Copyright (C) 1997-2000, 2002-2004, 2006, 2009-2014 Free Software 4 | Foundation, Inc. 5 | 6 | This program is free software: you can redistribute it and/or modify 7 | it under the terms of the GNU General Public License as published by 8 | the Free Software Foundation; either version 3 of the License, or 9 | (at your option) any later version. 10 | 11 | This program is distributed in the hope that it will be useful, 12 | but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14 | GNU General Public License for more details. 15 | 16 | You should have received a copy of the GNU General Public License 17 | along with this program. If not, see . */ 18 | 19 | #include 20 | 21 | #include "xalloc.h" 22 | 23 | #include 24 | 25 | #include "error.h" 26 | #include "exitfail.h" 27 | 28 | #include "gettext.h" 29 | #define _(msgid) gettext (msgid) 30 | 31 | void 32 | xalloc_die (void) 33 | { 34 | error (exit_failure, 0, "%s", _("memory exhausted")); 35 | 36 | /* _Noreturn cannot be given to error, since it may return if 37 | its first argument is 0. To help compilers understand the 38 | xalloc_die does not return, call abort. Also, the abort is a 39 | safety feature if exit_failure is 0 (which shouldn't happen). */ 40 | abort (); 41 | } 42 | -------------------------------------------------------------------------------- /lib/xalloc-oversized.h: -------------------------------------------------------------------------------- 1 | /* xalloc-oversized.h -- memory allocation size checking 2 | 3 | Copyright (C) 1990-2000, 2003-2004, 2006-2014 Free Software Foundation, Inc. 4 | 5 | This program is free software: you can redistribute it and/or modify 6 | it under the terms of the GNU General Public License as published by 7 | the Free Software Foundation; either version 3 of the License, or 8 | (at your option) any later version. 9 | 10 | This program is distributed in the hope that it will be useful, 11 | but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 | GNU General Public License for more details. 14 | 15 | You should have received a copy of the GNU General Public License 16 | along with this program. If not, see . */ 17 | 18 | #ifndef XALLOC_OVERSIZED_H_ 19 | # define XALLOC_OVERSIZED_H_ 20 | 21 | # include 22 | 23 | /* Return 1 if an array of N objects, each of size S, cannot exist due 24 | to size arithmetic overflow. S must be positive and N must be 25 | nonnegative. This is a macro, not a function, so that it 26 | works correctly even when SIZE_MAX < N. 27 | 28 | By gnulib convention, SIZE_MAX represents overflow in size 29 | calculations, so the conservative dividend to use here is 30 | SIZE_MAX - 1, since SIZE_MAX might represent an overflowed value. 31 | However, malloc (SIZE_MAX) fails on all known hosts where 32 | sizeof (ptrdiff_t) <= sizeof (size_t), so do not bother to test for 33 | exactly-SIZE_MAX allocations on such hosts; this avoids a test and 34 | branch when S is known to be 1. */ 35 | # define xalloc_oversized(n, s) \ 36 | ((size_t) (sizeof (ptrdiff_t) <= sizeof (size_t) ? -1 : -2) / (s) < (n)) 37 | 38 | #endif /* !XALLOC_OVERSIZED_H_ */ 39 | -------------------------------------------------------------------------------- /lib/xmalloc.c: -------------------------------------------------------------------------------- 1 | /* xmalloc.c -- malloc with out of memory checking 2 | 3 | Copyright (C) 1990-2000, 2002-2006, 2008-2014 Free Software Foundation, Inc. 4 | 5 | This program is free software: you can redistribute it and/or modify 6 | it under the terms of the GNU General Public License as published by 7 | the Free Software Foundation; either version 3 of the License, or 8 | (at your option) any later version. 9 | 10 | This program is distributed in the hope that it will be useful, 11 | but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 | GNU General Public License for more details. 14 | 15 | You should have received a copy of the GNU General Public License 16 | along with this program. If not, see . */ 17 | 18 | #include 19 | 20 | #define XALLOC_INLINE _GL_EXTERN_INLINE 21 | 22 | #include "xalloc.h" 23 | 24 | #include 25 | #include 26 | 27 | /* 1 if calloc is known to be compatible with GNU calloc. This 28 | matters if we are not also using the calloc module, which defines 29 | HAVE_CALLOC_GNU and supports the GNU API even on non-GNU platforms. */ 30 | #if defined HAVE_CALLOC_GNU || (defined __GLIBC__ && !defined __UCLIBC__) 31 | enum { HAVE_GNU_CALLOC = 1 }; 32 | #else 33 | enum { HAVE_GNU_CALLOC = 0 }; 34 | #endif 35 | 36 | /* Allocate N bytes of memory dynamically, with error checking. */ 37 | 38 | void * 39 | xmalloc (size_t n) 40 | { 41 | void *p = malloc (n); 42 | if (!p && n != 0) 43 | xalloc_die (); 44 | return p; 45 | } 46 | 47 | /* Change the size of an allocated block of memory P to N bytes, 48 | with error checking. */ 49 | 50 | void * 51 | xrealloc (void *p, size_t n) 52 | { 53 | if (!n && p) 54 | { 55 | /* The GNU and C99 realloc behaviors disagree here. Act like 56 | GNU, even if the underlying realloc is C99. */ 57 | free (p); 58 | return NULL; 59 | } 60 | 61 | p = realloc (p, n); 62 | if (!p && n) 63 | xalloc_die (); 64 | return p; 65 | } 66 | 67 | /* If P is null, allocate a block of at least *PN bytes; otherwise, 68 | reallocate P so that it contains more than *PN bytes. *PN must be 69 | nonzero unless P is null. Set *PN to the new block's size, and 70 | return the pointer to the new block. *PN is never set to zero, and 71 | the returned pointer is never null. */ 72 | 73 | void * 74 | x2realloc (void *p, size_t *pn) 75 | { 76 | return x2nrealloc (p, pn, 1); 77 | } 78 | 79 | /* Allocate S bytes of zeroed memory dynamically, with error checking. 80 | There's no need for xnzalloc (N, S), since it would be equivalent 81 | to xcalloc (N, S). */ 82 | 83 | void * 84 | xzalloc (size_t s) 85 | { 86 | return memset (xmalloc (s), 0, s); 87 | } 88 | 89 | /* Allocate zeroed memory for N elements of S bytes, with error 90 | checking. S must be nonzero. */ 91 | 92 | void * 93 | xcalloc (size_t n, size_t s) 94 | { 95 | void *p; 96 | /* Test for overflow, since some calloc implementations don't have 97 | proper overflow checks. But omit overflow and size-zero tests if 98 | HAVE_GNU_CALLOC, since GNU calloc catches overflow and never 99 | returns NULL if successful. */ 100 | if ((! HAVE_GNU_CALLOC && xalloc_oversized (n, s)) 101 | || (! (p = calloc (n, s)) && (HAVE_GNU_CALLOC || n != 0))) 102 | xalloc_die (); 103 | return p; 104 | } 105 | 106 | /* Clone an object P of size S, with error checking. There's no need 107 | for xnmemdup (P, N, S), since xmemdup (P, N * S) works without any 108 | need for an arithmetic overflow check. */ 109 | 110 | void * 111 | xmemdup (void const *p, size_t s) 112 | { 113 | return memcpy (xmalloc (s), p, s); 114 | } 115 | 116 | /* Clone STRING. */ 117 | 118 | char * 119 | xstrdup (char const *string) 120 | { 121 | return xmemdup (string, strlen (string) + 1); 122 | } 123 | -------------------------------------------------------------------------------- /lib/xstrndup.c: -------------------------------------------------------------------------------- 1 | /* Duplicate a bounded initial segment of a string, with out-of-memory 2 | checking. 3 | Copyright (C) 2003, 2006-2007, 2009-2014 Free Software Foundation, Inc. 4 | 5 | This program is free software: you can redistribute it and/or modify 6 | it under the terms of the GNU General Public License as published by 7 | the Free Software Foundation; either version 3 of the License, or 8 | (at your option) any later version. 9 | 10 | This program is distributed in the hope that it will be useful, 11 | but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 | GNU General Public License for more details. 14 | 15 | You should have received a copy of the GNU General Public License 16 | along with this program. If not, see . */ 17 | 18 | #include 19 | 20 | /* Specification. */ 21 | #include "xstrndup.h" 22 | 23 | #include 24 | #include "xalloc.h" 25 | 26 | /* Return a newly allocated copy of at most N bytes of STRING. 27 | In other words, return a copy of the initial segment of length N of 28 | STRING. */ 29 | char * 30 | xstrndup (const char *string, size_t n) 31 | { 32 | char *s = strndup (string, n); 33 | if (! s) 34 | xalloc_die (); 35 | return s; 36 | } 37 | -------------------------------------------------------------------------------- /lib/xstrndup.h: -------------------------------------------------------------------------------- 1 | /* Duplicate a bounded initial segment of a string, with out-of-memory 2 | checking. 3 | Copyright (C) 2003, 2009-2014 Free Software Foundation, Inc. 4 | 5 | This program is free software: you can redistribute it and/or modify 6 | it under the terms of the GNU General Public License as published by 7 | the Free Software Foundation; either version 3 of the License, or 8 | (at your option) any later version. 9 | 10 | This program is distributed in the hope that it will be useful, 11 | but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 | GNU General Public License for more details. 14 | 15 | You should have received a copy of the GNU General Public License 16 | along with this program. If not, see . */ 17 | 18 | #include 19 | 20 | /* Return a newly allocated copy of at most N bytes of STRING. 21 | In other words, return a copy of the initial segment of length N of 22 | STRING. */ 23 | extern char *xstrndup (const char *string, size_t n); 24 | -------------------------------------------------------------------------------- /m4/00gnulib.m4: -------------------------------------------------------------------------------- 1 | # 00gnulib.m4 serial 3 2 | dnl Copyright (C) 2009-2014 Free Software Foundation, Inc. 3 | dnl This file is free software; the Free Software Foundation 4 | dnl gives unlimited permission to copy and/or distribute it, 5 | dnl with or without modifications, as long as this notice is preserved. 6 | 7 | dnl This file must be named something that sorts before all other 8 | dnl gnulib-provided .m4 files. It is needed until such time as we can 9 | dnl assume Autoconf 2.64, with its improved AC_DEFUN_ONCE and 10 | dnl m4_divert semantics. 11 | 12 | # Until autoconf 2.63, handling of the diversion stack required m4_init 13 | # to be called first; but this does not happen with aclocal. Wrapping 14 | # the entire execution in another layer of the diversion stack fixes this. 15 | # Worse, prior to autoconf 2.62, m4_wrap depended on the underlying m4 16 | # for whether it was FIFO or LIFO; in order to properly balance with 17 | # m4_init, we need to undo our push just before anything wrapped within 18 | # the m4_init body. The way to ensure this is to wrap both sides of 19 | # m4_init with a one-shot macro that does the pop at the right time. 20 | m4_ifndef([_m4_divert_diversion], 21 | [m4_divert_push([KILL]) 22 | m4_define([gl_divert_fixup], [m4_divert_pop()m4_define([$0])]) 23 | m4_define([m4_init], 24 | [gl_divert_fixup()]m4_defn([m4_init])[gl_divert_fixup()])]) 25 | 26 | 27 | # AC_DEFUN_ONCE([NAME], VALUE) 28 | # ---------------------------- 29 | # Define NAME to expand to VALUE on the first use (whether by direct 30 | # expansion, or by AC_REQUIRE), and to nothing on all subsequent uses. 31 | # Avoid bugs in AC_REQUIRE in Autoconf 2.63 and earlier. This 32 | # definition is slower than the version in Autoconf 2.64, because it 33 | # can only use interfaces that existed since 2.59; but it achieves the 34 | # same effect. Quoting is necessary to avoid confusing Automake. 35 | m4_version_prereq([2.63.263], [], 36 | [m4_define([AC][_DEFUN_ONCE], 37 | [AC][_DEFUN([$1], 38 | [AC_REQUIRE([_gl_DEFUN_ONCE([$1])], 39 | [m4_indir([_gl_DEFUN_ONCE([$1])])])])]dnl 40 | [AC][_DEFUN([_gl_DEFUN_ONCE([$1])], [$2])])]) 41 | 42 | # gl_00GNULIB 43 | # ----------- 44 | # Witness macro that this file has been included. Needed to force 45 | # Automake to include this file prior to all other gnulib .m4 files. 46 | AC_DEFUN([gl_00GNULIB]) 47 | -------------------------------------------------------------------------------- /m4/close-stream.m4: -------------------------------------------------------------------------------- 1 | #serial 4 2 | dnl Copyright (C) 2006-2007, 2009-2014 Free Software Foundation, Inc. 3 | dnl This file is free software; the Free Software Foundation 4 | dnl gives unlimited permission to copy and/or distribute it, 5 | dnl with or without modifications, as long as this notice is preserved. 6 | 7 | dnl Prerequisites of lib/close-stream.c. 8 | AC_DEFUN([gl_CLOSE_STREAM], 9 | [ 10 | : 11 | ]) 12 | -------------------------------------------------------------------------------- /m4/closeout.m4: -------------------------------------------------------------------------------- 1 | # closeout.m4 serial 6 2 | dnl Copyright (C) 2002-2003, 2005-2006, 2009-2014 Free Software Foundation, 3 | dnl Inc. 4 | dnl This file is free software; the Free Software Foundation 5 | dnl gives unlimited permission to copy and/or distribute it, 6 | dnl with or without modifications, as long as this notice is preserved. 7 | 8 | dnl Prerequisites of lib/closeout.c. 9 | AC_DEFUN([gl_CLOSEOUT], 10 | [ 11 | : 12 | ]) 13 | -------------------------------------------------------------------------------- /m4/codeset.m4: -------------------------------------------------------------------------------- 1 | # codeset.m4 serial 5 (gettext-0.18.2) 2 | dnl Copyright (C) 2000-2002, 2006, 2008-2014 Free Software Foundation, Inc. 3 | dnl This file is free software; the Free Software Foundation 4 | dnl gives unlimited permission to copy and/or distribute it, 5 | dnl with or without modifications, as long as this notice is preserved. 6 | 7 | dnl From Bruno Haible. 8 | 9 | AC_DEFUN([AM_LANGINFO_CODESET], 10 | [ 11 | AC_CACHE_CHECK([for nl_langinfo and CODESET], [am_cv_langinfo_codeset], 12 | [AC_LINK_IFELSE( 13 | [AC_LANG_PROGRAM( 14 | [[#include ]], 15 | [[char* cs = nl_langinfo(CODESET); return !cs;]])], 16 | [am_cv_langinfo_codeset=yes], 17 | [am_cv_langinfo_codeset=no]) 18 | ]) 19 | if test $am_cv_langinfo_codeset = yes; then 20 | AC_DEFINE([HAVE_LANGINFO_CODESET], [1], 21 | [Define if you have and nl_langinfo(CODESET).]) 22 | fi 23 | ]) 24 | -------------------------------------------------------------------------------- /m4/configmake.m4: -------------------------------------------------------------------------------- 1 | # configmake.m4 serial 2 2 | dnl Copyright (C) 2010-2014 Free Software Foundation, Inc. 3 | dnl This file is free software; the Free Software Foundation 4 | dnl gives unlimited permission to copy and/or distribute it, 5 | dnl with or without modifications, as long as this notice is preserved. 6 | 7 | # gl_CONFIGMAKE_PREP 8 | # ------------------ 9 | # Guarantee all of the standard directory variables, even when used with 10 | # autoconf 2.59 (datarootdir wasn't supported until 2.59c, and runstatedir 11 | # in 2.70) or automake 1.9.6 (pkglibexecdir wasn't supported until 1.10b, 12 | # and runstatedir in 1.14.1). 13 | AC_DEFUN([gl_CONFIGMAKE_PREP], 14 | [ 15 | dnl Technically, datadir should default to datarootdir. But if 16 | dnl autoconf is too old to provide datarootdir, then reversing the 17 | dnl definition is a reasonable compromise. Only AC_SUBST a variable 18 | dnl if it was not already defined earlier by autoconf. 19 | if test "x$datarootdir" = x; then 20 | AC_SUBST([datarootdir], ['${datadir}']) 21 | fi 22 | dnl Copy the approach used in autoconf 2.60. 23 | if test "x$docdir" = x; then 24 | AC_SUBST([docdir], [m4_ifset([AC_PACKAGE_TARNAME], 25 | ['${datarootdir}/doc/${PACKAGE_TARNAME}'], 26 | ['${datarootdir}/doc/${PACKAGE}'])]) 27 | fi 28 | dnl The remaining variables missing from autoconf 2.59 are easier. 29 | if test "x$htmldir" = x; then 30 | AC_SUBST([htmldir], ['${docdir}']) 31 | fi 32 | if test "x$dvidir" = x; then 33 | AC_SUBST([dvidir], ['${docdir}']) 34 | fi 35 | if test "x$pdfdir" = x; then 36 | AC_SUBST([pdfdir], ['${docdir}']) 37 | fi 38 | if test "x$psdir" = x; then 39 | AC_SUBST([psdir], ['${docdir}']) 40 | fi 41 | if test "x$lispdir" = x; then 42 | AC_SUBST([lispdir], ['${datarootdir}/emacs/site-lisp']) 43 | fi 44 | if test "x$localedir" = x; then 45 | AC_SUBST([localedir], ['${datarootdir}/locale']) 46 | fi 47 | dnl Added in autoconf 2.70 48 | if test "x$runstatedir" = x; then 49 | AC_SUBST([runstatedir], ['${localstatedir}/run']) 50 | fi 51 | 52 | dnl Automake 1.9.6 only lacks pkglibexecdir; and since 1.11 merely 53 | dnl provides it without AC_SUBST, this blind use of AC_SUBST is safe. 54 | AC_SUBST([pkglibexecdir], ['${libexecdir}/${PACKAGE}']) 55 | ]) 56 | -------------------------------------------------------------------------------- /m4/dirname.m4: -------------------------------------------------------------------------------- 1 | #serial 10 -*- autoconf -*- 2 | dnl Copyright (C) 2002-2006, 2009-2014 Free Software Foundation, Inc. 3 | dnl This file is free software; the Free Software Foundation 4 | dnl gives unlimited permission to copy and/or distribute it, 5 | dnl with or without modifications, as long as this notice is preserved. 6 | 7 | AC_DEFUN([gl_DIRNAME], 8 | [ 9 | AC_REQUIRE([gl_DIRNAME_LGPL]) 10 | ]) 11 | 12 | AC_DEFUN([gl_DIRNAME_LGPL], 13 | [ 14 | dnl Prerequisites of lib/dirname.h. 15 | AC_REQUIRE([gl_DOUBLE_SLASH_ROOT]) 16 | 17 | dnl No prerequisites of lib/basename-lgpl.c, lib/dirname-lgpl.c, 18 | dnl lib/stripslash.c. 19 | ]) 20 | -------------------------------------------------------------------------------- /m4/double-slash-root.m4: -------------------------------------------------------------------------------- 1 | # double-slash-root.m4 serial 4 -*- Autoconf -*- 2 | dnl Copyright (C) 2006, 2008-2014 Free Software Foundation, Inc. 3 | dnl This file is free software; the Free Software Foundation 4 | dnl gives unlimited permission to copy and/or distribute it, 5 | dnl with or without modifications, as long as this notice is preserved. 6 | 7 | AC_DEFUN([gl_DOUBLE_SLASH_ROOT], 8 | [ 9 | AC_REQUIRE([AC_CANONICAL_HOST]) 10 | AC_CACHE_CHECK([whether // is distinct from /], [gl_cv_double_slash_root], 11 | [ if test x"$cross_compiling" = xyes ; then 12 | # When cross-compiling, there is no way to tell whether // is special 13 | # short of a list of hosts. However, the only known hosts to date 14 | # that have a distinct // are Apollo DomainOS (too old to port to), 15 | # Cygwin, and z/OS. If anyone knows of another system for which // has 16 | # special semantics and is distinct from /, please report it to 17 | # . 18 | case $host in 19 | *-cygwin | i370-ibm-openedition) 20 | gl_cv_double_slash_root=yes ;; 21 | *) 22 | # Be optimistic and assume that / and // are the same when we 23 | # don't know. 24 | gl_cv_double_slash_root='unknown, assuming no' ;; 25 | esac 26 | else 27 | set x `ls -di / // 2>/dev/null` 28 | if test "$[2]" = "$[4]" && wc //dev/null >/dev/null 2>&1; then 29 | gl_cv_double_slash_root=no 30 | else 31 | gl_cv_double_slash_root=yes 32 | fi 33 | fi]) 34 | if test "$gl_cv_double_slash_root" = yes; then 35 | AC_DEFINE([DOUBLE_SLASH_IS_DISTINCT_ROOT], [1], 36 | [Define to 1 if // is a file system root distinct from /.]) 37 | fi 38 | ]) 39 | -------------------------------------------------------------------------------- /m4/errno_h.m4: -------------------------------------------------------------------------------- 1 | # errno_h.m4 serial 12 2 | dnl Copyright (C) 2004, 2006, 2008-2014 Free Software Foundation, Inc. 3 | dnl This file is free software; the Free Software Foundation 4 | dnl gives unlimited permission to copy and/or distribute it, 5 | dnl with or without modifications, as long as this notice is preserved. 6 | 7 | AC_DEFUN_ONCE([gl_HEADER_ERRNO_H], 8 | [ 9 | AC_REQUIRE([AC_PROG_CC]) 10 | AC_CACHE_CHECK([for complete errno.h], [gl_cv_header_errno_h_complete], [ 11 | AC_EGREP_CPP([booboo],[ 12 | #include 13 | #if !defined ETXTBSY 14 | booboo 15 | #endif 16 | #if !defined ENOMSG 17 | booboo 18 | #endif 19 | #if !defined EIDRM 20 | booboo 21 | #endif 22 | #if !defined ENOLINK 23 | booboo 24 | #endif 25 | #if !defined EPROTO 26 | booboo 27 | #endif 28 | #if !defined EMULTIHOP 29 | booboo 30 | #endif 31 | #if !defined EBADMSG 32 | booboo 33 | #endif 34 | #if !defined EOVERFLOW 35 | booboo 36 | #endif 37 | #if !defined ENOTSUP 38 | booboo 39 | #endif 40 | #if !defined ENETRESET 41 | booboo 42 | #endif 43 | #if !defined ECONNABORTED 44 | booboo 45 | #endif 46 | #if !defined ESTALE 47 | booboo 48 | #endif 49 | #if !defined EDQUOT 50 | booboo 51 | #endif 52 | #if !defined ECANCELED 53 | booboo 54 | #endif 55 | #if !defined EOWNERDEAD 56 | booboo 57 | #endif 58 | #if !defined ENOTRECOVERABLE 59 | booboo 60 | #endif 61 | #if !defined EILSEQ 62 | booboo 63 | #endif 64 | ], 65 | [gl_cv_header_errno_h_complete=no], 66 | [gl_cv_header_errno_h_complete=yes]) 67 | ]) 68 | if test $gl_cv_header_errno_h_complete = yes; then 69 | ERRNO_H='' 70 | else 71 | gl_NEXT_HEADERS([errno.h]) 72 | ERRNO_H='errno.h' 73 | fi 74 | AC_SUBST([ERRNO_H]) 75 | AM_CONDITIONAL([GL_GENERATE_ERRNO_H], [test -n "$ERRNO_H"]) 76 | gl_REPLACE_ERRNO_VALUE([EMULTIHOP]) 77 | gl_REPLACE_ERRNO_VALUE([ENOLINK]) 78 | gl_REPLACE_ERRNO_VALUE([EOVERFLOW]) 79 | ]) 80 | 81 | # Assuming $1 = EOVERFLOW. 82 | # The EOVERFLOW errno value ought to be defined in , according to 83 | # POSIX. But some systems (like OpenBSD 4.0 or AIX 3) don't define it, and 84 | # some systems (like OSF/1) define it when _XOPEN_SOURCE_EXTENDED is defined. 85 | # Check for the value of EOVERFLOW. 86 | # Set the variables EOVERFLOW_HIDDEN and EOVERFLOW_VALUE. 87 | AC_DEFUN([gl_REPLACE_ERRNO_VALUE], 88 | [ 89 | if test -n "$ERRNO_H"; then 90 | AC_CACHE_CHECK([for ]$1[ value], [gl_cv_header_errno_h_]$1, [ 91 | AC_EGREP_CPP([yes],[ 92 | #include 93 | #ifdef ]$1[ 94 | yes 95 | #endif 96 | ], 97 | [gl_cv_header_errno_h_]$1[=yes], 98 | [gl_cv_header_errno_h_]$1[=no]) 99 | if test $gl_cv_header_errno_h_]$1[ = no; then 100 | AC_EGREP_CPP([yes],[ 101 | #define _XOPEN_SOURCE_EXTENDED 1 102 | #include 103 | #ifdef ]$1[ 104 | yes 105 | #endif 106 | ], [gl_cv_header_errno_h_]$1[=hidden]) 107 | if test $gl_cv_header_errno_h_]$1[ = hidden; then 108 | dnl The macro exists but is hidden. 109 | dnl Define it to the same value. 110 | AC_COMPUTE_INT([gl_cv_header_errno_h_]$1, $1, [ 111 | #define _XOPEN_SOURCE_EXTENDED 1 112 | #include 113 | /* The following two lines are a workaround against an autoconf-2.52 bug. */ 114 | #include 115 | #include 116 | ]) 117 | fi 118 | fi 119 | ]) 120 | case $gl_cv_header_errno_h_]$1[ in 121 | yes | no) 122 | ]$1[_HIDDEN=0; ]$1[_VALUE= 123 | ;; 124 | *) 125 | ]$1[_HIDDEN=1; ]$1[_VALUE="$gl_cv_header_errno_h_]$1[" 126 | ;; 127 | esac 128 | AC_SUBST($1[_HIDDEN]) 129 | AC_SUBST($1[_VALUE]) 130 | fi 131 | ]) 132 | 133 | dnl Autoconf >= 2.61 has AC_COMPUTE_INT built-in. 134 | dnl Remove this when we can assume autoconf >= 2.61. 135 | m4_ifdef([AC_COMPUTE_INT], [], [ 136 | AC_DEFUN([AC_COMPUTE_INT], [_AC_COMPUTE_INT([$2],[$1],[$3],[$4])]) 137 | ]) 138 | -------------------------------------------------------------------------------- /m4/error.m4: -------------------------------------------------------------------------------- 1 | #serial 14 2 | 3 | # Copyright (C) 1996-1998, 2001-2004, 2009-2014 Free Software Foundation, Inc. 4 | # 5 | # This file is free software; the Free Software Foundation 6 | # gives unlimited permission to copy and/or distribute it, 7 | # with or without modifications, as long as this notice is preserved. 8 | 9 | AC_DEFUN([gl_ERROR], 10 | [ 11 | dnl We don't use AC_FUNC_ERROR_AT_LINE any more, because it is no longer 12 | dnl maintained in Autoconf and because it invokes AC_LIBOBJ. 13 | AC_CACHE_CHECK([for error_at_line], [ac_cv_lib_error_at_line], 14 | [AC_LINK_IFELSE( 15 | [AC_LANG_PROGRAM( 16 | [[#include ]], 17 | [[error_at_line (0, 0, "", 0, "an error occurred");]])], 18 | [ac_cv_lib_error_at_line=yes], 19 | [ac_cv_lib_error_at_line=no])]) 20 | ]) 21 | 22 | # Prerequisites of lib/error.c. 23 | AC_DEFUN([gl_PREREQ_ERROR], 24 | [ 25 | AC_REQUIRE([AC_FUNC_STRERROR_R]) 26 | : 27 | ]) 28 | -------------------------------------------------------------------------------- /m4/extern-inline.m4: -------------------------------------------------------------------------------- 1 | dnl 'extern inline' a la ISO C99. 2 | 3 | dnl Copyright 2012-2014 Free Software Foundation, Inc. 4 | dnl This file is free software; the Free Software Foundation 5 | dnl gives unlimited permission to copy and/or distribute it, 6 | dnl with or without modifications, as long as this notice is preserved. 7 | 8 | AC_DEFUN([gl_EXTERN_INLINE], 9 | [ 10 | AH_VERBATIM([extern_inline], 11 | [/* Please see the Gnulib manual for how to use these macros. 12 | 13 | Suppress extern inline with HP-UX cc, as it appears to be broken; see 14 | . 15 | 16 | Suppress extern inline with Sun C in standards-conformance mode, as it 17 | mishandles inline functions that call each other. E.g., for 'inline void f 18 | (void) { } inline void g (void) { f (); }', c99 incorrectly complains 19 | 'reference to static identifier "f" in extern inline function'. 20 | This bug was observed with Sun C 5.12 SunOS_i386 2011/11/16. 21 | 22 | Suppress extern inline (with or without __attribute__ ((__gnu_inline__))) 23 | on configurations that mistakenly use 'static inline' to implement 24 | functions or macros in standard C headers like . For example, 25 | if isdigit is mistakenly implemented via a static inline function, 26 | a program containing an extern inline function that calls isdigit 27 | may not work since the C standard prohibits extern inline functions 28 | from calling static functions. This bug is known to occur on: 29 | 30 | OS X 10.8 and earlier; see: 31 | http://lists.gnu.org/archive/html/bug-gnulib/2012-12/msg00023.html 32 | 33 | DragonFly; see 34 | http://muscles.dragonflybsd.org/bulk/bleeding-edge-potential/latest-per-pkg/ah-tty-0.3.12.log 35 | 36 | FreeBSD; see: 37 | http://lists.gnu.org/archive/html/bug-gnulib/2014-07/msg00104.html 38 | 39 | OS X 10.9 has a macro __header_inline indicating the bug is fixed for C and 40 | for clang but remains for g++; see . 41 | Assume DragonFly and FreeBSD will be similar. */ 42 | #if (((defined __APPLE__ && defined __MACH__) \ 43 | || defined __DragonFly__ || defined __FreeBSD__) \ 44 | && (defined __header_inline \ 45 | ? (defined __cplusplus && defined __GNUC_STDC_INLINE__ \ 46 | && ! defined __clang__) \ 47 | : ((! defined _DONT_USE_CTYPE_INLINE_ \ 48 | && (defined __GNUC__ || defined __cplusplus)) \ 49 | || (defined _FORTIFY_SOURCE && 0 < _FORTIFY_SOURCE \ 50 | && defined __GNUC__ && ! defined __cplusplus)))) 51 | # define _GL_EXTERN_INLINE_STDHEADER_BUG 52 | #endif 53 | #if ((__GNUC__ \ 54 | ? defined __GNUC_STDC_INLINE__ && __GNUC_STDC_INLINE__ \ 55 | : (199901L <= __STDC_VERSION__ \ 56 | && !defined __HP_cc \ 57 | && !(defined __SUNPRO_C && __STDC__))) \ 58 | && !defined _GL_EXTERN_INLINE_STDHEADER_BUG) 59 | # define _GL_INLINE inline 60 | # define _GL_EXTERN_INLINE extern inline 61 | # define _GL_EXTERN_INLINE_IN_USE 62 | #elif (2 < __GNUC__ + (7 <= __GNUC_MINOR__) && !defined __STRICT_ANSI__ \ 63 | && !defined _GL_EXTERN_INLINE_STDHEADER_BUG) 64 | # if defined __GNUC_GNU_INLINE__ && __GNUC_GNU_INLINE__ 65 | /* __gnu_inline__ suppresses a GCC 4.2 diagnostic. */ 66 | # define _GL_INLINE extern inline __attribute__ ((__gnu_inline__)) 67 | # else 68 | # define _GL_INLINE extern inline 69 | # endif 70 | # define _GL_EXTERN_INLINE extern 71 | # define _GL_EXTERN_INLINE_IN_USE 72 | #else 73 | # define _GL_INLINE static _GL_UNUSED 74 | # define _GL_EXTERN_INLINE static _GL_UNUSED 75 | #endif 76 | 77 | #if 4 < __GNUC__ + (6 <= __GNUC_MINOR__) 78 | # if defined __GNUC_STDC_INLINE__ && __GNUC_STDC_INLINE__ 79 | # define _GL_INLINE_HEADER_CONST_PRAGMA 80 | # else 81 | # define _GL_INLINE_HEADER_CONST_PRAGMA \ 82 | _Pragma ("GCC diagnostic ignored \"-Wsuggest-attribute=const\"") 83 | # endif 84 | /* Suppress GCC's bogus "no previous prototype for 'FOO'" 85 | and "no previous declaration for 'FOO'" diagnostics, 86 | when FOO is an inline function in the header; see 87 | . */ 88 | # define _GL_INLINE_HEADER_BEGIN \ 89 | _Pragma ("GCC diagnostic push") \ 90 | _Pragma ("GCC diagnostic ignored \"-Wmissing-prototypes\"") \ 91 | _Pragma ("GCC diagnostic ignored \"-Wmissing-declarations\"") \ 92 | _GL_INLINE_HEADER_CONST_PRAGMA 93 | # define _GL_INLINE_HEADER_END \ 94 | _Pragma ("GCC diagnostic pop") 95 | #else 96 | # define _GL_INLINE_HEADER_BEGIN 97 | # define _GL_INLINE_HEADER_END 98 | #endif]) 99 | ]) 100 | -------------------------------------------------------------------------------- /m4/glibc21.m4: -------------------------------------------------------------------------------- 1 | # glibc21.m4 serial 5 2 | dnl Copyright (C) 2000-2002, 2004, 2008, 2010-2014 Free Software Foundation, 3 | dnl Inc. 4 | dnl This file is free software; the Free Software Foundation 5 | dnl gives unlimited permission to copy and/or distribute it, 6 | dnl with or without modifications, as long as this notice is preserved. 7 | 8 | # Test for the GNU C Library, version 2.1 or newer, or uClibc. 9 | # From Bruno Haible. 10 | 11 | AC_DEFUN([gl_GLIBC21], 12 | [ 13 | AC_CACHE_CHECK([whether we are using the GNU C Library >= 2.1 or uClibc], 14 | [ac_cv_gnu_library_2_1], 15 | [AC_EGREP_CPP([Lucky], 16 | [ 17 | #include 18 | #ifdef __GNU_LIBRARY__ 19 | #if (__GLIBC__ == 2 && __GLIBC_MINOR__ >= 1) || (__GLIBC__ > 2) 20 | Lucky GNU user 21 | #endif 22 | #endif 23 | #ifdef __UCLIBC__ 24 | Lucky user 25 | #endif 26 | ], 27 | [ac_cv_gnu_library_2_1=yes], 28 | [ac_cv_gnu_library_2_1=no]) 29 | ] 30 | ) 31 | AC_SUBST([GLIBC21]) 32 | GLIBC21="$ac_cv_gnu_library_2_1" 33 | ] 34 | ) 35 | -------------------------------------------------------------------------------- /m4/gnulib-cache.m4: -------------------------------------------------------------------------------- 1 | # Copyright (C) 2002-2014 Free Software Foundation, Inc. 2 | # 3 | # This file is free software; you can redistribute it and/or modify 4 | # it under the terms of the GNU General Public License as published by 5 | # the Free Software Foundation; either version 3 of the License, or 6 | # (at your option) any later version. 7 | # 8 | # This file is distributed in the hope that it will be useful, 9 | # but WITHOUT ANY WARRANTY; without even the implied warranty of 10 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 11 | # GNU General Public License for more details. 12 | # 13 | # You should have received a copy of the GNU General Public License 14 | # along with this file. If not, see . 15 | # 16 | # As a special exception to the GNU General Public License, 17 | # this file may be distributed as part of a program that 18 | # contains a configuration script generated by Autoconf, under 19 | # the same distribution terms as the rest of that program. 20 | # 21 | # Generated by gnulib-tool. 22 | # 23 | # This file represents the specification of how gnulib-tool is used. 24 | # It acts as a cache: It is written and read by gnulib-tool. 25 | # In projects that use version control, this file is meant to be put under 26 | # version control, like the configure.ac and various Makefile.am files. 27 | 28 | 29 | # Specification in the form of a command-line invocation: 30 | # gnulib-tool --import --dir=. --local-dir=gl --lib=libhello --source-base=lib --m4-base=m4 --doc-base=doc --tests-base=tests --aux-dir=build-aux --makefile-name=gnulib.mk --no-conditional-dependencies --no-libtool --macro-prefix=gl announce-gen closeout configmake dirname do-release-commit-and-tag error fdl gendocs getopt-gnu gettext gitlog-to-changelog gnu-web-doc-update gnupload maintainer-makefile mbsrtowcs non-recursive-gnulib-prefix-hack progname readme-release update-copyright wchar 31 | 32 | # Specification in the form of a few gnulib-tool.m4 macro invocations: 33 | gl_LOCAL_DIR([gl]) 34 | gl_MODULES([ 35 | announce-gen 36 | closeout 37 | configmake 38 | dirname 39 | do-release-commit-and-tag 40 | error 41 | fdl 42 | gendocs 43 | getopt-gnu 44 | gettext 45 | gitlog-to-changelog 46 | gnu-web-doc-update 47 | gnupload 48 | maintainer-makefile 49 | mbsrtowcs 50 | non-recursive-gnulib-prefix-hack 51 | progname 52 | readme-release 53 | update-copyright 54 | wchar 55 | ]) 56 | gl_AVOID([]) 57 | gl_SOURCE_BASE([lib]) 58 | gl_M4_BASE([m4]) 59 | gl_PO_BASE([]) 60 | gl_DOC_BASE([doc]) 61 | gl_TESTS_BASE([tests]) 62 | gl_LIB([libhello]) 63 | gl_MAKEFILE_NAME([gnulib.mk]) 64 | gl_MACRO_PREFIX([gl]) 65 | gl_PO_DOMAIN([]) 66 | gl_WITNESS_C_MACRO([]) 67 | -------------------------------------------------------------------------------- /m4/intlmacosx.m4: -------------------------------------------------------------------------------- 1 | # intlmacosx.m4 serial 5 (gettext-0.18.2) 2 | dnl Copyright (C) 2004-2014 Free Software Foundation, Inc. 3 | dnl This file is free software; the Free Software Foundation 4 | dnl gives unlimited permission to copy and/or distribute it, 5 | dnl with or without modifications, as long as this notice is preserved. 6 | dnl 7 | dnl This file can can be used in projects which are not available under 8 | dnl the GNU General Public License or the GNU Library General Public 9 | dnl License but which still want to provide support for the GNU gettext 10 | dnl functionality. 11 | dnl Please note that the actual code of the GNU gettext library is covered 12 | dnl by the GNU Library General Public License, and the rest of the GNU 13 | dnl gettext package package is covered by the GNU General Public License. 14 | dnl They are *not* in the public domain. 15 | 16 | dnl Checks for special options needed on Mac OS X. 17 | dnl Defines INTL_MACOSX_LIBS. 18 | AC_DEFUN([gt_INTL_MACOSX], 19 | [ 20 | dnl Check for API introduced in Mac OS X 10.2. 21 | AC_CACHE_CHECK([for CFPreferencesCopyAppValue], 22 | [gt_cv_func_CFPreferencesCopyAppValue], 23 | [gt_save_LIBS="$LIBS" 24 | LIBS="$LIBS -Wl,-framework -Wl,CoreFoundation" 25 | AC_LINK_IFELSE( 26 | [AC_LANG_PROGRAM( 27 | [[#include ]], 28 | [[CFPreferencesCopyAppValue(NULL, NULL)]])], 29 | [gt_cv_func_CFPreferencesCopyAppValue=yes], 30 | [gt_cv_func_CFPreferencesCopyAppValue=no]) 31 | LIBS="$gt_save_LIBS"]) 32 | if test $gt_cv_func_CFPreferencesCopyAppValue = yes; then 33 | AC_DEFINE([HAVE_CFPREFERENCESCOPYAPPVALUE], [1], 34 | [Define to 1 if you have the Mac OS X function CFPreferencesCopyAppValue in the CoreFoundation framework.]) 35 | fi 36 | dnl Check for API introduced in Mac OS X 10.3. 37 | AC_CACHE_CHECK([for CFLocaleCopyCurrent], [gt_cv_func_CFLocaleCopyCurrent], 38 | [gt_save_LIBS="$LIBS" 39 | LIBS="$LIBS -Wl,-framework -Wl,CoreFoundation" 40 | AC_LINK_IFELSE( 41 | [AC_LANG_PROGRAM( 42 | [[#include ]], 43 | [[CFLocaleCopyCurrent();]])], 44 | [gt_cv_func_CFLocaleCopyCurrent=yes], 45 | [gt_cv_func_CFLocaleCopyCurrent=no]) 46 | LIBS="$gt_save_LIBS"]) 47 | if test $gt_cv_func_CFLocaleCopyCurrent = yes; then 48 | AC_DEFINE([HAVE_CFLOCALECOPYCURRENT], [1], 49 | [Define to 1 if you have the Mac OS X function CFLocaleCopyCurrent in the CoreFoundation framework.]) 50 | fi 51 | INTL_MACOSX_LIBS= 52 | if test $gt_cv_func_CFPreferencesCopyAppValue = yes || test $gt_cv_func_CFLocaleCopyCurrent = yes; then 53 | INTL_MACOSX_LIBS="-Wl,-framework -Wl,CoreFoundation" 54 | fi 55 | AC_SUBST([INTL_MACOSX_LIBS]) 56 | ]) 57 | -------------------------------------------------------------------------------- /m4/lib-ld.m4: -------------------------------------------------------------------------------- 1 | # lib-ld.m4 serial 6 2 | dnl Copyright (C) 1996-2003, 2009-2014 Free Software Foundation, Inc. 3 | dnl This file is free software; the Free Software Foundation 4 | dnl gives unlimited permission to copy and/or distribute it, 5 | dnl with or without modifications, as long as this notice is preserved. 6 | 7 | dnl Subroutines of libtool.m4, 8 | dnl with replacements s/_*LT_PATH/AC_LIB_PROG/ and s/lt_/acl_/ to avoid 9 | dnl collision with libtool.m4. 10 | 11 | dnl From libtool-2.4. Sets the variable with_gnu_ld to yes or no. 12 | AC_DEFUN([AC_LIB_PROG_LD_GNU], 13 | [AC_CACHE_CHECK([if the linker ($LD) is GNU ld], [acl_cv_prog_gnu_ld], 14 | [# I'd rather use --version here, but apparently some GNU lds only accept -v. 15 | case `$LD -v 2>&1 /dev/null 2>&1 \ 45 | && { (PATH='/bin:/bin'; FPATH=$PATH; sh -c :) >/dev/null 2>&1 \ 46 | || PATH_SEPARATOR=';' 47 | } 48 | fi 49 | 50 | ac_prog=ld 51 | if test "$GCC" = yes; then 52 | # Check if gcc -print-prog-name=ld gives a path. 53 | AC_MSG_CHECKING([for ld used by $CC]) 54 | case $host in 55 | *-*-mingw*) 56 | # gcc leaves a trailing carriage return which upsets mingw 57 | ac_prog=`($CC -print-prog-name=ld) 2>&5 | tr -d '\015'` ;; 58 | *) 59 | ac_prog=`($CC -print-prog-name=ld) 2>&5` ;; 60 | esac 61 | case $ac_prog in 62 | # Accept absolute paths. 63 | [[\\/]]* | ?:[[\\/]]*) 64 | re_direlt='/[[^/]][[^/]]*/\.\./' 65 | # Canonicalize the pathname of ld 66 | ac_prog=`echo "$ac_prog"| sed 's%\\\\%/%g'` 67 | while echo "$ac_prog" | grep "$re_direlt" > /dev/null 2>&1; do 68 | ac_prog=`echo $ac_prog| sed "s%$re_direlt%/%"` 69 | done 70 | test -z "$LD" && LD="$ac_prog" 71 | ;; 72 | "") 73 | # If it fails, then pretend we aren't using GCC. 74 | ac_prog=ld 75 | ;; 76 | *) 77 | # If it is relative, then search for the first ld in PATH. 78 | with_gnu_ld=unknown 79 | ;; 80 | esac 81 | elif test "$with_gnu_ld" = yes; then 82 | AC_MSG_CHECKING([for GNU ld]) 83 | else 84 | AC_MSG_CHECKING([for non-GNU ld]) 85 | fi 86 | AC_CACHE_VAL([acl_cv_path_LD], 87 | [if test -z "$LD"; then 88 | acl_save_ifs="$IFS"; IFS=$PATH_SEPARATOR 89 | for ac_dir in $PATH; do 90 | IFS="$acl_save_ifs" 91 | test -z "$ac_dir" && ac_dir=. 92 | if test -f "$ac_dir/$ac_prog" || test -f "$ac_dir/$ac_prog$ac_exeext"; then 93 | acl_cv_path_LD="$ac_dir/$ac_prog" 94 | # Check to see if the program is GNU ld. I'd rather use --version, 95 | # but apparently some variants of GNU ld only accept -v. 96 | # Break only if it was the GNU/non-GNU ld that we prefer. 97 | case `"$acl_cv_path_LD" -v 2>&1 22 | #else 23 | char *malloc (); 24 | #endif 25 | ]], 26 | [[return ! malloc (0);]]) 27 | ], 28 | [ac_cv_func_malloc_0_nonnull=yes], 29 | [ac_cv_func_malloc_0_nonnull=no], 30 | [case "$host_os" in 31 | # Guess yes on platforms where we know the result. 32 | *-gnu* | freebsd* | netbsd* | openbsd* \ 33 | | hpux* | solaris* | cygwin* | mingw*) 34 | ac_cv_func_malloc_0_nonnull=yes ;; 35 | # If we don't know, assume the worst. 36 | *) ac_cv_func_malloc_0_nonnull=no ;; 37 | esac 38 | ]) 39 | ]) 40 | AS_IF([test $ac_cv_func_malloc_0_nonnull = yes], [$1], [$2]) 41 | ])# _AC_FUNC_MALLOC_IF 42 | 43 | ]) 44 | 45 | # gl_FUNC_MALLOC_GNU 46 | # ------------------ 47 | # Test whether 'malloc (0)' is handled like in GNU libc, and replace malloc if 48 | # it is not. 49 | AC_DEFUN([gl_FUNC_MALLOC_GNU], 50 | [ 51 | AC_REQUIRE([gl_STDLIB_H_DEFAULTS]) 52 | dnl _AC_FUNC_MALLOC_IF is defined in Autoconf. 53 | _AC_FUNC_MALLOC_IF( 54 | [AC_DEFINE([HAVE_MALLOC_GNU], [1], 55 | [Define to 1 if your system has a GNU libc compatible 'malloc' 56 | function, and to 0 otherwise.])], 57 | [AC_DEFINE([HAVE_MALLOC_GNU], [0]) 58 | REPLACE_MALLOC=1 59 | ]) 60 | ]) 61 | 62 | # gl_FUNC_MALLOC_POSIX 63 | # -------------------- 64 | # Test whether 'malloc' is POSIX compliant (sets errno to ENOMEM when it 65 | # fails), and replace malloc if it is not. 66 | AC_DEFUN([gl_FUNC_MALLOC_POSIX], 67 | [ 68 | AC_REQUIRE([gl_STDLIB_H_DEFAULTS]) 69 | AC_REQUIRE([gl_CHECK_MALLOC_POSIX]) 70 | if test $gl_cv_func_malloc_posix = yes; then 71 | AC_DEFINE([HAVE_MALLOC_POSIX], [1], 72 | [Define if the 'malloc' function is POSIX compliant.]) 73 | else 74 | REPLACE_MALLOC=1 75 | fi 76 | ]) 77 | 78 | # Test whether malloc, realloc, calloc are POSIX compliant, 79 | # Set gl_cv_func_malloc_posix to yes or no accordingly. 80 | AC_DEFUN([gl_CHECK_MALLOC_POSIX], 81 | [ 82 | AC_CACHE_CHECK([whether malloc, realloc, calloc are POSIX compliant], 83 | [gl_cv_func_malloc_posix], 84 | [ 85 | dnl It is too dangerous to try to allocate a large amount of memory: 86 | dnl some systems go to their knees when you do that. So assume that 87 | dnl all Unix implementations of the function are POSIX compliant. 88 | AC_COMPILE_IFELSE( 89 | [AC_LANG_PROGRAM( 90 | [[]], 91 | [[#if (defined _WIN32 || defined __WIN32__) && ! defined __CYGWIN__ 92 | choke me 93 | #endif 94 | ]])], 95 | [gl_cv_func_malloc_posix=yes], 96 | [gl_cv_func_malloc_posix=no]) 97 | ]) 98 | ]) 99 | -------------------------------------------------------------------------------- /m4/mbsinit.m4: -------------------------------------------------------------------------------- 1 | # mbsinit.m4 serial 8 2 | dnl Copyright (C) 2008, 2010-2014 Free Software Foundation, Inc. 3 | dnl This file is free software; the Free Software Foundation 4 | dnl gives unlimited permission to copy and/or distribute it, 5 | dnl with or without modifications, as long as this notice is preserved. 6 | 7 | AC_DEFUN([gl_FUNC_MBSINIT], 8 | [ 9 | AC_REQUIRE([gl_WCHAR_H_DEFAULTS]) 10 | AC_REQUIRE([AC_CANONICAL_HOST]) 11 | 12 | AC_REQUIRE([AC_TYPE_MBSTATE_T]) 13 | gl_MBSTATE_T_BROKEN 14 | 15 | AC_CHECK_FUNCS_ONCE([mbsinit]) 16 | if test $ac_cv_func_mbsinit = no; then 17 | HAVE_MBSINIT=0 18 | AC_CHECK_DECLS([mbsinit],,, [[ 19 | /* Tru64 with Desktop Toolkit C has a bug: must be included before 20 | . 21 | BSD/OS 4.0.1 has a bug: , and must be 22 | included before . */ 23 | #include 24 | #include 25 | #include 26 | #include 27 | ]]) 28 | if test $ac_cv_have_decl_mbsinit = yes; then 29 | dnl On Minix 3.1.8, the system's declares mbsinit() although 30 | dnl it does not have the function. Avoid a collision with gnulib's 31 | dnl replacement. 32 | REPLACE_MBSINIT=1 33 | fi 34 | else 35 | if test $REPLACE_MBSTATE_T = 1; then 36 | REPLACE_MBSINIT=1 37 | else 38 | dnl On mingw, mbsinit() always returns 1, which is inappropriate for 39 | dnl states produced by mbrtowc() for an incomplete multibyte character 40 | dnl in multibyte locales. 41 | case "$host_os" in 42 | mingw*) REPLACE_MBSINIT=1 ;; 43 | esac 44 | fi 45 | fi 46 | ]) 47 | 48 | # Prerequisites of lib/mbsinit.c. 49 | AC_DEFUN([gl_PREREQ_MBSINIT], [ 50 | : 51 | ]) 52 | -------------------------------------------------------------------------------- /m4/mbstate_t.m4: -------------------------------------------------------------------------------- 1 | # mbstate_t.m4 serial 13 2 | dnl Copyright (C) 2000-2002, 2008-2014 Free Software Foundation, Inc. 3 | dnl This file is free software; the Free Software Foundation 4 | dnl gives unlimited permission to copy and/or distribute it, 5 | dnl with or without modifications, as long as this notice is preserved. 6 | 7 | # From Paul Eggert. 8 | 9 | # BeOS 5 has but does not define mbstate_t, 10 | # so you can't declare an object of that type. 11 | # Check for this incompatibility with Standard C. 12 | 13 | # AC_TYPE_MBSTATE_T 14 | # ----------------- 15 | AC_DEFUN([AC_TYPE_MBSTATE_T], 16 | [ 17 | AC_REQUIRE([AC_USE_SYSTEM_EXTENSIONS]) dnl for HP-UX 11.11 18 | 19 | AC_CACHE_CHECK([for mbstate_t], [ac_cv_type_mbstate_t], 20 | [AC_COMPILE_IFELSE( 21 | [AC_LANG_PROGRAM( 22 | [AC_INCLUDES_DEFAULT[ 23 | /* Tru64 with Desktop Toolkit C has a bug: must be included before 24 | . 25 | BSD/OS 4.0.1 has a bug: , and must be 26 | included before . */ 27 | #include 28 | #include 29 | #include 30 | #include ]], 31 | [[mbstate_t x; return sizeof x;]])], 32 | [ac_cv_type_mbstate_t=yes], 33 | [ac_cv_type_mbstate_t=no])]) 34 | if test $ac_cv_type_mbstate_t = yes; then 35 | AC_DEFINE([HAVE_MBSTATE_T], [1], 36 | [Define to 1 if declares mbstate_t.]) 37 | else 38 | AC_DEFINE([mbstate_t], [int], 39 | [Define to a type if does not define.]) 40 | fi 41 | ]) 42 | -------------------------------------------------------------------------------- /m4/memchr.m4: -------------------------------------------------------------------------------- 1 | # memchr.m4 serial 12 2 | dnl Copyright (C) 2002-2004, 2009-2014 Free Software Foundation, Inc. 3 | dnl This file is free software; the Free Software Foundation 4 | dnl gives unlimited permission to copy and/or distribute it, 5 | dnl with or without modifications, as long as this notice is preserved. 6 | 7 | AC_DEFUN_ONCE([gl_FUNC_MEMCHR], 8 | [ 9 | dnl Check for prerequisites for memory fence checks. 10 | gl_FUNC_MMAP_ANON 11 | AC_CHECK_HEADERS_ONCE([sys/mman.h]) 12 | AC_CHECK_FUNCS_ONCE([mprotect]) 13 | 14 | AC_REQUIRE([gl_HEADER_STRING_H_DEFAULTS]) 15 | m4_ifdef([gl_FUNC_MEMCHR_OBSOLETE], [ 16 | dnl These days, we assume memchr is present. But if support for old 17 | dnl platforms is desired: 18 | AC_CHECK_FUNCS_ONCE([memchr]) 19 | if test $ac_cv_func_memchr = no; then 20 | HAVE_MEMCHR=0 21 | fi 22 | ]) 23 | if test $HAVE_MEMCHR = 1; then 24 | # Detect platform-specific bugs in some versions of glibc: 25 | # memchr should not dereference anything with length 0 26 | # http://bugzilla.redhat.com/499689 27 | # memchr should not dereference overestimated length after a match 28 | # http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=521737 29 | # http://sourceware.org/bugzilla/show_bug.cgi?id=10162 30 | # Assume that memchr works on platforms that lack mprotect. 31 | AC_CACHE_CHECK([whether memchr works], [gl_cv_func_memchr_works], 32 | [AC_RUN_IFELSE([AC_LANG_PROGRAM([[ 33 | #include 34 | #if HAVE_SYS_MMAN_H 35 | # include 36 | # include 37 | # include 38 | # include 39 | # ifndef MAP_FILE 40 | # define MAP_FILE 0 41 | # endif 42 | #endif 43 | ]], [[ 44 | int result = 0; 45 | char *fence = NULL; 46 | #if HAVE_SYS_MMAN_H && HAVE_MPROTECT 47 | # if HAVE_MAP_ANONYMOUS 48 | const int flags = MAP_ANONYMOUS | MAP_PRIVATE; 49 | const int fd = -1; 50 | # else /* !HAVE_MAP_ANONYMOUS */ 51 | const int flags = MAP_FILE | MAP_PRIVATE; 52 | int fd = open ("/dev/zero", O_RDONLY, 0666); 53 | if (fd >= 0) 54 | # endif 55 | { 56 | int pagesize = getpagesize (); 57 | char *two_pages = 58 | (char *) mmap (NULL, 2 * pagesize, PROT_READ | PROT_WRITE, 59 | flags, fd, 0); 60 | if (two_pages != (char *)(-1) 61 | && mprotect (two_pages + pagesize, pagesize, PROT_NONE) == 0) 62 | fence = two_pages + pagesize; 63 | } 64 | #endif 65 | if (fence) 66 | { 67 | if (memchr (fence, 0, 0)) 68 | result |= 1; 69 | strcpy (fence - 9, "12345678"); 70 | if (memchr (fence - 9, 0, 79) != fence - 1) 71 | result |= 2; 72 | if (memchr (fence - 1, 0, 3) != fence - 1) 73 | result |= 4; 74 | } 75 | return result; 76 | ]])], [gl_cv_func_memchr_works=yes], [gl_cv_func_memchr_works=no], 77 | [dnl Be pessimistic for now. 78 | gl_cv_func_memchr_works="guessing no"])]) 79 | if test "$gl_cv_func_memchr_works" != yes; then 80 | REPLACE_MEMCHR=1 81 | fi 82 | fi 83 | ]) 84 | 85 | # Prerequisites of lib/memchr.c. 86 | AC_DEFUN([gl_PREREQ_MEMCHR], [ 87 | AC_CHECK_HEADERS([bp-sym.h]) 88 | ]) 89 | -------------------------------------------------------------------------------- /m4/mmap-anon.m4: -------------------------------------------------------------------------------- 1 | # mmap-anon.m4 serial 10 2 | dnl Copyright (C) 2005, 2007, 2009-2014 Free Software Foundation, Inc. 3 | dnl This file is free software; the Free Software Foundation 4 | dnl gives unlimited permission to copy and/or distribute it, 5 | dnl with or without modifications, as long as this notice is preserved. 6 | 7 | # Detect how mmap can be used to create anonymous (not file-backed) memory 8 | # mappings. 9 | # - On Linux, AIX, OSF/1, Solaris, Cygwin, Interix, Haiku, both MAP_ANONYMOUS 10 | # and MAP_ANON exist and have the same value. 11 | # - On HP-UX, only MAP_ANONYMOUS exists. 12 | # - On Mac OS X, FreeBSD, NetBSD, OpenBSD, only MAP_ANON exists. 13 | # - On IRIX, neither exists, and a file descriptor opened to /dev/zero must be 14 | # used. 15 | 16 | AC_DEFUN([gl_FUNC_MMAP_ANON], 17 | [ 18 | dnl Persuade glibc to define MAP_ANONYMOUS. 19 | AC_REQUIRE([gl_USE_SYSTEM_EXTENSIONS]) 20 | 21 | # Check for mmap(). Don't use AC_FUNC_MMAP, because it checks too much: it 22 | # fails on HP-UX 11, because MAP_FIXED mappings do not work. But this is 23 | # irrelevant for anonymous mappings. 24 | AC_CHECK_FUNC([mmap], [gl_have_mmap=yes], [gl_have_mmap=no]) 25 | 26 | # Try to allow MAP_ANONYMOUS. 27 | gl_have_mmap_anonymous=no 28 | if test $gl_have_mmap = yes; then 29 | AC_MSG_CHECKING([for MAP_ANONYMOUS]) 30 | AC_EGREP_CPP([I cannot identify this map], [ 31 | #include 32 | #ifdef MAP_ANONYMOUS 33 | I cannot identify this map 34 | #endif 35 | ], 36 | [gl_have_mmap_anonymous=yes]) 37 | if test $gl_have_mmap_anonymous != yes; then 38 | AC_EGREP_CPP([I cannot identify this map], [ 39 | #include 40 | #ifdef MAP_ANON 41 | I cannot identify this map 42 | #endif 43 | ], 44 | [AC_DEFINE([MAP_ANONYMOUS], [MAP_ANON], 45 | [Define to a substitute value for mmap()'s MAP_ANONYMOUS flag.]) 46 | gl_have_mmap_anonymous=yes]) 47 | fi 48 | AC_MSG_RESULT([$gl_have_mmap_anonymous]) 49 | if test $gl_have_mmap_anonymous = yes; then 50 | AC_DEFINE([HAVE_MAP_ANONYMOUS], [1], 51 | [Define to 1 if mmap()'s MAP_ANONYMOUS flag is available after including 52 | config.h and .]) 53 | fi 54 | fi 55 | ]) 56 | -------------------------------------------------------------------------------- /m4/msvc-inval.m4: -------------------------------------------------------------------------------- 1 | # msvc-inval.m4 serial 1 2 | dnl Copyright (C) 2011-2014 Free Software Foundation, Inc. 3 | dnl This file is free software; the Free Software Foundation 4 | dnl gives unlimited permission to copy and/or distribute it, 5 | dnl with or without modifications, as long as this notice is preserved. 6 | 7 | AC_DEFUN([gl_MSVC_INVAL], 8 | [ 9 | AC_CHECK_FUNCS_ONCE([_set_invalid_parameter_handler]) 10 | if test $ac_cv_func__set_invalid_parameter_handler = yes; then 11 | HAVE_MSVC_INVALID_PARAMETER_HANDLER=1 12 | AC_DEFINE([HAVE_MSVC_INVALID_PARAMETER_HANDLER], [1], 13 | [Define to 1 on MSVC platforms that have the "invalid parameter handler" 14 | concept.]) 15 | else 16 | HAVE_MSVC_INVALID_PARAMETER_HANDLER=0 17 | fi 18 | AC_SUBST([HAVE_MSVC_INVALID_PARAMETER_HANDLER]) 19 | ]) 20 | -------------------------------------------------------------------------------- /m4/msvc-nothrow.m4: -------------------------------------------------------------------------------- 1 | # msvc-nothrow.m4 serial 1 2 | dnl Copyright (C) 2011-2014 Free Software Foundation, Inc. 3 | dnl This file is free software; the Free Software Foundation 4 | dnl gives unlimited permission to copy and/or distribute it, 5 | dnl with or without modifications, as long as this notice is preserved. 6 | 7 | AC_DEFUN([gl_MSVC_NOTHROW], 8 | [ 9 | AC_REQUIRE([gl_MSVC_INVAL]) 10 | ]) 11 | -------------------------------------------------------------------------------- /m4/nls.m4: -------------------------------------------------------------------------------- 1 | # nls.m4 serial 5 (gettext-0.18) 2 | dnl Copyright (C) 1995-2003, 2005-2006, 2008-2014 Free Software Foundation, 3 | dnl Inc. 4 | dnl This file is free software; the Free Software Foundation 5 | dnl gives unlimited permission to copy and/or distribute it, 6 | dnl with or without modifications, as long as this notice is preserved. 7 | dnl 8 | dnl This file can can be used in projects which are not available under 9 | dnl the GNU General Public License or the GNU Library General Public 10 | dnl License but which still want to provide support for the GNU gettext 11 | dnl functionality. 12 | dnl Please note that the actual code of the GNU gettext library is covered 13 | dnl by the GNU Library General Public License, and the rest of the GNU 14 | dnl gettext package package is covered by the GNU General Public License. 15 | dnl They are *not* in the public domain. 16 | 17 | dnl Authors: 18 | dnl Ulrich Drepper , 1995-2000. 19 | dnl Bruno Haible , 2000-2003. 20 | 21 | AC_PREREQ([2.50]) 22 | 23 | AC_DEFUN([AM_NLS], 24 | [ 25 | AC_MSG_CHECKING([whether NLS is requested]) 26 | dnl Default is enabled NLS 27 | AC_ARG_ENABLE([nls], 28 | [ --disable-nls do not use Native Language Support], 29 | USE_NLS=$enableval, USE_NLS=yes) 30 | AC_MSG_RESULT([$USE_NLS]) 31 | AC_SUBST([USE_NLS]) 32 | ]) 33 | -------------------------------------------------------------------------------- /m4/non-recursive-gnulib-prefix-hack.m4: -------------------------------------------------------------------------------- 1 | dnl Copyright (C) 2012-2014 Free Software Foundation, Inc. 2 | dnl This file is free software; the Free Software Foundation 3 | dnl gives unlimited permission to copy and/or distribute it, 4 | dnl with or without modifications, as long as this notice is preserved. 5 | 6 | dnl gl_NON_RECURSIVE_GNULIB_PREFIX_HACK LIB_DIR 7 | dnl Adjust configure-set $gl_LIBOBJS and each AC_SUBST'd *_H variable 8 | dnl with a value ending in ".h" to reflect that these files are located 9 | dnl in the directory specified by LIB_DIR. 10 | AC_DEFUN([gl_NON_RECURSIVE_GNULIB_PREFIX_HACK], 11 | [ 12 | # Tell AC_LIBSOURCES where to find source files like alloca.c. 13 | AC_CONFIG_LIBOBJ_DIR([lib]) 14 | 15 | # This hack originated in bison. It is required when using non-recursive 16 | # automake rules to build from gnulib-provided lib/ sources. Hence, LIB_DIR 17 | # is usually simply "lib". Those rules use the list of names like "fchdir.o" 18 | # and "strstr.o" in gl_LIBOBJS. With non-recursive make, we must prefix each 19 | # such file name with the "lib/" prefix. See also build-aux/prefix-gnulib-mk. 20 | gl_LIBOBJS=`echo "$gl_LIBOBJS" | sed -e 's, , $1/,g'` 21 | 22 | # Listing the names of the variables to prefix is error-prone. 23 | # Rather, adjust each AC_SUBST'd variable whose name ends in '_H' 24 | # and whose value ends in '.h'. 25 | for ac_var in $ac_subst_vars 26 | do 27 | eval "ac_val=\$$ac_var" 28 | case $ac_var:$ac_val in 29 | (*_H:*.h) eval "$ac_var=$1/\$$ac_var";; 30 | esac 31 | done 32 | ]) 33 | -------------------------------------------------------------------------------- /m4/off_t.m4: -------------------------------------------------------------------------------- 1 | # off_t.m4 serial 1 2 | dnl Copyright (C) 2012-2014 Free Software Foundation, Inc. 3 | dnl This file is free software; the Free Software Foundation 4 | dnl gives unlimited permission to copy and/or distribute it, 5 | dnl with or without modifications, as long as this notice is preserved. 6 | 7 | dnl Check whether to override the 'off_t' type. 8 | dnl Set WINDOWS_64_BIT_OFF_T. 9 | 10 | AC_DEFUN([gl_TYPE_OFF_T], 11 | [ 12 | m4_ifdef([gl_LARGEFILE], [ 13 | AC_REQUIRE([gl_LARGEFILE]) 14 | ], [ 15 | WINDOWS_64_BIT_OFF_T=0 16 | ]) 17 | AC_SUBST([WINDOWS_64_BIT_OFF_T]) 18 | ]) 19 | -------------------------------------------------------------------------------- /m4/progtest.m4: -------------------------------------------------------------------------------- 1 | # progtest.m4 serial 7 (gettext-0.18.2) 2 | dnl Copyright (C) 1996-2003, 2005, 2008-2014 Free Software Foundation, Inc. 3 | dnl This file is free software; the Free Software Foundation 4 | dnl gives unlimited permission to copy and/or distribute it, 5 | dnl with or without modifications, as long as this notice is preserved. 6 | dnl 7 | dnl This file can can be used in projects which are not available under 8 | dnl the GNU General Public License or the GNU Library General Public 9 | dnl License but which still want to provide support for the GNU gettext 10 | dnl functionality. 11 | dnl Please note that the actual code of the GNU gettext library is covered 12 | dnl by the GNU Library General Public License, and the rest of the GNU 13 | dnl gettext package package is covered by the GNU General Public License. 14 | dnl They are *not* in the public domain. 15 | 16 | dnl Authors: 17 | dnl Ulrich Drepper , 1996. 18 | 19 | AC_PREREQ([2.50]) 20 | 21 | # Search path for a program which passes the given test. 22 | 23 | dnl AM_PATH_PROG_WITH_TEST(VARIABLE, PROG-TO-CHECK-FOR, 24 | dnl TEST-PERFORMED-ON-FOUND_PROGRAM [, VALUE-IF-NOT-FOUND [, PATH]]) 25 | AC_DEFUN([AM_PATH_PROG_WITH_TEST], 26 | [ 27 | # Prepare PATH_SEPARATOR. 28 | # The user is always right. 29 | if test "${PATH_SEPARATOR+set}" != set; then 30 | # Determine PATH_SEPARATOR by trying to find /bin/sh in a PATH which 31 | # contains only /bin. Note that ksh looks also at the FPATH variable, 32 | # so we have to set that as well for the test. 33 | PATH_SEPARATOR=: 34 | (PATH='/bin;/bin'; FPATH=$PATH; sh -c :) >/dev/null 2>&1 \ 35 | && { (PATH='/bin:/bin'; FPATH=$PATH; sh -c :) >/dev/null 2>&1 \ 36 | || PATH_SEPARATOR=';' 37 | } 38 | fi 39 | 40 | # Find out how to test for executable files. Don't use a zero-byte file, 41 | # as systems may use methods other than mode bits to determine executability. 42 | cat >conf$$.file <<_ASEOF 43 | #! /bin/sh 44 | exit 0 45 | _ASEOF 46 | chmod +x conf$$.file 47 | if test -x conf$$.file >/dev/null 2>&1; then 48 | ac_executable_p="test -x" 49 | else 50 | ac_executable_p="test -f" 51 | fi 52 | rm -f conf$$.file 53 | 54 | # Extract the first word of "$2", so it can be a program name with args. 55 | set dummy $2; ac_word=[$]2 56 | AC_MSG_CHECKING([for $ac_word]) 57 | AC_CACHE_VAL([ac_cv_path_$1], 58 | [case "[$]$1" in 59 | [[\\/]]* | ?:[[\\/]]*) 60 | ac_cv_path_$1="[$]$1" # Let the user override the test with a path. 61 | ;; 62 | *) 63 | ac_save_IFS="$IFS"; IFS=$PATH_SEPARATOR 64 | for ac_dir in ifelse([$5], , $PATH, [$5]); do 65 | IFS="$ac_save_IFS" 66 | test -z "$ac_dir" && ac_dir=. 67 | for ac_exec_ext in '' $ac_executable_extensions; do 68 | if $ac_executable_p "$ac_dir/$ac_word$ac_exec_ext"; then 69 | echo "$as_me: trying $ac_dir/$ac_word..." >&AS_MESSAGE_LOG_FD 70 | if [$3]; then 71 | ac_cv_path_$1="$ac_dir/$ac_word$ac_exec_ext" 72 | break 2 73 | fi 74 | fi 75 | done 76 | done 77 | IFS="$ac_save_IFS" 78 | dnl If no 4th arg is given, leave the cache variable unset, 79 | dnl so AC_PATH_PROGS will keep looking. 80 | ifelse([$4], , , [ test -z "[$]ac_cv_path_$1" && ac_cv_path_$1="$4" 81 | ])dnl 82 | ;; 83 | esac])dnl 84 | $1="$ac_cv_path_$1" 85 | if test ifelse([$4], , [-n "[$]$1"], ["[$]$1" != "$4"]); then 86 | AC_MSG_RESULT([$][$1]) 87 | else 88 | AC_MSG_RESULT([no]) 89 | fi 90 | AC_SUBST([$1])dnl 91 | ]) 92 | -------------------------------------------------------------------------------- /m4/quotearg.m4: -------------------------------------------------------------------------------- 1 | # quotearg.m4 serial 9 2 | dnl Copyright (C) 2002, 2004-2014 Free Software Foundation, Inc. 3 | dnl This file is free software; the Free Software Foundation 4 | dnl gives unlimited permission to copy and/or distribute it, 5 | dnl with or without modifications, as long as this notice is preserved. 6 | 7 | AC_DEFUN([gl_QUOTEARG], 8 | [ 9 | : 10 | ]) 11 | -------------------------------------------------------------------------------- /m4/ssize_t.m4: -------------------------------------------------------------------------------- 1 | # ssize_t.m4 serial 5 (gettext-0.18.2) 2 | dnl Copyright (C) 2001-2003, 2006, 2010-2014 Free Software Foundation, Inc. 3 | dnl This file is free software; the Free Software Foundation 4 | dnl gives unlimited permission to copy and/or distribute it, 5 | dnl with or without modifications, as long as this notice is preserved. 6 | 7 | dnl From Bruno Haible. 8 | dnl Test whether ssize_t is defined. 9 | 10 | AC_DEFUN([gt_TYPE_SSIZE_T], 11 | [ 12 | AC_CACHE_CHECK([for ssize_t], [gt_cv_ssize_t], 13 | [AC_COMPILE_IFELSE( 14 | [AC_LANG_PROGRAM( 15 | [[#include ]], 16 | [[int x = sizeof (ssize_t *) + sizeof (ssize_t); 17 | return !x;]])], 18 | [gt_cv_ssize_t=yes], [gt_cv_ssize_t=no])]) 19 | if test $gt_cv_ssize_t = no; then 20 | AC_DEFINE([ssize_t], [int], 21 | [Define as a signed type of the same size as size_t.]) 22 | fi 23 | ]) 24 | -------------------------------------------------------------------------------- /m4/stdbool.m4: -------------------------------------------------------------------------------- 1 | # Check for stdbool.h that conforms to C99. 2 | 3 | dnl Copyright (C) 2002-2006, 2009-2014 Free Software Foundation, Inc. 4 | dnl This file is free software; the Free Software Foundation 5 | dnl gives unlimited permission to copy and/or distribute it, 6 | dnl with or without modifications, as long as this notice is preserved. 7 | 8 | #serial 5 9 | 10 | # Prepare for substituting if it is not supported. 11 | 12 | AC_DEFUN([AM_STDBOOL_H], 13 | [ 14 | AC_REQUIRE([AC_CHECK_HEADER_STDBOOL]) 15 | 16 | # Define two additional variables used in the Makefile substitution. 17 | 18 | if test "$ac_cv_header_stdbool_h" = yes; then 19 | STDBOOL_H='' 20 | else 21 | STDBOOL_H='stdbool.h' 22 | fi 23 | AC_SUBST([STDBOOL_H]) 24 | AM_CONDITIONAL([GL_GENERATE_STDBOOL_H], [test -n "$STDBOOL_H"]) 25 | 26 | if test "$ac_cv_type__Bool" = yes; then 27 | HAVE__BOOL=1 28 | else 29 | HAVE__BOOL=0 30 | fi 31 | AC_SUBST([HAVE__BOOL]) 32 | ]) 33 | 34 | # AM_STDBOOL_H will be renamed to gl_STDBOOL_H in the future. 35 | AC_DEFUN([gl_STDBOOL_H], [AM_STDBOOL_H]) 36 | 37 | # This version of the macro is needed in autoconf <= 2.68. 38 | 39 | AC_DEFUN([AC_CHECK_HEADER_STDBOOL], 40 | [AC_CACHE_CHECK([for stdbool.h that conforms to C99], 41 | [ac_cv_header_stdbool_h], 42 | [AC_COMPILE_IFELSE( 43 | [AC_LANG_PROGRAM( 44 | [[ 45 | #include 46 | #ifndef bool 47 | "error: bool is not defined" 48 | #endif 49 | #ifndef false 50 | "error: false is not defined" 51 | #endif 52 | #if false 53 | "error: false is not 0" 54 | #endif 55 | #ifndef true 56 | "error: true is not defined" 57 | #endif 58 | #if true != 1 59 | "error: true is not 1" 60 | #endif 61 | #ifndef __bool_true_false_are_defined 62 | "error: __bool_true_false_are_defined is not defined" 63 | #endif 64 | 65 | struct s { _Bool s: 1; _Bool t; } s; 66 | 67 | char a[true == 1 ? 1 : -1]; 68 | char b[false == 0 ? 1 : -1]; 69 | char c[__bool_true_false_are_defined == 1 ? 1 : -1]; 70 | char d[(bool) 0.5 == true ? 1 : -1]; 71 | /* See body of main program for 'e'. */ 72 | char f[(_Bool) 0.0 == false ? 1 : -1]; 73 | char g[true]; 74 | char h[sizeof (_Bool)]; 75 | char i[sizeof s.t]; 76 | enum { j = false, k = true, l = false * true, m = true * 256 }; 77 | /* The following fails for 78 | HP aC++/ANSI C B3910B A.05.55 [Dec 04 2003]. */ 79 | _Bool n[m]; 80 | char o[sizeof n == m * sizeof n[0] ? 1 : -1]; 81 | char p[-1 - (_Bool) 0 < 0 && -1 - (bool) 0 < 0 ? 1 : -1]; 82 | /* Catch a bug in an HP-UX C compiler. See 83 | http://gcc.gnu.org/ml/gcc-patches/2003-12/msg02303.html 84 | http://lists.gnu.org/archive/html/bug-coreutils/2005-11/msg00161.html 85 | */ 86 | _Bool q = true; 87 | _Bool *pq = &q; 88 | ]], 89 | [[ 90 | bool e = &s; 91 | *pq |= q; 92 | *pq |= ! q; 93 | /* Refer to every declared value, to avoid compiler optimizations. */ 94 | return (!a + !b + !c + !d + !e + !f + !g + !h + !i + !!j + !k + !!l 95 | + !m + !n + !o + !p + !q + !pq); 96 | ]])], 97 | [ac_cv_header_stdbool_h=yes], 98 | [ac_cv_header_stdbool_h=no])]) 99 | AC_CHECK_TYPES([_Bool]) 100 | ]) 101 | -------------------------------------------------------------------------------- /m4/stddef_h.m4: -------------------------------------------------------------------------------- 1 | dnl A placeholder for POSIX 2008 , for platforms that have issues. 2 | # stddef_h.m4 serial 4 3 | dnl Copyright (C) 2009-2014 Free Software Foundation, Inc. 4 | dnl This file is free software; the Free Software Foundation 5 | dnl gives unlimited permission to copy and/or distribute it, 6 | dnl with or without modifications, as long as this notice is preserved. 7 | 8 | AC_DEFUN([gl_STDDEF_H], 9 | [ 10 | AC_REQUIRE([gl_STDDEF_H_DEFAULTS]) 11 | AC_REQUIRE([gt_TYPE_WCHAR_T]) 12 | STDDEF_H= 13 | if test $gt_cv_c_wchar_t = no; then 14 | HAVE_WCHAR_T=0 15 | STDDEF_H=stddef.h 16 | fi 17 | AC_CACHE_CHECK([whether NULL can be used in arbitrary expressions], 18 | [gl_cv_decl_null_works], 19 | [AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[#include 20 | int test[2 * (sizeof NULL == sizeof (void *)) -1]; 21 | ]])], 22 | [gl_cv_decl_null_works=yes], 23 | [gl_cv_decl_null_works=no])]) 24 | if test $gl_cv_decl_null_works = no; then 25 | REPLACE_NULL=1 26 | STDDEF_H=stddef.h 27 | fi 28 | AC_SUBST([STDDEF_H]) 29 | AM_CONDITIONAL([GL_GENERATE_STDDEF_H], [test -n "$STDDEF_H"]) 30 | if test -n "$STDDEF_H"; then 31 | gl_NEXT_HEADERS([stddef.h]) 32 | fi 33 | ]) 34 | 35 | AC_DEFUN([gl_STDDEF_MODULE_INDICATOR], 36 | [ 37 | dnl Use AC_REQUIRE here, so that the default settings are expanded once only. 38 | AC_REQUIRE([gl_STDDEF_H_DEFAULTS]) 39 | gl_MODULE_INDICATOR_SET_VARIABLE([$1]) 40 | ]) 41 | 42 | AC_DEFUN([gl_STDDEF_H_DEFAULTS], 43 | [ 44 | dnl Assume proper GNU behavior unless another module says otherwise. 45 | REPLACE_NULL=0; AC_SUBST([REPLACE_NULL]) 46 | HAVE_WCHAR_T=1; AC_SUBST([HAVE_WCHAR_T]) 47 | ]) 48 | -------------------------------------------------------------------------------- /m4/strerror.m4: -------------------------------------------------------------------------------- 1 | # strerror.m4 serial 17 2 | dnl Copyright (C) 2002, 2007-2014 Free Software Foundation, Inc. 3 | dnl This file is free software; the Free Software Foundation 4 | dnl gives unlimited permission to copy and/or distribute it, 5 | dnl with or without modifications, as long as this notice is preserved. 6 | 7 | AC_DEFUN([gl_FUNC_STRERROR], 8 | [ 9 | AC_REQUIRE([gl_HEADER_STRING_H_DEFAULTS]) 10 | AC_REQUIRE([gl_HEADER_ERRNO_H]) 11 | AC_REQUIRE([gl_FUNC_STRERROR_0]) 12 | AC_REQUIRE([AC_CANONICAL_HOST]) dnl for cross-compiles 13 | m4_ifdef([gl_FUNC_STRERROR_R_WORKS], [ 14 | AC_REQUIRE([gl_FUNC_STRERROR_R_WORKS]) 15 | ]) 16 | if test "$ERRNO_H:$REPLACE_STRERROR_0" = :0; then 17 | AC_CACHE_CHECK([for working strerror function], 18 | [gl_cv_func_working_strerror], 19 | [AC_RUN_IFELSE( 20 | [AC_LANG_PROGRAM( 21 | [[#include 22 | ]], 23 | [[if (!*strerror (-2)) return 1;]])], 24 | [gl_cv_func_working_strerror=yes], 25 | [gl_cv_func_working_strerror=no], 26 | [case "$host_os" in 27 | # Guess yes on glibc systems. 28 | *-gnu*) gl_cv_func_working_strerror="guessing yes" ;; 29 | # If we don't know, assume the worst. 30 | *) gl_cv_func_working_strerror="guessing no" ;; 31 | esac 32 | ]) 33 | ]) 34 | case "$gl_cv_func_working_strerror" in 35 | *yes) ;; 36 | *) 37 | dnl The system's strerror() fails to return a string for out-of-range 38 | dnl integers. Replace it. 39 | REPLACE_STRERROR=1 40 | ;; 41 | esac 42 | m4_ifdef([gl_FUNC_STRERROR_R_WORKS], [ 43 | dnl If the system's strerror_r or __xpg_strerror_r clobbers strerror's 44 | dnl buffer, we must replace strerror. 45 | case "$gl_cv_func_strerror_r_works" in 46 | *no) REPLACE_STRERROR=1 ;; 47 | esac 48 | ]) 49 | else 50 | dnl The system's strerror() cannot know about the new errno values we add 51 | dnl to , or any fix for strerror(0). Replace it. 52 | REPLACE_STRERROR=1 53 | fi 54 | ]) 55 | 56 | dnl Detect if strerror(0) passes (that is, does not set errno, and does not 57 | dnl return a string that matches strerror(-1)). 58 | AC_DEFUN([gl_FUNC_STRERROR_0], 59 | [ 60 | AC_REQUIRE([AC_CANONICAL_HOST]) dnl for cross-compiles 61 | REPLACE_STRERROR_0=0 62 | AC_CACHE_CHECK([whether strerror(0) succeeds], 63 | [gl_cv_func_strerror_0_works], 64 | [AC_RUN_IFELSE( 65 | [AC_LANG_PROGRAM( 66 | [[#include 67 | #include 68 | ]], 69 | [[int result = 0; 70 | char *str; 71 | errno = 0; 72 | str = strerror (0); 73 | if (!*str) result |= 1; 74 | if (errno) result |= 2; 75 | if (strstr (str, "nknown") || strstr (str, "ndefined")) 76 | result |= 4; 77 | return result;]])], 78 | [gl_cv_func_strerror_0_works=yes], 79 | [gl_cv_func_strerror_0_works=no], 80 | [case "$host_os" in 81 | # Guess yes on glibc systems. 82 | *-gnu*) gl_cv_func_strerror_0_works="guessing yes" ;; 83 | # If we don't know, assume the worst. 84 | *) gl_cv_func_strerror_0_works="guessing no" ;; 85 | esac 86 | ]) 87 | ]) 88 | case "$gl_cv_func_strerror_0_works" in 89 | *yes) ;; 90 | *) 91 | REPLACE_STRERROR_0=1 92 | AC_DEFINE([REPLACE_STRERROR_0], [1], [Define to 1 if strerror(0) 93 | does not return a message implying success.]) 94 | ;; 95 | esac 96 | ]) 97 | -------------------------------------------------------------------------------- /m4/strndup.m4: -------------------------------------------------------------------------------- 1 | # strndup.m4 serial 21 2 | dnl Copyright (C) 2002-2003, 2005-2014 Free Software Foundation, Inc. 3 | dnl This file is free software; the Free Software Foundation 4 | dnl gives unlimited permission to copy and/or distribute it, 5 | dnl with or without modifications, as long as this notice is preserved. 6 | 7 | AC_DEFUN([gl_FUNC_STRNDUP], 8 | [ 9 | dnl Persuade glibc to declare strndup(). 10 | AC_REQUIRE([AC_USE_SYSTEM_EXTENSIONS]) 11 | 12 | AC_REQUIRE([AC_CANONICAL_HOST]) dnl for cross-compiles 13 | AC_REQUIRE([gl_HEADER_STRING_H_DEFAULTS]) 14 | AC_CHECK_DECLS_ONCE([strndup]) 15 | AC_CHECK_FUNCS_ONCE([strndup]) 16 | if test $ac_cv_have_decl_strndup = no; then 17 | HAVE_DECL_STRNDUP=0 18 | fi 19 | 20 | if test $ac_cv_func_strndup = yes; then 21 | HAVE_STRNDUP=1 22 | # AIX 4.3.3, AIX 5.1 have a function that fails to add the terminating '\0'. 23 | AC_CACHE_CHECK([for working strndup], [gl_cv_func_strndup_works], 24 | [AC_RUN_IFELSE([ 25 | AC_LANG_PROGRAM([[#include 26 | #include ]], [[ 27 | #if !HAVE_DECL_STRNDUP 28 | extern 29 | #ifdef __cplusplus 30 | "C" 31 | #endif 32 | char *strndup (const char *, size_t); 33 | #endif 34 | char *s; 35 | s = strndup ("some longer string", 15); 36 | free (s); 37 | s = strndup ("shorter string", 13); 38 | return s[13] != '\0';]])], 39 | [gl_cv_func_strndup_works=yes], 40 | [gl_cv_func_strndup_works=no], 41 | [ 42 | changequote(,)dnl 43 | case $host_os in 44 | aix | aix[3-6]*) gl_cv_func_strndup_works="guessing no";; 45 | *) gl_cv_func_strndup_works="guessing yes";; 46 | esac 47 | changequote([,])dnl 48 | ])]) 49 | case $gl_cv_func_strndup_works in 50 | *no) REPLACE_STRNDUP=1 ;; 51 | esac 52 | else 53 | HAVE_STRNDUP=0 54 | fi 55 | ]) 56 | -------------------------------------------------------------------------------- /m4/strnlen.m4: -------------------------------------------------------------------------------- 1 | # strnlen.m4 serial 13 2 | dnl Copyright (C) 2002-2003, 2005-2007, 2009-2014 Free Software Foundation, 3 | dnl Inc. 4 | dnl This file is free software; the Free Software Foundation 5 | dnl gives unlimited permission to copy and/or distribute it, 6 | dnl with or without modifications, as long as this notice is preserved. 7 | 8 | AC_DEFUN([gl_FUNC_STRNLEN], 9 | [ 10 | AC_REQUIRE([gl_HEADER_STRING_H_DEFAULTS]) 11 | 12 | dnl Persuade glibc to declare strnlen(). 13 | AC_REQUIRE([AC_USE_SYSTEM_EXTENSIONS]) 14 | 15 | AC_CHECK_DECLS_ONCE([strnlen]) 16 | if test $ac_cv_have_decl_strnlen = no; then 17 | HAVE_DECL_STRNLEN=0 18 | else 19 | m4_pushdef([AC_LIBOBJ], [:]) 20 | dnl Note: AC_FUNC_STRNLEN does AC_LIBOBJ([strnlen]). 21 | AC_FUNC_STRNLEN 22 | m4_popdef([AC_LIBOBJ]) 23 | if test $ac_cv_func_strnlen_working = no; then 24 | REPLACE_STRNLEN=1 25 | fi 26 | fi 27 | ]) 28 | 29 | # Prerequisites of lib/strnlen.c. 30 | AC_DEFUN([gl_PREREQ_STRNLEN], [:]) 31 | -------------------------------------------------------------------------------- /m4/sys_types_h.m4: -------------------------------------------------------------------------------- 1 | # sys_types_h.m4 serial 5 2 | dnl Copyright (C) 2011-2014 Free Software Foundation, Inc. 3 | dnl This file is free software; the Free Software Foundation 4 | dnl gives unlimited permission to copy and/or distribute it, 5 | dnl with or without modifications, as long as this notice is preserved. 6 | 7 | AC_DEFUN_ONCE([gl_SYS_TYPES_H], 8 | [ 9 | AC_REQUIRE([gl_SYS_TYPES_H_DEFAULTS]) 10 | gl_NEXT_HEADERS([sys/types.h]) 11 | 12 | dnl Ensure the type pid_t gets defined. 13 | AC_REQUIRE([AC_TYPE_PID_T]) 14 | 15 | dnl Ensure the type mode_t gets defined. 16 | AC_REQUIRE([AC_TYPE_MODE_T]) 17 | 18 | dnl Whether to override the 'off_t' type. 19 | AC_REQUIRE([gl_TYPE_OFF_T]) 20 | ]) 21 | 22 | AC_DEFUN([gl_SYS_TYPES_H_DEFAULTS], 23 | [ 24 | ]) 25 | -------------------------------------------------------------------------------- /m4/warn-on-use.m4: -------------------------------------------------------------------------------- 1 | # warn-on-use.m4 serial 5 2 | dnl Copyright (C) 2010-2014 Free Software Foundation, Inc. 3 | dnl This file is free software; the Free Software Foundation 4 | dnl gives unlimited permission to copy and/or distribute it, 5 | dnl with or without modifications, as long as this notice is preserved. 6 | 7 | # gl_WARN_ON_USE_PREPARE(INCLUDES, NAMES) 8 | # --------------------------------------- 9 | # For each whitespace-separated element in the list of NAMES, define 10 | # HAVE_RAW_DECL_name if the function has a declaration among INCLUDES 11 | # even after being undefined as a macro. 12 | # 13 | # See warn-on-use.h for some hints on how to poison function names, as 14 | # well as ideas on poisoning global variables and macros. NAMES may 15 | # include global variables, but remember that only functions work with 16 | # _GL_WARN_ON_USE. Typically, INCLUDES only needs to list a single 17 | # header, but if the replacement header pulls in other headers because 18 | # some systems declare functions in the wrong header, then INCLUDES 19 | # should do likewise. 20 | # 21 | # It is generally safe to assume declarations for functions declared 22 | # in the intersection of C89 and C11 (such as printf) without 23 | # needing gl_WARN_ON_USE_PREPARE. 24 | AC_DEFUN([gl_WARN_ON_USE_PREPARE], 25 | [ 26 | m4_foreach_w([gl_decl], [$2], 27 | [AH_TEMPLATE([HAVE_RAW_DECL_]AS_TR_CPP(m4_defn([gl_decl])), 28 | [Define to 1 if ]m4_defn([gl_decl])[ is declared even after 29 | undefining macros.])])dnl 30 | dnl FIXME: gl_Symbol must be used unquoted until we can assume 31 | dnl autoconf 2.64 or newer. 32 | for gl_func in m4_flatten([$2]); do 33 | AS_VAR_PUSHDEF([gl_Symbol], [gl_cv_have_raw_decl_$gl_func])dnl 34 | AC_CACHE_CHECK([whether $gl_func is declared without a macro], 35 | gl_Symbol, 36 | [AC_COMPILE_IFELSE([AC_LANG_PROGRAM([$1], 37 | [@%:@undef $gl_func 38 | (void) $gl_func;])], 39 | [AS_VAR_SET(gl_Symbol, [yes])], [AS_VAR_SET(gl_Symbol, [no])])]) 40 | AS_VAR_IF(gl_Symbol, [yes], 41 | [AC_DEFINE_UNQUOTED(AS_TR_CPP([HAVE_RAW_DECL_$gl_func]), [1]) 42 | dnl shortcut - if the raw declaration exists, then set a cache 43 | dnl variable to allow skipping any later AC_CHECK_DECL efforts 44 | eval ac_cv_have_decl_$gl_func=yes]) 45 | AS_VAR_POPDEF([gl_Symbol])dnl 46 | done 47 | ]) 48 | -------------------------------------------------------------------------------- /m4/wchar_t.m4: -------------------------------------------------------------------------------- 1 | # wchar_t.m4 serial 4 (gettext-0.18.2) 2 | dnl Copyright (C) 2002-2003, 2008-2014 Free Software Foundation, Inc. 3 | dnl This file is free software; the Free Software Foundation 4 | dnl gives unlimited permission to copy and/or distribute it, 5 | dnl with or without modifications, as long as this notice is preserved. 6 | 7 | dnl From Bruno Haible. 8 | dnl Test whether has the 'wchar_t' type. 9 | dnl Prerequisite: AC_PROG_CC 10 | 11 | AC_DEFUN([gt_TYPE_WCHAR_T], 12 | [ 13 | AC_CACHE_CHECK([for wchar_t], [gt_cv_c_wchar_t], 14 | [AC_COMPILE_IFELSE( 15 | [AC_LANG_PROGRAM( 16 | [[#include 17 | wchar_t foo = (wchar_t)'\0';]], 18 | [[]])], 19 | [gt_cv_c_wchar_t=yes], 20 | [gt_cv_c_wchar_t=no])]) 21 | if test $gt_cv_c_wchar_t = yes; then 22 | AC_DEFINE([HAVE_WCHAR_T], [1], [Define if you have the 'wchar_t' type.]) 23 | fi 24 | ]) 25 | -------------------------------------------------------------------------------- /m4/wint_t.m4: -------------------------------------------------------------------------------- 1 | # wint_t.m4 serial 5 (gettext-0.18.2) 2 | dnl Copyright (C) 2003, 2007-2014 Free Software Foundation, Inc. 3 | dnl This file is free software; the Free Software Foundation 4 | dnl gives unlimited permission to copy and/or distribute it, 5 | dnl with or without modifications, as long as this notice is preserved. 6 | 7 | dnl From Bruno Haible. 8 | dnl Test whether has the 'wint_t' type. 9 | dnl Prerequisite: AC_PROG_CC 10 | 11 | AC_DEFUN([gt_TYPE_WINT_T], 12 | [ 13 | AC_CACHE_CHECK([for wint_t], [gt_cv_c_wint_t], 14 | [AC_COMPILE_IFELSE( 15 | [AC_LANG_PROGRAM( 16 | [[ 17 | /* Tru64 with Desktop Toolkit C has a bug: must be included before 18 | . 19 | BSD/OS 4.0.1 has a bug: , and must be included 20 | before . */ 21 | #include 22 | #include 23 | #include 24 | #include 25 | wint_t foo = (wchar_t)'\0';]], 26 | [[]])], 27 | [gt_cv_c_wint_t=yes], 28 | [gt_cv_c_wint_t=no])]) 29 | if test $gt_cv_c_wint_t = yes; then 30 | AC_DEFINE([HAVE_WINT_T], [1], [Define if you have the 'wint_t' type.]) 31 | fi 32 | ]) 33 | -------------------------------------------------------------------------------- /m4/xalloc.m4: -------------------------------------------------------------------------------- 1 | # xalloc.m4 serial 18 2 | dnl Copyright (C) 2002-2006, 2009-2014 Free Software Foundation, Inc. 3 | dnl This file is free software; the Free Software Foundation 4 | dnl gives unlimited permission to copy and/or distribute it, 5 | dnl with or without modifications, as long as this notice is preserved. 6 | 7 | AC_DEFUN([gl_XALLOC], [:]) 8 | -------------------------------------------------------------------------------- /m4/xstrndup.m4: -------------------------------------------------------------------------------- 1 | # xstrndup.m4 serial 2 2 | dnl Copyright (C) 2003, 2009-2014 Free Software Foundation, Inc. 3 | dnl This file is free software; the Free Software Foundation 4 | dnl gives unlimited permission to copy and/or distribute it, 5 | dnl with or without modifications, as long as this notice is preserved. 6 | 7 | AC_DEFUN([gl_XSTRNDUP], 8 | [ 9 | gl_PREREQ_XSTRNDUP 10 | ]) 11 | 12 | # Prerequisites of lib/xstrndup.c. 13 | AC_DEFUN([gl_PREREQ_XSTRNDUP], [ 14 | : 15 | ]) 16 | -------------------------------------------------------------------------------- /man/hello.x: -------------------------------------------------------------------------------- 1 | [NAME] 2 | hello - friendly greeting program 3 | [ADDITIONAL INFORMATION] 4 | See 5 | .UR http://git.savannah.gnu.org/cgit/hello.git/tree/man/hello.x 6 | man/hello.x 7 | .UE 8 | how to add addtional information to a manual page. 9 | -------------------------------------------------------------------------------- /po/ChangeLog: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/rajeshsola/gnu-hello/274bd5b954066558a5ead00d3cceefe21ecdba9b/po/ChangeLog -------------------------------------------------------------------------------- /po/LINGUAS: -------------------------------------------------------------------------------- 1 | bg 2 | ca 3 | da 4 | de 5 | el 6 | eo 7 | es 8 | et 9 | eu 10 | fa 11 | fi 12 | fr 13 | ga 14 | gl 15 | he 16 | hr 17 | hu 18 | id 19 | it 20 | ja 21 | ka 22 | ko 23 | lv 24 | ms 25 | nb 26 | nl 27 | nn 28 | pl 29 | pt 30 | pt_BR 31 | ro 32 | ru 33 | sk 34 | sl 35 | sr 36 | sv 37 | th 38 | tr 39 | uk 40 | vi 41 | zh_CN 42 | zh_TW 43 | -------------------------------------------------------------------------------- /po/Makevars: -------------------------------------------------------------------------------- 1 | # Makefile variables for PO directory in any package using GNU gettext. 2 | 3 | # Usually the message domain is the same as the package name. 4 | DOMAIN = $(PACKAGE) 5 | 6 | # These two variables depend on the location of this directory. 7 | subdir = po 8 | top_builddir = .. 9 | 10 | # These options get passed to xgettext. 11 | XGETTEXT_OPTIONS = --keyword=_ --keyword=N_ \ 12 | \ 13 | --flag=_:1:pass-c-format\ 14 | --flag=N_:1:pass-c-format\ 15 | --flag=error:3:c-format --flag=error_at_line:5:c-format\ 16 | \ 17 | --from-code=UTF-8\ 18 | --flag=asprintf:2:c-format --flag=vasprintf:2:c-format\ 19 | --flag=asnprintf:3:c-format --flag=vasnprintf:3:c-format\ 20 | --flag=wrapf:1:c-format\ 21 | $${end_of_xgettext_options+} 22 | 23 | # This is the copyright holder that gets inserted into the header of the 24 | # $(DOMAIN).pot file. Set this to the copyright holder of the surrounding 25 | # package. (Note that the msgstr strings, extracted from the package's 26 | # sources, belong to the copyright holder of the package.) Translators are 27 | # expected to transfer the copyright for their translations to this person 28 | # or entity, or to disclaim their copyright. The empty string stands for 29 | # the public domain; in this case the translators are expected to disclaim 30 | # their copyright. 31 | COPYRIGHT_HOLDER = Free Software Foundation, Inc. 32 | 33 | # This is the email address or URL to which the translators shall report 34 | # bugs in the untranslated strings: 35 | # - Strings which are not entire sentences, see the maintainer guidelines 36 | # in the GNU gettext documentation, section 'Preparing Strings'. 37 | # - Strings which use unclear terms or require additional context to be 38 | # understood. 39 | # - Strings which make invalid assumptions about notation of date, time or 40 | # money. 41 | # - Pluralisation problems. 42 | # - Incorrect English spelling. 43 | # - Incorrect formatting. 44 | # It can be your email address, or a mailing list address where translators 45 | # can write to without being subscribed, or the URL of a web page through 46 | # which the translators can contact you. 47 | MSGID_BUGS_ADDRESS = bug-hello@gnu.org 48 | 49 | # This is the list of locale categories, beyond LC_MESSAGES, for which the 50 | # message catalogs shall be used. It is usually empty. 51 | EXTRA_LOCALE_CATEGORIES = 52 | -------------------------------------------------------------------------------- /po/POTFILES.in: -------------------------------------------------------------------------------- 1 | # Copyright (C) 2005, 2006, 2014 Free Software Foundation, Inc. 2 | # 3 | # Copying and distribution of this file, with or without modification, 4 | # are permitted in any medium without royalty provided the copyright 5 | # notice and this notice are preserved. 6 | # 7 | # List of source files containing translatable strings. 8 | 9 | # Package source files. 10 | src/hello.c 11 | 12 | # Gnulib source files. 13 | lib/error.c 14 | lib/getopt.c 15 | lib/closeout.c 16 | lib/quotearg.c 17 | lib/xalloc-die.c 18 | -------------------------------------------------------------------------------- /po/Rules-quot: -------------------------------------------------------------------------------- 1 | # Special Makefile rules for English message catalogs with quotation marks. 2 | 3 | DISTFILES.common.extra1 = quot.sed boldquot.sed en@quot.header en@boldquot.header insert-header.sin Rules-quot 4 | 5 | .SUFFIXES: .insert-header .po-update-en 6 | 7 | en@quot.po-create: 8 | $(MAKE) en@quot.po-update 9 | en@boldquot.po-create: 10 | $(MAKE) en@boldquot.po-update 11 | 12 | en@quot.po-update: en@quot.po-update-en 13 | en@boldquot.po-update: en@boldquot.po-update-en 14 | 15 | .insert-header.po-update-en: 16 | @lang=`echo $@ | sed -e 's/\.po-update-en$$//'`; \ 17 | if test "$(PACKAGE)" = "gettext"; then PATH=`pwd`/../src:$$PATH; GETTEXTLIBDIR=`cd $(top_srcdir)/src && pwd`; export GETTEXTLIBDIR; fi; \ 18 | tmpdir=`pwd`; \ 19 | echo "$$lang:"; \ 20 | ll=`echo $$lang | sed -e 's/@.*//'`; \ 21 | LC_ALL=C; export LC_ALL; \ 22 | cd $(srcdir); \ 23 | if $(MSGINIT) -i $(DOMAIN).pot --no-translator -l $$lang -o - 2>/dev/null | sed -f $$tmpdir/$$lang.insert-header | $(MSGCONV) -t UTF-8 | $(MSGFILTER) sed -f `echo $$lang | sed -e 's/.*@//'`.sed 2>/dev/null > $$tmpdir/$$lang.new.po; then \ 24 | if cmp $$lang.po $$tmpdir/$$lang.new.po >/dev/null 2>&1; then \ 25 | rm -f $$tmpdir/$$lang.new.po; \ 26 | else \ 27 | if mv -f $$tmpdir/$$lang.new.po $$lang.po; then \ 28 | :; \ 29 | else \ 30 | echo "creation of $$lang.po failed: cannot move $$tmpdir/$$lang.new.po to $$lang.po" 1>&2; \ 31 | exit 1; \ 32 | fi; \ 33 | fi; \ 34 | else \ 35 | echo "creation of $$lang.po failed!" 1>&2; \ 36 | rm -f $$tmpdir/$$lang.new.po; \ 37 | fi 38 | 39 | en@quot.insert-header: insert-header.sin 40 | sed -e '/^#/d' -e 's/HEADER/en@quot.header/g' $(srcdir)/insert-header.sin > en@quot.insert-header 41 | 42 | en@boldquot.insert-header: insert-header.sin 43 | sed -e '/^#/d' -e 's/HEADER/en@boldquot.header/g' $(srcdir)/insert-header.sin > en@boldquot.insert-header 44 | 45 | mostlyclean: mostlyclean-quot 46 | mostlyclean-quot: 47 | rm -f *.insert-header 48 | -------------------------------------------------------------------------------- /po/bg.gmo: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/rajeshsola/gnu-hello/274bd5b954066558a5ead00d3cceefe21ecdba9b/po/bg.gmo -------------------------------------------------------------------------------- /po/boldquot.sed: -------------------------------------------------------------------------------- 1 | s/"\([^"]*\)"/“\1”/g 2 | s/`\([^`']*\)'/‘\1’/g 3 | s/ '\([^`']*\)' / ‘\1’ /g 4 | s/ '\([^`']*\)'$/ ‘\1’/g 5 | s/^'\([^`']*\)' /‘\1’ /g 6 | s/“”/""/g 7 | s/“/“/g 8 | s/”/”/g 9 | s/‘/‘/g 10 | s/’/’/g 11 | -------------------------------------------------------------------------------- /po/ca.gmo: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/rajeshsola/gnu-hello/274bd5b954066558a5ead00d3cceefe21ecdba9b/po/ca.gmo -------------------------------------------------------------------------------- /po/da.gmo: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/rajeshsola/gnu-hello/274bd5b954066558a5ead00d3cceefe21ecdba9b/po/da.gmo -------------------------------------------------------------------------------- /po/da.po: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/rajeshsola/gnu-hello/274bd5b954066558a5ead00d3cceefe21ecdba9b/po/da.po -------------------------------------------------------------------------------- /po/de.gmo: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/rajeshsola/gnu-hello/274bd5b954066558a5ead00d3cceefe21ecdba9b/po/de.gmo -------------------------------------------------------------------------------- /po/el.gmo: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/rajeshsola/gnu-hello/274bd5b954066558a5ead00d3cceefe21ecdba9b/po/el.gmo -------------------------------------------------------------------------------- /po/en@boldquot.header: -------------------------------------------------------------------------------- 1 | # All this catalog "translates" are quotation characters. 2 | # The msgids must be ASCII and therefore cannot contain real quotation 3 | # characters, only substitutes like grave accent (0x60), apostrophe (0x27) 4 | # and double quote (0x22). These substitutes look strange; see 5 | # http://www.cl.cam.ac.uk/~mgk25/ucs/quotes.html 6 | # 7 | # This catalog translates grave accent (0x60) and apostrophe (0x27) to 8 | # left single quotation mark (U+2018) and right single quotation mark (U+2019). 9 | # It also translates pairs of apostrophe (0x27) to 10 | # left single quotation mark (U+2018) and right single quotation mark (U+2019) 11 | # and pairs of quotation mark (0x22) to 12 | # left double quotation mark (U+201C) and right double quotation mark (U+201D). 13 | # 14 | # When output to an UTF-8 terminal, the quotation characters appear perfectly. 15 | # When output to an ISO-8859-1 terminal, the single quotation marks are 16 | # transliterated to apostrophes (by iconv in glibc 2.2 or newer) or to 17 | # grave/acute accent (by libiconv), and the double quotation marks are 18 | # transliterated to 0x22. 19 | # When output to an ASCII terminal, the single quotation marks are 20 | # transliterated to apostrophes, and the double quotation marks are 21 | # transliterated to 0x22. 22 | # 23 | # This catalog furthermore displays the text between the quotation marks in 24 | # bold face, assuming the VT100/XTerm escape sequences. 25 | # 26 | -------------------------------------------------------------------------------- /po/en@quot.header: -------------------------------------------------------------------------------- 1 | # All this catalog "translates" are quotation characters. 2 | # The msgids must be ASCII and therefore cannot contain real quotation 3 | # characters, only substitutes like grave accent (0x60), apostrophe (0x27) 4 | # and double quote (0x22). These substitutes look strange; see 5 | # http://www.cl.cam.ac.uk/~mgk25/ucs/quotes.html 6 | # 7 | # This catalog translates grave accent (0x60) and apostrophe (0x27) to 8 | # left single quotation mark (U+2018) and right single quotation mark (U+2019). 9 | # It also translates pairs of apostrophe (0x27) to 10 | # left single quotation mark (U+2018) and right single quotation mark (U+2019) 11 | # and pairs of quotation mark (0x22) to 12 | # left double quotation mark (U+201C) and right double quotation mark (U+201D). 13 | # 14 | # When output to an UTF-8 terminal, the quotation characters appear perfectly. 15 | # When output to an ISO-8859-1 terminal, the single quotation marks are 16 | # transliterated to apostrophes (by iconv in glibc 2.2 or newer) or to 17 | # grave/acute accent (by libiconv), and the double quotation marks are 18 | # transliterated to 0x22. 19 | # When output to an ASCII terminal, the single quotation marks are 20 | # transliterated to apostrophes, and the double quotation marks are 21 | # transliterated to 0x22. 22 | # 23 | -------------------------------------------------------------------------------- /po/eo.gmo: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/rajeshsola/gnu-hello/274bd5b954066558a5ead00d3cceefe21ecdba9b/po/eo.gmo -------------------------------------------------------------------------------- /po/es.gmo: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/rajeshsola/gnu-hello/274bd5b954066558a5ead00d3cceefe21ecdba9b/po/es.gmo -------------------------------------------------------------------------------- /po/et.gmo: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/rajeshsola/gnu-hello/274bd5b954066558a5ead00d3cceefe21ecdba9b/po/et.gmo -------------------------------------------------------------------------------- /po/et.po: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/rajeshsola/gnu-hello/274bd5b954066558a5ead00d3cceefe21ecdba9b/po/et.po -------------------------------------------------------------------------------- /po/eu.gmo: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/rajeshsola/gnu-hello/274bd5b954066558a5ead00d3cceefe21ecdba9b/po/eu.gmo -------------------------------------------------------------------------------- /po/fa.gmo: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/rajeshsola/gnu-hello/274bd5b954066558a5ead00d3cceefe21ecdba9b/po/fa.gmo -------------------------------------------------------------------------------- /po/fi.gmo: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/rajeshsola/gnu-hello/274bd5b954066558a5ead00d3cceefe21ecdba9b/po/fi.gmo -------------------------------------------------------------------------------- /po/fr.gmo: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/rajeshsola/gnu-hello/274bd5b954066558a5ead00d3cceefe21ecdba9b/po/fr.gmo -------------------------------------------------------------------------------- /po/ga.gmo: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/rajeshsola/gnu-hello/274bd5b954066558a5ead00d3cceefe21ecdba9b/po/ga.gmo -------------------------------------------------------------------------------- /po/gl.gmo: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/rajeshsola/gnu-hello/274bd5b954066558a5ead00d3cceefe21ecdba9b/po/gl.gmo -------------------------------------------------------------------------------- /po/he.gmo: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/rajeshsola/gnu-hello/274bd5b954066558a5ead00d3cceefe21ecdba9b/po/he.gmo -------------------------------------------------------------------------------- /po/he.po: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/rajeshsola/gnu-hello/274bd5b954066558a5ead00d3cceefe21ecdba9b/po/he.po -------------------------------------------------------------------------------- /po/hr.gmo: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/rajeshsola/gnu-hello/274bd5b954066558a5ead00d3cceefe21ecdba9b/po/hr.gmo -------------------------------------------------------------------------------- /po/hu.gmo: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/rajeshsola/gnu-hello/274bd5b954066558a5ead00d3cceefe21ecdba9b/po/hu.gmo -------------------------------------------------------------------------------- /po/id.gmo: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/rajeshsola/gnu-hello/274bd5b954066558a5ead00d3cceefe21ecdba9b/po/id.gmo -------------------------------------------------------------------------------- /po/insert-header.sin: -------------------------------------------------------------------------------- 1 | # Sed script that inserts the file called HEADER before the header entry. 2 | # 3 | # At each occurrence of a line starting with "msgid ", we execute the following 4 | # commands. At the first occurrence, insert the file. At the following 5 | # occurrences, do nothing. The distinction between the first and the following 6 | # occurrences is achieved by looking at the hold space. 7 | /^msgid /{ 8 | x 9 | # Test if the hold space is empty. 10 | s/m/m/ 11 | ta 12 | # Yes it was empty. First occurrence. Read the file. 13 | r HEADER 14 | # Output the file's contents by reading the next line. But don't lose the 15 | # current line while doing this. 16 | g 17 | N 18 | bb 19 | :a 20 | # The hold space was nonempty. Following occurrences. Do nothing. 21 | x 22 | :b 23 | } 24 | -------------------------------------------------------------------------------- /po/it.gmo: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/rajeshsola/gnu-hello/274bd5b954066558a5ead00d3cceefe21ecdba9b/po/it.gmo -------------------------------------------------------------------------------- /po/it.po: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/rajeshsola/gnu-hello/274bd5b954066558a5ead00d3cceefe21ecdba9b/po/it.po -------------------------------------------------------------------------------- /po/ja.gmo: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/rajeshsola/gnu-hello/274bd5b954066558a5ead00d3cceefe21ecdba9b/po/ja.gmo -------------------------------------------------------------------------------- /po/ja.po: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/rajeshsola/gnu-hello/274bd5b954066558a5ead00d3cceefe21ecdba9b/po/ja.po -------------------------------------------------------------------------------- /po/ka.gmo: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/rajeshsola/gnu-hello/274bd5b954066558a5ead00d3cceefe21ecdba9b/po/ka.gmo -------------------------------------------------------------------------------- /po/ko.gmo: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/rajeshsola/gnu-hello/274bd5b954066558a5ead00d3cceefe21ecdba9b/po/ko.gmo -------------------------------------------------------------------------------- /po/lv.gmo: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/rajeshsola/gnu-hello/274bd5b954066558a5ead00d3cceefe21ecdba9b/po/lv.gmo -------------------------------------------------------------------------------- /po/ms.gmo: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/rajeshsola/gnu-hello/274bd5b954066558a5ead00d3cceefe21ecdba9b/po/ms.gmo -------------------------------------------------------------------------------- /po/nb.gmo: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/rajeshsola/gnu-hello/274bd5b954066558a5ead00d3cceefe21ecdba9b/po/nb.gmo -------------------------------------------------------------------------------- /po/nl.gmo: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/rajeshsola/gnu-hello/274bd5b954066558a5ead00d3cceefe21ecdba9b/po/nl.gmo -------------------------------------------------------------------------------- /po/nn.gmo: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/rajeshsola/gnu-hello/274bd5b954066558a5ead00d3cceefe21ecdba9b/po/nn.gmo -------------------------------------------------------------------------------- /po/nn.po: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/rajeshsola/gnu-hello/274bd5b954066558a5ead00d3cceefe21ecdba9b/po/nn.po -------------------------------------------------------------------------------- /po/pl.gmo: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/rajeshsola/gnu-hello/274bd5b954066558a5ead00d3cceefe21ecdba9b/po/pl.gmo -------------------------------------------------------------------------------- /po/pt.gmo: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/rajeshsola/gnu-hello/274bd5b954066558a5ead00d3cceefe21ecdba9b/po/pt.gmo -------------------------------------------------------------------------------- /po/pt.po: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/rajeshsola/gnu-hello/274bd5b954066558a5ead00d3cceefe21ecdba9b/po/pt.po -------------------------------------------------------------------------------- /po/pt_BR.gmo: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/rajeshsola/gnu-hello/274bd5b954066558a5ead00d3cceefe21ecdba9b/po/pt_BR.gmo -------------------------------------------------------------------------------- /po/quot.sed: -------------------------------------------------------------------------------- 1 | s/"\([^"]*\)"/“\1”/g 2 | s/`\([^`']*\)'/‘\1’/g 3 | s/ '\([^`']*\)' / ‘\1’ /g 4 | s/ '\([^`']*\)'$/ ‘\1’/g 5 | s/^'\([^`']*\)' /‘\1’ /g 6 | s/“”/""/g 7 | -------------------------------------------------------------------------------- /po/remove-potcdate.sin: -------------------------------------------------------------------------------- 1 | # Sed script that remove the POT-Creation-Date line in the header entry 2 | # from a POT file. 3 | # 4 | # The distinction between the first and the following occurrences of the 5 | # pattern is achieved by looking at the hold space. 6 | /^"POT-Creation-Date: .*"$/{ 7 | x 8 | # Test if the hold space is empty. 9 | s/P/P/ 10 | ta 11 | # Yes it was empty. First occurrence. Remove the line. 12 | g 13 | d 14 | bb 15 | :a 16 | # The hold space was nonempty. Following occurrences. Do nothing. 17 | x 18 | :b 19 | } 20 | -------------------------------------------------------------------------------- /po/ro.gmo: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/rajeshsola/gnu-hello/274bd5b954066558a5ead00d3cceefe21ecdba9b/po/ro.gmo -------------------------------------------------------------------------------- /po/ro.po: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/rajeshsola/gnu-hello/274bd5b954066558a5ead00d3cceefe21ecdba9b/po/ro.po -------------------------------------------------------------------------------- /po/ru.gmo: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/rajeshsola/gnu-hello/274bd5b954066558a5ead00d3cceefe21ecdba9b/po/ru.gmo -------------------------------------------------------------------------------- /po/sk.gmo: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/rajeshsola/gnu-hello/274bd5b954066558a5ead00d3cceefe21ecdba9b/po/sk.gmo -------------------------------------------------------------------------------- /po/sl.gmo: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/rajeshsola/gnu-hello/274bd5b954066558a5ead00d3cceefe21ecdba9b/po/sl.gmo -------------------------------------------------------------------------------- /po/sr.gmo: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/rajeshsola/gnu-hello/274bd5b954066558a5ead00d3cceefe21ecdba9b/po/sr.gmo -------------------------------------------------------------------------------- /po/stamp-po: -------------------------------------------------------------------------------- 1 | timestamp 2 | -------------------------------------------------------------------------------- /po/sv.gmo: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/rajeshsola/gnu-hello/274bd5b954066558a5ead00d3cceefe21ecdba9b/po/sv.gmo -------------------------------------------------------------------------------- /po/th.gmo: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/rajeshsola/gnu-hello/274bd5b954066558a5ead00d3cceefe21ecdba9b/po/th.gmo -------------------------------------------------------------------------------- /po/tr.gmo: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/rajeshsola/gnu-hello/274bd5b954066558a5ead00d3cceefe21ecdba9b/po/tr.gmo -------------------------------------------------------------------------------- /po/uk.gmo: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/rajeshsola/gnu-hello/274bd5b954066558a5ead00d3cceefe21ecdba9b/po/uk.gmo -------------------------------------------------------------------------------- /po/vi.gmo: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/rajeshsola/gnu-hello/274bd5b954066558a5ead00d3cceefe21ecdba9b/po/vi.gmo -------------------------------------------------------------------------------- /po/zh_CN.gmo: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/rajeshsola/gnu-hello/274bd5b954066558a5ead00d3cceefe21ecdba9b/po/zh_CN.gmo -------------------------------------------------------------------------------- /po/zh_TW.gmo: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/rajeshsola/gnu-hello/274bd5b954066558a5ead00d3cceefe21ecdba9b/po/zh_TW.gmo -------------------------------------------------------------------------------- /src/system.h: -------------------------------------------------------------------------------- 1 | /* system.h: system-dependent declarations; include this first. 2 | 3 | Copyright 1996, 2005, 2006, 2007, 2008, 2013, 2014 Free Software 4 | Foundation, Inc. 5 | 6 | This program is free software; you can redistribute it and/or modify 7 | it under the terms of the GNU General Public License as published by 8 | the Free Software Foundation; either version 3, or (at your option) 9 | any later version. 10 | 11 | This program is distributed in the hope that it will be useful, 12 | but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14 | GNU General Public License for more details. 15 | 16 | You should have received a copy of the GNU General Public License 17 | along with this program. If not, see . */ 18 | 19 | #ifndef HELLO_SYSTEM_H 20 | # define HELLO_SYSTEM_H 21 | 22 | /* Assume ANSI C89 headers are available. */ 23 | # include 24 | # include 25 | # include 26 | # include 27 | 28 | /* Use POSIX headers. If they are not available, we use the substitute 29 | provided by gnulib. */ 30 | # include 31 | # include 32 | 33 | /* Unicode. */ 34 | #include 35 | #include 36 | 37 | /* Internationalization. */ 38 | # include "gettext.h" 39 | # define _(str) gettext (str) 40 | # define N_(str) gettext_noop (str) 41 | 42 | /* Check for errors on write. */ 43 | # include "closeout.h" 44 | 45 | #endif /* HELLO_SYSTEM_H */ 46 | -------------------------------------------------------------------------------- /tests/greeting-1: -------------------------------------------------------------------------------- 1 | #! /bin/sh 2 | # Test arbitrary --greeting. 3 | # 4 | # Copyright (C) 2001, 2006, 2014 Free Software Foundation, Inc. 5 | # 6 | # Copying and distribution of this file, with or without modification, 7 | # are permitted in any medium without royalty provided the copyright 8 | # notice and this notice are preserved. 9 | 10 | trap 'rm -fr $tmpfiles' 1 2 3 15 11 | 12 | # No locale settings in this test, since we are using a fixed string; 13 | # nothing in the output should be locale-dependent. 14 | 15 | tmpfiles="greeting-test1.ok" 16 | cat <greeting-test1.ok 17 | Nothing happens here. 18 | EOF 19 | 20 | tmpfiles="$tmpfiles greeting-test1.out" 21 | : ${HELLO=hello} 22 | ${HELLO} -g 'Nothing happens here.' | tr -d '\r' >greeting-test1.out 23 | 24 | # remove \r (CR) characters from the output, so that the tests work on 25 | # platforms with CRLF line endings. There is apparently no reliable 26 | # method (across Cygwin, MingW, etc.) to force an eol style. 27 | 28 | : ${DIFF=diff} 29 | ${DIFF} greeting-test1.ok greeting-test1.out 30 | result=$? 31 | 32 | rm -fr $tmpfiles 33 | 34 | exit $result 35 | -------------------------------------------------------------------------------- /tests/greeting-2: -------------------------------------------------------------------------------- 1 | #! /bin/sh 2 | # Test very long --greeting argument, and also show skipping a test. 3 | # (And one way to compute full moons.) 4 | # 5 | # Copyright (C) 2001, 2006, 2014 Free Software Foundation, Inc. 6 | # 7 | # Copying and distribution of this file, with or without modification, 8 | # are permitted in any medium without royalty provided the copyright 9 | # notice and this notice are preserved. 10 | 11 | trap 'rm -fr $tmpfiles' 1 2 3 15 12 | 13 | tmpfiles="greeting-test2.ok" 14 | cat < greeting-test2.ok 15 | Wuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuhhh! 16 | EOF 17 | 18 | # Werewolves cry at full moon only. 19 | set - `TZ=GMT date +"%Y %j %H %M %S"` 20 | year=$1; day=$2; hours=$3; minutes=$4; seconds=$5 21 | years_since_2000=`expr $year - 2000` 22 | days_since_2000=`expr '(' $years_since_2000 '*' 365 ')' + '(' '(' $years_since_2000 - 1 ')' / 4 ')' + $day` 23 | seconds_since_2000=`expr '(' '(' '(' '(' '(' $days_since_2000 '*' 24 ')' + $hours ')' '*' 60 ')' + $minutes ')' '*' 60 ')' + $seconds` 24 | # A moon period is ca. 2551442.8 seconds. 25 | remainder=`expr $seconds_since_2000 % 2551443` 26 | # Full moon is around remainder = 1760000, oscillating between ca. 1720000 27 | # and ca. 1805000. Allow a tolerance of +/- 24 h. 28 | if test `expr $remainder '>' 1650000` = 0 || test `expr $remainder '<' 1890000` = 0; then 29 | { echo "$0: Skipping test: not a full moon night"; rm -fr $tmpfiles; exit 77; } 30 | fi 31 | 32 | # The exit 77 is the magic value which tells Automake's `make check' 33 | # that this test was skipped. It's also good to give a 34 | # human-understandable reason why the test was skipped, so the person 35 | # running the test can know. 36 | 37 | tmpfiles="$tmpfiles greeting-test2.out" 38 | : ${HELLO=hello} 39 | ${HELLO} -g 'Wuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuhhh!' \ 40 | | tr -d '\r' >greeting-test2.out 41 | 42 | : ${DIFF=diff} 43 | ${DIFF} greeting-test2.ok greeting-test2.out 44 | result=$? 45 | 46 | rm -fr $tmpfiles 47 | 48 | exit $result 49 | -------------------------------------------------------------------------------- /tests/hello-1: -------------------------------------------------------------------------------- 1 | #! /bin/sh 2 | # Test standard GNU greeting. 3 | # 4 | # Copyright (C) 2001, 2006, 2014 Free Software Foundation, Inc. 5 | # 6 | # Copying and distribution of this file, with or without modification, 7 | # are permitted in any medium without royalty provided the copyright 8 | # notice and this notice are preserved. 9 | # This script takes one argument. 10 | 11 | trap 'rm -fr $tmpfiles' 1 2 3 15 12 | 13 | # We force the C locale here, since we are checking normal output, 14 | # which will be translated. 15 | 16 | LANGUAGE= 17 | LC_ALL=C 18 | LC_MESSAGES= 19 | LANG= 20 | export LANGUAGE LC_ALL LC_MESSAGES LANG 21 | 22 | tmpfiles="hello-test1.ok" 23 | cat < hello-test1.ok 24 | Hello, world! 25 | EOF 26 | 27 | tmpfiles="$tmpfiles hello-test1.out" 28 | : ${HELLO=hello} 29 | ${HELLO} | tr -d '\r' >hello-test1.out 30 | 31 | : ${DIFF=diff} 32 | ${DIFF} hello-test1.ok hello-test1.out 33 | result=$? 34 | 35 | rm -fr $tmpfiles 36 | 37 | exit $result 38 | -------------------------------------------------------------------------------- /tests/last-1: -------------------------------------------------------------------------------- 1 | #! /bin/sh 2 | # Test that last greeting option specified is what counts. 3 | # 4 | # Copyright 2008, 2013, 2014 Free Software Foundation, Inc. 5 | # 6 | # Copying and distribution of this file, with or without modification, 7 | # are permitted in any medium without royalty provided the copyright 8 | # notice and this notice are preserved. 9 | # This script takes one argument. 10 | 11 | trap 'rm -fr $tmpfiles' 1 2 3 15 12 | 13 | # We force the C locale here, since we are checking normal output, 14 | # which will be translated. 15 | 16 | LANGUAGE= 17 | LC_ALL=C 18 | LC_MESSAGES= 19 | LANG= 20 | export LANGUAGE LC_ALL LC_MESSAGES LANG 21 | 22 | tmpfiles="last-test1.ok" 23 | cat < last-test1.ok 24 | my hello 25 | EOF 26 | 27 | tmpfiles="$tmpfiles last-test1.out" 28 | : ${HELLO=hello} 29 | ${HELLO} -t -g 'my hello' | tr -d '\r' \ 30 | | tr -d '\r' >last-test1.out 31 | 32 | : ${DIFF=diff} 33 | ${DIFF} last-test1.ok last-test1.out 34 | result=$? 35 | 36 | rm -fr $tmpfiles 37 | 38 | exit $result 39 | -------------------------------------------------------------------------------- /tests/traditional-1: -------------------------------------------------------------------------------- 1 | #! /bin/sh 2 | # Test traditional greeting. 3 | # 4 | # Copyright (C) 2001, 2006, 2014 Free Software Foundation, Inc. 5 | # 6 | # Copying and distribution of this file, with or without modification, 7 | # are permitted in any medium without royalty provided the copyright 8 | # notice and this notice are preserved. 9 | 10 | trap 'rm -fr $tmpfiles' 1 2 3 15 11 | 12 | # We force the C locale here, since we are checking normal output, 13 | # which will be translated. 14 | 15 | LANGUAGE= 16 | LC_ALL=C 17 | LC_MESSAGES= 18 | LANG= 19 | export LANGUAGE LC_ALL LC_MESSAGES LANG 20 | 21 | tmpfiles="traditional-test1.ok" 22 | cat < traditional-test1.ok 23 | hello, world 24 | EOF 25 | 26 | tmpfiles="$tmpfiles traditional-test1.out" 27 | : ${HELLO=hello} 28 | ${HELLO} --traditional | tr -d '\r' >traditional-test1.out 29 | 30 | : ${DIFF=diff} 31 | ${DIFF} traditional-test1.ok traditional-test1.out 32 | result=$? 33 | 34 | rm -fr $tmpfiles 35 | 36 | exit $result 37 | --------------------------------------------------------------------------------