9070 Remove wanboot from gate
[unleashed.git] / usr / src / man / man1 / newform.1
blob2a504d152e9e33423a5f06c716e09243b56ee01d
1 '\" te
2 .\"  Copyright 1989 AT&T  Copyright (c) 1997, Sun Microsystems, Inc.  All Rights Reserved
3 .\" The contents of this file are subject to the terms of the Common Development and Distribution License (the "License").  You may not use this file except in compliance with the License.
4 .\" You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE or http://www.opensolaris.org/os/licensing.  See the License for the specific language governing permissions and limitations under the License.
5 .\" When distributing Covered Code, include this CDDL HEADER in each file and include the License file at usr/src/OPENSOLARIS.LICENSE.  If applicable, add the following below this CDDL HEADER, with the fields enclosed by brackets "[]" replaced with your own identifying information: Portions Copyright [yyyy] [name of copyright owner]
6 .TH NEWFORM 1 "Jul 21, 1997"
7 .SH NAME
8 newform \- change the format of a text file
9 .SH SYNOPSIS
10 .LP
11 .nf
12 \fBnewform\fR [\fB-s\fR] [\fB-i\fR\fItabspec\fR] [\fB-o\fR\fItabspec\fR] [\fB-b\fR\fIn\fR] [\fB-e\fR\fIn\fR] [\fB-p\fR\fIn\fR]
13      [\fB-a\fR\fIn\fR] [\fB-f\fR] [\fB-c\fR\fIchar\fR] [\fB-l\fR\fIn\fR] [\fIfilename\fR]...
14 .fi
16 .SH DESCRIPTION
17 .sp
18 .LP
19 \fBnewform\fR reads lines from the named \fIfilename\fRs, or the standard input
20 if no input file is named, and reproduces the lines on the standard output.
21 Lines are reformatted in accordance with command line options in effect.
22 .sp
23 .LP
24 Except for \fB-s\fR, command line options may appear in any order, may be
25 repeated, and may be intermingled with the optional \fIfilename\fRs. Command
26 line options are processed in the order specified. This means that option
27 sequences like ``\fB-e\fR15 \fB-l\fR60'' will yield results different from
28 ``\fB-l\fR60 \fB-e\fR15''. Options are applied to all \fIfilename\fRs on the
29 command line.
30 .SH OPTIONS
31 .sp
32 .LP
33 The following options are supported:
34 .sp
35 .ne 2
36 .na
37 \fB\fB-s\fR \fR
38 .ad
39 .RS 14n
40 Shears off leading characters on each line up to the first tab and places up to
41 8 of the sheared characters at the end of the line. If more than 8 characters
42 (not counting the first tab) are sheared, the eighth character is replaced by a
43 \fB*\fR and any characters to the right of it are discarded. The first tab is
44 always discarded.
45 .sp
46 An error message and program exit will occur if this option is used on a file
47 without a tab on each line. The characters sheared off are saved internally
48 until all other options specified are applied to that line. The characters are
49 then added at the end of the processed line.
50 .sp
51 For example, to convert a file with leading digits, one or more tabs, and text
52 on each line, to a file beginning with the text, all tabs after the first
53 expanded to spaces, padded with spaces out to column 72 (or truncated to column
54 72), and the leading digits placed starting at column 73, the command would be:
55 .sp
56 \fBnewform \|\fR\fB-s\fR\fB \|\fR\fB-i\fR\fB \|\fR\fB-l\fR\fB \|\fR\fB-a\fR\fB
57 \|\fR\fB-e\fR\fB \|\fIfilename\fR\fR
58 .RE
60 .sp
61 .ne 2
62 .na
63 \fB\fB-i\fR\fItabspec\fR \fR
64 .ad
65 .RS 14n
66 Input tab specification: expands tabs to spaces, according to the tab
67 specifications given. \fITabspec\fR recognizes all tab specification forms
68 described in \fBtabs\fR(1). In addition, \fItabspec\fR may be \fB-\fR, in which
69 \fBnewform\fR assumes that the tab specification is to be found in the first
70 line read from the standard input (see \fBfspec\fR(4)). If no \fItabspec\fR is
71 given, \fItabspec\fR defaults to \fB\(mi8\fR\&. A \fItabspec\fR of \fB\(mi0\fR
72 expects no tabs; if any are found, they are treated as \fB\(mi1\fR\&.
73 .RE
75 .sp
76 .ne 2
77 .na
78 \fB\fB-o\fR\fItabspec\fR \fR
79 .ad
80 .RS 14n
81 Output tab specification: replaces spaces by tabs, according to the tab
82 specifications given. The tab specifications are the same as for
83 \fB-i\fR\fItabspec\fR. If no \fItabspec\fR is given, \fItabspec\fR defaults to
84 \fB\(mi8\fR\&. A \fItabspec\fR of \fB\(mi0\fR means that no spaces will be
85 converted to tabs on output.
86 .RE
88 .sp
89 .ne 2
90 .na
91 \fB\fB-b\fR\fIn\fR \fR
92 .ad
93 .RS 14n
94 Truncate \fIn\fR characters from the beginning of the line when the line length
95 is greater than the effective line length (see \fB\(mil\fIn\fR\fR). Default is
96 to truncate the number of characters necessary to obtain the effective line
97 length. The default value is used when \fB-b\fR with no \fIn\fR is used. This
98 option can be used to delete the sequence numbers from a \fBCOBOL\fR program as
99 follows:
101 \fBnewform \|\fR\fB-l\fR\fB1 \|\fR\fB-b\fR\fB7 \|\fIfilename\fR\fR
105 .ne 2
107 \fB\fB-e\fR\fIn\fR\fR
109 .RS 14n
110 Same as \fB-b\fR\fIn\fR except that characters are truncated from the end of
111 the line.
115 .ne 2
117 \fB\fB-p\fR\fIn\fR\fR
119 .RS 14n
120 Prefix \fIn\fR characters (see \fB-c\fR\fIchar\fR) to the beginning of a line
121 when the line length is less than the effective line length. Default is to
122 prefix the number of characters necessary to obtain the effective line length.
126 .ne 2
128 \fB\fB-a\fR\fIn\fR\fR
130 .RS 14n
131 Same as \fB-p\fR\fIn\fR except characters are appended to the end of a line.
135 .ne 2
137 \fB\fB-f\fR\fR
139 .RS 14n
140 Write the tab specification format line on the standard output before any other
141 lines are output. The tab specification format line which is printed will
142 correspond to the format specified in the \fBlast\fR \fB-o\fR option. If no
143 \fB-o\fR option is specified, the line which is printed will contain the
144 default specification of \fB\(mi8\fR\&.
148 .ne 2
150 \fB\fB-c\fR\fIchar\fR\fR
152 .RS 14n
153 Change the prefix/append character to \fIchar\fR. Default character for
154 \fIchar\fR is a space.
158 .ne 2
160 \fB\fB-l\fR\fIn\fR\fR
162 .RS 14n
163 Set the effective line length to \fIn\fR characters. If \fIn\fR is not entered,
164 \fB-l\fR defaults to 72. The default line length without the \fB-l\fR option is
165 80 characters. Note:  Tabs and backspaces are considered to be one character
166 (use \fB-i\fR to expand tabs to spaces).
168 The \fB\(mil1\fR must be used to set the effective line length shorter than any
169 existing line in the file so that the \fB-b\fR option is activated.
172 .SH OPERANDS
175 The following operand is supported:
177 .ne 2
179 \fB\fIfilename\fR \fR
181 .RS 13n
182 Input file
185 .SH EXIT STATUS
188 The following exit values are returned:
190 .ne 2
192 \fB\fB0\fR \fR
194 .RS 6n
195 Successful operation.
199 .ne 2
201 \fB\fB1\fR \fR
203 .RS 6n
204 Operation failed.
207 .SH SEE ALSO
210 \fBcsplit\fR(1), \fBtabs\fR(1), \fBfspec\fR(4), \fBattributes\fR(5)
211 .SH DIAGNOSTICS
214 All diagnostics are fatal.
216 .ne 2
218 \fB\fBusage:\fR \fB \|.\|.\|.\fR \fR
220 .sp .6
221 .RS 4n
222 \fBnewform\fR was called with a bad option.
226 .ne 2
228 \fB\fB"not \fR\fB-s\fR\fB format"\fR\fR
230 .sp .6
231 .RS 4n
232 There was no tab on one line.
236 .ne 2
238 \fB\fB"can't open file"\fR\fR
240 .sp .6
241 .RS 4n
242 Self-explanatory.
246 .ne 2
248 \fB\fB"internal line too long"\fR\fR
250 .sp .6
251 .RS 4n
252 A line exceeds 512 characters after being expanded in the internal work buffer.
256 .ne 2
258 \fB\fB"tabspec in error" \fR\fR
260 .sp .6
261 .RS 4n
262 A tab specification is incorrectly formatted, or specified tab stops are not
263 ascending.
267 .ne 2
269 \fB\fB"tabspec indirection illegal" \fR\fR
271 .sp .6
272 .RS 4n
273 A \fItabspec\fR read from a file (or standard input) may not contain a
274 \fItabspec\fR referencing another file (or standard input).
277 .SH NOTES
280 \fBnewform\fR normally only keeps track of physical characters; however, for
281 the \fB-i\fR and \fB-o\fR options, \fBnewform\fR will keep track of backspaces
282 in order to line up tabs in the appropriate logical columns.
285 \fBnewform\fR will not prompt the user if a \fItabspec\fR is to be read from
286 the standard input (by use of \fB\fR\fB-i\fR\fB-\fR or \fB\fR\fB-o\fR\fB-\fR).
289 If the \fB-f\fR option is used, and the last \fB-o\fR option specified was
290 \fB\fR\fB-o\fR\fB-\fR, and was preceded by either a \fB\fR\fB-o\fR\fB-\fR or a
291 \fB\fR\fB-i\fR\fB-\fR, the tab specification format line will be incorrect.