summaryrefslogtreecommitdiff
path: root/textproc/nbsed/files/compile.c
diff options
context:
space:
mode:
authorjlam <jlam>2004-08-21 08:39:54 +0000
committerjlam <jlam>2004-08-21 08:39:54 +0000
commit1d8bcd8ca30285a26bfd780770544c3a34182f97 (patch)
tree37507e58e3b6de60fd74a6f04ca44378baa93067 /textproc/nbsed/files/compile.c
parenta179647a6e0b46ae251e3140f0ea785e5389c1ac (diff)
downloadpkgsrc-1d8bcd8ca30285a26bfd780770544c3a34182f97.tar.gz
Update textproc/nbsed to 20040821 (date of import from src HEAD).
Changes from the previous version include: - Adding a sed2nbcompat script to ease importing from src HEAD into pkgsrc. - Make this package depend on libnbcompat since it needs a regex implementation and it's also a bootstrap package. * s/xmalloc/xrealloc/ so that large (greater than _POSIX2_LINE_MAX*2-1) multi line text can be added.
Diffstat (limited to 'textproc/nbsed/files/compile.c')
-rw-r--r--textproc/nbsed/files/compile.c37
1 files changed, 24 insertions, 13 deletions
diff --git a/textproc/nbsed/files/compile.c b/textproc/nbsed/files/compile.c
index 68798d9dae6..84843905b6c 100644
--- a/textproc/nbsed/files/compile.c
+++ b/textproc/nbsed/files/compile.c
@@ -1,4 +1,4 @@
-/* $NetBSD: compile.c,v 1.5 2004/07/25 05:40:08 grant Exp $ */
+/* $NetBSD: compile.c,v 1.6 2004/08/21 08:39:54 jlam Exp $ */
/*-
* Copyright (c) 1992, 1993
@@ -67,41 +67,52 @@
* SUCH DAMAGE.
*/
+#if HAVE_CONFIG_H
#include "config.h"
-
-#ifdef HAVE_SYS_CDEFS_H
+#endif
+#include <nbcompat.h>
+#if HAVE_SYS_CDEFS_H
#include <sys/cdefs.h>
#endif
-
#ifndef lint
#if 0
static char sccsid[] = "@(#)compile.c 8.2 (Berkeley) 4/28/95";
#else
-__RCSID("$NetBSD: compile.c,v 1.5 2004/07/25 05:40:08 grant Exp $");
+__RCSID("$NetBSD: compile.c,v 1.6 2004/08/21 08:39:54 jlam Exp $");
#endif
#endif /* not lint */
+#if HAVE_SYS_TYPES_H
#include <sys/types.h>
+#endif
+#if HAVE_SYS_STAT_H
#include <sys/stat.h>
+#endif
+#if HAVE_CTYPE_H
#include <ctype.h>
+#endif
+#if HAVE_ERRNO_H
#include <errno.h>
-
-#ifdef HAVE_FCNTL_H
+#endif
+#if HAVE_FCNTL_H
#include <fcntl.h>
#endif
-
-#ifdef HAVE_LIMITS_H
+#if HAVE_LIMITS_H
#include <limits.h>
#endif
-
-#ifdef HAVE_REGEX_H
+#if HAVE_REGEX_H
#include <regex.h>
#endif
-
+#if HAVE_STDIO_H
#include <stdio.h>
+#endif
+#if HAVE_STDLIB_H
#include <stdlib.h>
+#endif
+#if HAVE_STRING_H
#include <string.h>
+#endif
#include "defs.h"
#include "extern.h"
@@ -559,7 +570,7 @@ compile_subst(char *p, struct s_subst *s)
size += sp - op;
if (asize - size < _POSIX2_LINE_MAX + 1) {
asize *= 2;
- text = xmalloc(asize);
+ text = xrealloc(text, asize);
}
} while (cu_fgets(p = lbuf, sizeof(lbuf)));
err(COMPILE, "unterminated substitute in regular expression");