From owner-freebsd-questions@FreeBSD.ORG Sat Jun 5 10:56:15 2004 Return-Path: Delivered-To: freebsd-questions@freebsd.org Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id 2E7A116A4CE for ; Sat, 5 Jun 2004 10:56:15 -0700 (PDT) Received: from mail.mi.celestial.com (dagney.celestial.com [192.136.111.7]) by mx1.FreeBSD.org (Postfix) with ESMTP id E94C943D3F for ; Sat, 5 Jun 2004 10:56:14 -0700 (PDT) (envelope-from bill@celestial.com) Received: by mail.mi.celestial.com (Postfix, from userid 203) id A686211EA4A; Sat, 5 Jun 2004 10:56:14 -0700 (PDT) Date: Sat, 5 Jun 2004 10:56:14 -0700 From: Bill Campbell To: freebsd-questions@freebsd.org Message-ID: <20040605175614.GA47256@alexis.mi.celestial.com> Mail-Followup-To: freebsd-questions@freebsd.org References: <40C185CF.2020709@mail.ru> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <40C185CF.2020709@mail.ru> User-Agent: Mutt/1.4.2.1i Subject: Re: termcap vs terminfo X-BeenThere: freebsd-questions@freebsd.org X-Mailman-Version: 2.1.1 Precedence: list Reply-To: freebsd@celestial.com List-Id: User questions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 05 Jun 2004 17:56:15 -0000 On Sat, Jun 05, 2004, sigsegv@mail.ru wrote: >I've noticed that the base system does not have terminfo, but instead >comes with termcap. Apparently BSD always had termcap and System V had >terminfo. I don't want to start a religious war as to which one is >better, but only want to ask if anyone has experienced problems when >porting ncurses applications from BSD to System V and vice versa, and >what could be done to minimise such problems. First, you can install ncurses on FreeBSD so that's not a problem. It's been many years since I first worked with termcap on a Tandy Model 16/6000 running Xenix. I still have a couple of the early O'Reilly ``A Nutshell Handbook: Reading and Writing Termcap Entries'' by John Strang Copyright 1985 and Strang's ``Programming with Curses'' published at the same time. Terminfo came along a bit later from Bell Labs, and offered some extended functionallity as well as some restriction not found in termcap. Technically, they're both terminal capability databases. The termcap data file is simple ascii with two character attribute fields, and historically has been limited to a maximum size of 1024 characters for any terminal entry. Termcap is extensible in that there aren't any hard-coded attributes so the programmer can make up whatever suits the application. Terminfo doesn't restrict the attribute names to two characters, is compiled into a binary file for each terminal, and has never had the size limit of termcap. One of the downsides of terminfo is that the attributes aren't as flexible as those of termcap so the programmer can't arbitrarily define new ones as needed. Before the advent of ncurses and other open source terminfo implementations, this could be a serious problem. My bottom line is that termcap is simpler to use for projects such as printer descriptions where all I want is a simple way to define attributes, and I can retrieve them using the standard termcap libraries in C or perl. I've been using in a printer interface system for almost 20 years now where I use termcap files to define printer capabilities for run-time conversion depending on the type of printer. When I'm working with real terminals, I'm more likely to be using ncurses with terminfo since the work is largely done for me. Bill -- INTERNET: bill@Celestial.COM Bill Campbell; Celestial Software LLC UUCP: camco!bill PO Box 820; 6641 E. Mercer Way FAX: (206) 232-9186 Mercer Island, WA 98040-0820; (206) 236-1676 URL: http://www.celestial.com/ ``One of the common failings among honorable people is a failure to appreciate how thoroughly dishonorable some other people can be, and how dangerous it is to trust them.'' - Thomas Sowell