| 1 |
.\"*************************************************************************** |
| 2 |
.\" Copyright 2018-2024,2025 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.74 2025/08/16 19:11:47 tom Exp $ |
| 31 |
.TH tabs 1 2025-08-16 "ncurses 6.6" "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 |
\fBtabs\fP [\fIoptions\fP] [\fItabstop-list\fP] |
| 53 |
.SH DESCRIPTION |
| 54 |
The \fBtabs\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, \fBtabs\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 \fBclear\fP(1), \fBtabs\fP writes to the standard output. |
| 66 |
You can redirect the standard output to a file (which prevents |
| 67 |
\fBtabs\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 \fBreset\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 \fBtabs\fP which terminal type to use. |
| 93 |
If this option is not given, \fBtabs\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 \fBtabs\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 \fBtabs\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 |
.nf |
| 132 |
tabs 1,6,11,16,21 |
| 133 |
tabs 1 6 11 16 21 |
| 134 |
.fi |
| 135 |
.EE |
| 136 |
.RE |
| 137 |
.PP |
| 138 |
Use a \*(``+\*('' to treat a number |
| 139 |
as an increment relative to the previous value, |
| 140 |
e.g., |
| 141 |
.PP |
| 142 |
.RS 4 |
| 143 |
.EX |
| 144 |
tabs 1,+5,+5,+5,+5 |
| 145 |
.EE |
| 146 |
.RE |
| 147 |
.PP |
| 148 |
which is equivalent to the 1,6,11,16,21 example. |
| 149 |
.SS "Standard Tab Stops" |
| 150 |
POSIX defines several lists of tab stops. |
| 151 |
.TP 5 |
| 152 |
.B \-a |
| 153 |
Assembler, IBM S/370, first format |
| 154 |
.br |
| 155 |
1,10,16,36,72 |
| 156 |
.TP 5 |
| 157 |
.B \-a2 |
| 158 |
Assembler, IBM S/370, second format |
| 159 |
.br |
| 160 |
1,10,16,40,72 |
| 161 |
.TP 5 |
| 162 |
.B \-c |
| 163 |
COBOL, normal format |
| 164 |
.br |
| 165 |
1,8,12,16,20,55 |
| 166 |
.TP 5 |
| 167 |
.B \-c2 |
| 168 |
COBOL compact format |
| 169 |
.br |
| 170 |
1,6,10,14,49 |
| 171 |
.TP 5 |
| 172 |
.B \-c3 |
| 173 |
COBOL compact format extended |
| 174 |
.br |
| 175 |
1,6,10,14,18,22,26,30,34,38,42,46,50,54,58,62,67 |
| 176 |
.TP 5 |
| 177 |
.B \-f |
| 178 |
FORTRAN |
| 179 |
.br |
| 180 |
1,7,11,15,19,23 |
| 181 |
.TP 5 |
| 182 |
.B \-p |
| 183 |
PL/I |
| 184 |
.br |
| 185 |
1,5,9,13,17,21,25,29,33,37,41,45,49,53,57,61 |
| 186 |
.TP 5 |
| 187 |
.B \-s |
| 188 |
SNOBOL |
| 189 |
.br |
| 190 |
1,10,55 |
| 191 |
.TP 5 |
| 192 |
.B \-u |
| 193 |
UNIVAC 1100 Assembler |
| 194 |
.br |
| 195 |
1,12,20,44 |
| 196 |
.SS Margins |
| 197 |
A few terminals expose a means of changing their left and right margins. |
| 198 |
\fBtabs\fP supports this feature with an option. |
| 199 |
.TP 5 |
| 200 |
.BI +m \ margin |
| 201 |
The effect depends on whether the terminal has the margin capabilities: |
| 202 |
.RS |
| 203 |
.bP |
| 204 |
If the terminal provides the capability for setting the left margin, |
| 205 |
\fBtabs\fP uses this, |
| 206 |
and adjusts the available tab stop widths. |
| 207 |
.bP |
| 208 |
If the terminal does not provide the margin capabilities, |
| 209 |
\fBtabs\fP imitates their effect, |
| 210 |
putting tab stops at appropriate places on each line. |
| 211 |
The terminal's left margin is not modified. |
| 212 |
.RE |
| 213 |
.IP |
| 214 |
If the |
| 215 |
.I margin |
| 216 |
parameter is omitted, |
| 217 |
the default is 10. |
| 218 |
Use |
| 219 |
.B +m0 |
| 220 |
to reset the left margin, |
| 221 |
that is, |
| 222 |
to make it the left edge of the terminal's display. |
| 223 |
Before setting a left margin, |
| 224 |
\fBtabs\fP resets the margin to reduce problems that might arise |
| 225 |
from moving the cursor to the left of the current left margin. |
| 226 |
.PP |
| 227 |
When setting or resetting the left margin, |
| 228 |
\fBtabs\fP may also reset the right margin. |
| 229 |
.SH FILES |
| 230 |
.TP |
| 231 |
.I /usr/share/tabset |
| 232 |
tab stop initialization database |
| 233 |
.SH PORTABILITY |
| 234 |
IEEE Std 1003.1/The Open Group Base Specifications Issue\ 7 |
| 235 |
(POSIX.1-2008) |
| 236 |
describes a |
| 237 |
.I tabs |
| 238 |
utility. |
| 239 |
However, |
| 240 |
.bP |
| 241 |
this standard describes a |
| 242 |
.B +m |
| 243 |
option to set a terminal's left margin. |
| 244 |
Very few of the entries in the terminal database provide the |
| 245 |
.B \%set_left_margin |
| 246 |
.RB ( smgl ) |
| 247 |
or |
| 248 |
.B \%set_left_margin_parm |
| 249 |
.RB \%( smglp ) |
| 250 |
capabilities needed to support the feature. |
| 251 |
.bP |
| 252 |
Unlike |
| 253 |
.IR tput , |
| 254 |
.I tabs |
| 255 |
has no specification in X/Open Curses Issue\ 7. |
| 256 |
.PP |
| 257 |
The |
| 258 |
.B \-d |
| 259 |
(debug) and |
| 260 |
.B \-n |
| 261 |
(no-op) options are |
| 262 |
.I \%ncurses |
| 263 |
extensions not provided by other implementations. |
| 264 |
.SH HISTORY |
| 265 |
A |
| 266 |
.I tabs |
| 267 |
utility appeared in PWB/Unix 1.0 (1977). |
| 268 |
.\" https://minnie.tuhs.org/cgi-bin/utree.pl?file=PWB1/sys/source/s2/\ |
| 269 |
.\" tabs.c |
| 270 |
A reduced version shipped in Seventh Edition Unix |
| 271 |
(early 1979) |
| 272 |
.\" https://minnie.tuhs.org/cgi-bin/utree.pl?file=V7/usr/src/cmd/tabs.c |
| 273 |
and in 3BSD |
| 274 |
.\" https://minnie.tuhs.org/cgi-bin/utree.pl?file=3BSD/usr/src/cmd/\ |
| 275 |
.\" tabs.c |
| 276 |
(later the same year); |
| 277 |
it supported an option \*(``\-n\*('' to set the first tab stop at the |
| 278 |
left margin. |
| 279 |
That option is not specified by POSIX. |
| 280 |
.PP |
| 281 |
The PWB/Unix |
| 282 |
.I tabs |
| 283 |
utility returned in System III (1980), |
| 284 |
and used built-in tables |
| 285 |
to support a half-dozen hardcopy terminal (printer) types. |
| 286 |
It also had logic to support setting the left margin, |
| 287 |
as well as a feature for copying the tab settings from a file. |
| 288 |
.PP |
| 289 |
Versions of the program in later releases of AT&T Unix, |
| 290 |
such as SVr4, |
| 291 |
.\" https://minnie.tuhs.org/cgi-bin/utree.pl?file=SysVR4/cmd/tabs/tabs.c |
| 292 |
added support for the terminal database, |
| 293 |
but retained the tables to support the printers. |
| 294 |
By this time, |
| 295 |
System\ V |
| 296 |
.I tput |
| 297 |
had incorporated the tab stop initialization feature of BSD's |
| 298 |
.I tset |
| 299 |
from 1982, |
| 300 |
but employed the |
| 301 |
.I \%term\%info |
| 302 |
database to do so. |
| 303 |
.PP |
| 304 |
The |
| 305 |
.B +m |
| 306 |
option was documented in the POSIX Base Specifications Issue\ 5 |
| 307 |
(Unix98, 1997), |
| 308 |
then omitted in Issue\ 6 |
| 309 |
(Unix03, 2004) |
| 310 |
without express motivation, |
| 311 |
though an introductory comment |
| 312 |
\*(``and optionally adjusts the margin\*('' remains, |
| 313 |
overlooked in the removal. |
| 314 |
The |
| 315 |
.I tabs |
| 316 |
utility documented in Issues 6 and later has no mechanism for setting |
| 317 |
margins. |
| 318 |
The |
| 319 |
.B +m |
| 320 |
option in |
| 321 |
.IR \%ncurses 's |
| 322 |
implementation |
| 323 |
differs from the SVr4 feature by using terminal capabilities |
| 324 |
rather than built-in tables. |
| 325 |
.PP |
| 326 |
POSIX documents no limit on the number of tab stops. |
| 327 |
Other implementations impose one; |
| 328 |
the limit is 20 in PWB/Unix's |
| 329 |
.I tabs |
| 330 |
utility. |
| 331 |
While some terminals may not accept an arbitrary number of tab stops, |
| 332 |
.I \%ncurses |
| 333 |
attempts to set tab stops up to the right margin |
| 334 |
if the list thereof is sufficiently long. |
| 335 |
.PP |
| 336 |
The \*(``Rationale\*('' section of the Issue\ 6 |
| 337 |
.I tabs |
| 338 |
reference page |
| 339 |
.\" https://pubs.opengroup.org/onlinepubs/009604499/utilities/tabs.html |
| 340 |
details how the committee considered redesigning the |
| 341 |
.I tabs |
| 342 |
and |
| 343 |
.I tput |
| 344 |
utilities, |
| 345 |
without settling on an improved solution. |
| 346 |
It claims that |
| 347 |
.PP |
| 348 |
.RS 4 |
| 349 |
no known historical version of |
| 350 |
.I tabs |
| 351 |
supports the capability of setting arbitrary tab stops. |
| 352 |
.RE |
| 353 |
.PP |
| 354 |
The feature described in subsection \*(``Explicit Lists\*('' above was |
| 355 |
implemented in PWB/Unix, |
| 356 |
.\" see URL above |
| 357 |
and permitted the setting of arbitrary tab stops nevertheless. |
| 358 |
.SH SEE ALSO |
| 359 |
\fB\%infocmp\fP(1), |
| 360 |
\fB\%tset\fP(1), |
| 361 |
\fB\%ncurses\fP(3NCURSES), |
| 362 |
\fB\%terminfo\fP(5) |