------------------------------- Page    i -------------------------------

                          Ned Reference Manual

------------------------------- Page   ii -------------------------------

                            TABLE OF CONTENTS


1.    Purpose . . . . . . . . . . . . . . . . . . . . . . . . . . . .   1

2.    Introduction  . . . . . . . . . . . . . . . . . . . . . . . . .   1

3.    The Command . . . . . . . . . . . . . . . . . . . . . . . . . .   1

3.1      Synopsis . . . . . . . . . . . . . . . . . . . . . . . . . .   1
3.2      Description  . . . . . . . . . . . . . . . . . . . . . . . .   1

4.    General Information . . . . . . . . . . . . . . . . . . . . . .   2

5.    Line Commands . . . . . . . . . . . . . . . . . . . . . . . . .   3

6.    Primary Commands  . . . . . . . . . . . . . . . . . . . . . . .   5

7.    Addressing  . . . . . . . . . . . . . . . . . . . . . . . . . .  14

8.    Regular Expressions . . . . . . . . . . . . . . . . . . . . . .  15

9.    Size Limitations  . . . . . . . . . . . . . . . . . . . . . . .  17

10.   Files . . . . . . . . . . . . . . . . . . . . . . . . . . . . .  17

11.   Diagnostics . . . . . . . . . . . . . . . . . . . . . . . . . .  18

12.   Bugs  . . . . . . . . . . . . . . . . . . . . . . . . . . . . .  18

13.   References  . . . . . . . . . . . . . . . . . . . . . . . . . .  18


                                                            Last Page  18

-------------------------------- Page  1 --------------------------------

1.    PURPOSE

This document is a reference manual for  the ned full screen text  editor
used under  UTS.  It  is  intended for  use by  those who  want an  exact
specification of how ned  behaves.  For a  tutorial introduction to  ned,
see reference [1].




2.    INTRODUCTION

The general plan of this document is as  follows.  First there is a  dis-
cussion of the  command, including  a synopsis and  a description.   Then
there are sections on line  and primary commands,  and on addressing  and
regular expressions.  Strictly speaking, regular expressions and address-
ing should come before  primary commands,  since both are  needed to  use
primary commands in their full generality.  However, the thorough discus-
sions of addressing  and regular  expressions are long  and complex,  and
since in many cases the full generality is not needed,  it was decided to
discuss the commands first in the interest of readability.  The  document
concludes with several short sections on miscellaneous topics.




3.    THE COMMAND


3.1      SYNOPSIS

ned [-p] [-r] [-x] [-c cmd] [-F Ffile] [name]


3.2      DESCRIPTION

Ned is a full screen text editor for use with 3270 type terminals.

If the name argument is given, ned simulates an e command (see below)  on
the named file; that  is to say,  the file is  read into ned's buffer  so
that it can be edited.  The name -  indicates that the standard input  is
to be read.

The following options are available:

-p   If ned can find a file named .ned  or a file named $HOME/.../ned  it

-------------------------------- Page  2 --------------------------------

     will simulate  an F command  (see below)  on the first  of these  if
     finds; that is, it will  assume the file  contains ned primary  com-
     mands (see below) and will attempt to execute them before  the first
     display is generated (but  after the simulated  e command, if  any).
     The -p argument suppresses this feature.

-r   "read only" flag; when this flag is given no write commands will  be
     allowed, except  for write  commands where an  explicit filename  is
     given.

-x   puts ned into encrypt mode.   Ned will request  a password, and  use
     that password to encrypt and decrypt files on reading and writing.

-c   specifies that the ned primary command cmd is to be executed  before
     the first screen is displayed.

-F   specifies a file of ned commands which  are to be read and  executed
     after the $HOME/.../ned file, but before the first screen is shown.




4.    GENERAL INFORMATION

Ned operates on a  copy of the file  it is editing;  changes made in  the
copy have no effect on the file until a w  (write) command is given.  The
copy of the  text being  edited resides in  a temporary  file called  the
buffer.  There is only one buffer.

If changes have been made in the buffer since the last w command, and the
user attempts to destroy  the buffer via the  q or e commands, ned  warns
the user  by displaying  the message  "Unsaved changes."  in the  message
display area, ringing the bell, and allowing one to continue  editing.  A
second q or e command at this point will take effect.

Since some commonly used ASCII characters (e.g. braces) are not available
on the 3270 keyboard, certain two character sequences have been chosen to
represent them.  See the K  command below for an  explanation of how  ned
translates characters.

