Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/trunk]: src/bin/ed Improved version of OpenBSD's mdoc'ed version of ed(1...



details:   https://anonhg.NetBSD.org/src/rev/9fe13673f6b8
branches:  trunk
changeset: 551582:9fe13673f6b8
user:      wiz <wiz%NetBSD.org@localhost>
date:      Mon Sep 08 12:58:41 2003 +0000

description:
Improved version of OpenBSD's mdoc'ed version of ed(1) (v1.42).

diffstat:

 bin/ed/ed.1 |  1272 ++++++++++++++++++++++++++++------------------------------
 1 files changed, 618 insertions(+), 654 deletions(-)

diffs (truncated from 1631 to 300 lines):

diff -r f720ad96807c -r 9fe13673f6b8 bin/ed/ed.1
--- a/bin/ed/ed.1       Mon Sep 08 12:34:29 2003 +0000
+++ b/bin/ed/ed.1       Mon Sep 08 12:58:41 2003 +0000
@@ -1,1009 +1,973 @@
-.\"    $NetBSD: ed.1,v 1.25 2003/05/01 13:50:59 wiz Exp $
+.\"    $NetBSD: ed.1,v 1.26 2003/09/08 12:58:41 wiz Exp $
+.\"    $OpenBSD: ed.1,v 1.42 2003/07/27 13:25:43 jmc Exp $
+.\"
+.\" Copyright (c) 1993 Andrew Moore, Talke Studio.
+.\" All rights reserved.
+.\"
+.\" Redistribution and use in source and binary forms, with or without
+.\" modification, are permitted provided that the following conditions
+.\" are met:
+.\" 1. Redistributions of source code must retain the above copyright
+.\"    notice, this list of conditions and the following disclaimer.
+.\" 2. Redistributions in binary form must reproduce the above copyright
+.\"    notice, this list of conditions and the following disclaimer in the
+.\"    documentation and/or other materials provided with the distribution.
 .\"
-.TH ED 1 "21 May 1993"
-.SH NAME
-ed \- text editor
-.\" ed, red \- text editor
-.SH SYNOPSIS
-ed [-] [-sxE] [-p \fIstring\fR] [\fIfile\fR]
-.\" .LP
-.\" red [-] [-sxE] [-p \fIstring\fR] [\fIfile\fR]
-.SH DESCRIPTION
-.B ed
+.\" THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
+.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+.\" ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
+.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+.\" SUCH DAMAGE.
+.\"
+.Dd May 21, 1993
+.Dt ED 1
+.Os
+.Sh NAME
+.Nm ed
+.Nd text editor
+.Sh SYNOPSIS
+.Nm
+.Op Fl
+.Op Fl sx
+.Op Fl p Ar string
+.Op Ar file
+.Sh DESCRIPTION
+.Nm
 is a line-oriented text editor.
-It is used to create, display, modify and otherwise manipulate text
-files.
-.\" .B red
-.\" is a restricted
-.\" .BR ed :
-.\" it can only edit files in the current
-.\" directory and cannot execute shell commands.
-
+It is used to create, display, modify, and otherwise manipulate text files.
 If invoked with a
-.I file
+.Ar file
 argument, then a copy of
-.I file
+.Ar file
 is read into the editor's buffer.
 Changes are made to this copy and not directly to
-.I file
+.Ar file
 itself.
 Upon quitting
-.BR ed ,
-any changes not explicitly saved  with a
-.I `w'
+.Nm ,
+any changes not explicitly saved with a
+.Ic w
 command are lost.
-
+.Pp
 Editing is done in two distinct modes:
-.I command
+.Em command
 and
-.IR input .
+.Em input .
 When first invoked,
-.B ed
+.Nm
 is in command mode.
-In this mode commands are read from the standard input and
+In this mode, commands are read from the standard input and
 executed to manipulate the contents of the editor buffer.
+.Pp
 A typical command might look like:
-.sp
-.RS
-,s/\fIold\fR/\fInew\fR/g
-.RE
-.sp
+.Bd -literal -offset indent
+,s/old/new/g
+.Ed
+.Pp
 which replaces all occurrences of the string
-.I old
+.Pa old
 with
-.IR new .
-
+.Pa new .
+.Pp
 When an input command, such as
-.I `a'
+.Ic a
 (append),
-.I `i'
-(insert) or
-.I `c'
-(change), is given,
-.B ed
+.Ic i
+(insert),
+or
+.Ic c
+(change) is given,
+.Nm
 enters input mode.
 This is the primary means of adding text to a file.
 In this mode, no commands are available;
 instead, the standard input is written directly to the editor buffer.
-Lines consist of text up to and including a
-.IR newline
-character.
-Input mode is terminated by entering a single period  (\fI.\fR) on a line.
-
+Lines consist of text up to and including a newline character.
+Input mode is terminated by entering a single period
+.Pq Ql \&.
+on a line.
+.Pp
 All
-.B ed
+.Nm
 commands operate on whole lines or ranges of lines; e.g.,
 the
-.I `d'
+.Ic d
 command deletes lines; the
-.I `m'
+.Ic m
 command moves lines, and so on.
 It is possible to modify only a portion of a line by means of replacement,
 as in the example above.
-However even here, the
-.I `s'
+However, even here, the
+.Ic s
 command is applied to whole lines at a time.
-
+.Pp
 In general,
-.B ed
+.Nm
 commands consist of zero or more line addresses, followed by a single
 character command and possibly additional parameters; i.e.,
 commands have the structure:
-.sp
-.RS
-.I [address [,address]]command[parameters]
-.RE
-.sp
+.Bd -literal -offset indent
+[address [,address]]command[parameters]
+.Ed
+.Pp
 The address(es) indicate the line or range of lines to be affected by the
 command.
 If fewer addresses are given than the command accepts, then
 default addresses are supplied.
-
-.SS OPTIONS
-.TP 8
--s
-Suppresses diagnostics.
+.Pp
+The options are as follows:
+.Bl -tag -width Ds
+.It Fl
+Same as the
+.Fl s
+option (deprecated).
+.It Fl s
+Suppress diagnostics.
 This should be used if
-.BR ed 's
+.Nm
 standard input is from a script.
-
-.TP 8
--x
-Prompts for an encryption key to be used in subsequent reads and writes
+.It Fl x
+Prompt for an encryption key to be used in subsequent reads and writes
 (see the
-.I `x'
+.Ic x
 command).
