1/*-
2 * Copyright (c) 1992 Diomidis Spinellis.
3 * Copyright (c) 1992, 1993
4 * The Regents of the University of California. All rights reserved.
5 *
6 * This code is derived from software contributed to Berkeley by
7 * Diomidis Spinellis of Imperial College, University of London.
8 *
--- 18 unchanged lines hidden (view full) ---
27 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
28 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
29 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
30 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
31 * SUCH DAMAGE.
32 */
33
34#include <sys/cdefs.h>
35__FBSDID("$FreeBSD: head/usr.bin/sed/compile.c 197356 2009-09-20 14:11:33Z dds $");
36
37#ifndef lint
38static const char sccsid[] = "@(#)compile.c 8.1 (Berkeley) 6/6/93";
39#endif
40
41#include <sys/types.h>
42#include <sys/stat.h>
43
--- 338 unchanged lines hidden (view full) ---
382 return (NULL);
383 else if (c == '\\')
384 errx(1, "%lu: %s: \\ can not be used as a string delimiter",
385 linenum, fname);
386 else if (c == '\n')
387 errx(1, "%lu: %s: newline can not be used as a string delimiter",
388 linenum, fname);
389 while (*p) {
390 if (*p == '[' && *p != c) {
391 if ((d = compile_ccl(&p, d)) == NULL)
392 errx(1, "%lu: %s: unbalanced brackets ([])", linenum, fname);
393 continue;
394 } else if (*p == '\\' && p[1] == '[') {
395 *d++ = *p++;
396 } else if (*p == '\\' && p[1] == c)
397 p++;
398 else if (*p == '\\' && p[1] == 'n') {
--- 546 unchanged lines hidden ---
2 * Copyright (c) 1992 Diomidis Spinellis.
3 * Copyright (c) 1992, 1993
4 * The Regents of the University of California. All rights reserved.
5 *
6 * This code is derived from software contributed to Berkeley by
7 * Diomidis Spinellis of Imperial College, University of London.
8 *
--- 18 unchanged lines hidden (view full) ---
27 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
28 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
29 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
30 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
31 * SUCH DAMAGE.
32 */
33
34#include <sys/cdefs.h>
35__FBSDID("$FreeBSD: head/usr.bin/sed/compile.c 197356 2009-09-20 14:11:33Z dds $");
36
37#ifndef lint
38static const char sccsid[] = "@(#)compile.c 8.1 (Berkeley) 6/6/93";
39#endif
40
41#include <sys/types.h>
42#include <sys/stat.h>
43
--- 338 unchanged lines hidden (view full) ---
382 return (NULL);
383 else if (c == '\\')
384 errx(1, "%lu: %s: \\ can not be used as a string delimiter",
385 linenum, fname);
386 else if (c == '\n')
387 errx(1, "%lu: %s: newline can not be used as a string delimiter",
388 linenum, fname);
389 while (*p) {
390 if (*p == '[' && *p != c) {
391 if ((d = compile_ccl(&p, d)) == NULL)
392 errx(1, "%lu: %s: unbalanced brackets ([])", linenum, fname);
393 continue;
394 } else if (*p == '\\' && p[1] == '[') {
395 *d++ = *p++;
396 } else if (*p == '\\' && p[1] == c)
397 p++;
398 else if (*p == '\\' && p[1] == 'n') {
--- 546 unchanged lines hidden ---