Ned has three types of commands:  primary commands, which are entered  at
the top of the screen, line commands, which are entered at the right edge
of the screen, and implicit commands, which are entered when you change a
line directly on  the screen.   (The term "implicit  command" is used  to
describe the action of modifying  a line displayed  on the screen.   This
modification is considered to be  a command to ned to change the line  in
the buffer in accordance  with what was  typed on the  screen.) When  the
enter key or one of the pf keys is pressed, the order of processing is:

-------------------------------- Page  3 --------------------------------

 1.  If a pf key  which contains a  line command was  pressed (see the  p
     primary command below),  that line  command is written  in the  line
     command area of the line the cursor is currently on.  Note that this
     overrides any line command entered by the user on this line.  If the
     cursor is not currently positioned on a data line, the line  command
     in the pf key is silently ignored.

 2.  Data lines  are processed  from top  to bottom  as follows.   If  an
     implicit command is  entered on  a line, that  command is  executed.
     Then any line command associated with the line is processed.

 3.  After all the lines are processed,  the primary command, if any,  is
     processed.

 4.  Finally, if a pf  key containing  one or more  primary commands  was
     pressed, these primary commands are processed.

When other keys are pressed, the actions are as follows.  Pa1 and pa2 are
pf mode keys; they affect  the operation of the pf keys.  See the p  com-
mand below for a full explanation.   Clear erases the current screen  and
reshows the  screen; any  changes entered  just before the  clear key  is
pressed are suppressed.




5.    LINE COMMANDS

Following is a list of ned line commands.  These commands are entered  in
the line command area  to the right of  the screen.  (In some cases  this
area can be on  the left side of  the screen; see  the D primary  command
below.) In general, a line command applies to exactly the line upon which
it is entered.  However, there are several block commands, namely cc, dd,
mm, jj, >>, and  <<.  These commands  generally involve several lines  at
once.  In these cases, the command is entered  on the first and the  last
lines of the group.   In the case  where only one  line is to be  copied,
moved, etc., the block  command is  entered as a  single character.   For
example, 8< will shift the data on that one line to the left by 8 charac-
ters.  Any errors encountered in line commands will be silently ignored.

There are some limitations on the use  of line commands in ned.   Certain
commands (j, n,  z) may be given  only once per  screen.  Only one  block
command may be given at a time, and since the elements of a block command
are attached to line numbers rather than to lines, intermediate deletions
or additions entered while the block command is pending may give rise  to
erroneous results.  In general, it is best to avoid being  too fancy with
line commands; keep it simple and you'll get what you expect.

-------------------------------- Page  4 --------------------------------

na   The append command specifies that n  blank lines are to be  inserted
     after the line on which  the a occurs.  If no value is given for  n,
     one blank line will be inserted.

b    The before command signals that the target for moved or copied lines
     (mm, cc line commands) is before the line on which the b occurs.

cc   The copy command specifies the beginning and end of a group of lines
     to be copied.  The target position for the copied lines is specified
     by the t or b command.

dd   The delete command specifies  the beginning  and end of  a group  of
     lines to be deleted.   This command may  also be entered as nd.   In
     this case, n lines will be deleted.

ni   The insert command specifies that n  blank lines are to be  inserted
     before the line on which the i occurs.  If no  value is given for n,
     one blank line will be inserted.

jj   The join command joins  the line it  is on with  the next line.   If
     given as a block command,  it joins all the lines in the block.   It
     may also be given as nj, in which case  the next n lines are  joined
     together.

kx   The mark command marks the line it is on with the single lower  case
     letter x.  The same function  is offered by use of the primary  com-
     mand k.

mm   The move command specifies the beginning and end of a group of lines
     to be moved.  The target  position for these lines may be  specified
     with the t or b line commands.

n    The nulls command sets the nulls mode on just for the line it is  on
     and only  for the  very next  display screen.  This  command may  be
     given only once per screen, and is most  useful when stored in a  pf
     key and used  in conjunction  with nonulls mode  (see the N  primary
     command).

rr   The repeat command repeats the block of lines n times, where n is an
     integer preceding the r.  The default value of n is 1.

s    The split command makes two lines out of one by inserting a  newline
     character immediately before the character where the cursor is posi-
     tioned.

t    The target line command  signals that  the target for  the moved  or
     copied lines (mm, cc line commands) is after the line on which the t
     occurs.

z    The z  command will  insert one  blank line,  and will  continue  to

