]> ncurses.scripts.mit.edu Git - ncurses.git/blob - man/tabs.1
ncurses 6.4 - patch 20240414
[ncurses.git] / man / tabs.1
1 .\"***************************************************************************
2 .\" Copyright 2018-2023,2024 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.57 2024/03/16 15:35:01 tom Exp $
31 .TH @TABS@ 1 2024-03-16 "ncurses @NCURSES_MAJOR@.@NCURSES_MINOR@" "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 .SH NAME
49 \fB\%@TABS@\fP \-
50 set terminal tab stops
51 .SH SYNOPSIS
52 \fB@TABS@\fP [\fIoptions\fP] [\fItabstop-list\fP]
53 .SH DESCRIPTION
54 The \fB@TABS@\fP program clears and sets tab-stops on the terminal.
55 This uses the terminfo \fBclear_all_tabs\fP and \fBset_tab\fP capabilities.
56 If either is absent, \fB@TABS@\fP is unable to clear/set tab-stops.
57 The terminal should be configured to use hard tabs, e.g.,
58 .PP
59 .RS 4
60 .EX
61 stty tab0
62 .EE
63 .RE
64 .PP
65 Like \fB@CLEAR@\fP(1), \fB@TABS@\fP writes to the standard output.
66 You can redirect the standard output to a file (which prevents
67 \fB@TABS@\fP from actually changing the tabstops),
68 and later \fBcat\fP the file to the screen, setting tabstops at that point.
69 .PP
70 These are hardware tabs, which cannot be queried rapidly by applications
71 running in the terminal, if at all.
72 Curses and other full-screen applications may use hardware tabs
73 in optimizing their output to the terminal.
74 If the hardware tabstops differ from the information in the terminal
75 database, the result is unpredictable.
76 Before running curses programs,
77 you should either reset tab-stops to the standard interval
78 .PP
79 .RS 4
80 .EX
81 tabs \-8
82 .EE
83 .RE
84 .PP
85 or use the \fB@RESET@\fP program,
86 since the normal initialization sequences do not ensure that tab-stops
87 are reset.
88 .SH OPTIONS
89 .SS "General Options"
90 .TP 5
91 .BI \-T "name"
92 Tell \fB@TABS@\fP which terminal type to use.
93 If this option is not given, \fB@TABS@\fP will use the \fB$TERM\fP
94 environment variable.
95 If that is not set, it will use the \fIansi+tabs\fP entry.
96 .TP 5
97 .B \-d
98 The debugging option shows a ruler line, followed by two data lines.
99 The first data line shows the expected tab-stops marked with asterisks.
100 The second data line shows the actual tab-stops, marked with asterisks.
101 .TP 5
102 .B \-n
103 This option tells \fB@TABS@\fP to check the options and run any debugging
104 option, but not to modify the terminal settings.
105 .TP
106 \fB\-V\fP
107 reports the version of \fI\%ncurses\fP which was used in this program,
108 and exits.
109 .PP
110 The \fB@TABS@\fP program processes a single list of tab stops.
111 The last option to be processed which defines a list is the one that
112 determines the list to be processed.
113 .SS "Implicit Lists"
114 Use a single number as an option,
115 e.g., \*(``\fB\-5\fP\*('' to set tabs at the given
116 interval (in this case 1, 6, 11, 16, 21, etc.).
117 Tabs are repeated up to the right margin of the screen.
118 .PP
119 Use \*(``\fB\-0\fP\*('' to clear all tabs.
120 .PP
121 Use \*(``\fB\-8\fP\*('' to set tabs to the standard interval.
122 .SS "Explicit Lists"
123 An explicit list can be defined after the options
124 (this does not use a \*(``\-\*('').
125 The values in the list must be in increasing numeric order,
126 and greater than zero.
127 They are separated by a comma or a blank, for example,
128 .PP
129 .RS 4
130 .EX
131 tabs 1,6,11,16,21
132 tabs 1 6 11 16 21
133 .EE
134 .RE
135 .PP
136 Use a \*(``+\*('' to treat a number
137 as an increment relative to the previous value,
138 e.g.,
139 .PP
140 .RS 4
141 .EX
142 tabs 1,+5,+5,+5,+5
143 .EE
144 .RE
145 .PP
146 which is equivalent to the 1,6,11,16,21 example.
147 .SS "Predefined Tab Stops"
148 POSIX defines several predefined lists of tab stops.
149 .TP 5
150 .B \-a
151 Assembler, IBM S/370, first format
152 .br
153 1,10,16,36,72
154 .TP 5
155 .B \-a2
156 Assembler, IBM S/370, second format
157 .br
158 1,10,16,40,72
159 .TP 5
160 .B \-c
161 COBOL, normal format
162 .br
163 1,8,12,16,20,55
164 .TP 5
165 .B \-c2
166 COBOL compact format
167 .br
168 1,6,10,14,49
169 .TP 5
170 .B \-c3
171 COBOL compact format extended
172 .br
173 1,6,10,14,18,22,26,30,34,38,42,46,50,54,58,62,67
174 .TP 5
175 .B \-f
176 FORTRAN
177 .br
178 1,7,11,15,19,23
179 .TP 5
180 .B \-p
181 PL/I
182 .br
183 1,5,9,13,17,21,25,29,33,37,41,45,49,53,57,61
184 .TP 5
185 .B \-s
186 SNOBOL
187 .br
188 1,10,55
189 .TP 5
190 .B \-u
191 UNIVAC 1100 Assembler
192 .br
193 1,12,20,44
194 .SS Margins
195 A few terminals expose a means of changing their left and right margins.
196 \fB@TABS@\fP supports this feature with an option.
197 .TP 5
198 .BI +m \ margin
199 The effect depends on whether the terminal has the margin capabilities:
200 .RS
201 .bP
202 If the terminal provides the capability for setting the left margin,
203 \fB@TABS@\fP uses this,
204 and adjusts the available tab stop widths.
205 .bP
206 If the terminal does not provide the margin capabilities,
207 \fB@TABS@\fP imitates their effect,
208 putting tab stops at appropriate places on each line.
209 The terminal's left margin is not modified.
210 .RE
211 .IP
212 If the
213 .I margin
214 parameter is omitted,
215 the default is 10.
216 Use
217 .B +m0
218 to reset the left margin,
219 that is,
220 to make it the left edge of the terminal's display.
221 Before setting a left margin,
222 \fB@TABS@\fP resets the margin to reduce problems that might arise
223 from moving the cursor to the left of the current left margin.
224 .PP
225 When setting or resetting the left margin,
226 \fB@TABS@\fP may also reset the right margin.
227 .SH FILES
228 .TP
229 .I @DATADIR@/tabset
230 tab stop initialization database
231 .SH PORTABILITY
232 IEEE Std 1003.1/The Open Group Base Specifications Issue 7
233 (POSIX.1-2008)
234 describes a
235 .B tabs
236 utility.
237 However,
238 .bP
239 this standard describes a
240 .B +m
241 option to set a terminal's left margin.
242 Very few of the entries in the terminal database provide the
243 .B \%set_left_margin
244 .RB ( smgl )
245 or
246 .B \%set_left_margin_parm
247 .RB \%( smglp )
248 capabilities needed to support the feature.
249 .bP
250 There is no counterpart in X/Open Curses Issue 7 for this utility,
251 unlike \fB@TPUT@\fP(1).
252 .PP
253 The
254 .B \-d
255 (debug) and
256 .B \-n
257 (no-op) options are
258 .I \%ncurses
259 extensions not provided by other implementations.
260 .SH HISTORY
261 A
262 .B tabs
263 utility appeared in PWB/Unix 1.0 (1977).
264 .\" https://minnie.tuhs.org/cgi-bin/utree.pl?file=PWB1/sys/source/s2/\
265 .\"   tabs.c
266 A reduced version shipped in Seventh Edition Unix
267 (early 1979)
268 .\" https://minnie.tuhs.org/cgi-bin/utree.pl?file=V7/usr/src/cmd/tabs.c
269 and in 3BSD
270 .\" https://minnie.tuhs.org/cgi-bin/utree.pl?file=3BSD/usr/src/cmd/\
271 .\"   tabs.c
272 (later the same year);
273 it supported a \*(``\-n\*('' option to set the first tab stop at the
274 left margin.
275 That option is not documented by POSIX.
276 .PP
277 The PWB/Unix
278 .B tabs
279 utility returned in System III (1980),
280 and used built-in tables,
281 rather than the terminal database,
282 to support a half-dozen hardcopy terminal (printer) types.
283 It also had built-in logic to support setting the left margin,
284 as well as a feature for copying the tab settings from a file.
285 .PP
286 Versions of the program in later releases of AT&T Unix,
287 such as SVr4,
288 .\" https://minnie.tuhs.org/cgi-bin/utree.pl?file=SysVR4/cmd/tabs/tabs.c
289 added support for the terminal database,
290 but retained the tables to support the printers.
291 By this time,
292 System\ V
293 .B tput
294 had incorporated the tab stop initialization feature of BSD's
295 .B tset
296 from 1982,
297 but employed the
298 .I \%term\%info
299 database to do so.
300 .PP
301 The
302 .B +m
303 option was documented in the POSIX Base Specifications Issue 5
304 (Unix98, 1997),
305 then omitted in Issue 6
306 (Unix03, 2004)
307 without express motivation,
308 though an introductory comment
309 \*(``and optionally adjusts the margin\*('' remains,
310 overlooked in the removal.
311 The
312 .B tabs
313 utility documented in Issues 6 and later has no mechanism for setting
314 margins.
315 The
316 .B +m
317 option in
318 .I \%ncurses
319 \fB\%@TABS@\fP differs from the SVr4 feature by using terminal
320 capabilities rather than built-in tables.
321 .PP
322 POSIX documents no limit on the number of tab stops.
323 Other implementations impose one;
324 the limit is 20 in PWB/Unix's
325 .B tabs
326 utility.
327 While some terminals may not accept an arbitrary number of tab stops,
328 .I \%ncurses
329 \fB\%@TABS@\fP attempts to set tab stops up to the right margin if the
330 list thereof is sufficiently long.
331 .PP
332 The \*(``Rationale\*('' section of the Issue 6
333 .B tabs
334 reference page
335 .\" https://pubs.opengroup.org/onlinepubs/009604499/utilities/tabs.html
336 details how the committee considered redesigning the
337 .B tabs
338 and
339 .B tput
340 utilities,
341 without settling on an improved solution.
342 It claims that
343 .PP
344 .RS 4
345 \*(``no known historical version of
346 .I tabs
347 supports the capability of setting arbitrary tab stops.\*(''
348 .RE
349 .PP
350 The feature described in subsection \*(``Explicit Lists\*('' above was
351 implemented in PWB/Unix,
352 .\" see URL above
353 and permitted the setting of abitrary tab stops nevertheless.
354 .SH SEE ALSO
355 \fB\%@INFOCMP@\fP(1M),
356 \fB\%@TSET@\fP(1),
357 \fB\%curses\fP(3X),
358 \fB\%terminfo\fP(5)