Commit Graph

67 Commits

Author SHA1 Message Date
christos 46937c5008 Avoid infinite recursion on:
echo "foo foo bar bar bar baz" | sed 's/\([^ ]*\)\( *\1\)*/\1/g'

From OpenBSD.
2004-04-03 17:00:00 +00:00
enami d43ce6c183 Redo previous in a different way; cast the character held in int variable
as unsigned char just before passing isalnum() in ISWORD() rather than
fetching it as unsigned char.  It is ok since EOF is never passed to ISWORD()
(though it will be a bit inefficient.)

Addresses PR#24929.
2004-03-26 22:42:17 +00:00
enami 4604becb77 Sprinkle cast to prevent unwanted sign extension. Some of those actually
makes sed invoked during build process an out of bound array access.
2004-03-12 22:34:09 +00:00
wiz 08f5fb02e9 Remove sentence about this being an alpha
version -- after twelve years it is at least beta ;)
The BUGS section is extensive enough even without it.
2003-12-29 17:36:12 +00:00
agc eb7c1594f1 Move UCB-licensed code from 4-clause to 3-clause licence.
Patches provided by Joel Baker in PR 22280, verified by myself.
2003-08-07 16:42:00 +00:00
wiz 472351e13d Use
.In header.h
instead of
.Fd #include \*[Lt]header.h\*[Gt]
Much easier to read and write, and supported by groff for ages.
Okayed by ross.
2003-04-16 13:34:34 +00:00
kleink d58cfc7d35 Sprinkle some restrict. 2003-02-05 23:13:07 +00:00
itojun 9134efabd0 use strlcpy where it is more appropriate. 2002-11-17 01:51:24 +00:00
wiz 3225ede1d3 New sentence, new line. From Robert Elz. 2002-10-01 17:02:56 +00:00
christos ce8a71a179 make this compile with -DREDEBUG again. 2002-07-22 12:56:17 +00:00
simonb eb0846961e Remove <sys/types.h> from synopsis, as per latest SUS/Posix specs. 2002-04-29 01:41:43 +00:00
ross dc5571b22e Generate <>& symbolically. I'm avoiding .../dist/... directories for now. 2002-02-08 01:21:55 +00:00
ross 814f296b77 Generate <>& symbolically. 2002-02-07 07:00:09 +00:00
christos ecb7b5a99a PR/14975: Takayoshi Kochi: memory leak in regexec(3).
Always free m->pmatch and m->lastpos on error.
2001-12-17 16:32:49 +00:00
christos 74ffc129b3 turn a macro into a simple statement. 2001-12-17 16:31:11 +00:00
wiz 23f84ac4f1 Sort sections and add .Sx in two places. 2001-09-16 02:20:13 +00:00
wiz fabf44e83f Boring whitespace fix. 2001-09-16 02:19:33 +00:00
jdolecek 30ca1a2a3e add missing ' is ' in regerror() explanation 2000-11-06 13:20:58 +00:00
itohy 7daefc5a5a Passing "char" values to ctype(3) functions is problematic.
If an argument of a ctype function is outside "unsigned char"
and if it is not EOF, the behavior is undefined.

The isascii(3) is the sole exception of above and it was used to
be used to check a value was valid for other ctype functions in
ancient systems.  On modern systems, the ctype functions take
all values of "unsigned char", and this check is obsolete and
even wrong for non-ASCII systems.  However, we leave the isascii()
untouched for now, so as not to change the current behavior.
2000-07-07 08:03:36 +00:00
mycroft 605490369c Delint.
Remove trailing ; from uses of __weak_alias().  The macro inserts this if
needed.
2000-01-22 22:19:07 +00:00
lukem d896261208 back out the #ifdef _DIAGNOSTIC argument checks; too many people complained.
_DIAGASSERT() is still retained.
1999-09-20 04:38:56 +00:00
kleink c46d95a329 The previous assertion change was incorrect: the preg argument is permitted to
be NULL (part of the interface definition!) unless errcode is REG_ATOI, which
is a non-portable extension.

Also, remove assertions from the local regatoi() function, as they are either
redundant or will never fail due to the buffer allocation for that argument in
regerror().
1999-09-17 09:33:34 +00:00
lukem b48252f365 * use _DIAGASSERT() to check pointer arguments against NULL and file
descriptors against -1 (as appropriate).
* add actual checks which to detect stuff that would trigger_DIAGASSERT(),
  and attempt to return a sane error condition.
