]> ncurses.scripts.mit.edu Git - ncurses.git/blob - man/tabs.1
ncurses 6.4 - patch 20230909
[ncurses.git] / man / tabs.1
1 .\"***************************************************************************
2 .\" Copyright 2018-2021,2023 Thomas E. Dickey                                *
3 .\" Copyright 2008-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: tabs.1,v 1.41 2023/09/09 21:19:07 tom Exp $
31 .TH @TABS@ 1 2023-09-09 "ncurses 6.4" "User commands"
32 .ds n 5
33 .ie \n(.g .ds `` \(lq
34 .el       .ds `` ``
35 .ie \n(.g .ds '' \(rq
36 .el       .ds '' ''
37 .de bP
38 .ie n  .IP \(bu 4
39 .el    .IP \(bu 2
40 ..
41 .ie n .ds CW R
42 .el   \{
43 .ie \n(.g .ds CW CR
44 .el       .ds CW CW
45 .\}
46 .de NS
47 .ie n  .sp
48 .el    .sp .5
49 .ie n  .in +4
50 .el    .in +2
51 .nf
52 .ft \*(CW
53 ..
54 .de NE
55 .fi
56 .ft R
57 .ie n  .in -4
58 .el    .in -2
59 ..
60 .SH NAME
61 \fB@TABS@\fP \- set tabs on a terminal
62 .SH SYNOPSIS
63 \fB@TABS@\fP [\fIoptions\fP]] \fI[tabstop-list]\fP
64 .SH DESCRIPTION
65 The \fB@TABS@\fP program clears and sets tab-stops on the terminal.
66 This uses the terminfo \fBclear_all_tabs\fP and \fBset_tab\fP capabilities.
67 If either is absent, \fB@TABS@\fP is unable to clear/set tab-stops.
68 The terminal should be configured to use hard tabs, e.g.,
69 .NS
70 stty tab0
71 .NE
72 .PP
73 Like \fB@CLEAR@\fP(1), \fB@TABS@\fP writes to the standard output.
74 You can redirect the standard output to a file (which prevents
75 \fB@TABS@\fP from actually changing the tabstops),
76 and later \fBcat\fP the file to the screen, setting tabstops at that point.
77 .PP
78 These are hardware tabs, which cannot be queried rapidly by applications
79 running in the terminal, if at all.
80 Curses and other full-screen applications may use hardware tabs
81 in optimizing their output to the terminal.
82 If the hardware tabstops differ from the information in the terminal
83 database, the result is unpredictable.
84 Before running curses programs,
85 you should either reset tab-stops to the standard interval
86 .NS
87 tabs -8
88 .NE
89 .PP
90 or use the \fB@RESET@\fP program,
91 since the normal initialization sequences do not ensure that tab-stops
92 are reset.
93 .SH OPTIONS
94 .SS General Options
95 .TP 5
96 .BI \-T "name"
97 Tell \fB@TABS@\fP which terminal type to use.
98 If this option is not given, \fB@TABS@\fP will use the \fB$TERM\fP
99 environment variable.
100 If that is not set, it will use the \fIansi+tabs\fP entry.
101 .TP 5
102 .B \-d
103 The debugging option shows a ruler line, followed by two data lines.
104 The first data line shows the expected tab-stops marked with asterisks.
105 The second data line shows the actual tab-stops, marked with asterisks.
106 .TP 5
107 .B \-n
108 This option tells \fB@TABS@\fP to check the options and run any debugging
109 option, but not to modify the terminal settings.
110 .TP
111 \fB\-V\fP
112 reports the version of ncurses which was used in this program, and exits.
113 .PP
114 The \fB@TABS@\fP program processes a single list of tab stops.
115 The last option to be processed which defines a list is the one that
116 determines the list to be processed.
117 .SS Implicit Lists
118 Use a single number as an option,
119 e.g., \*(``\fB\-5\fP\*('' to set tabs at the given
120 interval (in this case 1, 6, 11, 16, 21, etc.).
121 Tabs are repeated up to the right margin of the screen.
122 .PP
123 Use \*(``\fB\-0\fP\*('' to clear all tabs.
124 .PP
125 Use \*(``\fB\-8\fP\*('' to set tabs to the standard interval.
126 .SS Explicit Lists
127 An explicit list can be defined after the options
128 (this does not use a \*(``\-\*('').
129 The values in the list must be in increasing numeric order,
130 and greater than zero.
131 They are separated by a comma or a blank, for example,
132 .NS
133 tabs 1,6,11,16,21
134 .br
135 tabs 1 6 11 16 21
136 .NE
137 .PP
138 Use a \*(``+\*('' to treat a number
139 as an increment relative to the previous value,
140 e.g.,
141 .NS
142 tabs 1,+5,+5,+5,+5
143 .NE
144 .PP
145 which is equivalent to the 1,6,11,16,21 example.
146 .SS Predefined Tab-Stops
147 POSIX defines several predefined lists of tab stops.
148 .TP 5
149 .B \-a
150 Assembler, IBM S/370, first format
151 .br
152 1,10,16,36,72
153 .TP 5
154 .B \-a2
155 Assembler, IBM S/370, second format
156 .br
157 1,10,16,40,72
158 .TP 5
159 .B \-c
160 COBOL, normal format
161 .br
162 1,8,12,16,20,55
163 .TP 5
164 .B \-c2
165 COBOL compact format
166 .br
167 1,6,10,14,49
168 .TP 5
169 .B \-c3
170 COBOL compact format extended
171 .br
172 1,6,10,14,18,22,26,30,34,38,42,46,50,54,58,62,67
173 .TP 5
174 .B \-f
175 FORTRAN
176 .br
177 1,7,11,15,19,23
178 .TP 5
179 .B \-p
180 PL/I
181 .br
182 1,5,9,13,17,21,25,29,33,37,41,45,49,53,57,61
183 .TP 5
184 .B \-s
185 SNOBOL
186 .br
187 1,10,55
188 .TP 5
189 .B \-u
190 UNIVAC 1100 Assembler
191 .br
192 1,12,20,44
193 .SS Margins
194 A few terminals provide the capability for changing their left/right margins.
195 The @TABS@ program has an option to use this feature:
196 .TP 5
197 .BI +m \ margin
198 The effect depends on whether the terminal has the margin capabilities:
199 .RS
200 .bP
201 If the terminal provides the capability for setting the left margin,
202 @TABS@ uses this, and adjusts the available width for tab-stops.
203 .bP
204 If the terminal does not provide the margin capabilities,
205 @TABS@ imitates the effect, putting the tab stops at the appropriate
206 place on each line.
207 The terminal's left-margin is not modified.
208 .RE
209 .IP
210 If the \fImargin\fP parameter is omitted, the default is 10.
211 Use \fB+m0\fP to reset the left margin,
212 i.e., to the left edge of the terminal's display.
213 Before setting a left-margin,
214 @TABS@ resets the margin to reduce problems which might arise
215 on moving the cursor before the current left-margin.
216 .PP
217 When setting or resetting the left-margin,
218 @TABS@ may reset the right-margin.
219 .SH PORTABILITY
220 \fIIEEE Std 1003.1/The Open Group Base Specifications Issue 7\fP (POSIX.1-2008)
221 describes a \fBtabs\fP utility.
222 However
223 .bP
224 This standard describes a \fB+m\fP option, to set a terminal's left-margin.
225 Very few of the entries in the terminal database provide the
226 \fBsmgl\fP (\fBset_left_margin\fP) or
227 \fBsmglp\fP (\fBset_left_margin_parm\fP)
228 capability needed to support the feature.
229 .bP
230 There is no counterpart in X/Open Curses Issue 7 for this utility,
231 unlike \fB@TPUT@\fP(1).
232 .PP
233 The \fB\-d\fP (debug) and \fB\-n\fP (no-op) options are extensions not provided
234 by other implementations.
235 .PP
236 A \fBtabs\fP utility appeared in PWB/Unix 1.0 (1977).
237 There was a reduced version of the \fBtabs\fP utility
238 in Unix 7th edition and in 3BSD (1979).
239 The latter supported a single \*(``\-n\*('' option
240 (to cause the first tab stop to be set on the left margin).
241 That option is not documented by POSIX.
242 .PP
243 The PWB/Unix \fBtabs\fP utility, which was included in System III (1980),
244 used built-in tables rather than the terminal database,
245 to support a half-dozen hardcopy terminal (printer) types.
246 It also had built-in logic to support the left-margin,
247 as well as a feature for copying the tab settings from a file.
248 .PP
249 Later versions of Unix, e.g., SVr4,
250 added support for the terminal database,
251 but kept the tables to support the printers.
252 In an earlier development effort,
253 the tab-stop initialization provided by \fBtset\fP (1982)
254 and incorporated into \fBtput\fP uses the terminal database,
255 .PP
256 The \fB+m\fP option was documented
257 in the Base Specifications Issue 5 (Unix98, 1997),
258 and omitted in Issue 6 (Unix03, 2004) without documenting the rationale,
259 though an introductory comment
260 \fI\*(``and optionally adjusts the margin\*(''\fP remains,
261 overlooked in the removal.
262 The documented \fBtabs\fP utility in Issues 6 and later has no mechanism
263 for setting margins.
264 The \fB+m\fP option in this implementation differs from the feature
265 in SVr4 by using terminal capabilities rather than built-in tables.
266 .PP
267 POSIX documents no limits on the number of tab stops.
268 Documentation for other implementations states that there is a limit on the
269 number of tab stops
270 (e.g., 20 in PWB/Unix's \fBtabs\fP utility).
271 While some terminals may not accept an arbitrary number
272 of tab stops, this implementation will attempt to set tab stops up to the
273 right margin of the screen, if the given list happens to be that long.
274 .PP
275 The \fIRationale\fP section of the POSIX documentation goes into some
276 detail about the ways the committee considered redesigning the
277 \fBtabs\fP and \fBtput\fP utilities,
278 without proposing an improved solution.
279 It comments that
280 .RS 5
281 .PP
282 no known historical version of tabs supports the capability of setting
283 arbitrary tab stops.
284 .RE
285 .PP
286 However, the \fIExplicit Lists\fP described in this manual page
287 were implemented in PWB/Unix.
288 Those provide the capability of setting abitrary tab stops.
289 .SH SEE ALSO
290 \fB@INFOCMP@\fP(1M),
291 \fB@TSET@\fP(1),
292 \fBcurses\fP(3X),
293 \fBterminfo\fP(\*n).
294 .PP
295 This describes \fBncurses\fP
296 version @NCURSES_MAJOR@.@NCURSES_MINOR@ (patch @NCURSES_PATCH@).