4.4BSD snapshot (revision 8.1); add 1993 to copyright
[unix-history] / usr / src / usr.bin / mail / main.c
index af7b4e2..2cd65ff 100644 (file)
@@ -1,32 +1,23 @@
 /*
 /*
- * 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.
  *
  *
- * Redistribution and use in source and binary forms are permitted
- * provided that the above copyright notice and this paragraph are
- * duplicated in all such forms and that any documentation,
- * advertising materials, and other materials related to such
- * distribution and use acknowledge that the software was developed
- * by the University of California, Berkeley.  The name of the
- * University may not be used to endorse or promote products derived
- * from this software without specific prior written permission.
- * THIS SOFTWARE IS PROVIDED ``AS IS'' AND WITHOUT ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED
- * WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR A PARTICULAR PURPOSE.
+ * %sccs.include.redist.c%
  */
 
 #ifndef lint
  */
 
 #ifndef lint
-char copyright[] =
-"@(#) Copyright (c) 1980 Regents of the University of California.\n\
- All rights reserved.\n";
+static char copyright[] =
+"@(#) Copyright (c) 1980, 1993\n\
      The Regents of the University of California.  All rights reserved.\n";
 #endif /* not lint */
 
 #ifndef lint
 #endif /* not lint */
 
 #ifndef lint
-static char sccsid[] = "@(#)main.c     5.22 (Berkeley) %G%";
+static char sccsid[] = "@(#)main.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
@@ -36,18 +27,19 @@ static char sccsid[] = "@(#)main.c  5.22 (Berkeley) %G%";
 
 jmp_buf        hdrjmp;
 
 
 jmp_buf        hdrjmp;
 
+int
 main(argc, argv)
 main(argc, argv)
-       char **argv;
+       int argc;
+       char *argv[];
 {
        register int i;
        struct name *to, *cc, *bcc, *smopts;
        char *subject;
        char *ef;
        char nosrc = 0;
 {
        register int i;
        struct name *to, *cc, *bcc, *smopts;
        char *subject;
        char *ef;
        char nosrc = 0;
-       int hdrstop(), (*prevint)();
-       int sigchild();
-       extern int getopt(), optind, opterr;
-       extern char *optarg;
+       void hdrstop();
+       sig_t prevint;
+       void sigchild();
 
        /*
         * Set up a reasonable environment.
 
        /*
         * Set up a reasonable environment.
@@ -190,10 +182,10 @@ Usage: mail [-iInv] [-s subject] [-c cc-addr] [-b bcc-addr] to-addr ...\n\
        rcvmode = !to;
        spreserve();
        if (!nosrc)
        rcvmode = !to;
        spreserve();
        if (!nosrc)
-               load(MASTER);
+               load(_PATH_MASTER_RC);
        /*
         * Expand returns a savestr, but load only uses the file name
        /*
         * Expand returns a savestr, but load only uses the file name
-        * for fopen, so it's save to do this.
+        * for fopen, so it's safe to do this.
         */
        load(expand("~/.mailrc"));
        if (!rcvmode) {
         */
        load(expand("~/.mailrc"));
        if (!rcvmode) {
@@ -235,7 +227,9 @@ Usage: mail [-iInv] [-s subject] [-c cc-addr] [-b bcc-addr] to-addr ...\n\
 /*
  * Interrupt printing of the headers.
  */
 /*
  * Interrupt printing of the headers.
  */
-hdrstop()
+void
+hdrstop(signo)
+       int signo;
 {
 
        fflush(stdout);
 {
 
        fflush(stdout);
@@ -251,6 +245,7 @@ hdrstop()
  *     If baud rate > 1200, use 24 or ws_row
  * Width is either 80 or ws_col;
  */
  *     If baud rate > 1200, use 24 or ws_row
  * Width is either 80 or ws_col;
  */
+void
 setscreensize()
 {
        struct sgttyb tbuf;
 setscreensize()
 {
        struct sgttyb tbuf;
@@ -258,7 +253,7 @@ setscreensize()
 
        if (ioctl(1, TIOCGWINSZ, (char *) &ws) < 0)
                ws.ws_col = ws.ws_row = 0;
 
        if (ioctl(1, TIOCGWINSZ, (char *) &ws) < 0)
                ws.ws_col = ws.ws_row = 0;
-       if (gtty(1, &tbuf) < 0)
+       if (ioctl(1, TIOCGETP, &tbuf) < 0)
                tbuf.sg_ospeed = B9600;
        if (tbuf.sg_ospeed < B1200)
                screenheight = 9;
                tbuf.sg_ospeed = B9600;
        if (tbuf.sg_ospeed < B1200)
                screenheight = 9;