OSDN Git Service

* cygwin.din (confstr): Export.
authorcorinna <corinna>
Mon, 11 Jun 2007 17:38:26 +0000 (17:38 +0000)
committercorinna <corinna>
Mon, 11 Jun 2007 17:38:26 +0000 (17:38 +0000)
* posix.sgml (confstr): Move to list of implemented SUSv3 functions.
* sysconf.cc (confstr): Implement.
* include/cygwin/version.h: Bump API minor number.

winsup/cygwin/ChangeLog
winsup/cygwin/cygwin.din
winsup/cygwin/include/cygwin/version.h
winsup/cygwin/posix.sgml
winsup/cygwin/sysconf.cc

index 6dd0e02..f974f79 100644 (file)
@@ -1,3 +1,10 @@
+2007-06-11  Corinna Vinschen  <corinna@vinschen.de>
+
+       * cygwin.din (confstr): Export.
+       * posix.sgml (confstr): Move to list of implemented SUSv3 functions.
+       * sysconf.cc (confstr): Implement.
+       * include/cygwin/version.h: Bump API minor number.
+
 2007-06-05  Corinna Vinschen  <corinna@vinschen.de>
 
        * ansi.sgml: Delete.
index eb982f7..2e64d2b 100644 (file)
@@ -195,6 +195,7 @@ _close = close SIGFE
 closedir SIGFE
 _closedir = closedir SIGFE
 closelog SIGFE
+confstr SIGFE
 connect = cygwin_connect SIGFE
 copysign NOSIGFE
 _copysign = copysign NOSIGFE
index bbee742..49ad569 100644 (file)
@@ -308,12 +308,13 @@ details. */
       166: Export sem_unlink.
       167: Add st_birthtim to struct stat.
       168: Export asnprintf, dprintf, _Exit, vasnprintf, vdprintf.
+      169: Export confstr.
      */
 
      /* Note that we forgot to bump the api for ualarm, strtoll, strtoull */
 
 #define CYGWIN_VERSION_API_MAJOR 0
-#define CYGWIN_VERSION_API_MINOR 168
+#define CYGWIN_VERSION_API_MINOR 169
 
      /* There is also a compatibity version number associated with the
        shared memory regions.  It is incremented when incompatible
index 5e9a60b..d236989 100644 (file)
@@ -75,6 +75,7 @@ also ISO/IEC 9945:2003 and IEEE Std 1003.1-2001 (POSIX.1-2001).</para>
     close
     closedir
     closelog
+    confstr
     connect
     copysign
     copysignf
@@ -1070,7 +1071,6 @@ also ISO/IEC 9945:2003 and IEEE Std 1003.1-2001 (POSIX.1-2001).</para>
     clog
     clogf
     clogl
-    confstr
     conj
     conjf
     conjl
index 64f5bfa..dddf2c3 100644 (file)
@@ -248,3 +248,51 @@ sysconf (int in)
   set_errno (EINVAL);
   return -1L;
 }
+
+#define ls(s)  sizeof(s),s
+
+static struct
+{
+  size_t l;
+  const char *s;
+} csa[] =
+{
+  {ls ("/bin:/usr/bin")},              /* _CS_PATH */
+  {0, NULL},                           /* _CS_POSIX_V6_ILP32_OFF32_CFLAGS */
+  {0, NULL},                           /* _CS_POSIX_V6_ILP32_OFF32_LDFLAGS */
+  {0, NULL},                           /* _CS_POSIX_V6_ILP32_OFF32_LIBS */
+  {0, NULL},                           /* _CS_POSIX_V6_ILP32_OFF32_LINTFLAGS */
+  {ls ("")},                           /* _CS_POSIX_V6_ILP32_OFFBIG_CFLAGS */
+  {ls ("")},                           /* _CS_POSIX_V6_ILP32_OFFBIG_LDFLAGS */
+  {ls ("")},                           /* _CS_POSIX_V6_ILP32_OFFBIG_LIBS */
+  {ls ("")},                           /* _CS_XBS5_ILP32_OFFBIG_LINTFLAGS */
+  {0, NULL},                           /* _CS_POSIX_V6_LP64_OFF64_CFLAGS */
+  {0, NULL},                           /* _CS_POSIX_V6_LP64_OFF64_LDFLAGS */
+  {0, NULL},                           /* _CS_POSIX_V6_LP64_OFF64_LIBS */
+  {0, NULL},                           /* _CS_XBS5_LP64_OFF64_LINTFLAGS */
+  {0, NULL},                           /* _CS_POSIX_V6_LPBIG_OFFBIG_CFLAGS */
+  {0, NULL},                           /* _CS_POSIX_V6_LPBIG_OFFBIG_LDFLAGS */
+  {0, NULL},                           /* _CS_POSIX_V6_LPBIG_OFFBIG_LIBS */
+  {0, NULL},                           /* _CS_XBS5_LPBIG_OFFBIG_LINTFLAGS */
+  {ls ("POSIX_V6_ILP32_OFFBIG")},      /* _CS_POSIX_V6_WIDTH_RESTRICTED_ENVS */
+};
+
+#define CS_MIN _CS_PATH
+#define CS_MAX _CS_POSIX_V6_WIDTH_RESTRICTED_ENVS
+
+extern "C" size_t
+confstr (int in, char *buf, size_t len)
+{
+  if (in >= CS_MIN && in <= CS_MAX)
+    {
+      if (csa[in].l && len)
+       {
+         buf[0] = 0;
+         strncat (buf, csa[in].s, min (len, csa[in].l) - 1);
+       }
+      return csa[in].l;
+    }
+  /* Invalid option value. */
+  set_errno (EINVAL);
+  return 0;
+}