blob: 059bc1ec66fcf7fdbbca52895bb0ae547eaf479f [file] [log] [blame]
Steve Kondikae271bc2015-11-15 02:50:53 +01001.\"***************************************************************************
micky3879b9f5e72025-07-08 18:04:53 -04002.\" Copyright 2018-2023,2024 Thomas E. Dickey *
3.\" Copyright 2008-2016,2017 Free Software Foundation, Inc. *
Steve Kondikae271bc2015-11-15 02:50:53 +01004.\" *
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.\"
micky3879b9f5e72025-07-08 18:04:53 -040030.\" $Id: tabs.1,v 1.59 2024/04/20 19:08:15 tom Exp $
31.TH @TABS@ 1 2024-04-20 "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.
Steve Kondikae271bc2015-11-15 02:50:53 +010048.SH NAME
micky3879b9f5e72025-07-08 18:04:53 -040049\fB\%@TABS@\fP \-
50set terminal tab stops
Steve Kondikae271bc2015-11-15 02:50:53 +010051.SH SYNOPSIS
micky3879b9f5e72025-07-08 18:04:53 -040052\fB@TABS@\fP [\fIoptions\fP] [\fItabstop-list\fP]
Steve Kondikae271bc2015-11-15 02:50:53 +010053.SH DESCRIPTION
Steve Kondikae271bc2015-11-15 02:50:53 +010054The \fB@TABS@\fP program clears and sets tab-stops on the terminal.
micky3879b9f5e72025-07-08 18:04:53 -040055This uses the terminfo \fBclear_all_tabs\fP and \fBset_tab\fP capabilities.
Steve Kondikae271bc2015-11-15 02:50:53 +010056If either is absent, \fB@TABS@\fP is unable to clear/set tab-stops.
57The terminal should be configured to use hard tabs, e.g.,
micky3879b9f5e72025-07-08 18:04:53 -040058.PP
59.RS 4
60.EX
Steve Kondikae271bc2015-11-15 02:50:53 +010061stty tab0
micky3879b9f5e72025-07-08 18:04:53 -040062.EE
Steve Kondikae271bc2015-11-15 02:50:53 +010063.RE
micky3879b9f5e72025-07-08 18:04:53 -040064.PP
65Like \fB@CLEAR@\fP(1), \fB@TABS@\fP writes to the standard output.
66You can redirect the standard output to a file (which prevents
67\fB@TABS@\fP from actually changing the tabstops),
68and later \fBcat\fP the file to the screen, setting tabstops at that point.
69.PP
70These are hardware tabs, which cannot be queried rapidly by applications
71running in the terminal, if at all.
72Curses and other full-screen applications may use hardware tabs
73in optimizing their output to the terminal.
74If the hardware tabstops differ from the information in the terminal
75database, the result is unpredictable.
76Before running curses programs,
77you should either reset tab-stops to the standard interval
78.PP
79.RS 4
80.EX
81tabs \-8
82.EE
83.RE
84.PP
85or use the \fB@RESET@\fP program,
86since the normal initialization sequences do not ensure that tab-stops
87are reset.
Steve Kondikae271bc2015-11-15 02:50:53 +010088.SH OPTIONS
micky3879b9f5e72025-07-08 18:04:53 -040089.SS "General Options"
Steve Kondikae271bc2015-11-15 02:50:53 +010090.TP 5
91.BI \-T "name"
92Tell \fB@TABS@\fP which terminal type to use.
93If this option is not given, \fB@TABS@\fP will use the \fB$TERM\fP
94environment variable.
95If that is not set, it will use the \fIansi+tabs\fP entry.
96.TP 5
97.B \-d
98The debugging option shows a ruler line, followed by two data lines.
99The first data line shows the expected tab-stops marked with asterisks.
100The second data line shows the actual tab-stops, marked with asterisks.
101.TP 5
102.B \-n
103This option tells \fB@TABS@\fP to check the options and run any debugging
104option, but not to modify the terminal settings.
105.TP
micky3879b9f5e72025-07-08 18:04:53 -0400106\fB\-V\fP
107reports the version of \fI\%ncurses\fP which was used in this program,
108and exits.
Steve Kondikae271bc2015-11-15 02:50:53 +0100109.PP
110The \fB@TABS@\fP program processes a single list of tab stops.
111The last option to be processed which defines a list is the one that
112determines the list to be processed.
micky3879b9f5e72025-07-08 18:04:53 -0400113.SS "Implicit Lists"
114Use a single number as an option,
115e.g., \*(``\fB\-5\fP\*('' to set tabs at the given
116interval (in this case 1, 6, 11, 16, 21, etc.).
117Tabs are repeated up to the right margin of the screen.
Steve Kondikae271bc2015-11-15 02:50:53 +0100118.PP
micky3879b9f5e72025-07-08 18:04:53 -0400119Use \*(``\fB\-0\fP\*('' to clear all tabs.
Steve Kondikae271bc2015-11-15 02:50:53 +0100120.PP
micky3879b9f5e72025-07-08 18:04:53 -0400121Use \*(``\fB\-8\fP\*('' to set tabs to the standard interval.
122.SS "Explicit Lists"
123An explicit list can be defined after the options
124(this does not use a \*(``\-\*('').
125The values in the list must be in increasing numeric order,
126and greater than zero.
127They are separated by a comma or a blank, for example,
128.PP
129.RS 4
130.EX
Steve Kondikae271bc2015-11-15 02:50:53 +0100131tabs 1,6,11,16,21
Steve Kondikae271bc2015-11-15 02:50:53 +0100132tabs 1 6 11 16 21
micky3879b9f5e72025-07-08 18:04:53 -0400133.EE
Steve Kondikae271bc2015-11-15 02:50:53 +0100134.RE
micky3879b9f5e72025-07-08 18:04:53 -0400135.PP
136Use a \*(``+\*('' to treat a number
137as an increment relative to the previous value,
Steve Kondikae271bc2015-11-15 02:50:53 +0100138e.g.,
micky3879b9f5e72025-07-08 18:04:53 -0400139.PP
140.RS 4
141.EX
Steve Kondikae271bc2015-11-15 02:50:53 +0100142tabs 1,+5,+5,+5,+5
micky3879b9f5e72025-07-08 18:04:53 -0400143.EE
Steve Kondikae271bc2015-11-15 02:50:53 +0100144.RE
micky3879b9f5e72025-07-08 18:04:53 -0400145.PP
Steve Kondikae271bc2015-11-15 02:50:53 +0100146which is equivalent to the 1,6,11,16,21 example.
micky3879b9f5e72025-07-08 18:04:53 -0400147.SS "Predefined Tab Stops"
148POSIX defines several predefined lists of tab stops.
Steve Kondikae271bc2015-11-15 02:50:53 +0100149.TP 5
150.B \-a
151Assembler, IBM S/370, first format
micky3879b9f5e72025-07-08 18:04:53 -0400152.br
1531,10,16,36,72
Steve Kondikae271bc2015-11-15 02:50:53 +0100154.TP 5
155.B \-a2
156Assembler, IBM S/370, second format
micky3879b9f5e72025-07-08 18:04:53 -0400157.br
1581,10,16,40,72
Steve Kondikae271bc2015-11-15 02:50:53 +0100159.TP 5
160.B \-c
161COBOL, normal format
micky3879b9f5e72025-07-08 18:04:53 -0400162.br
1631,8,12,16,20,55
Steve Kondikae271bc2015-11-15 02:50:53 +0100164.TP 5
165.B \-c2
166COBOL compact format
micky3879b9f5e72025-07-08 18:04:53 -0400167.br
1681,6,10,14,49
Steve Kondikae271bc2015-11-15 02:50:53 +0100169.TP 5
170.B \-c3
171COBOL compact format extended
micky3879b9f5e72025-07-08 18:04:53 -0400172.br
1731,6,10,14,18,22,26,30,34,38,42,46,50,54,58,62,67
Steve Kondikae271bc2015-11-15 02:50:53 +0100174.TP 5
175.B \-f
176FORTRAN
micky3879b9f5e72025-07-08 18:04:53 -0400177.br
1781,7,11,15,19,23
Steve Kondikae271bc2015-11-15 02:50:53 +0100179.TP 5
180.B \-p
181PL/I
micky3879b9f5e72025-07-08 18:04:53 -0400182.br
1831,5,9,13,17,21,25,29,33,37,41,45,49,53,57,61
Steve Kondikae271bc2015-11-15 02:50:53 +0100184.TP 5
185.B \-s
186SNOBOL
micky3879b9f5e72025-07-08 18:04:53 -0400187.br
1881,10,55
Steve Kondikae271bc2015-11-15 02:50:53 +0100189.TP 5
190.B \-u
191UNIVAC 1100 Assembler
micky3879b9f5e72025-07-08 18:04:53 -0400192.br
1931,12,20,44
194.SS Margins
195A 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
199The effect depends on whether the terminal has the margin capabilities:
200.RS
201.bP
202If the terminal provides the capability for setting the left margin,
203\fB@TABS@\fP uses this,
204and adjusts the available tab stop widths.
205.bP
206If the terminal does not provide the margin capabilities,
207\fB@TABS@\fP imitates their effect,
208putting tab stops at appropriate places on each line.
209The terminal's left margin is not modified.
210.RE
211.IP
212If the
213.I margin
214parameter is omitted,
215the default is 10.
216Use
217.B +m0
218to reset the left margin,
219that is,
220to make it the left edge of the terminal's display.
221Before setting a left margin,
222\fB@TABS@\fP resets the margin to reduce problems that might arise
223from moving the cursor to the left of the current left margin.
224.PP
225When 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
230tab stop initialization database
Steve Kondikae271bc2015-11-15 02:50:53 +0100231.SH PORTABILITY
micky3879b9f5e72025-07-08 18:04:53 -0400232IEEE Std 1003.1/The Open Group Base Specifications Issue 7
233(POSIX.1-2008)
234describes a
235.B tabs
236utility.
237However,
238.bP
239this standard describes a
240.B +m
241option to set a terminal's left margin.
242Very few of the entries in the terminal database provide the
243.B \%set_left_margin
244.RB ( smgl )
245or
246.B \%set_left_margin_parm
247.RB \%( smglp )
248capabilities needed to support the feature.
249.bP
250There is no counterpart in X/Open Curses Issue 7 for this utility,
251unlike \fB@TPUT@\fP(1).
Steve Kondikae271bc2015-11-15 02:50:53 +0100252.PP
micky3879b9f5e72025-07-08 18:04:53 -0400253The
254.B \-d
255(debug) and
256.B \-n
257(no-op) options are
258.I \%ncurses
259extensions not provided by other implementations.
260.SH HISTORY
261A
262.B tabs
263utility appeared in PWB/Unix 1.0 (1977).
264.\" https://minnie.tuhs.org/cgi-bin/utree.pl?file=PWB1/sys/source/s2/\
265.\" tabs.c
266A 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
269and in 3BSD
270.\" https://minnie.tuhs.org/cgi-bin/utree.pl?file=3BSD/usr/src/cmd/\
271.\" tabs.c
272(later the same year);
273it supported a \*(``\-n\*('' option to set the first tab stop at the
274left margin.
275That option is not specified by POSIX.
Steve Kondikae271bc2015-11-15 02:50:53 +0100276.PP
micky3879b9f5e72025-07-08 18:04:53 -0400277The PWB/Unix
278.B tabs
279utility returned in System III (1980),
280and used built-in tables
281to support a half-dozen hardcopy terminal (printer) types.
282It also had logic to support setting the left margin,
283as well as a feature for copying the tab settings from a file.
Steve Kondikae271bc2015-11-15 02:50:53 +0100284.PP
micky3879b9f5e72025-07-08 18:04:53 -0400285Versions of the program in later releases of AT&T Unix,
286such as SVr4,
287.\" https://minnie.tuhs.org/cgi-bin/utree.pl?file=SysVR4/cmd/tabs/tabs.c
288added support for the terminal database,
289but retained the tables to support the printers.
290By this time,
291System\ V
292.B tput
293had incorporated the tab stop initialization feature of BSD's
294.B tset
295from 1982,
296but employed the
297.I \%term\%info
298database to do so.
299.PP
300The
301.B +m
302option was documented in the POSIX Base Specifications Issue 5
303(Unix98, 1997),
304then omitted in Issue 6
305(Unix03, 2004)
306without express motivation,
307though an introductory comment
308\*(``and optionally adjusts the margin\*('' remains,
309overlooked in the removal.
310The
311.B tabs
312utility documented in Issues 6 and later has no mechanism for setting
313margins.
314The
315.B +m
316option in
317.I \%ncurses
318\fB\%@TABS@\fP differs from the SVr4 feature by using terminal
319capabilities rather than built-in tables.
320.PP
321POSIX documents no limit on the number of tab stops.
322Other implementations impose one;
323the limit is 20 in PWB/Unix's
324.B tabs
325utility.
326While some terminals may not accept an arbitrary number of tab stops,
327.I \%ncurses
328\fB\%@TABS@\fP attempts to set tab stops up to the right margin if the
329list thereof is sufficiently long.
330.PP
331The \*(``Rationale\*('' section of the Issue 6
332.B tabs
333reference page
334.\" https://pubs.opengroup.org/onlinepubs/009604499/utilities/tabs.html
335details how the committee considered redesigning the
336.B tabs
337and
338.B tput
339utilities,
340without settling on an improved solution.
341It claims that
342.PP
343.RS 4
344\*(``no known historical version of
345.I tabs
346supports the capability of setting arbitrary tab stops.\*(''
347.RE
348.PP
349The feature described in subsection \*(``Explicit Lists\*('' above was
350implemented in PWB/Unix,
351.\" see URL above
352and permitted the setting of abitrary tab stops nevertheless.
Steve Kondikae271bc2015-11-15 02:50:53 +0100353.SH SEE ALSO
micky3879b9f5e72025-07-08 18:04:53 -0400354\fB\%@INFOCMP@\fP(1M),
355\fB\%@TSET@\fP(1),
356\fB\%curses\fP(3X),
357\fB\%terminfo\fP(5)