* Copyright (c) 1991 The Regents of the University of California.
* %sccs.include.redist.c%
static char sccsid
[] = "@(#)wrterm.c 5.1 (Berkeley) %G%";
* Output termcap entry to stdout, quoting characters that would give the
* shell problems and omitting empty fields.
/* Find the end of the terminal names. */
if ((t
= index(bp
, ':')) == NULL
)
err("termcap names not colon terminated");
/* Output terminal names that don't have whitespace. */
while ((p
= strsep(&bp
, "|")) != NULL
)
if (*p
!= '\0' && strpbrk(p
, " \t") == NULL
) {
(void)printf("%s%s", sep
, p
);
* Output fields, transforming any dangerous characters. Skip
* empty fields or fields containing only whitespace.
while ((p
= strsep(&t
, ":")) != NULL
) {
while ((ch
= *p
) != '\0' && isspace(ch
))
while ((ch
= *p
++) != '\0')
case ' ': /* No spaces. */
case '!': /* No csh history chars. */
case ',': /* No csh history chars. */
case '"': /* No quotes. */
case '\'': /* No quotes. */
case '`': /* No quotes. */
case '\\': /* Anything following is OK. */