summaryrefslogtreecommitdiffstats
path: root/usr.bin
diff options
context:
space:
mode:
authorwollman <wollman@FreeBSD.org>1995-02-21 04:32:55 +0000
committerwollman <wollman@FreeBSD.org>1995-02-21 04:32:55 +0000
commit964a1c2ea7c3611e8c92911449119b0ad54d962c (patch)
tree08a6a4d6eb0fa78318a52fa2c864b54da33c9dc7 /usr.bin
parent5bf42927dd153c0fd8170469df2ce5c12c599448 (diff)
downloadFreeBSD-src-964a1c2ea7c3611e8c92911449119b0ad54d962c.zip
FreeBSD-src-964a1c2ea7c3611e8c92911449119b0ad54d962c.tar.gz
Use POSIX.2 regular expressions, kill libcompat.
Diffstat (limited to 'usr.bin')
-rw-r--r--usr.bin/rdist/Makefile2
-rw-r--r--usr.bin/rdist/docmd.c17
-rw-r--r--usr.bin/rdist/gram.y21
-rw-r--r--usr.bin/rdist/rdist.15
4 files changed, 32 insertions, 13 deletions
diff --git a/usr.bin/rdist/Makefile b/usr.bin/rdist/Makefile
index 4b60c6b..853439c 100644
--- a/usr.bin/rdist/Makefile
+++ b/usr.bin/rdist/Makefile
@@ -7,8 +7,6 @@ OBJS+= gram.o
BINOWN= root
BINMODE=4555
INSTALLFLAGS=-fschg
-DPADD= ${LIBCOMPAT}
-LDADD= -lcompat
CLEANFILES=y.tab.h
.include <bsd.prog.mk>
diff --git a/usr.bin/rdist/docmd.c b/usr.bin/rdist/docmd.c
index 0422a37..39a9d5d 100644
--- a/usr.bin/rdist/docmd.c
+++ b/usr.bin/rdist/docmd.c
@@ -32,12 +32,15 @@
*/
#ifndef lint
-static char sccsid[] = "@(#)docmd.c 8.1 (Berkeley) 6/9/93";
+/*static char sccsid[] = "From: @(#)docmd.c 8.1 (Berkeley) 6/9/93";*/
+static const char rcsid[] =
+ "$Id$";
#endif /* not lint */
#include "defs.h"
#include <setjmp.h>
#include <netdb.h>
+#include <regex.h>
FILE *lfp; /* log file for recording files updated */
struct subcmd *subcmds; /* list of sub-commands for current cmd */
@@ -592,6 +595,8 @@ except(file)
{
register struct subcmd *sc;
register struct namelist *nl;
+ regex_t rx;
+ int val;
if (debug)
printf("except(%s)\n", file);
@@ -605,9 +610,13 @@ except(file)
return(1);
continue;
}
- re_comp(nl->n_name);
- if (re_exec(file) > 0)
- return(1);
+ val = regcomp(&rx, nl->n_name,
+ REG_EXTENDED | REG_NOSUB);
+ if (!regexec(&rx, file, 0, 0, 0)) {
+ regfree(&rx);
+ return 1;
+ }
+ regfree(&rx);
}
}
return(0);
diff --git a/usr.bin/rdist/gram.y b/usr.bin/rdist/gram.y
index 7f40f87..6e54911 100644
--- a/usr.bin/rdist/gram.y
+++ b/usr.bin/rdist/gram.y
@@ -37,6 +37,9 @@ static char sccsid[] = "@(#)gram.y 8.1 (Berkeley) 6/9/93";
#endif /* not lint */
#include "defs.h"
+#include <sys/types.h>
+#include <regex.h>
+#include <limits.h>
struct cmd *cmds = NULL;
struct cmd *last_cmd;
@@ -163,11 +166,19 @@ cmd: INSTALL options opt_namelist SM = {
}
| PATTERN namelist SM = {
struct namelist *nl;
- char *cp, *re_comp();
-
- for (nl = $2; nl != NULL; nl = nl->n_next)
- if ((cp = re_comp(nl->n_name)) != NULL)
- yyerror(cp);
+ regex_t rx;
+ int val;
+ char errbuf[_POSIX2_LINE_MAX];
+
+ for (nl = $2; nl != NULL; nl = nl->n_next) {
+ if (val = regcomp(&rx, nl->n_name,
+ REG_EXTENDED)) {
+ regerror(val, &rx, errbuf,
+ sizeof errbuf);
+ yyerror(errbuf);
+ }
+ regfree(&rx);
+ }
$1->sc_args = expand($2, E_VARS);
$$ = $1;
}
diff --git a/usr.bin/rdist/rdist.1 b/usr.bin/rdist/rdist.1
index 9ae17e9..00a3339 100644
--- a/usr.bin/rdist/rdist.1
+++ b/usr.bin/rdist/rdist.1
@@ -308,7 +308,7 @@ command except that
.Ar pattern list
is a list of regular expressions
(see
-.Xr ed 1
+.Xr re_format 7
for details).
If one of the patterns matches some string within a file name, that file will
be ignored.
@@ -384,7 +384,8 @@ temporary file for update lists
.Sh SEE ALSO
.Xr sh 1 ,
.Xr csh 1 ,
-.Xr stat 2
+.Xr stat 2 ,
+.Xr re_format 7
.Sh HISTORY
The
.Nm rdist
OpenPOWER on IntegriCloud