Tools: MPW
Advanced Search
Apple Developer Connection
Member Login Log In | Not a Member? Support

MPW Command Reference


Entab

Tool

SYNTAX

Entab [file1 [file2]…] [-a minSpaces] [-d inputTab] [-l quote…]
[-n] [-p] [-q quote…] [-r quote…] [-t outputTab]

DESCRIPTION

The Entab tool copies one or more text files, replacing groups of spaces with tabs. Normally Entab performs the following two steps:

Removes tabs from input files, using their tab settings (resources automatically saved with the files) or the default value of four spaces per tab if there are no tab settings. See -d for information about how to override this.

Puts tabs into output files, setting tab stops every four spaces. You can specify another tab setting by using -t.

Note that Entab does not process spaces within either single or double quotation marks. However, you can specify different quotation characters (-l, -q, or -r) or request tabbing of spaces within quotation marks (-n).

WARNING
Beware of such command formats as

Entab myFile > myFile

When the same file is used for both input and output, redirection takes place before Entab can process the file. This means that the file is erased. •

INPUT

Standard input, unless you specify input files with the file1 [file2]… parameter.

OUTPUT

Standard output.

STATUS

Entab can return the following status codes:

0

normal termination

1

parameter or option error

PARAMETERS

file1 [file2]…

Specifies one or more files to be entabbed.

OPTIONS

-a minSpaces

Specifies the minimum number of spaces that can be replaced with a tab. The default is a one space minimum.

-d inputTab

Overrides the input file's default tab setting with the numerical tab value inputTab. Use this option when removing tabs from non-MPW files.

Note
The Entab tool always removes tabs from input files, using their tab setting or the default four spaces per tab. Using -d with MPW files overrides the file's own tab setting, leading to incorrect results when tabs are added to the files. •

-l quote

Specifies a list of left (or open) quotation characters, where quote… is a string of one or more nonblank characters. If you specify this option, you must also specify -r.

The Entab tool considers single (') and double (") quotation marks to be the default quoting characters, but you can use this option to specify different left (or open) quotation characters. When Entab encounters any left (or open) quotation character, it looks for a closing (or right) quotation character and does not process any text between the two. This means that no tabs are placed within text enclosed by any of the quotation characters.

Note
The Entab tool does not check for matching left and right quotation characters so that any left quotation character can begin a quote and any right quotation character can end it. •

-n

Treats all quotation marks as normal characters, causing Entab to replace spaces within quotation marks with tabs. Normally tabs are not added for spaces within quotation marks.

IMPORTANT
Do not use this option when entabbing program source files. Note that Entab ignores -l, -q, and -r, if you specify this option. •

-p

Writes progress and summary information to diagnostic output.

-q quote

Specifies a list of characters to be used as both left and right quotation characters, where quote… is a string of one or more nonblank characters.

The Entab tool considers single (') and double (") straight quotation marks to be the default quotation characters but you can use this option to specify different left and right quotation characters. When Entab encounters any open quotation character, it looks for a closing quotation character and does not process any text between the two. This means that no tabs are placed within text enclosed by any of the quotation characters.

-r quote

Specifies a list of right quotation characters, where quote… is a string of one or more nonblank characters. If you specify this option, you must also specify -l.

The Entab tool considers single (') and double (") quotation marks to be the default quoting characters, but you can use this option to specify different right quotation characters. (See the note under -l.)

-t outputTab

Sets the output file's tab setting to the numerical tab value outputTab. If you omit -t, Entab assumes 4 as the tab setting.

If you specify a tab setting of 0, the command does not place any tabs in the output file. In this way, -t can be used to completely remove tabs from input files.

Note
If you specify -q, -l, or -r, you must enclose the entire string parameter to these options in quotation marks or the MPW Shell may misinterpret special characters. •

EXAMPLES

The following command line removes all tabs from the Example.c file using the file's default tab setting, reinserts tabs with a tab setting of 2, and writes the resulting output to CleanExample.c.

Entab -t 2 Example.c > CleanExample.c

LIMITATIONS

The Entab tool does not take into account embedded formatting characters other than tab characters. Thus backspace characters can cause incorrect results.

Input lines can be no longer than 255 characters.

SEE ALSO

Format

 
 


Last Updated July 2000