version 1.1.1.1, 1996/09/21 05:39:44 |
version 1.1.1.2, 2003/04/13 18:21:21 |
|
|
* |
* |
* *** NOTE: this code has been altered slightly for use in Tcl. *** |
* *** NOTE: this code has been altered slightly for use in Tcl. *** |
* Slightly modified by David MacKenzie to undo most of the changes for TCL. |
* Slightly modified by David MacKenzie to undo most of the changes for TCL. |
|
* Added regexec2 with notbol parameter. -- 4/19/99 Mark Nudelman |
*/ |
*/ |
|
|
|
#include "less.h" |
|
#if HAVE_STDIO_H |
#include <stdio.h> |
#include <stdio.h> |
|
#endif |
|
#if HAVE_STDLIB_H |
|
#include <stdlib.h> |
|
#endif |
|
#if HAVE_STRING_H |
|
#include <string.h> |
|
#endif |
#include "regexp.h" |
#include "regexp.h" |
char *strchr(); |
|
|
|
/* |
/* |
* The "internal use only" fields in regexp.h are present to pass info from |
* The "internal use only" fields in regexp.h are present to pass info from |
|
|
*/ |
*/ |
|
|
/* definition number opnd? meaning */ |
/* definition number opnd? meaning */ |
|
#undef EOL |
#define END 0 /* no End of program. */ |
#define END 0 /* no End of program. */ |
#define BOL 1 /* no Match "" at beginning of line. */ |
#define BOL 1 /* no Match "" at beginning of line. */ |
#define EOL 2 /* no Match "" at end of line. */ |
#define EOL 2 /* no Match "" at end of line. */ |
|
|
- regexec - match a regexp against a string |
- regexec - match a regexp against a string |
*/ |
*/ |
int |
int |
regexec(prog, string) |
regexec2(prog, string, notbol) |
register regexp *prog; |
register regexp *prog; |
register char *string; |
register char *string; |
|
int notbol; |
{ |
{ |
register char *s; |
register char *s; |
|
|
|
|
} |
} |
|
|
/* Mark beginning of line for ^ . */ |
/* Mark beginning of line for ^ . */ |
regbol = string; |
if (notbol) |
|
regbol = NULL; |
|
else |
|
regbol = string; |
|
|
/* Simplest case: anchored match need be tried only once. */ |
/* Simplest case: anchored match need be tried only once. */ |
if (prog->reganch) |
if (prog->reganch) |
|
|
|
|
/* Failure. */ |
/* Failure. */ |
return(0); |
return(0); |
|
} |
|
|
|
int |
|
regexec(prog, string) |
|
register regexp *prog; |
|
register char *string; |
|
{ |
|
return regexec2(prog, string, 0); |
} |
} |
|
|
/* |
/* |