IBM / portlibfori

A set of APIs to enable applications to be more easily ported to PASE on IBM i
Other
8 stars 7 forks source link

Implement FNM_CASEFOLD for the fnmatch function #32

Closed markdirish closed 2 months ago

markdirish commented 4 months ago
markdirish commented 4 months ago

Created a test file to ensure that, when linking against libutil.so, programs can use FNM_CASEFOLD:

#include <fnmatch.h>
#include <stdio.h>

int main(int argc, char *argv[])
{
  const char *pattern = "abcdefgh";
  const char *string  = "AbCdEfGh";

  int result = fnmatch(pattern, string, 0);

  printf("Result is: %d\nExpected value: %d\n", result, FNM_NOMATCH);

  result = fnmatch(pattern, string, FNM_CASEFOLD);

  printf("Result is: %d\nExpected value: %d\n", result, 0);

  return 0;
}
$ ./fnmatchtest 
Result is: 1
Expected value: 1
Result is: 0
Expected value: 0