Add _PC_CASE_INSENSITIVE flag to pathconf

classic Classic list List threaded Threaded
2 messages Options
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Add _PC_CASE_INSENSITIVE flag to pathconf

Ken Brown-6
Patch attached.

I tested it by running getconf.exe, and also as follows:

$ cat case_sens_test.c
#include <unistd.h>
#include <stdio.h>

void
test (const char *path)
{
   int ret = pathconf (path, _PC_CASE_INSENSITIVE);
   printf ("pathconf (\"%s\", _PC_CASE_INSENSITIVE) returns %d\n", path,
ret);
   if (ret == -1)
     perror ("  pathconf");
}

int
main ()
{
   test ("/tmp");
   test ("/tmp/a");
   test ("/cygdrive/c/cygwin");
   test ("/");
   test (".");
}

$ gcc case_sens_test.c

$ ./a
pathconf ("/tmp", _PC_CASE_INSENSITIVE) returns 0
pathconf ("/tmp/a", _PC_CASE_INSENSITIVE) returns -1
   pathconf: No such file or directory
pathconf ("/cygdrive/c/cygwin", _PC_CASE_INSENSITIVE) returns 1
pathconf ("/", _PC_CASE_INSENSITIVE) returns 0
pathconf (".", _PC_CASE_INSENSITIVE) returns 0

This test was done, obviously, on a system with the obcaseinsensitive
registry key set to 0, and with /tmp/a non-existent.  I also tested with
the registry key set to 1, with the expected results.

Ken

0001-Add-_PC_CASE_INSENSITIVE-to-f-pathconf.patch (5K) Download Attachment
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: Add _PC_CASE_INSENSITIVE flag to pathconf

Corinna Vinschen-2
On Oct 20 15:54, Ken Brown wrote:

> Patch attached.
>
> I tested it by running getconf.exe, and also as follows:
>
> $ cat case_sens_test.c
> #include <unistd.h>
> #include <stdio.h>
>
> void
> test (const char *path)
> {
>   int ret = pathconf (path, _PC_CASE_INSENSITIVE);
>   printf ("pathconf (\"%s\", _PC_CASE_INSENSITIVE) returns %d\n", path,
> ret);
>   if (ret == -1)
>     perror ("  pathconf");
> }
>
> int
> main ()
> {
>   test ("/tmp");
>   test ("/tmp/a");
>   test ("/cygdrive/c/cygwin");
>   test ("/");
>   test (".");
> }
>
> $ gcc case_sens_test.c
>
> $ ./a
> pathconf ("/tmp", _PC_CASE_INSENSITIVE) returns 0
> pathconf ("/tmp/a", _PC_CASE_INSENSITIVE) returns -1
>   pathconf: No such file or directory
> pathconf ("/cygdrive/c/cygwin", _PC_CASE_INSENSITIVE) returns 1
> pathconf ("/", _PC_CASE_INSENSITIVE) returns 0
> pathconf (".", _PC_CASE_INSENSITIVE) returns 0
>
> This test was done, obviously, on a system with the obcaseinsensitive
> registry key set to 0, and with /tmp/a non-existent.  I also tested with the
> registry key set to 1, with the expected results.
>
> Ken
Thanks Ken.  Patch applied.


Corinna

--
Corinna Vinschen                  Please, send mails regarding Cygwin to
Cygwin Maintainer                 cygwin AT cygwin DOT com
Red Hat

signature.asc (836 bytes) Download Attachment
Loading...