Deleted Added
full compact
term.c (92922) term.c (200419)
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

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

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
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

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

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/term.c 92922 2002-03-22 01:42:45Z imp $");
36__FBSDID("$FreeBSD: head/usr.bin/tset/term.c 200419 2009-12-11 23:30:22Z delphij $");
37
38#ifndef lint
39static const char sccsid[] = "@(#)term.c 8.1 (Berkeley) 6/9/93";
40#endif
41
42#include <sys/types.h>
43#include <err.h>
44#include <errno.h>
45#include <stdio.h>
46#include <stdlib.h>
47#include <string.h>
37
38#ifndef lint
39static const char sccsid[] = "@(#)term.c 8.1 (Berkeley) 6/9/93";
40#endif
41
42#include <sys/types.h>
43#include <err.h>
44#include <errno.h>
45#include <stdio.h>
46#include <stdlib.h>
47#include <string.h>
48#include <termcap.h>
48#include <unistd.h>
49#include <ttyent.h>
50#include "extern.h"
51
52char tbuf[1024]; /* Termcap entry. */
53
54const char *askuser(const char *);
55char *ttys(char *);
56
57/*
58 * Figure out what kind of terminal we're dealing with, and then read in
59 * its termcap entry.
60 */
61const char *
49#include <unistd.h>
50#include <ttyent.h>
51#include "extern.h"
52
53char tbuf[1024]; /* Termcap entry. */
54
55const char *askuser(const char *);
56char *ttys(char *);
57
58/*
59 * Figure out what kind of terminal we're dealing with, and then read in
60 * its termcap entry.
61 */
62const char *
62get_termcap_entry(userarg, tcapbufp)
63 char *userarg, **tcapbufp;
63get_termcap_entry(char *userarg, char **tcapbufp)
64{
65 struct ttyent *t;
66 int rval;
67 char *p, *ttypath;
68 const char *ttype;
69
70 if (userarg) {
71 ttype = userarg;

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

120 if (rval == -1)
121 errx(1, "termcap: %s", strerror(errno ? errno : ENOENT));
122 *tcapbufp = tbuf;
123 return (ttype);
124}
125
126/* Prompt the user for a terminal type. */
127const char *
64{
65 struct ttyent *t;
66 int rval;
67 char *p, *ttypath;
68 const char *ttype;
69
70 if (userarg) {
71 ttype = userarg;

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

120 if (rval == -1)
121 errx(1, "termcap: %s", strerror(errno ? errno : ENOENT));
122 *tcapbufp = tbuf;
123 return (ttype);
124}
125
126/* Prompt the user for a terminal type. */
127const char *
128askuser(dflt)
129 const char *dflt;
128askuser(const char *dflt)
130{
131 static char answer[256];
132 char *p;
133
134 /* We can get recalled; if so, don't continue uselessly. */
135 if (feof(stdin) || ferror(stdin)) {
136 (void)fprintf(stderr, "\n");
137 exit(1);

--- 24 unchanged lines hidden ---
129{
130 static char answer[256];
131 char *p;
132
133 /* We can get recalled; if so, don't continue uselessly. */
134 if (feof(stdin) || ferror(stdin)) {
135 (void)fprintf(stderr, "\n");
136 exit(1);

--- 24 unchanged lines hidden ---