]> git.ipfire.org Git - thirdparty/gettext.git/commitdiff
envsubst: On native Windows, produce output suitable for the shell.
authorBruno Haible <bruno@clisp.org>
Sun, 25 Nov 2018 01:10:31 +0000 (02:10 +0100)
committerBruno Haible <bruno@clisp.org>
Sun, 25 Nov 2018 01:10:31 +0000 (02:10 +0100)
* autogen.sh (GNULIB_MODULES_RUNTIME_FOR_SRC): Add 'binary-io'.
* gettext-runtime/src/envsubst.c (main): In --variables mode, put stdout in
binary mode.

autogen.sh
gettext-runtime/src/envsubst.c

index a96b04c4172264328320568a79625c810ae85038..c6f66330feb4178f1a7ad90dca07b90ebdeca045 100755 (executable)
@@ -137,6 +137,7 @@ if ! $skip_gnulib; then
     GNULIB_MODULES_RUNTIME_FOR_SRC='
       atexit
       basename
+      binary-io
       closeout
       error
       getopt-gnu
index 941452b03b6e5d57a37954d8b9fa8f06db0fc0ca..8416b7a9d4a2836ecfc7259e9b5841dc81ee121e 100644 (file)
@@ -1,5 +1,5 @@
 /* Substitution of environment variables in shell format strings.
-   Copyright (C) 2003-2007, 2012, 2015-2018 Free Software Foundation, Inc.
+   Copyright (C) 2003-2007, 2012, 2018 Free Software Foundation, Inc.
    Written by Bruno Haible <bruno@clisp.org>, 2003.
 
    This program is free software: you can redistribute it and/or modify
@@ -34,6 +34,7 @@
 #include "basename.h"
 #include "xalloc.h"
 #include "propername.h"
+#include "binary-io.h"
 #include "gettext.h"
 
 #define _(str) gettext (str)
@@ -139,6 +140,11 @@ There is NO WARRANTY, to the extent permitted by law.\n\
         default:
           abort ();
         }
+
+      /* The result is most often used in shell `...` expressions.
+         Therefore, on native Windows, don't produce CR/LF newlines.  */
+      set_binary_mode (STDOUT_FILENO, O_BINARY);
+
       print_variables (argv[optind++]);
     }
   else