ANSI, local include files shouldn't include include files
authorKeith Bostic <bostic@ucbvax.Berkeley.EDU>
Sat, 2 Mar 1991 11:06:13 +0000 (03:06 -0800)
committerKeith Bostic <bostic@ucbvax.Berkeley.EDU>
Sat, 2 Mar 1991 11:06:13 +0000 (03:06 -0800)
SCCS-vsn: usr.bin/talk/Makefile 5.13
SCCS-vsn: usr.bin/talk/ctl.c 5.7
SCCS-vsn: usr.bin/talk/ctl_transact.c 5.8
SCCS-vsn: usr.bin/talk/get_addrs.c 5.7
SCCS-vsn: usr.bin/talk/get_names.c 5.9
SCCS-vsn: usr.bin/talk/invite.c 5.8
SCCS-vsn: usr.bin/talk/io.c 5.6
SCCS-vsn: usr.bin/talk/look_up.c 5.7
SCCS-vsn: usr.bin/talk/msgs.c 5.6
SCCS-vsn: usr.bin/talk/talk.h 5.7
SCCS-vsn: usr.bin/talk/talk_ctl.h 5.6

usr/src/usr.bin/talk/Makefile
usr/src/usr.bin/talk/ctl.c
usr/src/usr.bin/talk/ctl_transact.c
usr/src/usr.bin/talk/get_addrs.c
usr/src/usr.bin/talk/get_names.c
usr/src/usr.bin/talk/invite.c
usr/src/usr.bin/talk/io.c
usr/src/usr.bin/talk/look_up.c
usr/src/usr.bin/talk/msgs.c
usr/src/usr.bin/talk/talk.h
usr/src/usr.bin/talk/talk_ctl.h

index 26e76d4..c438348 100644 (file)
@@ -1,9 +1,9 @@
-#      @(#)Makefile    5.12 (Berkeley) %G%
+#      @(#)Makefile    5.13 (Berkeley) %G%
 
 PROG=  talk
 DPADD= ${LIBCURSES} ${LIBTERMCAP} ${LIBCOMPAT}
 LDADD= -lcurses -ltermlib -lcompat
 
 PROG=  talk
 DPADD= ${LIBCURSES} ${LIBTERMCAP} ${LIBCOMPAT}
 LDADD= -lcurses -ltermlib -lcompat
-SRCS=  talk.c get_names.c display.c io.c ctl.c init_disp.c \
-       msgs.c get_addrs.c ctl_transact.c invite.c look_up.c
+SRCS=  ctl.c ctl_transact.c display.c get_addrs.c get_names.c \
+       init_disp.c invite.c io.c look_up.c msgs.c talk.c
 
 .include <bsd.prog.mk>
 
 .include <bsd.prog.mk>
index 9e56c06..34b9c05 100644 (file)
@@ -6,7 +6,7 @@
  */
 
 #ifndef lint
  */
 
 #ifndef lint
-static char sccsid[] = "@(#)ctl.c      5.6 (Berkeley) %G%";
+static char sccsid[] = "@(#)ctl.c      5.7 (Berkeley) %G%";
 #endif /* not lint */
 
 /*
 #endif /* not lint */
 
 /*
@@ -15,6 +15,11 @@ static char sccsid[] = "@(#)ctl.c    5.6 (Berkeley) %G%";
  * the progress
  */
 
  * the progress
  */
 
+#include <sys/types.h>
+#include <sys/socket.h>
+#include <protocols/talkd.h>
+#include <netinet/in.h>
+#include "talk.h"
 #include "talk_ctl.h"
 
 struct sockaddr_in daemon_addr = { sizeof(daemon_addr), AF_INET };
 #include "talk_ctl.h"
 
 struct sockaddr_in daemon_addr = { sizeof(daemon_addr), AF_INET };
@@ -42,10 +47,10 @@ open_sockt()
        sockt = socket(AF_INET, SOCK_STREAM, 0);
        if (sockt <= 0)
                p_error("Bad socket");
        sockt = socket(AF_INET, SOCK_STREAM, 0);
        if (sockt <= 0)
                p_error("Bad socket");
-       if (bind(sockt, &my_addr, sizeof(my_addr)) != 0)
+       if (bind(sockt, (struct sockaddr *)&my_addr, sizeof(my_addr)) != 0)
                p_error("Binding local socket");
        length = sizeof(my_addr);
                p_error("Binding local socket");
        length = sizeof(my_addr);
-       if (getsockname(sockt, &my_addr, &length) == -1)
+       if (getsockname(sockt, (struct sockaddr *)&my_addr, &length) == -1)
                p_error("Bad address for socket");
 }
 
                p_error("Bad address for socket");
 }
 
