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