Deleted Added
full compact
termcap.c (166129) termcap.c (166130)
1/* A portion of this file is from ncurses: */
2/***************************************************************************
3* COPYRIGHT NOTICE *
4****************************************************************************
5* ncurses is copyright (C) 1992-1995 *
6* Zeyd M. Ben-Halim *
7* zmbenhal@netcom.com *
8* Eric S. Raymond *

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

52 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
53 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
54 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
55 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
56 * SUCH DAMAGE.
57 */
58
59#include <sys/cdefs.h>
1/* A portion of this file is from ncurses: */
2/***************************************************************************
3* COPYRIGHT NOTICE *
4****************************************************************************
5* ncurses is copyright (C) 1992-1995 *
6* Zeyd M. Ben-Halim *
7* zmbenhal@netcom.com *
8* Eric S. Raymond *

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

52 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
53 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
54 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
55 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
56 * SUCH DAMAGE.
57 */
58
59#include <sys/cdefs.h>
60__FBSDID("$FreeBSD: head/lib/ncurses/ncurses/termcap.c 165906 2007-01-09 01:02:06Z imp $");
60__FBSDID("$FreeBSD: head/lib/ncurses/ncurses/termcap.c 166130 2007-01-20 07:46:45Z rafan $");
61
62#ifndef lint
63static const char sccsid[] = "@(#)termcap.c 8.1 (Berkeley) 6/4/93";
64#endif /* not lint */
65
66#include <stdio.h>
67#include <ctype.h>
68#include <stdlib.h>

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

192 memcpy(pd, ps, len);
193 ps += len;
194 pd += len;
195 *pd = '\0';
196 tcs = pd - 1;
197 for (;;) {
198 while ((tok = strsep(&ps, ":")) != NULL &&
199 *(tok - 2) != '\\' &&
61
62#ifndef lint
63static const char sccsid[] = "@(#)termcap.c 8.1 (Berkeley) 6/4/93";
64#endif /* not lint */
65
66#include <stdio.h>
67#include <ctype.h>
68#include <stdlib.h>

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

192 memcpy(pd, ps, len);
193 ps += len;
194 pd += len;
195 *pd = '\0';
196 tcs = pd - 1;
197 for (;;) {
198 while ((tok = strsep(&ps, ":")) != NULL &&
199 *(tok - 2) != '\\' &&
200 (*tok == '\0' || *tok == '\\' || !isgraph(*tok)))
200 (*tok == '\0' || *tok == '\\' || !isgraph(UChar(*tok))))
201 ;
202 if (tok == NULL)
203 break;
204 for (s = tcs; s != NULL && s[1] != '\0';
205 s = strchr(s, ':')) {
206 s++;
207 if (s[0] == tok[0] && s[1] == tok[1])
208 goto skip_it;

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

224 free(dummy);
225
226
227/*
228 * From here on is ncurses-specific glue code
229 */
230
231 if (i < 0)
201 ;
202 if (tok == NULL)
203 break;
204 for (s = tcs; s != NULL && s[1] != '\0';
205 s = strchr(s, ':')) {
206 s++;
207 if (s[0] == tok[0] && s[1] == tok[1])
208 goto skip_it;

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

224 free(dummy);
225
226
227/*
228 * From here on is ncurses-specific glue code
229 */
230
231 if (i < 0)
232 return(ERR);
232 return(TGETENT_ERR);
233
234 _nc_set_source("TERMCAP");
235 _nc_read_entry_source((FILE *)NULL, _nc_termcap, FALSE, TRUE, NULLHOOK);
236
237 if (_nc_head == (ENTRY *)NULL)
233
234 _nc_set_source("TERMCAP");
235 _nc_read_entry_source((FILE *)NULL, _nc_termcap, FALSE, TRUE, NULLHOOK);
236
237 if (_nc_head == (ENTRY *)NULL)
238 return(ERR);
238 return(TGETENT_ERR);
239
240 /* resolve all use references */
239
240 /* resolve all use references */
241 _nc_resolve_uses(TRUE);
241 _nc_resolve_uses2(TRUE, FALSE);
242
243 for_entry_list(ep)
244 if (_nc_name_match(ep->tterm.term_names, name, "|:"))
245 {
246 /*
242
243 for_entry_list(ep)
244 if (_nc_name_match(ep->tterm.term_names, name, "|:"))
245 {
246 /*
247 * Make a local copy of the terminal capabilities. free
248 * all entry storage except the string table for the
249 * loaded type (which we disconnected from the list by
250 * NULLing out ep->tterm.str_table above).
247 * Make a local copy of the terminal capabilities, delinked
248 * from the list.
251 */
252 memcpy(tp, &ep->tterm, sizeof(TERMTYPE));
249 */
250 memcpy(tp, &ep->tterm, sizeof(TERMTYPE));
253 ep->tterm.str_table = (char *)NULL;
251 _nc_delink_entry(_nc_head, &(ep->tterm));
252 free(ep);
254 _nc_free_entries(_nc_head);
255 _nc_head = _nc_tail = NULL; /* do not reuse! */
256
253 _nc_free_entries(_nc_head);
254 _nc_head = _nc_tail = NULL; /* do not reuse! */
255
257 return 1; /* OK */
256 return TGETENT_YES; /* OK */
258 }
259
260 _nc_free_entries(_nc_head);
261 _nc_head = _nc_tail = NULL; /* do not reuse! */
257 }
258
259 _nc_free_entries(_nc_head);
260 _nc_head = _nc_tail = NULL; /* do not reuse! */
262 return(0); /* not found */
261 return(TGETENT_NO); /* not found */
263}
262}