Bugs:

* When a confstr() name is queried and it doesn't have a
configuration-defined value (e.g., POSIX_V7_ILP32_OFF32_CFLAGS in
OpenBSD), getconf is unconformant by exiting with a non-zero status
instead of printing "undefined\n".

Misc:

* `getconf -l` lists duplicate entries.

* confstr() failures don't print strerror(errno) unlike sysconf()
failures.

Index: getconf.c
===================================================================
RCS file: /cvs/src/usr.bin/getconf/getconf.c,v
retrieving revision 1.14
diff -p -u -r1.14 getconf.c
--- getconf.c   2 Mar 2013 07:18:17 -0000       1.14
+++ getconf.c   4 Mar 2013 04:08:41 -0000
@@ -161,7 +161,6 @@ const struct conf_variable conf_table[] 
   posix2_pathconf_row(SYMLINKS)
 
   constant_row(_POSIX2_CHARCLASS_NAME_MAX)
-  constant_row(_POSIX2_RE_DUP_MAX)
   constant_row(_XOPEN_IOV_MAX)
   constant_row(_XOPEN_NAME_MAX)
   constant_row(_XOPEN_PATH_MAX)
@@ -183,7 +182,6 @@ const struct conf_variable uposix_conf_t
   /*posix_constant_row(AIO_LISTIO_MAX)*/
   /*posix_constant_row(AIO_MAX)*/
   posix_constant_row(ARG_MAX)
-  posix_constant_row(ARG_MAX)
   posix_constant_row(CHILD_MAX)
   /*posix_constant_row(DELAYTIMER_MAX)*/
   posix_constant_row(HOST_NAME_MAX)
@@ -487,9 +485,10 @@ main(int argc, char *argv[])
                
                if (slen == 0 || slen == (size_t)-1) {
                        if (errno)
-                               err(1, "%ld", cp->value);
+                               err(1, NULL);
                        else
-                               errx(1, "%ld", cp->value);
+                               puts("undefined");
+                       break;
                }
                if ((sval = malloc(slen)) == NULL)
                        err(1, NULL);

Reply via email to