Permalink
Browse files

Import gnulib modules getopt and closeout. Use closeout to check clos…

…ing of stdout at exit.
  • Loading branch information...
1 parent d539d8b commit 9d27d1caa76061440ec798d8eef50da5f4d09e33 @mschuerig committed Jan 11, 2009
Showing with 46 additions and 30 deletions.
  1. +1 −0 .gitignore
  2. +4 −4 Makefile.am
  3. +0 −1 TODO
  4. +4 −0 autogen.sh
  5. +7 −1 configure.ac
  6. +11 −11 po/de.po
  7. +11 −11 po/hangon.pot
  8. +3 −1 src/Makefile.am
  9. +5 −1 src/hangon.c
View
1 .gitignore
@@ -6,6 +6,7 @@ build.*/
### Autotools generated files
build-aux/
+gnulib/
m4/
autom4te.cache/
View
8 Makefile.am
@@ -1,12 +1,12 @@
-SUBDIRS = po src tests doc
+SUBDIRS = po gnulib/lib src tests doc
-ACLOCAL_AMFLAGS = -I m4
+ACLOCAL_AMFLAGS = -I m4 -I gnulib/m4
man_page = $(PACKAGE).1
man_MANS = $(man_page)
-CLEANFILES = $(man_page)
+MAINTAINERCLEANFILES = $(man_MANS)
-EXTRA_DIST = hangon.x $(man_MANS)
+EXTRA_DIST = hangon.x $(man_MANS) gnulib/m4/gnulib-cache.m4
# Create the man page from --help and --version output
View
1 TODO
@@ -1,4 +1,3 @@
* don't restart command if exited with a specific set of status codes
* listen to multiple streams (stderr)?
-* gnulib: atexit(close_stdout)
View
4 autogen.sh
@@ -2,5 +2,9 @@
set -e
+gnulib-tool --import --m4-base=gnulib/m4 --source-base=gnulib/lib \
+ --no-vc-files closeout getopt
+
autoreconf --verbose --force --install
+
gettextize --force
View
8 configure.ac
@@ -4,6 +4,12 @@ AM_INIT_AUTOMAKE([-Wall -Werror])
AC_PROG_CC
+gl_EARLY
+gl_INIT
+
+dnl This isn't really necessary, is it?
+AC_PROG_RANLIB
+
# -Wextra enables additional checks not included in -Wall
# AM_INIT_AUTOMAKE doesn't accept -Wextra so it is added
# manually. See gcc(1).
@@ -31,7 +37,7 @@ AM_GNU_GETTEXT_VERSION([0.17])
AC_CONFIG_HEADERS([config.h])
AC_CONFIG_SRCDIR([src/hangon.c])
-AC_CONFIG_FILES([Makefile src/Makefile doc/Makefile po/Makefile.in])
+AC_CONFIG_FILES([Makefile gnulib/lib/Makefile src/Makefile doc/Makefile po/Makefile.in])
AC_CONFIG_TESTDIR([tests], [tests:src])
AC_CONFIG_FILES([tests/Makefile])
View
22 po/de.po
@@ -7,7 +7,7 @@ msgid ""
msgstr ""
"Project-Id-Version: hangon 0.1\n"
"Report-Msgid-Bugs-To: michael@schuerig.de\n"
-"POT-Creation-Date: 2009-01-11 22:45+0100\n"
+"POT-Creation-Date: 2009-01-12 00:24+0100\n"
"PO-Revision-Date: 2009-01-09 23:47+0100\n"
"Last-Translator: Michael Schuerig <michael@schuerig.de>\n"
"Language-Team: German\n"
@@ -16,17 +16,17 @@ msgstr ""
"Content-Transfer-Encoding: 8bit\n"
"Plural-Forms: nplurals=2; plural=(n != 1);\n"
-#: src/hangon.c:63
+#: src/hangon.c:65
#, c-format
msgid "Try %s --help for more information.\n"
msgstr "„%s --help“ gibt weitere Informationen.\n"
-#: src/hangon.c:65
+#: src/hangon.c:67
#, c-format
msgid "Usage: %s [OPTION]... -- COMMAND [COMMAND OPTION]...\n"
msgstr "Aufruf: %s [OPTION]... -- BEFEHL [BEFEHLSOPTIONEN]\n"
-#: src/hangon.c:69
+#: src/hangon.c:71
msgid ""
"Restart an erratic COMMAND until it finishes cleanly.\n"
" -q, --quiet suppress diagnostic messages\n"
@@ -39,24 +39,24 @@ msgstr ""
"wird\n"
" -t, --timeout=SEKUNDEN Zeit, nach der der BEFEHL neu gestartet wird\n"
-#: src/hangon.c:76
+#: src/hangon.c:78
msgid " -d, --debug show debugging information\n"
msgstr ""
" -d, --debug zeige Informationen für die Fehlersuche an\n"
-#: src/hangon.c:80
+#: src/hangon.c:82
msgid " --help display this help and exit\n"
msgstr " --help diese Hilfe anzeigen und beenden\n"
-#: src/hangon.c:83
+#: src/hangon.c:85
msgid " --version output version information and exit\n"
msgstr " --version Versionsinformation anzeigen und beenden\n"
-#: src/hangon.c:94
+#: src/hangon.c:96
msgid "(C)"
msgstr "©"
-#: src/hangon.c:95
+#: src/hangon.c:97
msgid ""
"License GPLv2+: GNU GPL version 2 or later <http://gnu.org/licenses/gpl."
"html>\n"
@@ -68,12 +68,12 @@ msgstr ""
"Dies ist freie Software: Sie können sie ändern und weitergeben.\n"
"Es gibt keinerlei Garantien, soweit wie es das Gesetz erlaubt.\n"
-#: src/hangon.c:223
+#: src/hangon.c:227
#, c-format
msgid "timeout must not be negative\n"
msgstr "die Timeout-Option darf nicht negativ sein\n"
-#: src/hangon.c:230
+#: src/hangon.c:234
#, c-format
msgid "retries must not be negative\n"
msgstr "die retries-Option darf nicht negativ sein\n"
View
22 po/hangon.pot
@@ -8,61 +8,61 @@ msgid ""
msgstr ""
"Project-Id-Version: hangon 0.1\n"
"Report-Msgid-Bugs-To: michael@schuerig.de\n"
-"POT-Creation-Date: 2009-01-11 22:45+0100\n"
+"POT-Creation-Date: 2009-01-12 00:24+0100\n"
"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
"Language-Team: LANGUAGE <LL@li.org>\n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=CHARSET\n"
"Content-Transfer-Encoding: 8bit\n"
-#: src/hangon.c:63
+#: src/hangon.c:65
#, c-format
msgid "Try %s --help for more information.\n"
msgstr ""
-#: src/hangon.c:65
+#: src/hangon.c:67
#, c-format
msgid "Usage: %s [OPTION]... -- COMMAND [COMMAND OPTION]...\n"
msgstr ""
-#: src/hangon.c:69
+#: src/hangon.c:71
msgid ""
"Restart an erratic COMMAND until it finishes cleanly.\n"
" -q, --quiet suppress diagnostic messages\n"
" -r, --retries=TIMES maximum number of times COMMAND is restarted\n"
" -t, --timeout=SECONDS timeout in seconds\n"
msgstr ""
-#: src/hangon.c:76
+#: src/hangon.c:78
msgid " -d, --debug show debugging information\n"
msgstr ""
-#: src/hangon.c:80
+#: src/hangon.c:82
msgid " --help display this help and exit\n"
msgstr ""
-#: src/hangon.c:83
+#: src/hangon.c:85
msgid " --version output version information and exit\n"
msgstr ""
-#: src/hangon.c:94
+#: src/hangon.c:96
msgid "(C)"
msgstr ""
-#: src/hangon.c:95
+#: src/hangon.c:97
msgid ""
"License GPLv2+: GNU GPL version 2 or later <http://gnu.org/licenses/gpl.html>\n"
"This is free software: you are free to change and redistribute it.\n"
"There is NO WARRANTY, to the extent permitted by law.\n"
msgstr ""
-#: src/hangon.c:223
+#: src/hangon.c:227
#, c-format
msgid "timeout must not be negative\n"
msgstr ""
-#: src/hangon.c:230
+#: src/hangon.c:234
#, c-format
msgid "retries must not be negative\n"
msgstr ""
View
4 src/Makefile.am
@@ -1,5 +1,7 @@
bin_PROGRAMS = hangon
hangon_SOURCES = hangon.c
+hangon_LDADD = @LIBINTL@ ../gnulib/lib/libgnu.a
+
localedir = $(datadir)/locale
-AM_CPPFLAGS = -DLOCALEDIR=\"$(localedir)\"
+AM_CPPFLAGS = -DLOCALEDIR=\"$(localedir)\" -I$(top_srcdir)/gnulib/lib -I$(top_builddir)/gnulib/lib
View
6 src/hangon.c
@@ -12,6 +12,8 @@
#include <sys/time.h>
#include <sys/wait.h>
+#include "closeout.h"
+
#include "config.h"
#define PROGRAM_NAME "hangon"
@@ -207,13 +209,15 @@ int
main(int argc, char *argv[])
{
program_name = argv[0];
-
+
setlocale(LC_ALL, "");
#if ENABLE_NLS
bindtextdomain(PACKAGE, LOCALEDIR);
textdomain(PACKAGE);
#endif
+ atexit(close_stdout);
+
int optc;
while ((optc = getopt_long(argc, argv, "t:r:qdhv", long_options, NULL)) != -1) {
switch (optc) {

0 comments on commit 9d27d1c

Please sign in to comment.