@@ -59,10 +64,12 @@ open_ctl()
        ctl_sockt = socket(AF_INET, SOCK_DGRAM, 0);
        if (ctl_sockt <= 0)
                p_error("Bad socket");
        ctl_sockt = socket(AF_INET, SOCK_DGRAM, 0);
        if (ctl_sockt <= 0)
                p_error("Bad socket");
-       if (bind(ctl_sockt, &ctl_addr, sizeof(ctl_addr), 0) != 0)
+       if (bind(ctl_sockt,
+           (struct sockaddr *)&ctl_addr, sizeof(ctl_addr)) != 0)
                p_error("Couldn't bind to control socket");
        length = sizeof(ctl_addr);
                p_error("Couldn't bind to control socket");
        length = sizeof(ctl_addr);
-       if (getsockname(ctl_sockt, &ctl_addr, &length) == -1)
+       if (getsockname(ctl_sockt,
+           (struct sockaddr *)&ctl_addr, &length) == -1)
                p_error("Bad address for ctl socket");
 }
 
                p_error("Bad address for ctl socket");
 }
 
index 1694f00..a7ffe79 100644 (file)
@@ -6,11 +6,16 @@
  */
 
 #ifndef lint
  */
 
 #ifndef lint
-static char sccsid[] = "@(#)ctl_transact.c     5.7 (Berkeley) %G%";
+static char sccsid[] = "@(#)ctl_transact.c     5.8 (Berkeley) %G%";
 #endif /* not lint */
 
 #endif /* not lint */
 
-#include "talk_ctl.h"
+#include <sys/types.h>
+#include <sys/socket.h>
 #include <sys/time.h>
 #include <sys/time.h>
+#include <netinet/in.h>
+#include <protocols/talkd.h>
+#include <errno.h>
+#include "talk_ctl.h"
 
 #define CTL_WAIT 2     /* time to wait for a response, in seconds */
 
 
 #define CTL_WAIT 2     /* time to wait for a response, in seconds */
 