-
-.TP 8
-.RI \-p \ string
+.It Fl p Ar string
 Specifies a command prompt.
 This may be toggled on and off with the
-.I `P'
+.Ic P
 command.
-
-.TP 8
--E
-Enables the use of extended regular expressions instead of the basic
-regular expressions that are normally used.
-
-.TP 8
-.I file
+.It Ar file
 Specifies the name of a file to read.
 If
-.I file
+.Ar file
 is prefixed with a
-bang (!), then it is interpreted as a shell command.
-In this case,
-what is read is
-the standard output of
-.I file
+bang
+.Pq Ql \&! ,
+then it is interpreted as a shell command.
+In this case, what is read is the standard output of
+.Ar file
 executed via
-.IR sh (1).
+.Xr sh 1 .
 To read a file whose name begins with a bang, prefix the
-name with a backslash (\\).
+name with a backslash
+.Pq Ql \e .
 The default filename is set to
-.I file
+.Ar file
 only if it is not prefixed with a bang.
-
-.SS LINE ADDRESSING
+.El
+.Ss LINE ADDRESSING
 An address represents the number of a line in the buffer.
-.B ed
+.Nm
 maintains a
-.I current address
-which is
-typically supplied to commands as the default address when none is specified.
-When a file is first read,  the current address is set to the last line
+.Em current address
+which is typically supplied to commands as the default address
+when none is specified.
+When a file is first read, the current address is set to the last line
 of the file.
 In general, the current address is set to the last line affected by a command.
-
-A line address is constructed from one of the bases in the list below,
-optionally followed by a numeric offset.
+.Pp
+A line address is
+constructed from one of the bases in the list below, optionally followed
+by a numeric offset.
 The offset may include any combination of digits, operators (i.e.,
-.IR + ,
-.I -
+.Sq + ,
+.Sq - ,
 and
-.IR ^ )
+.Sq ^ ) ,
 and whitespace.
 Addresses are read from left to right, and their values are computed
 relative to the current address.
-
+.Pp
 One exception to the rule that addresses represent line numbers is the
 address
-.I 0



Home | Main Index | Thread Index | Old Index