Changeset 3532 for trunk/src/grep/lib


Ignore:
Timestamp:
Dec 20, 2021, 11:51:05 PM (4 years ago)
Author:
bird
Message:

grep: Initial windows config and adjustments.

Location:
trunk/src/grep/lib
Files:
2 added
7 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/grep/lib/binary-io.h

    r3529 r3532  
    3939#  define __gl_setmode setmode
    4040# else
     41#  ifdef KMK_GREP
     42#   include <io.h> /* declares _setmode() */
     43#  endif
    4144#  define __gl_setmode _setmode
    4245#  undef fileno
  • trunk/src/grep/lib/dfa.c

    r3529 r3532  
    297297  RPAREN,                       /* RPAREN never appears in the parse tree.  */
    298298
     299#if defined(KMK_GREP) && defined(KBUILD_OS_WINDOWS)
     300# define WCHAR DFA_WCHAR
     301#endif
    299302  WCHAR,                        /* Only returned by lex.  wctok contains
    300303                                   the wide character representation.  */
  • trunk/src/grep/lib/dup-safer-flag.c

    r3529 r3532  
    3434dup_safer_flag (int fd, int flag)
    3535{
     36#if defined(KMK_GREP) && defined(_MSC_VER)
     37  int afd[STDERR_FILENO + 1];
     38  int i;
     39  for (i = 0; ; i++)
     40    {
     41      int fdNew = _dup(fd);
     42      if (fdNew >= STDERR_FILENO + 1 || fdNew < 0)
     43        {
     44          while (i-- > 0)
     45            close(afd[i]);
     46          return fdNew;
     47        }
     48      afd[i] = fdNew;
     49    }
     50#else
    3651  return fcntl (fd, (flag & O_CLOEXEC) ? F_DUPFD_CLOEXEC : F_DUPFD,
    3752                STDERR_FILENO + 1);
     53#endif
    3854}
  • trunk/src/grep/lib/dup-safer.c

    r3529 r3532  
    3131dup_safer (int fd)
    3232{
     33#if defined(KMK_GREP) && defined(_MSC_VER)
     34  int afd[STDERR_FILENO + 1];
     35  int i;
     36  for (i = 0; ; i++)
     37    {
     38      int fdNew = _dup(fd);
     39      if (fdNew >= STDERR_FILENO + 1 || fdNew < 0)
     40        {
     41          while (i-- > 0)
     42            close(afd[i]);
     43          return fdNew;
     44        }
     45      afd[i] = fdNew;
     46    }
     47#else
    3348  return fcntl (fd, F_DUPFD, STDERR_FILENO + 1);
     49#endif
    3450}
  • trunk/src/grep/lib/fnmatch.in.h

    r3529 r3532  
    3434
    3535/* The definitions of _GL_FUNCDECL_RPL etc. are copied here.  */
     36#if defined(KMK_GREP)
     37# include "c++defs.h"
     38#endif
    3639
    3740/* The definition of _GL_ARG_NONNULL is copied here.  */
     41#if defined(KMK_GREP)
     42# include "arg-nonnull.h"
     43#endif
    3844
    3945/* The definition of _GL_WARN_ON_USE is copied here.  */
  • trunk/src/grep/lib/regcomp.c

    r3529 r3532  
    880880                       != 0);
    881881#else
     882# ifdef _MSC_VER
     883  (void)codeset_name;
     884  if (GetACP() == 65001 /*utf-8*/)
     885# else
    882886  codeset_name = nl_langinfo (CODESET);
    883887  if ((codeset_name[0] == 'U' || codeset_name[0] == 'u')
     
    885889      && (codeset_name[2] == 'F' || codeset_name[2] == 'f')
    886890      && strcmp (codeset_name + 3 + (codeset_name[3] == '-'), "8") == 0)
     891# endif
    887892    dfa->is_utf8 = 1;
    888893
  • trunk/src/grep/lib/regex_internal.h

    r3529 r3532  
    2626#include <string.h>
    2727
     28#if !defined(KMK_GREP) || !defined(_MSC_VER)
    2829#include <langinfo.h>
     30#endif
    2931#include <locale.h>
    3032#include <wchar.h>
Note: See TracChangeset for help on using the changeset viewer.