-------------------------------- Page  5 --------------------------------

     insert additional blank lines each time the enter key is  pressed as
     long as data is entered on the  most recently added blank line,  and
     the cursor  is positioned  on that  line.  If  no data  (not even  a
     space) is entered by the user on the  line, ned will delete it,  and
     will stop  inserting additional  lines.  This command  may be  given
     only once per screen.

n>>  The >> command causes  the line  to be shifted  right n  characters.
     This is done by inserting leading blanks into the line.  The default
     value for n is  8.  The value  for n  may be entered  on either  the
     first or last line where the >> is entered.

n<<  The << command  causes the  line to  be shifted  left n  characters.
     This is done by  deleting the first  n characters of the line.   The
     default value for n is 8.  The value for n may be entered on  either
     the first or last line where the << is entered.

.    The . command causes  the line it  is on to  become the new  current
     line.  This causes it to  be displayed at the position set by the  Z
     primary command (usually the top line on the screen).

:    The : command adjusts the current line so that the line the : is  on
     will appear at the bottom of the screen.




6.    PRIMARY COMMANDS

Primary commands have a simple and  regular structure: zero, one, or  two
addresses followed by  a single character  command, possibly followed  by
parameters to that command.  These addresses specify one or more lines in
the buffer.  Every command that requires addresses has default addresses,
so that the addresses can often be omitted.  If a primary command  causes
an error, ned will place an informative message in the message area, ring
the bell, and redisplay the erroneous command so that it may be corrected
and re-entered,  if desired.   Multiple primary commands  on the  primary
command line are allowed;  they must  be separated by  semicolons.  As  a
result, any semicolons in a filename (in the e, f, r, w, x, E, and F com-
mands) must be preceeded by a backslash.  Also, the ! and p commands  may
not be followed by another primary command on the same command line.

In the following list of ned commands, the default addresses are shown in
parentheses.  The parentheses are not  part of the address, but are  used
to show that the given addresses are the default.

(.)a The append command causes ned to go into insert mode.  In this mode,
     the screen contains  blank data  lines.  Any data  entered on  these

-------------------------------- Page  6 --------------------------------

     lines is entered into the buffer after the current line.  Any  lines
     upon which no data  was entered (not  even a blank) will be  ignored
     (i.e. deleted).   For the  append  command, the  first line  on  the
     screen will be the addressed  line.  . is left at the last  inserted
     line; or, if there were none, at the addressed line.  Address '0' is
     legal for  this command;  text  is placed  at the  beginning of  the
     buffer.

(.,.)c   The change command deletes the  addressed lines, then goes  into
     insert mode as described under the append command.  . is left at the
     last line input; if there  were none, it is left  at the first  line
     not deleted.

(.,.)d   The delete command deletes the addressed lines from the  buffer.
     . remains at the current  line if that line was not deleted,  other-
     wise it moves to the line before the first line that was deleted.

e name   The edit command causes the entire contents of the buffer to  be
     deleted, and then the named file to be read in; . is set to the last
     line of the buffer.  If no file  name is given, the remembered  file
     name, if any, is used (see the f command).  The number of characters
     read is displayed; name is remembered for possible use as a  default
     file name in subsequent e or r or w commands.

f name   If name is  given, the  filename command  changes the  currently
     remembered file name to  name; otherwise, it displays the  currently
     remembered file name in the message display area.

(1,$)g/regular expression/command   In the global command, the first step
     is to mark  every line  that matches the  given regular  expression.
     Then, for every such line, the given command is executed with . ini-
     tially set to that line.   The global commands g and v are not  per-
     mitted.

(.)i The insert command causes ned to  go into the insert mode  described
     under the append command.  The  only difference between the i and  a
     commands is that with the i command,  the current line is placed  at
     the bottom of the  screen instead of at the  top.  . is left at  the
     last inserted line; or, if there were none, at the addressed line.

(.,.+1)j   The join  command  joins  contiguous  lines  by  removing  the
     appropriate new-line  characters.   This  command  inserts  a  space
     between the joined lines; the J command (see below) does not.

(.)kx   The mark command marks the addressed line with name x, which must
     be a lower-case  letter.  The  address form 'x  then addresses  this
     line.

(.)l The list command displays all the lines on the screen in a  distinc-
     tive way: some  non-printing characters  (e.g., tab, backspace)  are

