summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJim Meyering <jim@meyering.net>1995-05-20 13:11:40 +0000
committerJim Meyering <jim@meyering.net>1995-05-20 13:11:40 +0000
commitd3ff3a6a6d1bab294ff8188533a78cbab116f0a5 (patch)
tree0cd701b6fee6deb561a985eb2310c7244ca4394a
parent3b5897b0a415b6628f6c13a992dd4c9fd259fa5d (diff)
downloadgnulib-d3ff3a6a6d1bab294ff8188533a78cbab116f0a5.tar.gz
GNU text utilitiesTEXTUTILS-1_11_1a
-rw-r--r--lib/error.c7
-rw-r--r--lib/error.h3
-rw-r--r--lib/regex.c24
-rw-r--r--lib/regex.h4
4 files changed, 25 insertions, 13 deletions
diff --git a/lib/error.c b/lib/error.c
index b1bbf1853d..a65d644d1b 100644
--- a/lib/error.c
+++ b/lib/error.c
@@ -1,5 +1,5 @@
/* error.c -- error handler for noninteractive utilities
- Copyright (C) 1990, 91, 92, 93, 94 Free Software Foundation, Inc.
+ Copyright (C) 1990, 91, 92, 93, 94, 95 Free Software Foundation, Inc.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
@@ -43,6 +43,9 @@
void exit ();
#endif
+/* This variable is incremented each time `error' is called. */
+unsigned int error_message_count;
+
/* If NULL, error will flush stdout, then print on stderr the program
name, a colon and a space. Otherwise, error will call this
function without parameters instead. */
@@ -112,6 +115,8 @@ error (status, errnum, message, va_alist)
fprintf (stderr, message, a1, a2, a3, a4, a5, a6, a7, a8);
#endif
+ ++error_message_count;
+
if (errnum)
fprintf (stderr, ": %s", strerror (errnum));
putc ('\n', stderr);
diff --git a/lib/error.h b/lib/error.h
index 55d862adb0..e288a79215 100644
--- a/lib/error.h
+++ b/lib/error.h
@@ -38,4 +38,7 @@ void error (int, int, const char *, ...) \
void error ();
#endif
+/* This variable is incremented each time `error' is called. */
+extern unsigned int error_message_count;
+
#endif /* _error_h_ */
diff --git a/lib/regex.c b/lib/regex.c
index eeb6f78cbf..5a6d3a157d 100644
--- a/lib/regex.c
+++ b/lib/regex.c
@@ -3,7 +3,7 @@
(Implements POSIX draft P10003.2/D11.2, except for
internationalization features.)
- Copyright (C) 1993, 1994 Free Software Foundation, Inc.
+ Copyright (C) 1993, 1994, 1995 Free Software Foundation, Inc.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
@@ -33,9 +33,8 @@
/* We need this for `regex.h', and perhaps for the Emacs include files. */
#include <sys/types.h>
-/* This is for other GNU distributions with internationalized messages.
- The GNU C Library itself does not yet support such messages. */
-#if HAVE_LIBINTL_H
+/* This is for other GNU distributions with internationalized messages. */
+#if HAVE_LIBINTL_H || defined (_LIBC)
# include <libintl.h>
#else
# define gettext(msgid) (msgid)
@@ -56,7 +55,7 @@
even if config.h says that we can. */
#undef REL_ALLOC
-#ifdef STDC_HEADERS
+#if defined (STDC_HEADERS) || defined (_LIBC)
#include <stdlib.h>
#else
char *malloc ();
@@ -66,7 +65,7 @@ char *realloc ();
/* We used to test for `BSTRING' here, but only GCC and Emacs define
`BSTRING', as far as I know, and neither of them use this code. */
#ifndef INHIBIT_STRING_HEADER
-#if HAVE_STRING_H || STDC_HEADERS
+#if HAVE_STRING_H || STDC_HEADERS || defined (_LIBC)
#include <string.h>
#ifndef bcmp
#define bcmp(s1, s2, n) memcmp ((s1), (s2), (n))
@@ -1011,7 +1010,8 @@ typedef struct
#define FAIL_STACK_FULL() (fail_stack.avail == fail_stack.size)
-/* Initialize `fail_stack'. Do `return -2' if the alloc fails. */
+/* Define macros to initialize and free the failure stack.
+ Do `return -2' if the alloc fails. */
#ifdef MATCH_MAY_ALLOCATE
#define INIT_FAIL_STACK() \
@@ -1025,11 +1025,15 @@ typedef struct
fail_stack.size = INIT_FAILURE_ALLOC; \
fail_stack.avail = 0; \
} while (0)
+
+#define RESET_FAIL_STACK() REGEX_FREE_STACK (fail_stack.stack)
#else
#define INIT_FAIL_STACK() \
do { \
fail_stack.avail = 0; \
} while (0)
+
+#define RESET_FAIL_STACK()
#endif
@@ -3080,7 +3084,7 @@ re_compile_fastmap (bufp)
{
if (!PUSH_PATTERN_OP (p + j, fail_stack))
{
- REGEX_FREE_STACK (fail_stack.stack);
+ RESET_FAIL_STACK ();
return -2;
}
}
@@ -3141,7 +3145,7 @@ re_compile_fastmap (bufp)
bufp->can_be_null |= path_can_be_null;
done:
- REGEX_FREE_STACK (fail_stack.stack);
+ RESET_FAIL_STACK ();
return 0;
} /* re_compile_fastmap */
@@ -3411,7 +3415,7 @@ static boolean alt_match_null_string_p (),
FREE_VAR (reg_info_dummy); \
} while (0)
#else
-#define FREE_VARIABLES() /* Do nothing! */
+#define FREE_VARIABLES() ((void)0) /* Do nothing! But inhibit gcc warning. */
#endif /* not MATCH_MAY_ALLOCATE */
/* These values must meet several constraints. They must not be valid
diff --git a/lib/regex.h b/lib/regex.h
index 66791b0670..31eaf849f7 100644
--- a/lib/regex.h
+++ b/lib/regex.h
@@ -1,7 +1,7 @@
/* Definitions for data structures and routines for the regular
expression library, version 0.12.
- Copyright (C) 1985, 89, 90, 91, 92, 1993 Free Software Foundation, Inc.
+ Copyright (C) 1985, 89, 90, 91, 92, 93, 95 Free Software Foundation, Inc.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
@@ -23,7 +23,7 @@
/* POSIX says that <sys/types.h> must be included (by the caller) before
<regex.h>. */
-#ifdef VMS
+#if !defined (_POSIX_C_SOURCE) && !defined (_POSIX_SOURCE) && defined (VMS)
/* VMS doesn't have `size_t' in <sys/types.h>, even though POSIX says it
should be there. */
#include <stddef.h>