X-Git-Url: https://git.gag.com/?a=blobdiff_plain;f=client-src%2Fnoop.c;h=76f1b264c9db4cc0ec7702c9f62e29e130f900d0;hb=refs%2Fheads%2Fmaster;hp=a0c4105abcf3e41c958f029a075e50078dc36123;hpb=12179dea039515c06168c0037d048566a3f623de;p=debian%2Famanda diff --git a/client-src/noop.c b/client-src/noop.c index a0c4105..76f1b26 100644 --- a/client-src/noop.c +++ b/client-src/noop.c @@ -1,6 +1,7 @@ /* * Amanda, The Advanced Maryland Automatic Network Disk Archiver * Copyright (c) 1991-1999 University of Maryland at College Park + * Copyright (c) 2007-2012 Zmanda, Inc. All Rights Reserved. * All Rights Reserved. * * Permission to use, copy, modify, distribute, and sell this software and its @@ -52,10 +53,28 @@ main( (void)argc; /* Quiet unused parameter warning */ (void)argv; /* Quiet unused parameter warning */ + if (argc > 1 && argv && argv[1] && g_str_equal(argv[1], "--version")) { + printf("noop-%s\n", VERSION); + return (0); + } + + /* + * Configure program for internationalization: + * 1) Only set the message locale for now. + * 2) Set textdomain for all amanda related programs to "amanda" + * We don't want to be forced to support dozens of message catalogs. + */ + setlocale(LC_MESSAGES, "C"); + textdomain("amanda"); + /* Don't die when child closes pipe */ signal(SIGPIPE, SIG_IGN); safe_fd(-1, 0); + openbsd_fd_inform(); + + check_running_as(RUNNING_AS_CLIENT_LOGIN); + do { /* soak up any stdin */ n = read(0, &ch, 1); @@ -69,8 +88,8 @@ main( amfree(our_feature_string); am_release_feature_set(our_features); our_features = NULL; - if (fullwrite(1, options, strlen(options)) < 0) { - error("error sending noop response: %s", strerror(errno)); + if (full_write(1, options, strlen(options)) < strlen(options)) { + error(_("error sending noop response: %s"), strerror(errno)); /*NOTREACHED*/ } amfree(options);