4.4BSD snapshot (revision 8.1); add 1993 to copyright
[unix-history] / usr / src / usr.bin / mail / edit.c
index 36eae7e..6f5889c 100644 (file)
@@ -1,16 +1,17 @@
 /*
 /*
- * Copyright (c) 1980 Regents of the University of California.
- * All rights reserved.
+ * Copyright (c) 1980, 1993
+ *     The Regents of the University of California.  All rights reserved.
  *
  * %sccs.include.redist.c%
  */
 
 #ifndef lint
  *
  * %sccs.include.redist.c%
  */
 
 #ifndef lint
-static char sccsid[] = "@(#)edit.c     5.15 (Berkeley) %G%";
+static char sccsid[] = "@(#)edit.c     8.1 (Berkeley) %G%";
 #endif /* not lint */
 
 #include "rcv.h"
 #endif /* not lint */
 
 #include "rcv.h"
-#include <sys/stat.h>
+#include <fcntl.h>
+#include "extern.h"
 
 /*
  * Mail -- a mail program
 
 /*
  * Mail -- a mail program
@@ -21,7 +22,7 @@ static char sccsid[] = "@(#)edit.c    5.15 (Berkeley) %G%";
 /*
  * Edit a message list.
  */
 /*
  * Edit a message list.
  */
-
+int
 editor(msgvec)
        int *msgvec;
 {
 editor(msgvec)
        int *msgvec;
 {
@@ -32,7 +33,7 @@ editor(msgvec)
 /*
  * Invoke the visual editor on a message list.
  */
 /*
  * Invoke the visual editor on a message list.
  */
-
+int
 visual(msgvec)
        int *msgvec;
 {
 visual(msgvec)
        int *msgvec;
 {
@@ -45,9 +46,10 @@ visual(msgvec)
  * (which should not exist) and forking an editor on it.
  * We get the editor from the stuff above.
  */
  * (which should not exist) and forking an editor on it.
  * We get the editor from the stuff above.
  */
+int
 edit1(msgvec, type)
        int *msgvec;
 edit1(msgvec, type)
        int *msgvec;
-       char type;
+       int type;
 {
        register int c;
        int i;
 {
        register int c;
        int i;
@@ -80,7 +82,7 @@ edit1(msgvec, type)
                sigint = signal(SIGINT, SIG_IGN);
                fp = run_editor(setinput(mp), mp->m_size, type, readonly);
                if (fp != NULL) {
                sigint = signal(SIGINT, SIG_IGN);
                fp = run_editor(setinput(mp), mp->m_size, type, readonly);
                if (fp != NULL) {
-                       (void) fseek(otf, (long) 0, 2);
+                       (void) fseek(otf, 0L, 2);
                        size = ftell(otf);
                        mp->m_block = blockof(size);
                        mp->m_offset = offsetof(size);
                        size = ftell(otf);
                        mp->m_block = blockof(size);
                        mp->m_offset = offsetof(size);
@@ -113,7 +115,7 @@ FILE *
 run_editor(fp, size, type, readonly)
        register FILE *fp;
        off_t size;
 run_editor(fp, size, type, readonly)
        register FILE *fp;
        off_t size;
-       char type;
+       int type, readonly;
 {
        register FILE *nf = NULL;
        register int t;
 {
        register FILE *nf = NULL;
        register int t;
@@ -158,7 +160,7 @@ run_editor(fp, size, type, readonly)
        nf = NULL;
        if ((edit = value(type == 'e' ? "EDITOR" : "VISUAL")) == NOSTR)
                edit = type == 'e' ? _PATH_EX : _PATH_VI;
        nf = NULL;
        if ((edit = value(type == 'e' ? "EDITOR" : "VISUAL")) == NOSTR)
                edit = type == 'e' ? _PATH_EX : _PATH_VI;
-       if (run_command(edit, 0, -1, -1, tempEdit, NOSTR) < 0) {
+       if (run_command(edit, 0, -1, -1, tempEdit, NOSTR, NOSTR) < 0) {
                (void) unlink(tempEdit);
                goto out;
        }
                (void) unlink(tempEdit);
                goto out;
        }