* knf some code
* remove some `register' decls.

the first two items result in the addition of code similar to the
following in various functions:

		_DIAGASSERT(path != NULL)
	#ifdef _DIAGNOSTIC
		if (path == NULL) {
			errno = EFAULT;
			return (-1);
		}
	#endif
1999-09-16 11:44:54 +00:00
christos c927d63f09 Avoid overflow when adding a 64 bit quantity to a 32 bit pointer on 32 bit
machines.
1999-01-20 12:58:21 +00:00
drochner b6581ead5f Minor size_t!=int related cleanup, only effective on the alpha.
btw: the maximum length of an RE is limited by the "int" range, also
on the alpha. "sopno" is "int", and "int"s are used as counters within
the code, so it would need some work to change this. I only don't know
how one could test it...
1998-12-13 12:21:46 +00:00
drochner 7cd4c14e82 regoff_t is used like size_t within the code, it should be defined
so instead of off_t. This makes some casts unnecessary.
We can't change the definition now due to binary compatibility, so
prepare for the next libc major version.
1998-12-08 14:00:24 +00:00
drochner 64a8986fc2 Change some function arguments to appropriate types. This makes lint
happy without casts.
1998-12-08 13:52:48 +00:00
drochner 25804e11c9 remove another unneeded cast 1998-12-08 13:49:46 +00:00
drochner 285638718a correct a comment, minor formatting 1998-12-08 13:48:06 +00:00
drochner c300f8f462 Back out part of the last change. This broke on the alpha (or wherever
sizeof(u_int32_t) != sizeof(*)), at least in cases with re->re_g->nstates
between 32 and 64.
Primary reason for the breakage was that the "states1" definition didn't
work as expected. (It didn't work before either, but this was not noticed
due to sizeof(long)==sizeof(*).)
The alpha can handle larger problems with the "small" state machine model
if a "long" is used as state variable, so it is better to keep the old
definition here. (u_int32_t is left for the "operator" variables.)
Use "int" as "sopno" - this is used as index into the states field, there
is no point in using a fized-size type.
1998-12-08 13:41:42 +00:00
christos 4523c05fa8 Delint:
- we don't need to use longs; convert to use int32_t.
	- remove break statements after returns.
	- cast things properly.
1998-11-14 16:43:49 +00:00
lukem ce83c69e00 first pass at fixing up capitalization of function names and
arguments; ensure that each is correct with respect to the
implementation, rather than being correct as per english.
1998-08-29 08:32:32 +00:00
mycroft 392dcacb66 const poisoning. 1998-07-26 12:17:51 +00:00
mycroft 9ad899cc18 constify some tables. 1998-07-26 11:24:14 +00:00
mycroft 44436bf77f constify some tables. 1998-07-26 11:11:07 +00:00
perry 6982982f8d macroize BSD, NetBSD, FreeBSD and misc cleanup 1998-02-06 05:39:31 +00:00
perry 312aca536f add LIBRARY section to man page 1998-02-05 18:45:17 +00:00
perry dc1e66a8e4 remove illegal quotes from .Dd directives 1998-02-05 07:28:01 +00:00
perry c8bafd6265 remove obsolete register declarations 1998-02-03 18:38:12 +00:00
kleink acb9e4216c Enhance readability by converting to use -mdoc macros. 1998-01-18 20:59:26 +00:00
mrg 4e252e8c4d add missing .Nm entries. from spz@serpens.swb.de. 1997-11-14 02:04:36 +00:00
lukem d0e23d974a - use CPPFLAGS instead of CFLAGS
- use ${COMPILE.C} ... instead of ${CC} ${CFLAGS} -c ...
1997-10-22 23:14:04 +00:00
jtc 43fa6fe319 If port provides __weak_alias(), provide an Standard C and POSIX pure
identifier namespace by renaming non standard functions and variables
such that they have a leading underscore.  The library will use those
names internally.  Weak aliases are used to provide the original names
to the API.

This is only the first part of this change.  It is most of the functions
which are implemented in C for all NetBSD ports.  Subsequent changes are
to add the same support to the remaining C files, to assembly files, and
to the automagically generated assembly source used for system calls.
When all of the above is done, ports with weak alias support should add
a definition for __weak_alias to <sys/cdefs.h>.
1997-07-21 14:06:24 +00:00
christos c7d2bdf50e Remove unused variable
Fix RCSID's
1997-07-13 20:06:26 +00:00
christos 5f61e3e292 Fix RCSID's
Remove unused variable
1997-07-13 20:06:00 +00:00
christos 05e3795ec8 Add braces in initializers.
Fix RCSID's
Remove unused variables
1997-07-13 20:05:37 +00:00
christos 3127e6a7cf Fix RCSID's
Fix gcc warnings.
Add missing prototypes
#if 0 unused functions
1997-07-13 20:04:32 +00:00
christos 9cdb67bbd0 Add missing return NULL; 1997-07-13 20:03:30 +00:00
christos a654524992 Add missing braces in initializers. 1997-07-13 20:02:50 +00:00
cgd c765a5a975 qualify opcode constants with long, so that bad things don't happen when long
!= 32 bits.  This might need a bit more thought (i.e. why use long here to
begin with, when int32_t might be a better choice), but for now it's good
enough.  From Ross Harvey in PR 3450, extended by me to cover the rest of
the opcode constants and masks.
1997-04-06 19:29:14 +00:00