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