@@ -43,7 +48,8 @@ ctl_transact(target, msg, type, rp)
                /* resend message until a response is obtained */
                do {
                        cc = sendto(ctl_sockt, (char *)&msg, sizeof (msg), 0,
                /* resend message until a response is obtained */
                do {
                        cc = sendto(ctl_sockt, (char *)&msg, sizeof (msg), 0,
-                               &daemon_addr, sizeof (daemon_addr));
+                           (struct sockaddr *)&daemon_addr,
+                           sizeof (daemon_addr));
                        if (cc != sizeof (msg)) {
                                if (errno == EINTR)
                                        continue;
                        if (cc != sizeof (msg)) {
                                if (errno == EINTR)
                                        continue;
index 90cb5a2..3aed540 100644 (file)
@@ -6,11 +6,16 @@
  */
 
 #ifndef lint
  */
 
 #ifndef lint
-static char sccsid[] = "@(#)get_addrs.c        5.6 (Berkeley) %G%";
+static char sccsid[] = "@(#)get_addrs.c        5.7 (Berkeley) %G%";
 #endif /* not lint */
 
 #endif /* not lint */
 
-#include "talk_ctl.h"
+#include <sys/types.h>
+#include <sys/socket.h>
+#include <netinet/in.h>
+#include <protocols/talkd.h>
 #include <netdb.h>
 #include <netdb.h>
+#include <stdio.h>
+#include "talk_ctl.h"
 
 get_addrs(my_machine_name, his_machine_name)
        char *my_machine_name, *his_machine_name;
 
 get_addrs(my_machine_name, his_machine_name)
        char *my_machine_name, *his_machine_name;
index cbbb931..5092b81 100644 (file)
@@ -6,13 +6,14 @@
  */
 
 #ifndef lint
  */
 
 #ifndef lint
-static char sccsid[] = "@(#)get_names.c        5.8 (Berkeley) %G%";
+static char sccsid[] = "@(#)get_names.c        5.9 (Berkeley) %G%";
 #endif /* not lint */
 
 #endif /* not lint */
 
-#include "talk.h"
 #include <sys/param.h>
 #include <sys/param.h>
+#include <sys/socket.h>
 #include <protocols/talkd.h>
 #include <pwd.h>
 #include <protocols/talkd.h>
 #include <pwd.h>
+#include "talk.h"
 
 char   *getlogin();
 char   *ttyname();
 
 char   *getlogin();
 char   *ttyname();
@@ -52,7 +53,7 @@ get_names(argc, argv)
        gethostname(hostname, sizeof (hostname));
        my_machine_name = hostname;
        /* check for, and strip out, the machine name of the target */
        gethostname(hostname, sizeof (hostname));
        my_machine_name = hostname;
        /* check for, and strip out, the machine name of the target */
-       for (cp = argv[1]; *cp && !any(*cp, "@:!."); cp++)
+       for (cp = argv[1]; *cp && !index("@:!.", *cp); cp++)
                ;
        if (*cp == '\0') {
                /* this is a local to local talk */
                ;
        if (*cp == '\0') {
                /* this is a local to local talk */
@@ -89,14 +90,3 @@ get_names(argc, argv)
        strncpy(msg.r_tty, his_tty, TTY_SIZE);
        msg.r_tty[TTY_SIZE - 1] = '\0';
 }
        strncpy(msg.r_tty, his_tty, TTY_SIZE);
        msg.r_tty[TTY_SIZE - 1] = '\0';
 }
-
-static
-any(c, cp)
-       register char c, *cp;
-{
-
-       while (*cp)
-               if (c == *cp++)
-                       return (1);
-       return (0);
-}
index b7e7103..3db5306 100644 (file)
@@ -6,13 +6,19 @@
  */
 
 #ifndef lint
  */
 
 #ifndef lint
-static char sccsid[] = "@(#)invite.c   5.7 (Berkeley) %G%";
+static char sccsid[] = "@(#)invite.c   5.8 (Berkeley) %G%";
 #endif /* not lint */
 
 #endif /* not lint */
 
-#include "talk_ctl.h"
+#include <sys/types.h>
+#include <sys/socket.h>
 #include <sys/time.h>
 #include <signal.h>
 #include <sys/time.h>
 #include <signal.h>
+#include <netinet/in.h>
+#include <protocols/talkd.h>
+#include <errno.h>
 #include <setjmp.h>
 #include <setjmp.h>
+#include "talk_ctl.h"
+#include "talk.h"
 
 /*
  * There wasn't an invitation waiting, so send a request containing
 
 /*
  * There wasn't an invitation waiting, so send a request containing
@@ -143,12 +149,14 @@ send_delete()
         */
        msg.id_num = htonl(remote_id);
        daemon_addr.sin_addr = his_machine_addr;
         */
        msg.id_num = htonl(remote_id);
        daemon_addr.sin_addr = his_machine_addr;
-       if (sendto(ctl_sockt, &msg, sizeof (msg), 0, &daemon_addr,
+       if (sendto(ctl_sockt, &msg, sizeof (msg), 0,
+           (struct sockaddr *)&daemon_addr,
            sizeof (daemon_addr)) != sizeof(msg))
                perror("send_delete (remote)");
        msg.id_num = htonl(local_id);
        daemon_addr.sin_addr = my_machine_addr;
            sizeof (daemon_addr)) != sizeof(msg))
                perror("send_delete (remote)");
        msg.id_num = htonl(local_id);
        daemon_addr.sin_addr = my_machine_addr;
-       if (sendto(ctl_sockt, &msg, sizeof (msg), 0, &daemon_addr,
+       if (sendto(ctl_sockt, &msg, sizeof (msg), 0,
+           (struct sockaddr *)&daemon_addr,
            sizeof (daemon_addr)) != sizeof (msg))
                perror("send_delete (local)");
 }
            sizeof (daemon_addr)) != sizeof (msg))
                perror("send_delete (local)");
 }
index 8a6c41a..d41f788 100644 (file)
@@ -6,7 +6,7 @@
  */
 
 #ifndef lint
  */
 
 #ifndef lint
-static char sccsid[] = "@(#)io.c       5.5 (Berkeley) %G%";
+static char sccsid[] = "@(#)io.c       5.6 (Berkeley) %G%";
 #endif /* not lint */
 
 /*
 #endif /* not lint */
 
 /*
@@ -44,7 +44,7 @@ talk()
         * standard input ( STDIN_MASK )
         */
        read_template = sockt_mask | STDIN_MASK;
         * standard input ( STDIN_MASK )
         */
        read_template = sockt_mask | STDIN_MASK;
-       forever {
+       for (;;) {
                read_set = read_template;
                wait.tv_sec = A_LONG_TIME;
                wait.tv_usec = 0;
                read_set = read_template;
                wait.tv_sec = A_LONG_TIME;
                wait.tv_usec = 0;
index 2867c7e..d5413e4 100644 (file)
@@ -6,10 +6,16 @@
  */
 
 #ifndef lint
  */
 
 #ifndef lint
-static char sccsid[] = "@(#)look_up.c  5.6 (Berkeley) %G%";
+static char sccsid[] = "@(#)look_up.c  5.7 (Berkeley) %G%";
 #endif /* not lint */
 
 #endif /* not lint */
 
+#include <sys/types.h>
+#include <sys/socket.h>
+#include <netinet/in.h>
+#include <protocols/talkd.h>
+#include <errno.h>
 #include "talk_ctl.h"
 #include "talk_ctl.h"
+#include "talk.h"
 
 /*
  * See if the local daemon has an invitation for us.
 
 /*
  * See if the local daemon has an invitation for us.
@@ -39,7 +45,8 @@ check_local()
                if (rp->addr.sa_family != AF_INET)
                        p_error("Response uses invalid network address");
                errno = 0;
                if (rp->addr.sa_family != AF_INET)
                        p_error("Response uses invalid network address");
                errno = 0;
-               if (connect(sockt, &rp->addr, sizeof (rp->addr)) != -1)
+               if (connect(sockt,
+                   (struct sockaddr *)&rp->addr, sizeof (rp->addr)) != -1)
                        return (1);
        } while (errno == EINTR);
        if (errno == ECONNREFUSED) {
                        return (1);
        } while (errno == EINTR);
        if (errno == ECONNREFUSED) {
index a3fd89d..dc3f138 100644 (file)
@@ -6,7 +6,7 @@
  */
 
 #ifndef lint
  */
 
 #ifndef lint
-static char sccsid[] = "@(#)msgs.c     5.5 (Berkeley) %G%";
+static char sccsid[] = "@(#)msgs.c     5.6 (Berkeley) %G%";
 #endif /* not lint */
 
 /* 
 #endif /* not lint */
 
 /* 
@@ -14,9 +14,9 @@ static char sccsid[] = "@(#)msgs.c    5.5 (Berkeley) %G%";
  * if we are slow connecting.
  */
 
  * if we are slow connecting.
  */
 
+#include <sys/time.h>
 #include <signal.h>
 #include <stdio.h>
 #include <signal.h>
 #include <stdio.h>
-#include <sys/time.h>
 #include "talk.h"
 
 #define MSG_INTERVAL 4
 #include "talk.h"
 
 #define MSG_INTERVAL 4
@@ -24,9 +24,9 @@ static char sccsid[] = "@(#)msgs.c    5.5 (Berkeley) %G%";
 char   *current_state;
 int    current_line = 0;
 
 char   *current_state;
 int    current_line = 0;
 
+void
 disp_msg()
 {
 disp_msg()
 {
-
        message(current_state);
 }
 
        message(current_state);
 }
 
@@ -38,7 +38,7 @@ start_msgs()
        signal(SIGALRM, disp_msg);
        itimer.it_value.tv_sec = itimer.it_interval.tv_sec = MSG_INTERVAL;
        itimer.it_value.tv_usec = itimer.it_interval.tv_usec = 0;
        signal(SIGALRM, disp_msg);
        itimer.it_value.tv_sec = itimer.it_interval.tv_sec = MSG_INTERVAL;
        itimer.it_value.tv_usec = itimer.it_interval.tv_usec = 0;
-       setitimer(ITIMER_REAL, &itimer, (struct timerval *)0);
+       setitimer(ITIMER_REAL, &itimer, (struct itimerval *)0);
 }
 
 end_msgs()
 }
 
 end_msgs()
@@ -47,6 +47,6 @@ end_msgs()
 
        timerclear(&itimer.it_value);
        timerclear(&itimer.it_interval);
 
        timerclear(&itimer.it_value);
        timerclear(&itimer.it_interval);
-       setitimer(ITIMER_REAL, &itimer, (struct timerval *)0);
+       setitimer(ITIMER_REAL, &itimer, (struct itimerval *)0);
        signal(SIGALRM, SIG_DFL);
 }
        signal(SIGALRM, SIG_DFL);
 }
