[newlib-cygwin] Cygwin: getconf: align -a output to glibc getconf

Corinna Vinschen corinna@sourceware.org
Wed Mar 2 21:15:11 GMT 2022


https://sourceware.org/git/gitweb.cgi?p=newlib-cygwin.git;h=35ba7d147df8df56ef92ea296443d2732ece0445

commit 35ba7d147df8df56ef92ea296443d2732ece0445
Author: Corinna Vinschen <corinna@vinschen.de>
Date:   Wed Mar 2 22:15:02 2022 +0100

    Cygwin: getconf: align -a output to glibc getconf
    
    glibc getconf doesn't print "undefined" for undefined values
    in -a output.  It just prints the empty string.  Do it the
    same way.
    
    Signed-off-by: Corinna Vinschen <corinna@vinschen.de>

Diff:
---
 winsup/utils/getconf.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/winsup/utils/getconf.c b/winsup/utils/getconf.c
index bc37bfb47..88deddd38 100644
--- a/winsup/utils/getconf.c
+++ b/winsup/utils/getconf.c
@@ -481,7 +481,7 @@ printvar (const struct conf_variable *cp, const char *pathname)
 	{
 	  if (a_flag && errno != 0)
 	    return; /* Just skip invalid variables */
-	  print_strvar (cp->name, "undefined");
+	  print_strvar (cp->name, a_flag ? "" : "undefined");
 	}
       else
 	print_longvar (cp->name, val);
@@ -493,7 +493,7 @@ printvar (const struct conf_variable *cp, const char *pathname)
 	{
 	  if (a_flag && errno != 0)
 	    return; /* Just skip invalid variables */
-	  print_strvar (cp->name, "undefined");
+	  print_strvar (cp->name, a_flag ? "" : "undefined");
 	}
       else
 	print_longvar (cp->name, val);


More information about the Cygwin-cvs mailing list