[alt.sources] Patch #2 to tinfo, a public domain termcap/terminfo implementation.

ross@contact.uucp (Ross Ridge) (06/03/90)

This is patch #2 to the tinfo library I posted to alt.sources in April '90.
It fixes some important bugs, and makes a few small changes.

tinfo is a merges the functions of termcap and terminfo, and can use either
of the two's databases.  If you would like a copy of the original postings
(5 parts), and/or the first patch please E-MAIL me (ross@contact.uucp),
and I'll mail them to you.

[By accident I lost a few peoples requests last time, if you asked but didn't
 get anything last time please ask again.]

								Ross Ridge

Note: this is a normal diff, so if you've made your own changes to the source
      patch will be less forgiving.

------------------

Index: conv.1
Prereq: "90/05/19"
2c2
< .TH CONV 1 "90/05/19" "tinfo"
---
> .TH CONV 1 "90/06/02" "tinfo"
Index: findterm.c
Prereq: 90/03/22
5c5
<  * 90/03/22 03:43:31
---
>  * 90/06/02 20:55:44
16c16
< static char SCCSid[] = "@(#) findterm.c 1.1";
---
> static char SCCSid[] = "@(#) findterm.c 1.2";
72c72,73
< 	if (fstat(fd, &st) == -1)
---
> 	if (fstat(fd, &st) == -1) {
> 		close(fd);
73a75
> 	}
89c91,92
< 	if (f == NULL)
---
> 	if (f == NULL) {
> 		close(fd);
90a94
> 	}
131a136,139
> 				if (!cont) {
> 					fclose(f);
> 					return 1;
> 				}
160a169
> 				fclose(f);
194a204
> 				fclose(f);
204a215
> 	fclose(f);
Index: terminfo.c
Prereq: 90/03/27
6c6
<  * 90/03/27 18:29:45
---
>  * 90/06/01 16:45:21
15,17c15,16
< #ifdef USE_SCCS_IDS
< static char SCCSid[] = "@(#) terminfo.c 1.2";
< #endif
---
> static char SCCSid[] = "@(#) terminfo.c 1.3";
> 
19a19,21
> #ifdef __GNUC__
> __inline__
> #endif
25c27,28
< #define RETERR(e, msg)  { (err == NULL ? (printerr(msg), exit(1), 0) : (*err = e)); return ERR; }
---
> #define RETERR(e, msg)  { (err == NULL ? (printerr(msg), exit(1), 0) \
> 				       : (*err = e)); return ERR; }
29c32,33
< #define RETERR(e, msg)  { (err == NULL ? (fprintf(stderr, msg), exit(1), 0) : (*err = e)); return ERR; }
---
> #define RETERR(e, msg)  { (err == NULL ? (fprintf(stderr, msg), exit(1), 0) \
> 				       : (*err = e)); return ERR; }
Index: termcap.c
Prereq: 90/03/22
6c6
<  * 90/03/22 03:43:33
---
>  * 90/06/01 16:45:19
15,17c15,16
< #ifdef USE_SCCS_IDS
< static char SCCSid[] = "@(#) termcap.c 1.1";
< #endif
---
> static char SCCSid[] = "@(#) termcap.c 1.2";
> 
Index: tcapvars.c
Prereq: 90/03/22
6c6
<  * 90/03/22 03:43:43
---
>  * 90/05/31 17:44:20
14c14
< static char SCCSid[] = "@(#) tcapvars.c 1.1";
---
> static char SCCSid[] = "@(#) tcapvars.c 1.2";
18c18
< int ospeed;
---
> short ospeed;
Index: conv.c
Prereq: 90/04/18
6c6
<  * 90/04/18 07:43:15
---
>  * 90/06/02 20:55:13
46c46
< static char SCCSid[] = "@(#) conv.c 1.5";
---
> static char SCCSid[] = "@(#) conv.c 1.6";
666a667,676
> int badname(name)
> char *name; {
> 	while(*name) {
> 		if (*name == '/' || !isgraph(*name))
> 			return 1;
> 		name++;
> 	}
> 	return 0;
> }
> 
696a707,714
> 		if (badname(s)) {
> 			if (lineno)
> 				warn();
> 			fprintf(stderr, "bad terminal name '%s', ingored.\n",
> 				s);
> 			s--;
> 			continue;
> 		}
740a759,763
> 	if (last[0] == '\0') {
> 		if (lineno)
> 			warn();
> 		fprintf(stderr, "no terminal name, entry ignored.\n");
> 	}
857a881,884
> 
> #if DEBUG
> 	printf("%s\n", buf);
> #endif
873a901,903
> #if DEBUG
> 	printf("...%s\n", name);
> #endif
1051c1081
< 				buf[--l] = '\0';
---
> 				line[--l] = '\0';
-- 
Ross Ridge								 //
"The Great HTMU"							[oo]
ross@contact.uucp							-()-
ross@watcsc.waterloo.edu						 //