summaryrefslogtreecommitdiff
path: root/usr.sbin/amd
diff options
context:
space:
mode:
authorTed Unangst <tedu@cvs.openbsd.org>2010-07-05 21:54:12 +0000
committerTed Unangst <tedu@cvs.openbsd.org>2010-07-05 21:54:12 +0000
commit2e87b7ee142639249253c1fba9d51d0101953496 (patch)
treeed1303bbb1ec2dafd19efead8c2484219d5daf20 /usr.sbin/amd
parente390ddfdc31768aad8e77c640893c709738970cf (diff)
convert last user of libcompat in base to modern regexes. ok deraadt
Diffstat (limited to 'usr.sbin/amd')
-rw-r--r--usr.sbin/amd/amd/Makefile5
-rw-r--r--usr.sbin/amd/amd/mapc.c23
-rw-r--r--usr.sbin/amd/config/os-bsd44.h4
3 files changed, 12 insertions, 20 deletions
diff --git a/usr.sbin/amd/amd/Makefile b/usr.sbin/amd/amd/Makefile
index 1f9f1dccc6f..9ae1530b5d6 100644
--- a/usr.sbin/amd/amd/Makefile
+++ b/usr.sbin/amd/amd/Makefile
@@ -1,5 +1,5 @@
# from: @(#)Makefile 8.2 (Berkeley) 4/22/94
-# $Id: Makefile,v 1.2 2005/02/18 15:51:02 henning Exp $
+# $Id: Makefile,v 1.3 2010/07/05 21:54:11 tedu Exp $
.include "../config/Makefile.config"
@@ -23,9 +23,6 @@ CFLAGS+=-DOS_REP=\"${OS}\"
CFLAGS+=-DOS_HDR=\"os-${OS}.h\"
CFLAGS+=${CONFIG}
-DPADD+= ${LIBCOMPAT}
-LDADD+= -lcompat
-
.PATH: ${.CURDIR}/../rpcx ${.CURDIR}/../config
.include "../../Makefile.inc"
.include <bsd.prog.mk>
diff --git a/usr.sbin/amd/amd/mapc.c b/usr.sbin/amd/amd/mapc.c
index 2d41bf39a27..8760fd22757 100644
--- a/usr.sbin/amd/amd/mapc.c
+++ b/usr.sbin/amd/amd/mapc.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: mapc.c,v 1.13 2009/10/27 23:59:50 deraadt Exp $ */
+/* $OpenBSD: mapc.c,v 1.14 2010/07/05 21:54:11 tedu Exp $ */
/*-
* Copyright (c) 1989 Jan-Simon Pendry
@@ -275,13 +275,6 @@ mapc_showtypes(FILE *fp)
}
}
-static const char *reg_error = "?";
-void
-regerror(const char *m)
-{
- reg_error = m;
-}
-
/*
* Add key and val to the map m.
* key and val are assumed to be safe copies
@@ -300,18 +293,19 @@ mapc_add_kv(mnt_map *m, char *key, char *val)
#ifdef HAS_REGEXP
if (MAPC_ISRE(m)) {
char keyb[MAXPATHLEN];
- regexp *re;
+ regex_t *re;
/*
* Make sure the string is bound to the start and end
*/
snprintf(keyb, sizeof(keyb), "^%s$", key);
- re = regcomp(keyb);
- if (re == 0) {
- plog(XLOG_USER, "error compiling RE \"%s\": %s", keyb, reg_error);
+ re = malloc(sizeof(*re));
+ if (!re || regcomp(re, keyb, 0)) {
+ free(re);
+ plog(XLOG_USER, "error compiling RE \"%s\": %s", keyb);
return;
} else {
free(key);
- key = (char *) re;
+ key = (char *)re;
}
}
#endif
@@ -624,7 +618,8 @@ mapc_meta_search(mnt_map *m, char *key, char **pval, int recurse)
for (i = 0; i < NKVHASH; i++) {
k = m->kvhash[i];
while (k) {
- if (regexec((regexp *) k->key, key))
+ if (regexec((regex_t *)k->key, key,
+ 0, NULL, 0) == 0)
break;
k = k->next;
}
diff --git a/usr.sbin/amd/config/os-bsd44.h b/usr.sbin/amd/config/os-bsd44.h
index 8345291000f..ca5901bf77c 100644
--- a/usr.sbin/amd/config/os-bsd44.h
+++ b/usr.sbin/amd/config/os-bsd44.h
@@ -1,4 +1,4 @@
-/* $OpenBSD: os-bsd44.h,v 1.8 2003/06/02 23:36:52 millert Exp $ */
+/* $OpenBSD: os-bsd44.h,v 1.9 2010/07/05 21:54:11 tedu Exp $ */
/*
* Copyright (c) 1990 Jan-Simon Pendry
@@ -190,7 +190,7 @@ struct mntent {
* 4.4 has RE support built in
*/
#undef RE_HDR
-#define RE_HDR <regexp.h>
+#define RE_HDR <regex.h>
/*
* Need precise length links