Subversion Repositories planix.SVN

Rev

Rev 36 | Rev 39 | Go to most recent revision | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 36 Rev 37
Line 29... Line 29...
29
 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
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
30
 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
31
 * SUCH DAMAGE.
31
 * SUCH DAMAGE.
32
 */
32
 */
33
 
33
 
-
 
34
/*
34
#ifndef lint
35
#ifndef lint
35
static char sccsid[] = "@(#)termcap.c	5.6 (Berkeley) 7/3/92";
36
static char sccsid[] = "@(#)termcap.c	5.6 (Berkeley) 7/3/92";
36
#endif /* not lint */
37
#endif */  /* not lint */
37
 
38
 
38
#define	BUFSIZ		1024
39
#define	BUFSIZ		1024
39
#define MAXHOP		32	/* max number of tc= indirections */
40
#define MAXHOP		32	/* max number of tc= indirections */
40
#define	PBUFSIZ		512	/* max length of filename path */
41
#define	PBUFSIZ		512	/* max length of filename path */
41
#define	PVECSIZ		32	/* max number of names in path */
42
#define	PVECSIZ		32	/* max number of names in path */
42
 
43
 
43
#include <ctype.h>
44
#include <ctype.h>
44
#include <stdlib.h>
45
#include <stdlib.h>
45
#include "pathnames.h"
46
#include "pathnames.h"
-
 
47
 
-
 
48
#include <string.h>
-
 
49
#include <unistd.h>
-
 
50
#include <fcntl.h>
-
 
51
 
-
 
52
 
-
 
53
int tnamatch();
-
 
54
int tnchktc();
-
 
55
int tfindent();
-
 
56
 
46
 
57
 
47
/*
58
/*
48
 * termcap - routines for dealing with the terminal capability data base
59
 * termcap - routines for dealing with the terminal capability data base
49
 *
60
 *
50
 * BUG:		Should use a "last" pointer in tbuf, so that searching
61
 * BUG:		Should use a "last" pointer in tbuf, so that searching
Line 74... Line 85...
74
	char *bp, *name;
85
	char *bp, *name;
75
{
86
{
76
	register char *p;
87
	register char *p;
77
	register char *cp;
88
	register char *cp;
78
	register int c;
89
	register int c;
79
	char *term, *home, *termpath;
90
	char /* *term,*/ *home, *termpath;
80
	char **fname = pathvec;
91
	char **fname = pathvec;
81
 
92
 
82
	pvec = pathvec;
93
	pvec = pathvec;
83
	tbuf = bp;
94
	tbuf = bp;
84
	p = pathbuf;
95
	p = pathbuf;
Line 92... Line 103...
92
	 * does not hold a file name then a path of names is searched
103
	 * does not hold a file name then a path of names is searched
93
	 * instead.  The path is found in the TERMPATH variable, or
104
	 * instead.  The path is found in the TERMPATH variable, or
94
	 * becomes "$HOME/.termcap /etc/termcap" if no TERMPATH exists.
105
	 * becomes "$HOME/.termcap /etc/termcap" if no TERMPATH exists.
95
	 */
106
	 */
96
	if (!cp || *cp != '/') {	/* no TERMCAP or it holds an entry */
107
	if (!cp || *cp != '/') {	/* no TERMCAP or it holds an entry */
97
		if (termpath = getenv("TERMPATH"))
108
		if ( (termpath = getenv("TERMPATH")) )
98
			strncpy(pathbuf, termpath, PBUFSIZ);
109
			strncpy(pathbuf, termpath, PBUFSIZ);
99
		else {
110
		else {
100
			if (home = getenv("HOME")) {	/* set up default */
111
			if ( (home = getenv("HOME")) ) {	/* set up default */
101
				p += strlen(home);	/* path, looking in */
112
				p += strlen(home);	/* path, looking in */
102
				strcpy(pathbuf, home);	/* $HOME first */
113
				strcpy(pathbuf, home);	/* $HOME first */
103
				*p++ = '/';
114
				*p++ = '/';
104
			}	/* if no $HOME look in current directory */
115
			}	/* if no $HOME look in current directory */
105
			strncpy(p, _PATH_DEF, PBUFSIZ - (p - pathbuf));
116
			strncpy(p, _PATH_DEF, PBUFSIZ - (p - pathbuf));