aboutsummaryrefslogtreecommitdiff
path: root/utils/showtrans.c
diff options
context:
space:
mode:
Diffstat (limited to 'utils/showtrans.c')
-rw-r--r--utils/showtrans.c34
1 files changed, 18 insertions, 16 deletions
diff --git a/utils/showtrans.c b/utils/showtrans.c
index d6acfd9d..aa55f14d 100644
--- a/utils/showtrans.c
+++ b/utils/showtrans.c
@@ -1,8 +1,7 @@
/* Show files' passive translators.
- Copyright (C) 1995, 1996 Free Software Foundation, Inc.
-
- Written by Miles Bader <miles@gnu.ai.mit.edu>
+ Copyright (C) 1995,96,97,98,99,2001,02 Free Software Foundation, Inc.
+ Written by Miles Bader <miles@gnu.org>
This program is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public License as
@@ -25,11 +24,13 @@
#include <argp.h>
#include <fcntl.h>
#include <unistd.h>
+#include <version.h>
+#include <sys/mman.h>
#include <error.h>
#include <argz.h>
-char *argp_program_version = "showtrans 1.0 (GNU " HURD_RELEASE ")";
+const char *argp_program_version = STANDARD_HURD_VERSION (showtrans);
static struct argp_option options[] =
{
@@ -42,13 +43,13 @@ static struct argp_option options[] =
};
static char *args_doc = "FILE...";
-
-static char *doc = "A FILE argument of `-' prints the translator on the node \
-attached to standard input.";
+static char *doc = "Show the passive translator of FILE..."
+"\vA FILE argument of `-' prints the translator on the node"
+" attached to standard input.";
/* ---------------------------------------------------------------- */
-void
+int
main (int argc, char *argv[])
{
/* The default exit status -- changed to 0 if we find any translators. */
@@ -66,7 +67,7 @@ main (int argc, char *argv[])
else
{
char buf[1024], *trans = buf;
- int trans_len = sizeof (buf);
+ size_t trans_len = sizeof (buf);
error_t err = file_get_translator (node, &trans, &trans_len);
switch (err)
@@ -76,14 +77,15 @@ main (int argc, char *argv[])
argz_stringify (trans, trans_len, ' ');
if (!silent)
- if (print_prefix)
- printf ("%s: %s\n", name, trans);
- else
- puts (trans);
+ {
+ if (print_prefix)
+ printf ("%s: %.*s\n", name, (int) trans_len, trans);
+ else
+ printf ("%.*s\n", (int) trans_len, trans);
+ }
if (trans != buf)
- vm_deallocate (mach_task_self (),
- (vm_address_t)trans, trans_len);
+ munmap (trans, trans_len);
status = 0;
@@ -138,5 +140,5 @@ main (int argc, char *argv[])
argp_parse (&argp, argc, argv, 0, 0, 0);
- exit (status);
+ return status;
}