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