summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorJim Meyering <jim@meyering.net>2000-05-07 14:53:15 +0000
committerJim Meyering <jim@meyering.net>2000-05-07 14:53:15 +0000
commit071e5e3b2511ccd17474c8a42abd492b3e0e6999 (patch)
treea7144d51c3c2b16dc8387fdf4a97fe5e9a97b464 /src
parent21f7f8fb60ff3a69eb3095e7700b1890d080e8c9 (diff)
downloadcoreutils-071e5e3b2511ccd17474c8a42abd492b3e0e6999.tar.xz
Include "closeout.h".
(main): Call atexit with close_stdout.
Diffstat (limited to 'src')
-rw-r--r--src/hostid.c6
-rw-r--r--src/hostname.c3
2 files changed, 5 insertions, 4 deletions
diff --git a/src/hostid.c b/src/hostid.c
index 607ccaa38..b1cfb0e1a 100644
--- a/src/hostid.c
+++ b/src/hostid.c
@@ -1,5 +1,5 @@
/* print the hexadecimal identifier for the current host
- Copyright (C) 1997, 1999 Free Software Foundation, Inc.
+ Copyright (C) 1997, 1999, 2000 Free Software Foundation, Inc.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
@@ -70,6 +70,8 @@ main (int argc, char **argv)
bindtextdomain (PACKAGE, LOCALEDIR);
textdomain (PACKAGE);
+ atexit (close_stdout);
+
parse_long_options (argc, argv, PROGRAM_NAME, GNU_PACKAGE, VERSION,
AUTHORS, usage);
@@ -82,7 +84,5 @@ main (int argc, char **argv)
id = gethostid ();
printf ("%lx\n", id);
- close_stdout ();
-
exit (EXIT_SUCCESS);
}
diff --git a/src/hostname.c b/src/hostname.c
index 6b2c4ddab..6de60ba14 100644
--- a/src/hostname.c
+++ b/src/hostname.c
@@ -88,6 +88,8 @@ main (int argc, char **argv)
bindtextdomain (PACKAGE, LOCALEDIR);
textdomain (PACKAGE);
+ atexit (close_stdout);
+
parse_long_options (argc, argv, PROGRAM_NAME, GNU_PACKAGE, VERSION,
AUTHORS, usage);
@@ -114,7 +116,6 @@ main (int argc, char **argv)
if (hostname == NULL)
error (1, errno, _("cannot determine hostname"));
printf ("%s\n", hostname);
- close_stdout ();
}
else
{