regex.c revision 7c478bd95313f5f23a4c958a745db2134aa03244
/*
* CDDL HEADER START
*
* The contents of this file are subject to the terms of the
* Common Development and Distribution License, Version 1.0 only
* (the "License"). You may not use this file except in compliance
* with the License.
*
* You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
* See the License for the specific language governing permissions
* and limitations under the License.
*
* When distributing Covered Code, include this CDDL HEADER in each
* file and include the License file at usr/src/OPENSOLARIS.LICENSE.
* If applicable, add the following below this CDDL HEADER, with the
* fields enclosed by brackets "[]" replaced with your own identifying
* information: Portions Copyright [yyyy] [name of copyright owner]
*
* CDDL HEADER END
*/
/* Copyright (c) 1988 AT&T */
/* All Rights Reserved */
/*
* Copyright 2004 Sun Microsystems, Inc. All rights reserved.
* Use is subject to license terms.
*/
#pragma ident "%Z%%M% %I% %E% SMI"
/*LINTLIBRARY*/
#include <stdlib.h>
#include <unistd.h>
#include "utility.h"
/*
* this code was taken from REGCMP(3X)
*/
/*VARARGS*/
/*ARGSUSED*/
#define SSIZE 50
#define TGRP 48
#define A256 01
#define A512 02
#define A768 03
#define NBRA 10
#define CIRCFL 32
#define CBRA 60
#define GRP 40
#define SGRP 56
#define PGRP 68
#define EGRP 44
#define RNGE 03
#define CCHR 20
#define CDOT 64
#define CCL 24
#define NCCL 8
#define CDOL 28
/* definition so it was changed to FCEOF */
#define CKET 12
#define STAR 01
#define PLUS 02
#define MINUS 16
char *__braslist[NBRA];
char *__braelist[NBRA];
char *__loc1;
char *
{
__braslist[in] = 0;
}
__cflg = 0;
*p2 = '\0';
}
}
if (!__cflg)
else
return ((char *)cur);
}
{
intptr_t i;
}
/* fast check for first character */
c = p2[1];
do {
if (*p1 != c)
continue;
return (i);
}
} while (*p1++);
}
/* regular algorithm */
do {
return (i);
}
} while (*p1++);
}
{
gflg = 0;
for (; ; ) {
switch (*ep++) {
case CCHR:
continue;
return (0);
case EGRP:
case GRP:
ep++;
continue;
(void) __xpop(0);
case CDOT:
if (*lp++)
continue;
return (0);
case CDOL:
if (*lp == 0)
continue;
lp++;
return (0);
case FCEOF:
__cflg = 1;
case TGRP:
ep++;
gflg = 1;
while (lcnt--)
return (0);
while (dcnt--)
else
goto star;
while (lcnt--)
return (0);
while (dcnt--)
ep += 2;
goto star;
while (lcnt--)
if (*lp++ == '\0')
return (0);
while (dcnt--)
if (*lp++ == '\0') break;
ep += 2;
goto star;
while (lcnt--)
return (0);
while (dcnt--)
break;
goto star;
case CCL:
continue;
}
return (0);
case NCCL:
continue;
}
return (0);
case CBRA:
continue;
case CKET:
ep += 2;
continue;
if (*lp++ == '\0')
return (0);
while (*lp++);
goto star;
return (0);
ep++;
goto star;
case PGRP:
return (0);
case SGRP:
ep++;
gflg = 1;
goto star;
return (0);
goto star;
star:
do {
return (i);
return (0);
default:
return (0);
}
}
}
{
char *set, c;
intptr_t n;
if ((c = ac) == 0)
return (0);
n = *set++;
while (--n) {
return (0);
if (*++set <= c) {
if (c <= *++set)
return (af);
} else
++set;
++set;
n -= 2;
continue;
}
if (*set++ == c)
return (af);
}
return (!af);
}
{
(void) exit(1);
}
if (i)
else
return (1);
}
{
if (i)
else
}
{
*i = (*k++&0377);
if (*k == (char)-1)
*j = 20000;
else
*j = ((*k&0377) - *i);
return (1);
}