-------------------------------- Page  7 --------------------------------

     represented by  (hopefully)  mnemonic  characters,  all  other  non-
     printing characters are printed in octal.  Data should not be  input
     on such a screen.

(.,.)ma   The move command  repositions the addressed  line(s) after  the
     line addressed  by a.  Address  '0' is  legal for a  and causes  the
     addressed line(s) to be moved to the beginning of the file; it is an
     error if address a falls within the range of moved lines.  . remains
     on the line where it was if that line was not moved, otherwise,  the
     addressed line becomes the current line.

p n command list   The pf command is  used to  set the contents  of a  pf
     key; n is the number of the pf key to  be set.  The command list may
     contain one or more  commands, separated by  semicolons.  The  first
     command is presumed  to be a  line command.  If  no line command  is
     desired, the list must begin with a semicolon.  The rest of the com-
     mands, if  any, are  presumed  to be  primary commands.   Semicolons
     needed in  the commands  may be  escaped by  preceding them  with  a
     backslash.  If the p command  is given with no arguments, a  special
     pf display screen is  shown which displays  the current contents  of
     the pf keys, and allows changes to be made by typing directly on the
     screen.

     There are conceptually 3 sets of 12 pf keys, keys 1-12, 101-112, and
     201-212.  The pf keys numbered 101-112 are invoked by first pressing
     pa1, then  the  desired pf  key.   Similarly, pf  keys  201-212  are
     invoked by first pressing the pa2 key.

     The default settings of the pf keys are:



          _______________________________________
         |                       <pa1>     <pa2>|
         |   entr                               |
         |   pf1       ;H                       |
         |   pf2       n                        |
         |   pf3       ;x;q                     |
         |   pf4       ;??                      |
         |   pf5       ;//                      |
         |   pf6       s                        |
         |   pf7       ;-11      ;-22      ;-44 |
         |   pf8       ;+11      ;+22      ;+44 |
         |   pf9       j                        |
         |   pf10      ;L8       ;L16      ;L32 |
         |   pf11      ;R8       ;R16      ;R32 |
         |   pf12      ;Ph                      |
         |___test_req__;q_______________________|

-------------------------------- Page  8 --------------------------------

     The test req key (designated pf29) should  only be set to contain  a
     primary command or a null string, which is a no-op.  This is because
     the 3270 hardware  does not  pass cursor  position information  back
     when the test req key is pressed.  As a result,  any line command in
     this key may be executed on the wrong line.

q    The quit command causes ned to exit.   No automatic write of a  file
     is done.

($)r name   The read command reads in the given file after the  addressed
     line.  If no file name  is given, the remembered file name, if  any,
     is used (see e  and f commands).   The remembered file  name is  not
     changed unless name is the very first file name mentioned  since ned
     was invoked.  Address '0' is legal for r  and causes the file to  be
     read at the beginning of the buffer.  If the read is successful, the
     number of characters read is  displayed; . is  set to the  addressed
     line.

(.,.)s/regular expression/replacement/[g]   The    substitute     command
     searches each addressed line for an occurrence of the specified reg-
     ular expression.  On each line in which a match is found, all  (non-
     overlapped) matched strings are  replaced by the replacement if  the
     global replacement indicator g  appears after the  command.  If  the
     global indicator does not appear,  only the first occurrence of  the
     matched string is replaced.  It is an error for the substitution  to
     fail on  all addressed  lines.  Any  character other  than space  or
     new-line may be used instead of / to delimit the regular  expression
     and the replacement; . is left at the first line  on which a substi-
     tution occurred.

     An ampersand  & appearing  in  the replacement  is replaced  by  the
     string matching  the regular  expression on the  current line.   The
     special meaning of & in this context may be suppressed by  preceding
     it by \.  As a more general feature, the characters \n, where n is a
     digit, are replaced by the text  matched by the n-th regular  subex-
     pression of the specified regular expression enclosed between \( and
     \).  When  nested parenthesized  subexpressions  are present,  n  is
     determined by counting occurrences of \( starting from the left.

(.,.)ta   This command acts just like the  m command, except that a  copy
     of the addressed lines is placed after address a (which may be '0');
     . is left unchanged.

u    The undo command reverses the effect of  the last s command.  The  u
     command affects only the last line changed by the most recent s com-
     mand.

(1,$)v/regular expression/command   This command is the same as the  glo-
     bal command g except that  the command is executed with .  initially
     set to every line that does not match the regular expression.

-------------------------------- Page  9 --------------------------------

(1,$)w name   The write command writes the addressed lines onto the named
     file.  If  the file  does not  exist, it  is created  with mode  666
     (unless the  X command  has been  given in  which case  mode 777  is
     used).  The remembered file name  is not changed unless name is  the
     very first file name mentioned  since ned was  invoked.  If no  file
     name is given, the remembered file name, if any, is  used (see e and
     f commands);  . is  unchanged.  If  the command  is successful,  the
     number of characters written is displayed.

     Whenever ned writes a file, it  creates a temporary file and  writes
     the data into the temporary before writing into the permanent  file.
     This should be of concern  to users only when  the system goes  down
     during a write.  In this  case, a temporary file may be left in  the
     directory the file came from or in the user's logon directory.   The
     file name will be of the form ned.tmp#, where # is the process id of
     ned.  When  the system  comes  back up,  this file  may  be  edited,
     renamed, moved, etc. as desired.

(1,$)x name   The x command is the same as  the w command except that  if
     no changes have been made in the file, it will not be written out to
     disk.

A n  The Autosave command causes ned to save  a copy of the buffer  when-
     ever the number of changes made to the file exceeds n.  This copy is
     saved in the current directory in a file named ned.auto#, where # is
     ned's process id.  This file  is removed by ned when it  terminates.
     If the system  crashes before  ned terminates, the  file remains  in
     existence for possible recovery later.  The command A? causes ned to
     display the current autosave number in the message display area.

B    The B command causes the special characters mentioned above (e.g. *,
     ., etc.) to lose their special meaning in regular expressions.   The
     B?  command will cause ned to place "Reg. expr. on." or "Reg.  expr.
     off." in the message area, as appropriate.

C    The Column numbers command causes the  top data line to be  replaced
     with a line  containing column numbers.   The column numbers  remain
     until another Column command is  given.  The column numbers are  not
     considered part of the data.

D n  The Display command causes ned to use the display format n.  If n is
     omitted, ned will  cycle through all  the possible display  formats.
     The command D?  will cause the number  of the current display to  be
     displayed in the message display area.

-------------------------------- Page 10 --------------------------------

      Display format 0 is as follows:


      _____________________________________________________
     |  <primary command>            <message>            |
     |  <data line>                             <line cmd>|
     |  <data line>                             <line cmd>|
     |   .                                                |
     |   .                                                |
     |   .                                                |
     |__<data_line>_____________________________<line_cmd>|



      Display format 1 is as follows:

      _____________________________________________________
     |  <filename>     <message>  <alt count>  <no. lines>|
     |  ==> <primary command>                             |
     |  <data line>                             <line cmd>|
     |  <data line>                             <line cmd>|
     |   .                                                |
     |   .                                                |
     |   .                                                |
     |__<data_line>_____________________________<line_cmd>|



      Display format 2 is as follows:

      _____________________________________________________
     |  <filename>     <message>  <alt count>  <no. lines>|
     |  ==> <primary command>                             |
     |  <line cmd> <data line>                            |
     |  <line cmd> <data line>                            |
     |   .                                                |
     |   .                                                |
     |   .                                                |
     |__<line_cmd>_<data_line>____________________________|

-------------------------------- Page 11 --------------------------------

      Display format 3 is as follows:


      _____________________________________________________
     |  <primary command>            <message> <alt count>|
     |  <data line>                             <line cmd>|
     |  <data line>                             <line cmd>|
     |   .                                                |
     |   .                                                |
     |   .                                                |
     |__<data_line>_____________________________<line_cmd>|


     For each display, the normal content of the line command area is the
     line number of the line in the file.  If a  line has to be truncated
     to fit on the screen, the first character of the line command  field
     will be  a *.   (The line  will not  be truncated in  the file  just
     because it is too short to fit on the screen.)

E name   The Edit command is  the same as  the e command  except that  no
     check is made to protect against destroying the buffer; the  command
     takes effect in any case.

F name   The File command causes ned to  read the named file and  execute
     each line of the file as a ned primary command.

H    The Help command causes display of several help screens.

K    The K command controls  ned's character translation.   Any time  any
     characters are entered on  a data line  or on the command line,  ned
     translates the line before examining its contents.  This translation
     normally includes the following characters:

      ____________________________________________________
     |____________from____________|___________to_________|
     |_char___________name________|__char_______name_____|
     |  (<    paren less than     |   {     left brace   |
     |  >)    greater than paren  |   }     right brace  |
     |  (|    paren bar           |   [     left bracket |
     |  |)    bar paren           |   ]     right bracket|
     |  \~    centsign notsign    |   ^     circumflex   |
     |  ~     notsign             |   ~     tilde        |
     |  \     centsign            |   \     backslash    |
     |  \<    centsign less than  |   '     grave accent |
     |__\!____centsign_exclamation|_________tab__________|


     (Depending on which  output device  this was generated  on, some  of
     these characters may look funny.) Entering the K command will  cause
     ned to stop translating the characters in the above table.   Repeat-

-------------------------------- Page 12 --------------------------------

     between translating and  not translating these  characters.  In  any
     case, if a character exists  in the file which is not  translatable,
     it will be displayed as  a broken vertical bar  on the display.   If
     any change  is made  to a  line on  which a broken  vertical bar  is
     displayed, each broken vertical bar will be  replaced by a ? in  the
     file and the original  non-displayable character will be lost.   The
     K? command will cause ned to place "Memorex." or "COI." in the  mes-
     sage area, as appropriate.

L n  The Left command causes  the display window  to be moved  left by  n
     spaces.  The display window cannot be moved further left than column
     1.

N    The N command switches  between nulls and  nonulls mode.  This  mode
     determines whether trailing  space at  the end of  a line is  filled
     with nulls or spaces for display.   The default mode is nulls.   The
     N?  command will cause ned to display "Nulls." or "Nonulls."  in the
     message area, as appropriate.

P row,col   The cursor Position  command allows  one to  specify the  new
     cursor position.  The  cursor position is  specified as an  absolute
     row and column position  on the  3270 screen.  The  upper left  hand
     corner position has row and  col equal to 1.  The shorthand  command
     Ph puts the cursor  at the home  position, that is,  on the  primary
     command line.  Another shorthand, Pe, puts the cursor at the  end of
     the data line it is on.  This command is most useful when stored  in
     a pf key.

Q    The Quit command causes Ned to exit without checking if changes have
     been made in the buffer since the last w command.

R n  The Right command  causes the  display window  to be  moved right  n
     spaces.  The display window cannot  be moved further right than  512
     characters (the maximum line length ned will support).

(.,.)Sn   The Shift command  shifts the  addressed lines to  the right  n
     spaces.  If n is negative, the shift will be to the left.

T arg   The Tabs command controls the  interpretation of tabs and  spaces
     entered  at  the  terminal.   If  arg  is  a  sequence  of   numbers
     "n1,n2,...", tabs  entered at  the  terminal will  be  converted  to
     spaces at  the tab  stops n1,  n2, ...,  and will be  stored in  the
     buffer as spaces.  If arg is 0, ned will perserve leading tabs (i.e.
     tabs at the beginning  of the line  before other characters),  while
     other tabs will be converted  to spaces.  This  is the default  set-
     ting.  In this case, the  tab stops are fixed at the standard  posi-
     tions, i.e. 9, 17, 25, ....  If you enter more spaces on a line con-
     taining leading tabs, ned  will convert the  leading spaces to  tabs
     when possible.  Ned will not  change spaces to tabs  on a line  that
     does not  contain  leading  tabs.   For  display  of  lines  already

-------------------------------- Page 13 --------------------------------

     containing tabs, ned always uses the standard tab positions.  The T?
     command will cause  the current  tab values to  be displayed in  the
     message display area.  (Note: to determine where there are tabs  and
     where there are spaces, use the l primary command.)

U    The Uppercase command causes ned to shift all alphabetic  characters
     entered at the terminal to  uppercase.  If U is entered  repeatedly,
     it switches between  translating and not  translating to  uppercase.
     The U? command will cause  ned to display "Caps." or "Asis." in  the
     message area, as appropriate.

V    The Verbose command causes ned to respond to errors with either ver-
     bose messages  or  a terse  "?".   If V  is entered  repeatedly,  it
     switches between verbose and terse messages.  The default is verbose
     messages.

X    This command changes the mode that ned will use when creating a  new
     file.  The first  use of X  turns the executable  bits on, the  next
     turns them off, and it  toggles back and forth  from there.  The  X?
     command displays the mode which is currently in effect.  Note:  this
     mode is used only  when ned has  to create a  file not currently  in
     existence; ned will never change the mode of an existing  file.  The
     mode ned uses to  create the file  is not necessarily  the mode  the
     file will  have because  of the  umask(2) system  call which  allows
     users to specify that some permissions will not be granted.  This is
     normally set so that if  ned uses 0777, the real mode will be  0775,
     and if ned uses 0666, the real mode will be 0664.

Z n  This command causes ned to position the current line on the nth line
     below the command line.  The default value of n is one.

($)= The line number of the addressed  line is displayed; . is  unchanged
     by this command.

(1,$)!UTS command   The remainder of the line after the ! is sent to  the
     UTS shell (sh(1)) to  be interpreted as  a command; . is  unchanged.
     If the first character after  the ! is a >,  then the > is not  con-
     sidered part of the command, instead the addressed lines become  the
     standard input to the command.  If  the first character after the  !
     is a <, then  the < is not  considered part of the command,  instead
     the output  from the  command  is placed  in the  buffer  after  the
     addressed line  (only one  address  (default $)  is needed  in  this
     case).  If the first character after the ! is a |, then the | is not
     considered part of the  command, instead the addressed lines  become
     the standard input to the command,  and the output from the  command
     replaces the addressed  lines in the  buffer.  For convenience,  the
     command ! is shorthand for !sh.

(.)  A primary command consisting of just an address causes the addressed
     line to  become  the current  line.   If the  address is  a  regular

-------------------------------- Page 14 --------------------------------

     expression, the trailing / or ? may be omitted.

&command   The &  command alone  causes the  last primary  command to  be
     redisplayed on  the  primary command  line.   If the  &  command  is
     entered with another command  following it (e.g.  &+17) the  command
     will be kept on the primary command line on the  next and subsequent
     screens until it is erased.  This command may not be stored in a  pf
     key.




7.    ADDRESSING

To understand addressing in ned it is necessary to know that at any  time
there is a  current line.   Generally speaking, the  current line is  the
last line affected by a command; the exact effect on the current line  is
discussed under  the description  of the  command.  The  current line  is
always the first line displayed at the top of the screen.

Addresses are constructed as follows:

 1.  The character . addresses the current line.

 2.  The character $ addresses the last line of the buffer.

 3.  A decimal number n addresses the n-th line of the buffer.

 4.  'x (single quote  followed by  a letter) addresses  the line  marked
     with the mark name character  x, which must be a lower-case  letter.
     Lines are marked with the k command described below.

 5.  A regular expression enclosed by slashes / addresses the first  line
     found by searching forward from the line following the current  line
     toward the end of the buffer and stopping at the first line contain-
     ing a  string matching  the regular expression.   If necessary,  the
     search wraps around  to the  beginning of the  buffer and  continues
     through the current line, so that the entire buffer is searched.

 6.  A regular expression enclosed in queries ? addresses the first  line
     found by searching backward from the line preceding the current line
     toward the beginning of the  buffer and stopping  at the first  line
     containing a string matching  the regular expression.  If  necessary
     the search  wraps around  to the  end of  the buffer  and  continues
     through the current line.

 7.  An address followed by a plus sign + or a minus sign - followed by a
     decimal number specifies that address plus (respectively minus)  the

-------------------------------- Page 15 --------------------------------

     indicated number of lines.  The plus sign may be omitted.

 8.  If an address begins  with + or  -, the addition  or subtraction  is
     taken with respect  to the  current line; e.g.  -5 is understood  to
     mean .-5.

 9.  If an address  ends with  + or  -, then  1 is  added or  subtracted,
     respectively.  As  a consequence  of this  rule and of  rule 8,  the
     address - refers to the line preceding the current line.   Moreover,
     trailing + and - characters  have a cumulative effect, so --  refers
     to the current line less 2.

Primary commands may require zero,  one, or two addresses.  Primary  com-
mands that require no addresses  regard the presence of an address as  an
error.  Primary commands that accept one or two addresses assume  default
addresses when  an insufficient  number of  addresses is  given; if  more
addresses are given than  such a  command requires, the  last one(s)  are
used.

Typically, addresses are separated from  each other by  a comma ,.   They
may also be separated by a semicolon ;.  In the  latter case, the current
line . is set to  the first address before the  second address is  inter-
preted.  This feature can be used to determine the starting line for for-
ward and  backward searches  (see items  5. and  6. in  section 7).   The
second address of any two-address sequence must correspond to a line that
follows, in the buffer, the line corresponding to the first address.




8.    REGULAR EXPRESSIONS

Ned supports a  form of  limited regular expression  notation similar  to
that used by ed(1).  Regular expressions are used in addresses to specify
lines and in some commands (e.g., s) to  specify portions of a line  that
are to be replaced.  A  regular expression specifies a set of strings  of
characters.  A member of this set of strings is said to be matched by the
regular expression.   The regular  expressions  allowed by  ned are  con-
structed as follows:

   I.  The following  one-character regular  expressions match  a  single
       character:

        A.  An ordinary  character (not  one of  those discussed  in  I.B
            below) is  a one-character  regular  expression that  matches
            itself.

        B.  A backslash \  followed by  any special character  is a  one-

-------------------------------- Page 16 --------------------------------

            character regular expression that matches the special charac-
            ter itself.  The special characters are:

             1.  ., *, [, and \  (period, asterisk, left square  bracket,
                 and backslash, respectively), which are always  special,
                 except when they appear within  square brackets []  (see
                 I.D below).

             2.  ^ (caret or circumflex) which  is special at the  begin-
                 ning of  an  entire regular  expression (see  III.A  and
                 III.B below), or when it immediately follows the left of
                 a pair of square brackets [] (see I.D below).

             3.  $ (currency symbol), which is  special at the end of  an
                 entire regular expression (see III.B below).

             4.  The character used  to bound (i.e.,  delimit) an  entire
                 regular expression,  which is special  for that  regular
                 expression (for example, see how / is used in the g pri-
                 mary command, above.)

        C.  A period . is a one-character regular expression that matches
            any character except the new-line character.

        D.  A non-empty string of characters enclosed in square  brackets
            [] is a  one-character regular  expression that matches  "any
            one" character in that string.  If, however, the first  char-
            acter of the string is a circumflex ^, the one-character reg-
            ular expression matches any character except new-line and the
            remaining characters in the  string.  The ^ has this  special
            meaning only if it occurs first  in the string.  The minus  -
            may be used to indicate a range of consecutive ASCII  charac-
            ters; for example, [0-9] is equivalent to [0123456789].   The
            - loses this  special meaning  if it occurs  first (after  an
            initial ^, if any)  or last in  the string.  The  ] does  not
            terminate such a string when  it occurs first (after an  ini-
            tial ^, if any),  in it,  e.g., []a] matches  either a  right
            square bracket  ] or  the  letter 'a'.   The five  characters
            listed in  I.B.1 above  stand for  themselves within  such  a
            string of characters.

  II.  The following rules may be  used to construct regular  expressions
       from one-character regular expressions:

        A.  A one-character regular  expression is  a regular  expression
            that matches  whatever the  one-character regular  expression
            matches.

        B.  A one-character regular expression followed by an asterisk  *
            is a regular expression that matches zero or more occurrences