index 9b350b6..43fc248 100644 (file)
@@ -4,16 +4,10 @@
  *
  * %sccs.include.redist.c%
  *
  *
  * %sccs.include.redist.c%
  *
- *     @(#)talk.h      5.6 (Berkeley) %G%
+ *     @(#)talk.h      5.7 (Berkeley) %G%
  */
 
  */
 
-#include <sys/types.h>
 #include <curses.h>
 #include <curses.h>
-#include <utmp.h>
-
-#define forever                for(;;)
-
-int    quit();
 
 extern int sockt;
 extern int curses_initialized;
 
 extern int sockt;
 extern int curses_initialized;
index f4940ef..8245f7f 100644 (file)
@@ -4,17 +4,9 @@
  *
  * %sccs.include.redist.c%
  *
  *
  * %sccs.include.redist.c%
  *
- *     @(#)talk_ctl.h  5.5 (Berkeley) %G%
+ *     @(#)talk_ctl.h  5.6 (Berkeley) %G%
  */
 
  */
 
-#include <sys/types.h>
-#include <protocols/talkd.h>
-#include <netinet/in.h>
-#include "talk.h"
-#include <errno.h>
-
-extern int errno;
-
 extern struct sockaddr_in daemon_addr;
 extern struct sockaddr_in ctl_addr;
 extern struct sockaddr_in my_addr;
 extern struct sockaddr_in daemon_addr;
 extern struct sockaddr_in ctl_addr;
 extern struct sockaddr_in my_addr;