--- /dev/null
+--- ed-0.2.orig/glbl.c
++++ ed-0.2/glbl.c
+@@ -128,8 +128,8 @@
+ for (; *ibufp;)
+ if ((status = extract_addr_range ()) < 0 ||
+ (status = exec_command ()) < 0 ||
+- status > 0 && (status = display_lines (
+- current_addr, current_addr, status)) < 0)
++ (status > 0 && (status = display_lines (
++ current_addr, current_addr, status)) < 0))
+ return status;
+ }
+ return 0;
+--- ed-0.2.orig/io.c
++++ ed-0.2/io.c
+@@ -100,7 +100,7 @@
+ return ERR;
+ if (o_n && appended && size && o_isbinary && o_newline_added)
+ fputs ("Newline inserted\n", stderr);
+- else if (newline_added && (!appended || !isbinary && !o_isbinary))
++ else if (newline_added && (!appended || (!isbinary && !o_isbinary)))
+ fputs ("Newline appended\n", stderr);
+ if (isbinary && newline_added && !appended)
+ size += 1;
+@@ -120,8 +120,8 @@
+ register int c;
+ register int i = 0;
+
+- while (((c = getc (fp)) != EOF || !feof (fp) &&
+- !ferror (fp)) && c != '\n')
++ while (((c = getc (fp)) != EOF || (!feof (fp) &&
++ !ferror (fp))) && c != '\n')
+ {
+ REALLOC (sbuf, sbufsz, i + 1, ERR);
+ if (!(sbuf[i++] = c))
+--- ed-0.2.orig/main.c
++++ ed-0.2/main.c
+@@ -165,6 +165,11 @@
+ int c, n;
+ long status = 0;
+
++#ifdef __GNUC__
++ (void)&argc;
++ (void)&argv;
++#endif
++
+ program_name = argv[0];
+ red = (n = strlen (argv[0])) > 2 && argv[0][n - 3] == 'r';
+ top:
+@@ -220,7 +225,7 @@
+ reliable_signal (SIGQUIT, SIG_IGN);
+ reliable_signal (SIGINT, signal_int);
+ #ifdef HAVE_SIGSETJMP
+- if (status = sigsetjmp (env, 1))
++ if ((status = sigsetjmp (env, 1)))
+ #else
+ if (status = setjmp (env))
+ #endif
+@@ -659,7 +664,7 @@
+ return ERR;
+ else if (build_active_list (c == 'g' || c == 'G') < 0)
+ return ERR;
+- else if (n = (c == 'G' || c == 'V'))
++ else if ((n = (c == 'G' || c == 'V')))
+ GET_COMMAND_SUFFIX ();
+ isglobal++;
+ if (exec_global (n, gflag) < 0)
+@@ -1069,7 +1074,7 @@
+ return ERR;
+ do
+ {
+- if (n = dir ? INC_MOD (n, addr_last) : DEC_MOD (n, addr_last))
++ if ((n = dir ? INC_MOD (n, addr_last) : DEC_MOD (n, addr_last)))
+ {
+ lp = get_addressed_line_node (n);
+ if ((s = get_sbuf_line (lp)) == NULL)
+@@ -1648,7 +1653,7 @@
+
+ REALLOC (file, filesz, PATH_MAX + 1, NULL);
+ /* assert: no trailing escape */
+- while (file[i++] = (*s == '\\') ? *++s : *s)
++ while ((file[i++] = (*s == '\\') ? *++s : *s))
+ s++;
+ return file;
+ }
+--- ed-0.2.orig/re.c
++++ ed-0.2/re.c
+@@ -62,7 +62,7 @@
+ return NULL;
+ }
+ patlock = 0;
+- if (n = regcomp (exp, exps, 0))
++ if ((n = regcomp (exp, exps, 0)))
+ {
+ regerror (n, exp, errmsg, ERRSZ);
+ free (exp);
+--- ed-0.2.orig/sub.c
++++ ed-0.2/sub.c
+@@ -101,7 +101,7 @@
+ else if (!isglobal)
+ {
+ while ((n = get_tty_line ()) == 0 ||
+- n > 0 && ibuf[n - 1] != '\n')
++ (n > 0 && ibuf[n - 1] != '\n'))
+ clearerr (stdin);
+ if (n < 0)
+ return NULL;
+@@ -229,7 +229,7 @@
+ }
+ txt += rm[0].rm_eo;
+ }
+- while (*txt && (!changed || (gflag & GSG) && rm[0].rm_eo) &&
++ while (*txt && (!changed || ((gflag & GSG) && rm[0].rm_eo)) &&
+ !regexec (pat, txt, SE_MAX, rm, REG_NOTBOL));
+ i = eot - txt;
+ REALLOC (rbuf, rbufsz, off + i + 2, ERR);
+--- ed-0.2.orig/Makefile.in
++++ ed-0.2/Makefile.in
+@@ -65,8 +65,8 @@
+
+ all: ed
+
+-ed: $(OBJECTS) libed.a
+- $(CC) $(LDFLAGS) -o ed $(OBJECTS) libed.a $(LIBS)
++ed: $(OBJECTS)
++ $(CC) $(LDFLAGS) -o ed $(OBJECTS) $(LIBS)
+
+ buf.o: ed.h config.h regex.h
+ ed.o: ed.h config.h regex.h
+--- ed-0.2.orig/ed.1
++++ ed-0.2/ed.1
+@@ -196,14 +196,14 @@
+ The last line in the buffer.
+
+ .TP 8
+-n
++.I n
+ The
+ .IR n th,
+ line in the buffer
+ where
+ .I n
+ is a number in the range
+-.I [0,$].
++.IR [0,$] .
+
+ .HP
+ -
+@@ -215,9 +215,9 @@
+ and may be repeated with cumulative effect.
+
+ .HP
+--\fIn\fR
++.RI - n
+ .TP 8
+-^\fIn\fR
++.RI ^ n
+ The
+ .IR n th
+ previous line, where
+@@ -235,7 +235,7 @@
+ .HP
+ +\fIn\fR
+ .TP 8
+-whitespace \fIn\fR
++.I whitespace n
+ The
+ .IR n th
+ next line, where
+@@ -253,16 +253,16 @@
+ %
+ The first through last lines in the buffer. This is equivalent to
+ the address range
+-.I 1,$.
++.IR 1,$ .
+
+ .TP 8
+ ;
+ The current through last lines in the buffer. This is equivalent to
+ the address range
+-.I .,$.
++.IR .,$ .
+
+ .TP 8
+-.RI / re/
++.RI / re /
+ The
+ next line containing the regular expression
+ .IR re .
+@@ -271,7 +271,7 @@
+ // repeats the last search.
+
+ .TP 8
+-.RI ? re?
++.RI ? re ?
+ The
+ previous line containing the regular expression
+ .IR re .
+@@ -280,7 +280,7 @@
+ ?? repeats the last search.
+
+ .TP 8
+-.RI \' lc
++.RI ' lc
+ The
+ line previously marked by a
+ .I `k'
+@@ -331,7 +331,7 @@
+ matches itself.
+
+ .TP 8
+-\fR.\fR
++\&.
+ Matches any single character.
+
+ .TP 8
+@@ -482,7 +482,7 @@
+ \fR\e+\fR
+ Matches the single character regular expression or subexpression
+ immediately preceding it one or more times. So the regular expression
+-`a+' is shorthand for `aa*'. If \e+ occurs at the beginning of a
++`a\e+' is shorthand for `aa*'. If \e+ occurs at the beginning of a
+ regular expression or subexpression, then it matches a literal `+'.
+
+
+@@ -564,7 +564,7 @@
+ The current address is set to the last line read.
+
+ .TP 8
+-.RI e \ !command
++e !\fIcommand\fR
+ Edits the standard output of
+ .IR `!command' ,
+ (see
+@@ -746,7 +746,7 @@
+ The current address is set to the last line read.
+
+ .TP 8
+-.RI ($)r \ !command
++($)r !\fIcommand\fR
+ Reads
+ to after the addressed line
+ the standard output of
+@@ -843,7 +843,7 @@
+ suffix toggles the global suffix of the last substitution.
+ The
+ .I `p'
+-suffix toggles the print suffix of the last substitution
++suffix toggles the print suffix of the last substitution.
+ The current address is set to the last line affected.
+
+ .TP 8
+@@ -909,7 +909,7 @@
+ command.
+
+ .TP 8
+-.RI (1,$)w \ !command
++(1,$)w !\fIcommand\fR
+ Writes the addressed lines to the standard input of
+ .IR `!command' ,
+ (see the
+y
\ No newline at end of file