Print this page
remove support for non-ANSI compilation

Split Close
Expand all
Collapse all
          --- old/usr/src/head/regexp.h
          +++ new/usr/src/head/regexp.h
↓ open down ↓ 13 lines elided ↑ open up ↑
  14   14   * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
  15   15   * If applicable, add the following below this CDDL HEADER, with the
  16   16   * fields enclosed by brackets "[]" replaced with your own identifying
  17   17   * information: Portions Copyright [yyyy] [name of copyright owner]
  18   18   *
  19   19   * CDDL HEADER END
  20   20   */
  21   21  /*      Copyright (c) 1988 AT&T */
  22   22  /*        All Rights Reserved   */
  23   23  
  24      -
  25   24  /*
       25 + * Copyright 2014 Garrett D'Amore <garrett@damore.org>
       26 + *
  26   27   * Copyright 2006 Sun Microsystems, Inc.  All rights reserved.
  27   28   * Use is subject to license terms.
  28   29   */
  29   30  
  30   31  #ifndef _REGEXP_H
  31   32  #define _REGEXP_H
  32   33  
  33      -#pragma ident   "%Z%%M% %I%     %E% SMI"        /* SVr4.0 1.9   */
  34      -
  35   34  #include <string.h>
  36   35  
  37   36  #ifdef  __cplusplus
  38   37  extern "C" {
  39   38  #endif
  40   39  
  41   40  #define CBRA    2
  42   41  #define CCHR    4
  43   42  #define CDOT    8
  44   43  #define CCL     12
↓ open down ↓ 18 lines elided ↑ open up ↑
  63   62  int     sed, nbra;
  64   63  char    *loc1, *loc2, *locs;
  65   64  static int      nodelim;
  66   65  
  67   66  int     circf;
  68   67  static int      low;
  69   68  static int      size;
  70   69  
  71   70  static unsigned char    bittab[] = { 1, 2, 4, 8, 16, 32, 64, 128 };
  72   71  
  73      -#ifdef  __STDC__
  74   72  int advance(const char *lp, const char *ep);
  75   73  static void getrnge(const char *str);
  76      -#else
  77      -int advance();
  78      -static void getrnge();
  79      -#endif
  80   74  
  81   75  char *
  82      -#ifdef  __STDC__
  83   76  compile(char *instring, char *ep, const char *endbuf, int seof)
  84      -#else
  85      -compile(instring, ep, endbuf, seof)
  86      -register char *ep;
  87      -char *instring, *endbuf;
  88      -int seof;
  89      -#endif
  90   77  {
  91   78          INIT    /* Dependent declarations and initializations */
  92   79          register int c;
  93   80          register int eof = seof;
  94   81          char *lastep;
  95   82          int cclcnt;
  96   83          char bracket[NBRA], *bracketp;
  97   84          int closed;
  98   85          int neg;
  99   86          int lc;
↓ open down ↓ 208 lines elided ↑ open up ↑
 308  295                  defchar:
 309  296                  default:
 310  297                          lastep = ep;
 311  298                          *ep++ = CCHR;
 312  299                          *ep++ = (char)c;
 313  300                  }
 314  301          }
 315  302          /*NOTREACHED*/
 316  303  }
 317  304  
 318      -#ifdef  __STDC__
 319  305  int
 320  306  step(const char *p1, const char *p2)
 321      -#else
 322      -int
 323      -step(p1, p2)
 324      -register char *p1, *p2;
 325      -#endif
 326  307  {
 327  308          char c;
 328  309  
 329  310  
 330  311          if (circf) {
 331  312                  loc1 = (char *)p1;
 332  313                  return (advance(p1, p2));
 333  314          }
 334  315          /* fast check for first character */
 335  316          if (*p2 == CCHR) {
↓ open down ↓ 12 lines elided ↑ open up ↑
 348  329          do {
 349  330                  if (advance(p1, p2)) {
 350  331                          loc1 = (char *)p1;
 351  332                          return (1);
 352  333                  }
 353  334          } while (*p1++);
 354  335          return (0);
 355  336  }
 356  337  
 357  338  int
 358      -#ifdef  __STDC__
 359  339  advance(const char *lp, const char *ep)
 360      -#else
 361      -advance(lp, ep)
 362      -register char *lp, *ep;
 363      -#endif
 364  340  {
 365      -#ifdef  __STDC__
 366  341          const char *curlp;
 367      -#else
 368      -        register char *curlp;
 369      -#endif
 370  342          int c;
 371  343          char *bbeg;
 372  344          register char neg;
 373  345          size_t ct;
 374  346  
 375  347          for (;;) {
 376  348                  neg = 0;
 377  349                  switch (*ep++) {
 378  350  
 379  351                  case CCHR:
↓ open down ↓ 193 lines elided ↑ open up ↑
 573  545                                          return (1);
 574  546                          } while (lp > curlp);
 575  547                          return (0);
 576  548  
 577  549                  }
 578  550          }
 579  551          /*NOTREACHED*/
 580  552  }
 581  553  
 582  554  static void
 583      -#ifdef  __STDC__
 584  555  getrnge(const char *str)
 585      -#else
 586      -getrnge(str)
 587      -register char *str;
 588      -#endif
 589  556  {
 590  557          low = *str++ & 0377;
 591  558          size = ((*str & 0377) == 255)? 20000: (*str &0377) - low;
 592  559  }
 593  560  
 594  561  #ifdef  __cplusplus
 595  562  }
 596  563  #endif
 597  564  
 598  565  #endif  /* _REGEXP_H */
    
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX