]> ncurses.scripts.mit.edu Git - ncurses.git/blob - man/tic.1m
9f634a4ad499a7c47fa9bb32f906bb69376facf2
[ncurses.git] / man / tic.1m
1 .\"***************************************************************************
2 .\" Copyright (c) 1998-2018,2019 Free Software Foundation, Inc.              *
3 .\"                                                                          *
4 .\" Permission is hereby granted, free of charge, to any person obtaining a  *
5 .\" copy of this software and associated documentation files (the            *
6 .\" "Software"), to deal in the Software without restriction, including      *
7 .\" without limitation the rights to use, copy, modify, merge, publish,      *
8 .\" distribute, distribute with modifications, sublicense, and/or sell       *
9 .\" copies of the Software, and to permit persons to whom the Software is    *
10 .\" furnished to do so, subject to the following conditions:                 *
11 .\"                                                                          *
12 .\" The above copyright notice and this permission notice shall be included  *
13 .\" in all copies or substantial portions of the Software.                   *
14 .\"                                                                          *
15 .\" THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS  *
16 .\" OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF               *
17 .\" MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.   *
18 .\" IN NO EVENT SHALL THE ABOVE COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,   *
19 .\" DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR    *
20 .\" OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR    *
21 .\" THE USE OR OTHER DEALINGS IN THE SOFTWARE.                               *
22 .\"                                                                          *
23 .\" Except as contained in this notice, the name(s) of the above copyright   *
24 .\" holders shall not be used in advertising or otherwise to promote the     *
25 .\" sale, use or other dealings in this Software without prior written       *
26 .\" authorization.                                                           *
27 .\"***************************************************************************
28 .\"
29 .\" $Id: tic.1m,v 1.75 2019/10/12 20:56:38 tom Exp $
30 .TH @TIC@ 1M ""
31 .ie \n(.g .ds `` \(lq
32 .el       .ds `` ``
33 .ie \n(.g .ds '' \(rq
34 .el       .ds '' ''
35 .ds n 5
36 .ds d @TERMINFO@
37 .de bP
38 .ie n  .IP \(bu 4
39 .el    .IP \(bu 2
40 ..
41 .SH NAME
42 \fB@TIC@\fR \- the \fIterminfo\fR entry-description compiler
43 .SH SYNOPSIS
44 \fB@TIC@\fR
45 [\fB\-\
46 0\
47 1\
48 C\
49 D\
50 G\
51 I\
52 K\
53 L\
54 N\
55 T\
56 U\
57 V\
58 W\
59 a\
60 c\
61 f\
62 g\
63 q\
64 r\
65 s\
66 t\
67 x\
68 \fR]
69 [\fB\-e\fR \fInames\fR]
70 [\fB\-o\fR \fIdir\fR]
71 [\fB\-Q\fR[\fIn\fR]]
72 [\fB\-R\fR \fIsubset\fR]
73 [\fB\-v\fR[\fIn\fR]]
74 [\fB\-w\fR[\fIn\fR]]
75 \fIfile\fR
76 .br
77 .SH DESCRIPTION
78 The \fB@TIC@\fR command translates a \fBterminfo\fR file from source
79 format into compiled format.
80 The compiled format is necessary for use with
81 the library routines in \fBncurses\fR(3X).
82 .PP
83 As described in \fBterm\fR(\*n), the database may be either a directory
84 tree (one file per terminal entry) or a hashed database (one record per entry).
85 The \fB@TIC@\fR command writes only one type of entry,
86 depending on how it was built:
87 .bP
88 For directory trees, the top-level directory, e.g., /usr/share/terminfo,
89 specifies the location of the database.
90 .bP
91 For hashed databases, a filename is needed.
92 If the given file is not found by that name,
93 but can be found by adding the suffix ".db",
94 then that is used.
95 .IP
96 The default name for the hashed database is the same as the
97 default directory name (only adding a ".db" suffix).
98 .PP
99 In either case (directory or hashed database),
100 \fB@TIC@\fP will create the container if it does not exist.
101 For a directory, this would be the "terminfo" leaf,
102 versus a "terminfo.db" file.
103 .PP
104 The results are normally placed in the system terminfo database \fB\*d\fR.
105 The compiled terminal description can be placed
106 in a different terminfo database.
107 There are two ways to achieve this:
108 .bP
109 First, you may override the system default either by
110 using the \fB\-o\fP option,
111 or by setting the variable \fBTERMINFO\fR
112 in your shell environment to a valid database location.
113 .bP
114 Secondly, if \fB@TIC@\fR cannot write in \fI\*d\fR
115 or the location specified using your TERMINFO variable,
116 it looks for the directory \fI$HOME/.terminfo\fR
117 (or hashed database \fI$HOME/.terminfo.db)\fR;
118 if that location exists, the entry is placed there.
119 .PP
120 Libraries that read terminfo entries are expected to check in succession
121 .bP
122 a location specified with the TERMINFO environment variable,
123 .bP
124 \fI$HOME/.terminfo\fR,
125 .bP
126 directories listed in the TERMINFO_DIRS environment variable,
127 .bP
128 a compiled-in list of directories (@TERMINFO_DIRS@), and
129 .bP
130 the system terminfo database (\fI\*d\fR).
131 .SS ALIASES
132 .PP
133 This is the same program as @INFOTOCAP@ and @CAPTOINFO@;
134 usually those are linked to, or copied from this program:
135 .bP
136 When invoked as @INFOTOCAP@, @TIC@ sets the \fB\-I\fP option.
137 .bP
138 When invoked as @CAPTOINFO@, @TIC@ sets the \fB\-C\fP option.
139 .SS OPTIONS
140 .TP
141 \fB\-0\fR
142 restricts the output to a single line
143 .TP
144 \fB\-1\fR
145 restricts the output to a single column
146 .TP
147 \fB\-a\fR
148 tells \fB@TIC@\fP to retain commented-out capabilities rather than discarding
149 them.
150 Capabilities are commented by prefixing them with a period.
151 This sets the \fB\-x\fR option, because it treats the commented-out
152 entries as user-defined names.
153 If the source is termcap, accept the 2-character names required by version 6.
154 Otherwise these are ignored.
155 .TP
156 \fB\-C\fR
157 Force source translation to termcap format.
158 Note: this differs from the \fB\-C\fR
159 option of \fB@INFOCMP@\fR(1M) in that it does not merely translate capability
160 names, but also translates terminfo strings to termcap format.
161 Capabilities
162 that are not translatable are left in the entry under their terminfo names
163 but commented out with two preceding dots.
164 The actual format used incorporates some improvements for escaped characters
165 from terminfo format.
166 For a stricter BSD-compatible translation, add the \fB\-K\fR option.
167 .IP
168 If this is combined with \fB\-c\fR, \fB@TIC@\fR makes additional checks
169 to report cases where the terminfo values do not have an exact equivalent
170 in termcap form.
171 For example:
172 .RS
173 .bP
174 \fBsgr\fP usually will not convert, because termcap lacks the ability to
175 work with more than two parameters, and because termcap lacks many of
176 the arithmetic/logical operators used in terminfo.
177 .bP
178 capabilities with more than one delay or with delays before the end of
179 the string will not convert completely.
180 .RE
181 .TP
182 \fB\-c\fR
183 tells \fB@TIC@\fP to only check \fIfile\fR for errors,
184 including syntax problems and bad use-links.
185 If you specify \fB\-C\fR (\fB\-I\fR) with this option, the code
186 will print warnings about entries which, after use resolution, are more than
187 1023 (4096) bytes long.
188 Due to a fixed buffer length in older termcap libraries,
189 as well as buggy checking for the buffer length
190 (and a documented limit in terminfo),
191 these entries may cause core
192 dumps with other implementations.
193 .IP
194 \fB@TIC@\fP checks string capabilities to ensure that those with parameters
195 will be valid expressions.
196 It does this check only for the predefined string capabilities;
197 those which are defined with the \fB\-x\fP option are ignored.
198 .TP
199 \fB\-D\fR
200 tells \fB@TIC@\fP to print the database locations that it knows about, and exit.
201 The first location shown is the one to which it would write compiled
202 terminal descriptions.
203 If \fB@TIC@\fP is not able to find a writable database location
204 according to the rules summarized above,
205 it will print a diagnostic and exit with an error rather than
206 printing a list of database locations.
207 .TP
208 \fB\-e \fR\fInames\fR
209 Limit writes and translations to the following comma-separated list of
210 terminals.
211 If any name or alias of a terminal matches one of the names in
212 the list, the entry will be written or translated as normal.
213 Otherwise no output will be generated for it.
214 The option value is interpreted as a file containing the list if it
215 contains a '/'.
216 (Note: depending on how @TIC@ was compiled,
217 this option may require \fB\-I\fR or \fB\-C\fR.)
218 .TP
219 \fB\-f\fR
220 Display complex terminfo strings which contain if/then/else/endif expressions
221 indented for readability.
222 .TP
223 \fB\-G\fR
224 Display constant literals in decimal form
225 rather than their character equivalents.
226 .TP
227 \fB\-g\fR
228 Display constant character literals in quoted form
229 rather than their decimal equivalents.
230 .TP
231 \fB\-I\fR
232 Force source translation to terminfo format.
233 .TP
234 \fB\-K\fR
235 Suppress some longstanding ncurses extensions to termcap format,
236 e.g., "\\s" for space.
237 .TP
238 \fB\-L\fR
239 Force source translation to terminfo format
240 using the long C variable names listed in <\fBterm.h\fR>
241 .TP
242 \fB\-N\fR
243 Disable smart defaults.
244 Normally, when translating from termcap to terminfo, the compiler makes
245 a number of assumptions about the defaults of string capabilities
246 \fBreset1_string\fR, \fBcarriage_return\fR, \fBcursor_left\fR,
247 \fBcursor_down\fR, \fBscroll_forward\fR, \fBtab\fR, \fBnewline\fR,
248 \fBkey_backspace\fR, \fBkey_left\fR, and \fBkey_down\fR, then attempts
249 to use obsolete termcap capabilities to deduce correct values.
250 It also
251 normally suppresses output of obsolete termcap capabilities such as \fBbs\fR.
252 This option forces a more literal translation that also preserves the
253 obsolete capabilities.
254 .TP
255 \fB\-o\fR\fIdir\fR
256 Write compiled entries to given database location.
257 Overrides the TERMINFO environment variable.
258 .TP
259 \fB\-Q\fR\fIn\fR
260 Rather than show source in terminfo (text) format,
261 print the compiled (binary) format in hexadecimal or base64 form,
262 depending on the option's value:
263 .RS 8
264 .TP 3
265 1
266 hexadecimal
267 .TP 3
268 2
269 base64
270 .TP 3
271 3
272 hexadecimal and base64
273 .RE
274 .TP
275 \fB\-q\fR
276 Suppress comments and blank lines when showing translated source.
277 .TP
278 \fB\-R\fR\fIsubset\fR
279 Restrict output to a given subset.
280 This option is for use with archaic
281 versions of terminfo like those on SVr1, Ultrix, or HP/UX that do not support
282 the full set of SVR4/XSI Curses terminfo; and outright broken ports like AIX 3.x
283 that have their own extensions incompatible with SVr4/XSI.
284 Available subsets
285 are "SVr1", "Ultrix", "HP", "BSD" and "AIX";
286 see \fBterminfo\fR(\*n) for details.
287 .TP
288 \fB\-r\fR
289 Force entry resolution (so there are no remaining tc capabilities) even
290 when doing translation to termcap format.
291 This may be needed if you are
292 preparing a termcap file for a termcap library (such as GNU termcap through
293 version 1.3 or BSD termcap through 4.3BSD) that does not handle multiple
294 tc capabilities per entry.
295 .TP
296 \fB\-s\fR
297 Summarize the compile by showing the database location into which entries
298 are written, and the number of entries which are compiled.
299 .TP
300 \fB\-T\fR
301 eliminates size-restrictions on the generated text.
302 This is mainly useful for testing and analysis, since the compiled
303 descriptions are limited (e.g., 1023 for termcap, 4096 for terminfo).
304 .TP
305 \fB\-t\fR
306 tells \fB@TIC@\fP to discard commented-out capabilities.
307 Normally when translating from terminfo to termcap,
308 untranslatable capabilities are commented-out.
309 .TP 5
310 \fB\-U\fR
311 tells \fB@TIC@\fP to not post-process the data after parsing the source file.
312 Normally, it infers data which is commonly missing in older terminfo data,
313 or in termcaps.
314 .TP
315 \fB\-V\fR
316 reports the version of ncurses which was used in this program, and exits.
317 .TP
318 \fB\-v\fR\fIn\fR
319 specifies that (verbose) output be written to standard error trace
320 information showing \fB@TIC@\fR's progress.
321 .IP
322 The optional parameter \fIn\fR is a number from 1 to 10, inclusive,
323 indicating the desired level of detail of information.
324 If ncurses is built without tracing support, the optional parameter is ignored.
325 If \fIn\fR is omitted, the default level is 1.
326 If \fIn\fR is specified and greater than 1, the level of
327 detail is increased.
328 .RS
329 .PP
330 The debug flag levels are as follows:
331 .TP
332 1
333 Names of files created and linked
334 .TP
335 2
336 Information related to the \*(``use\*('' facility
337 .TP
338 3
339 Statistics from the hashing algorithm
340 .TP
341 5
342 String-table memory allocations
343 .TP
344 7
345 Entries into the string-table
346 .TP
347 8
348 List of tokens encountered by scanner
349 .TP
350 9
351 All values computed in construction of the hash table
352 .LP
353 If the debug level \fIn\fR is not given, it is taken to be one.
354 .RE
355 .TP
356 \fB\-W\fR
357 By itself, the \fB\-w\fP option will not force long strings to be wrapped.
358 Use the \fB\-W\fP option to do this.
359 .IP
360 If you specify both \fB\-f\fP and \fB\-W\fP options,
361 the latter is ignored when \fB\-f\fP has already split the line.
362 .TP
363 \fB\-w\fR\fIn\fR
364 specifies the width of the output.
365 The parameter is optional.
366 If it is omitted, it defaults to 60.
367 .TP
368 \fB\-x\fR
369 Treat unknown capabilities as user-defined (see \fBuser_caps(\*n)\fP).
370 That is, if you supply a capability name which \fB@TIC@\fP does not recognize,
371 it will infer its type (boolean, number or string) from the syntax and
372 make an extended table entry for that.
373 User-defined capability strings
374 whose name begins with \*(``k\*('' are treated as function keys.
375 .SS PARAMETERS
376 .TP
377 \fIfile\fR
378 contains one or more \fBterminfo\fR terminal descriptions in source
379 format [see \fBterminfo\fR(\*n)].
380 Each description in the file
381 describes the capabilities of a particular terminal.
382 .IP
383 If \fIfile\fR is \*(``-\*('', then the data is read from the standard input.
384 The \fIfile\fR parameter may also be the path of a character-device.
385 .SS PROCESSING
386 .PP
387 All but one of the capabilities recognized by \fB@TIC@\fR are documented
388 in \fBterminfo\fR(\*n).
389 The exception is the \fBuse\fR capability.
390 .PP
391 When a \fBuse\fR=\fIentry\fR\-\fIname\fR field is discovered in a
392 terminal entry currently being compiled, \fB@TIC@\fR reads in the binary
393 from \fB\*d\fR to complete the entry.
394 (Entries created from
395 \fIfile\fR will be used first.
396 \fB@TIC@\fR duplicates the capabilities in
397 \fIentry\fR\-\fIname\fR for the current entry, with the exception of
398 those capabilities that explicitly are defined in the current entry.
399 .PP
400 When an entry, e.g., \fBentry_name_1\fR, contains a
401 \fBuse=\fR\fIentry\fR_\fIname\fR_\fI2\fR field, any canceled
402 capabilities in \fIentry\fR_\fIname\fR_\fI2\fR must also appear in
403 \fBentry_name_1\fR before \fBuse=\fR for these capabilities to be
404 canceled in \fBentry_name_1\fR.
405 .PP
406 Total compiled entries cannot exceed 4096 bytes.
407 The name field cannot
408 exceed 512 bytes.
409 Terminal names exceeding the maximum alias length
410 (32 characters on systems with long filenames, 14 characters otherwise)
411 will be truncated to the maximum alias length
412 and a warning message will be printed.
413 .SH HISTORY
414 .PP
415 System V Release 2 provided a \fBtic\fP utility.
416 It accepted a single option: \fB\-v\fP (optionally followed by a number).
417 According to Ross Ridge's comment in \fImytinfo\fP,
418 this version of \fBtic\fP was
419 unable to represent cancelled capabilities.
420 .PP
421 System V Release 3 provided a different \fBtic\fP utility,
422 written by Pavel Curtis,
423 (originally named \*(``compile\*('' in \fIpcurses\fP).
424 This added an option \fB\-c\fP to check the file for
425 errors, with the caveat that errors in \*(``use=\*('' links
426 would not be reported.
427 System V Release 3 documented a few warning messages which
428 did not appear in \fIpcurses\fP.
429 While the program itself was changed little as development
430 continued with System V Release 4,
431 the table of capabilities grew from 180 (\fIpcurses\fP) to 464 (Solaris).
432 .PP
433 In early development of ncurses (1993),
434 Zeyd Ben-Halim used the table from \fImytinfo\fP to
435 extend the \fIpcurses\fP table to 469 capabilities
436 (456 matched SVr4, 8 were only in SVr4, 13 were not in SVr4).
437 Of those 13, 11 were ultimately discarded
438 (perhaps to match the draft of X/Open Curses).
439 The exceptions were
440 \fBmemory_lock_above\fP and
441 \fBmemory_unlock\fP (see \fBuser_caps\fP(5)).
442 .PP
443 Eric Raymond incorporated parts of \fImytinfo\fP into ncurses
444 to implement the termcap-to-terminfo source conversion,
445 and extended that to begin development of 
446 the corresponding terminfo-to-termcap source conversion,
447 Thomas Dickey completed that development over the course of several years.
448 .PP
449 In 1999, Thomas Dickey added the \fB\-x\fP option
450 to support user-defined capabilities.
451 .PP
452 In 2010, Roy Marples provided a \fBtic\fP program
453 and terminfo library for NetBSD.
454 That implementation adapts several features from ncurses,
455 including \fB@TIC@\fP's \fB\-x\fP option.
456 .PP
457 The \fB\-c\fP option tells \fB@TIC@\fP to check for problems in the
458 terminfo source file.
459 Continued development provides additional checks:
460 .bP
461 \fIpcurses\fP had 8 warnings
462 .bP
463 ncurses in 1996 had 16 warnings
464 .bP
465 Solaris (SVr4) curses has 28 warnings
466 .bP
467 NetBSD tic in 2019 has 19 warnings.
468 .bP
469 ncurses in 2019 has 96 warnings
470 .PP
471 The checking done in ncurses' \fB@TIC@\fP helps with the conversion to
472 termcap, as well as pointing out errors and inconsistencies.
473 It is also used to ensure consistency with the user-defined capabilities.
474 There are 527 distinct capabilities in ncurses' terminal database;
475 128 of those are user-defined.
476 .SH PORTABILITY
477 .PP
478 X/Open Curses, Issue 7 (2009) provides a brief description of \fBtic\fP.
479 It lists one option: \fB\-c\fP.
480 The omission of \fB\-v\fP is unexpected.
481 The change history states that the description is derived from True64 UNIX.
482 According to its manual pages, that system also supported the \fB\-v\fP option.
483 .PP
484 Shortly after Issue 7 was released, Tru64 was discontinued.
485 As of 2019, the surviving implementations of \fBtic\fP
486 are SVr4 (AIX, HP-UX and Solaris),
487 ncurses
488 and NetBSD curses.
489 The SVr4 \fBtic\fP programs all support the \fB\-v\fP option.
490 The NetBSD \fBtic\fP program follows X/Open's documentation,
491 omitting the \fB\-v\fP option.
492 .PP
493 The X/Open rationale states that some implementations of \fBtic\fP
494 read terminal descriptions from the standard input if the \fIfile\fP
495 parameter is omitted.
496 None of these implementations do that.
497 Further, it comments that some may choose to read from \*(''./terminfo.src\*(''
498 but that is obsolescent behavior from SVr2,
499 and is not (for example) a documented feature of SVr3.
500 .SS COMPATIBILITY
501 There is some evidence that historic \fB@TIC@\fR implementations treated
502 description fields with no whitespace in them as additional aliases or
503 short names.
504 This \fB@TIC@\fR does not do that, but it does warn when
505 description fields may be treated that way and check them for dangerous
506 characters.
507 .SS EXTENSIONS
508 Unlike the SVr4 \fB@TIC@\fR command, this implementation can actually
509 compile termcap sources.
510 In fact, entries in terminfo and termcap syntax can
511 be mixed in a single source file.
512 See \fBterminfo\fR(\*n) for the list of
513 termcap names taken to be equivalent to terminfo names.
514 .PP
515 The SVr4 manual pages are not clear on the resolution rules for \fBuse\fR
516 capabilities.
517 This implementation of \fB@TIC@\fR will find \fBuse\fR targets anywhere
518 in the source file, or anywhere in the file tree rooted at \fBTERMINFO\fR (if
519 \fBTERMINFO\fR is defined),
520 or in the user's \fI$HOME/.terminfo\fR database
521 (if it exists),
522 or (finally) anywhere in the system's file tree of
523 compiled entries.
524 .PP
525 The error messages from this \fB@TIC@\fR have the same format as GNU C
526 error messages, and can be parsed by GNU Emacs's compile facility.
527 .PP
528 Aside from \fB\-c\fP and \fB\-v\fP, options are not portable:
529 .bP
530 Most of @TIC@'s options 
531 are not supported by SVr4 \fBtic\fP:
532 .sp
533 .RS
534 \fB\-0\fR
535 \fB\-1\fR
536 \fB\-C\fR
537 \fB\-G\fR
538 \fB\-I\fR
539 \fB\-N\fR
540 \fB\-R\fR
541 \fB\-T\fR
542 \fB\-V\fR
543 \fB\-a\fR
544 \fB\-e\fR
545 \fB\-f\fR
546 \fB\-g\fR
547 \fB\-o\fR
548 \fB\-r\fR
549 \fB\-s\fR
550 \fB\-t\fR
551 \fB\-x\fR
552 .RE
553 .bP
554 The NetBSD \fBtic\fP  supports a few of the ncurses options
555 .sp
556 .RS
557 \fB\-a\fP
558 \fB\-o\fP
559 \fB\-x\fP
560 .RE
561 .IP
562 and adds \fB\-S\fP
563 (a feature which does the same thing
564 as @INFOCMP@'s \fB\-e\fP and \fB\-E\fP options).
565 .PP
566 The SVr4 \fB\-c\fR mode does not report bad \*(``use=\*('' links.
567 .PP
568 System V does not compile entries to or read entries from your
569 \fI$HOME/.terminfo\fR database unless TERMINFO is explicitly set to it.
570 .SH FILES
571 .TP 5
572 \fB\*d/?/*\fR
573 Compiled terminal description database.
574 .SH SEE ALSO
575 \fB@INFOCMP@\fR(1M),
576 \fB@CAPTOINFO@\fR(1M),
577 \fB@INFOTOCAP@\fR(1M),
578 \fB@TOE@\fR(1M),
579 \fBcurses\fR(3X),
580 \fBterm\fR(\*n).
581 \fBterminfo\fR(\*n).
582 \fBuser_caps\fR(\*n).
583 .PP
584 This describes \fBncurses\fR
585 version @NCURSES_MAJOR@.@NCURSES_MINOR@ (patch @NCURSES_PATCH@).
586 .SH AUTHOR
587 Eric S. Raymond <esr@snark.thyrsus.com>
588 and
589 .br
590 Thomas E. Dickey <dickey@invisible-island.net>