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