Deleted Added
full compact
wrterm.c (50477) wrterm.c (87701)
1/*-
2 * Copyright (c) 1991, 1993
3 * The Regents of the University of California. All rights reserved.
4 *
5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that the following conditions
7 * are met:
8 * 1. Redistributions of source code must retain the above copyright

--- 17 unchanged lines hidden (view full) ---

26 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
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
1/*-
2 * Copyright (c) 1991, 1993
3 * The Regents of the University of California. All rights reserved.
4 *
5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that the following conditions
7 * are met:
8 * 1. Redistributions of source code must retain the above copyright

--- 17 unchanged lines hidden (view full) ---

26 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
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
36__FBSDID("$FreeBSD: head/usr.bin/tset/wrterm.c 87701 2001-12-11 23:29:45Z markm $");
37
34#ifndef lint
38#ifndef lint
35#if 0
36static char sccsid[] = "@(#)wrterm.c 8.1 (Berkeley) 6/9/93";
39static const char sccsid[] = "@(#)wrterm.c 8.1 (Berkeley) 6/9/93";
37#endif
40#endif
38static const char rcsid[] =
39 "$FreeBSD: head/usr.bin/tset/wrterm.c 50477 1999-08-28 01:08:13Z peter $";
40#endif /* not lint */
41
42#include <sys/types.h>
41
42#include <sys/types.h>
43
43#include <ctype.h>
44#include <err.h>
45#include <stdio.h>
46#include <string.h>
44#include <ctype.h>
45#include <err.h>
46#include <stdio.h>
47#include <string.h>
48
47#include "extern.h"
48
49/*
50 * Output termcap entry to stdout, quoting characters that would give the
51 * shell problems and omitting empty fields.
52 */
53void
54wrtermcap(bp)

--- 4 unchanged lines hidden (view full) ---

59 char *t, *sep;
60
61 /* Find the end of the terminal names. */
62 if ((t = index(bp, ':')) == NULL)
63 errx(1, "termcap names not colon terminated");
64 *t++ = '\0';
65
66 /* Output terminal names that don't have whitespace. */
49#include "extern.h"
50
51/*
52 * Output termcap entry to stdout, quoting characters that would give the
53 * shell problems and omitting empty fields.
54 */
55void
56wrtermcap(bp)

--- 4 unchanged lines hidden (view full) ---

61 char *t, *sep;
62
63 /* Find the end of the terminal names. */
64 if ((t = index(bp, ':')) == NULL)
65 errx(1, "termcap names not colon terminated");
66 *t++ = '\0';
67
68 /* Output terminal names that don't have whitespace. */
67 sep = "";
69 sep = strdup("");
68 while ((p = strsep(&bp, "|")) != NULL)
69 if (*p != '\0' && strpbrk(p, " \t") == NULL) {
70 (void)printf("%s%s", sep, p);
70 while ((p = strsep(&bp, "|")) != NULL)
71 if (*p != '\0' && strpbrk(p, " \t") == NULL) {
72 (void)printf("%s%s", sep, p);
71 sep = "|";
73 sep = strdup("|");
72 }
73 (void)putchar(':');
74
75 /*
76 * Output fields, transforming any dangerous characters. Skip
77 * empty fields or fields containing only whitespace.
78 */
79 while ((p = strsep(&t, ":")) != NULL) {

--- 38 unchanged lines hidden ---
74 }
75 (void)putchar(':');
76
77 /*
78 * Output fields, transforming any dangerous characters. Skip
79 * empty fields or fields containing only whitespace.
80 */
81 while ((p = strsep(&t, ":")) != NULL) {

--- 38 unchanged lines hidden ---