Hi tech --
Turned on WARNINGS=yes for talk(1). Found a few things. The nready
assignment is a false positive from gcc but I fixed it anyway.
Then I ran unifdef on talk(1). It unconditionally pulls in curses.h
from talk.h so there's no need to have those #ifdefs. Similar deal
with MSG_EOR, those files already pull in sys/socket.h so it's
always defined.
~Brian
Index: ctl_transact.c
===================================================================
RCS file: /cvs/src/usr.bin/talk/ctl_transact.c,v
retrieving revision 1.13
diff -u -p -u -p -r1.13 ctl_transact.c
--- ctl_transact.c 1 Feb 2016 07:29:25 -0000 1.13
+++ ctl_transact.c 23 May 2017 15:23:42 -0000
@@ -47,12 +47,12 @@
* of time
*/
void
-ctl_transact(struct in_addr target, CTL_MSG msg, int type, CTL_RESPONSE *rp)
+ctl_transact(struct in_addr target, CTL_MSG mesg, int type, CTL_RESPONSE *rp)
{
struct pollfd pfd[1];
- int nready, cc;
+ int nready = 0, cc;
- msg.type = type;
+ mesg.type = type;
daemon_addr.sin_addr = target;
daemon_addr.sin_port = daemon_port;
pfd[0].fd = ctl_sockt;
@@ -65,10 +65,10 @@ ctl_transact(struct in_addr target, CTL_
do {
/* resend message until a response is obtained */
do {
- cc = sendto(ctl_sockt, (char *)&msg, sizeof (msg), 0,
+ cc = sendto(ctl_sockt, (char *)&mesg, sizeof(mesg), 0,
(struct sockaddr *)&daemon_addr,
- sizeof (daemon_addr));
- if (cc != sizeof (msg)) {
+ sizeof(daemon_addr));
+ if (cc != sizeof(mesg)) {
if (errno == EINTR)
continue;
quit("Error on write to talk daemon", 1);
@@ -86,7 +86,7 @@ ctl_transact(struct in_addr target, CTL_
* request/acknowledgements being sent)
*/
do {
- cc = recv(ctl_sockt, (char *)rp, sizeof (*rp), 0);
+ cc = recv(ctl_sockt, (char *)rp, sizeof(*rp), 0);
if (cc < 0) {
if (errno == EINTR)
continue;
Index: display.c
===================================================================
RCS file: /cvs/src/usr.bin/talk/display.c,v
retrieving revision 1.18
diff -u -p -u -p -r1.18 display.c
--- display.c 1 Feb 2016 07:29:25 -0000 1.18
+++ display.c 23 May 2017 15:23:42 -0000
@@ -95,7 +95,7 @@ display(xwin_t *win, char *text, int siz
* the line.
*/
if (*text == win->werase) {
- int endcol, xcol, i, c;
+ int endcol, xcol, j, c;
endcol = win->x_col;
xcol = endcol - 1;
@@ -112,7 +112,7 @@ display(xwin_t *win, char *text, int siz
xcol--;
}
wmove(win->x_win, win->x_line, xcol + 1);
- for (i = xcol + 1; i < endcol; i++)
+ for (j = xcol + 1; j < endcol; j++)
waddch(win->x_win, ' ');
wmove(win->x_win, win->x_line, xcol + 1);
getyx(win->x_win, win->x_line, win->x_col);
Index: init_disp.c
===================================================================
RCS file: /cvs/src/usr.bin/talk/init_disp.c,v
retrieving revision 1.22
diff -u -p -u -p -r1.22 init_disp.c
--- init_disp.c 1 Feb 2016 07:29:25 -0000 1.22
+++ init_disp.c 23 May 2017 15:23:42 -0000
@@ -81,11 +81,7 @@ init_display(void)
wclear(his_win.x_win);
line_win = newwin(1, COLS, my_win.x_nlines, 0);
-#if defined(NCURSES_VERSION) || defined(whline)
whline(line_win, '-', COLS);
-#else
- box(line_win, '-', '-');
-#endif
wrefresh(line_win);
/* let them know we are working on it */
current_state = "No connection yet";
@@ -192,12 +188,7 @@ resize_display(void)
wresize(line_win, 1, COLS);
mvwin(line_win, my_win.x_nlines, 0);
-#if defined(NCURSES_VERSION) || defined(whline)
whline(line_win, '-', COLS);
-#else
- wmove(line_win, my_win.x_nlines, 0);
- box(line_win, '-', '-');
-#endif
/* Now redraw the screen. */
wrefresh(his_win.x_win);
Index: invite.c
===================================================================
RCS file: /cvs/src/usr.bin/talk/invite.c,v
retrieving revision 1.17
diff -u -p -u -p -r1.17 invite.c
--- invite.c 16 Mar 2016 15:41:11 -0000 1.17
+++ invite.c 23 May 2017 15:23:42 -0000
@@ -75,13 +75,9 @@ invite_remote(void)
itimer.it_interval = itimer.it_value;
if (listen(sockt, 5) != 0)
quit("Error on attempt to listen for caller", 1);
-#ifdef MSG_EOR
/* copy new style sockaddr to old, swap family (short in old) */
msg.addr = *(struct osockaddr *)&my_addr; /* XXX new to old style*/
msg.addr.sa_family = htons(my_addr.sin_family);
-#else
- msg.addr = *(struct sockaddr *)&my_addr;
-#endif
msg.id_num = htonl(-1); /* an impossible id_num */
invitation_waiting = 1;
announce_invite();
Index: io.c
===================================================================
RCS file: /cvs/src/usr.bin/talk/io.c,v
retrieving revision 1.20
diff -u -p -u -p -r1.20 io.c
--- io.c 18 Feb 2016 21:51:20 -0000 1.20
+++ io.c 23 May 2017 15:23:42 -0000
@@ -58,14 +58,10 @@ talk(void)
char buf[BUFSIZ];
int nb;
-#if defined(NCURSES_VERSION) || defined(beep)
message("Connection established");
beep();
beep();
beep();
-#else
- message("Connection established\007\007\007");
-#endif
current_line = 0;
/*
Index: look_up.c
===================================================================
RCS file: /cvs/src/usr.bin/talk/look_up.c,v
retrieving revision 1.13
diff -u -p -u -p -r1.13 look_up.c
--- look_up.c 1 Feb 2016 07:29:25 -0000 1.13
+++ look_up.c 23 May 2017 15:23:42 -0000
@@ -47,13 +47,10 @@ check_local(void)
CTL_RESPONSE response;
/* the rest of msg was set up in get_names */
-#ifdef MSG_EOR
/* copy new style sockaddr to old, swap family (short in old) */
msg.ctl_addr = *(struct osockaddr *)&ctl_addr;
msg.ctl_addr.sa_family = htons(ctl_addr.sin_family);
-#else
- msg.ctl_addr = *(struct sockaddr *)&ctl_addr;
-#endif
+
/* must be initiating a talk */
if (!look_for_invite(&response))
return (0);