-------------------------------- Page 17 --------------------------------

            of the  one-character regular  expression.  If  there is  any
            choice, this regular expression  matches as many  occurrences
            as possible.

        C.  The concatenation of regular expressions is a regular expres-
            sion that matches the concatenation of the strings matched by
            each component of the regular expression.

        D.  A regular expression enclosed between the character sequences
            \( and \) is a  regular expression that matches whatever  the
            unadorned regular expression matches;  this construction  has
            side effects discussed under the s command, below.

 III.  Finally, an entire regular expression may be constrained to  match
       only an initial segment or final segment of a line (or both):

        A.  A circumflex ^ at the beginning of an entire regular  expres-
            sion constrains that regular  expression to match an  initial
            segment of a line.

        B.  A currency symbol $ at the  end of an entire regular  expres-
            sion constrains that regular expression to match a final seg-
            ment of a line.  The construction ^entire regular expression$
            constrains the entire regular expression to match the  entire
            line.

  IV.  The  null  regular  expression  standing   alone  (e.g.,  //)   is
       equivalent to the last regular expression encountered.




9.    SIZE LIMITATIONS

Ned limits lines to 512 characters, and filenames to 64 characters.   The
limit on the number of  lines depends on the amount of user memory:  each
line is stored in memory.




10.   FILES

ned.auto#, the autosave file;
ned.tmp#
     where '#' is the process number (in octal).

-------------------------------- Page 18 --------------------------------

11.   DIAGNOSTICS

Erroneous primary commands  cause ned  to ring  the bell  and display  an
informative error message.  Erroneous line commands are silently ignored.




12.   BUGS

Ned deletes all ASCII  null characters  whenever it reads  text into  the
buffer.

The restrictions on block line commands should be lifted.

Ned should have a split screen mode.




13.   REFERENCES

[1] The Ned Tutorial.
