summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTed Unangst <tedu@cvs.openbsd.org>2010-08-12 23:31:30 +0000
committerTed Unangst <tedu@cvs.openbsd.org>2010-08-12 23:31:30 +0000
commit8ebdf17f43fd568d42a0c0054ba7136979236248 (patch)
treede0a8c30799b8a163d7dc48daa139c902843d841
parentf0adf2e165bd2ccabbca552f25fe9e07c0f619aa (diff)
some inconsequential cleanups. ok deraadt
-rw-r--r--usr.bin/talk/ctl.c4
-rw-r--r--usr.bin/talk/ctl_transact.c8
-rw-r--r--usr.bin/talk/display.c26
-rw-r--r--usr.bin/talk/get_addrs.c9
-rw-r--r--usr.bin/talk/get_names.c6
-rw-r--r--usr.bin/talk/io.c4
-rw-r--r--usr.bin/talk/look_up.c5
-rw-r--r--usr.bin/talk/msgs.c11
8 files changed, 28 insertions, 45 deletions
diff --git a/usr.bin/talk/ctl.c b/usr.bin/talk/ctl.c
index 9dd04d1382f..ff106a01604 100644
--- a/usr.bin/talk/ctl.c
+++ b/usr.bin/talk/ctl.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: ctl.c,v 1.11 2009/10/27 23:59:44 deraadt Exp $ */
+/* $OpenBSD: ctl.c,v 1.12 2010/08/12 23:31:29 tedu Exp $ */
/* $NetBSD: ctl.c,v 1.3 1994/12/09 02:14:10 jtc Exp $ */
/*
@@ -52,7 +52,7 @@ u_short daemon_port; /* port number of the talk daemon */
int ctl_sockt;
int sockt;
-int invitation_waiting = 0;
+int invitation_waiting;
CTL_MSG msg;
diff --git a/usr.bin/talk/ctl_transact.c b/usr.bin/talk/ctl_transact.c
index 46d2b4cd85c..8f33d194d58 100644
--- a/usr.bin/talk/ctl_transact.c
+++ b/usr.bin/talk/ctl_transact.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: ctl_transact.c,v 1.11 2009/10/27 23:59:44 deraadt Exp $ */
+/* $OpenBSD: ctl_transact.c,v 1.12 2010/08/12 23:31:29 tedu Exp $ */
/* $NetBSD: ctl_transact.c,v 1.3 1994/12/09 02:14:12 jtc Exp $ */
/*
@@ -45,11 +45,7 @@
* of time
*/
void
-ctl_transact(target, msg, type, rp)
- struct in_addr target;
- CTL_MSG msg;
- int type;
- CTL_RESPONSE *rp;
+ctl_transact(struct in_addr target, CTL_MSG msg, int type, CTL_RESPONSE *rp)
{
struct pollfd pfd[1];
int nready, cc;
diff --git a/usr.bin/talk/display.c b/usr.bin/talk/display.c
index e6bc89e21a0..fe0e0aaeaa9 100644
--- a/usr.bin/talk/display.c
+++ b/usr.bin/talk/display.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: display.c,v 1.15 2009/10/27 23:59:44 deraadt Exp $ */
+/* $OpenBSD: display.c,v 1.16 2010/08/12 23:31:29 tedu Exp $ */
/* $NetBSD: display.c,v 1.3 1994/12/09 02:14:13 jtc Exp $ */
/*
@@ -41,17 +41,16 @@ xwin_t my_win;
xwin_t his_win;
WINDOW *line_win;
-int curses_initialized = 0;
-int high_print = 0;
-bool smooth_scroll = FALSE;
+int curses_initialized;
+int high_print;
+bool smooth_scroll;
/*
* max HAS to be a function, it is called with
- * a argument of the form --foo at least once.
+ * an argument of the form --foo at least once.
*/
int
-max(a,b)
- int a, b;
+max(int a, int b)
{
return (a > b ? a : b);
@@ -62,10 +61,7 @@ max(a,b)
* characters while we are at it.
*/
void
-display(win, text, size)
- xwin_t *win;
- char *text;
- int size;
+display(xwin_t *win, char *text, int size)
{
int i;
char cch;
@@ -160,9 +156,7 @@ display(win, text, size)
* Read the character at the indicated position in win
*/
int
-readwin(win, line, col)
- WINDOW *win;
- int line, col;
+readwin(WINDOW *win, int line, int col)
{
int oldline, oldcol;
int c;
@@ -179,9 +173,7 @@ readwin(win, line, col)
* so that the current position is obvious
*/
void
-xscroll(win, flag)
- xwin_t *win;
- int flag;
+xscroll(xwin_t *win, int flag)
{
if (flag == -1) {
diff --git a/usr.bin/talk/get_addrs.c b/usr.bin/talk/get_addrs.c
index adbe5ea62de..c437d2e6c0a 100644
--- a/usr.bin/talk/get_addrs.c
+++ b/usr.bin/talk/get_addrs.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: get_addrs.c,v 1.8 2009/10/27 23:59:44 deraadt Exp $ */
+/* $OpenBSD: get_addrs.c,v 1.9 2010/08/12 23:31:29 tedu Exp $ */
/* $NetBSD: get_addrs.c,v 1.3 1994/12/09 02:14:14 jtc Exp $ */
/*
@@ -37,8 +37,7 @@
#include "talk_ctl.h"
void
-get_addrs(my_machine_name, his_machine_name)
- char *my_machine_name, *his_machine_name;
+get_addrs(char *my_machine_name, char *his_machine_name)
{
struct hostent *hp;
struct servent *sp;
@@ -48,7 +47,7 @@ get_addrs(my_machine_name, his_machine_name)
hp = gethostbyname(my_machine_name);
if (hp == NULL)
errx(1, "%s: %s", my_machine_name, hstrerror(h_errno));
- bcopy(hp->h_addr, (char *)&my_machine_addr, hp->h_length);
+ bcopy(hp->h_addr, &my_machine_addr, hp->h_length);
/*
* If the callee is on-machine, just copy the
* network address, otherwise do a lookup...
@@ -57,7 +56,7 @@ get_addrs(my_machine_name, his_machine_name)
hp = gethostbyname(his_machine_name);
if (hp == NULL)
errx(1, "%s: %s", his_machine_name, hstrerror(h_errno));
- bcopy(hp->h_addr, (char *) &his_machine_addr, hp->h_length);
+ bcopy(hp->h_addr, &his_machine_addr, hp->h_length);
} else
his_machine_addr = my_machine_addr;
/* find the server's port */
diff --git a/usr.bin/talk/get_names.c b/usr.bin/talk/get_names.c
index 65c2a289c36..caf98634894 100644
--- a/usr.bin/talk/get_names.c
+++ b/usr.bin/talk/get_names.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: get_names.c,v 1.18 2009/10/27 23:59:44 deraadt Exp $ */
+/* $OpenBSD: get_names.c,v 1.19 2010/08/12 23:31:29 tedu Exp $ */
/* $NetBSD: get_names.c,v 1.4 1994/12/09 02:14:16 jtc Exp $ */
/*
@@ -42,9 +42,7 @@ extern CTL_MSG msg;
* Determine the local and remote user, tty, and machines
*/
void
-get_names(argc, argv)
- int argc;
- char *argv[];
+get_names(int argc, char *argv[])
{
char hostname[MAXHOSTNAMELEN];
char *his_name, *my_name;
diff --git a/usr.bin/talk/io.c b/usr.bin/talk/io.c
index 5ef273aecc6..a56958213c2 100644
--- a/usr.bin/talk/io.c
+++ b/usr.bin/talk/io.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: io.c,v 1.17 2009/10/27 23:59:44 deraadt Exp $ */
+/* $OpenBSD: io.c,v 1.18 2010/08/12 23:31:29 tedu Exp $ */
/* $NetBSD: io.c,v 1.4 1994/12/09 02:14:20 jtc Exp $ */
/*
@@ -46,7 +46,7 @@
#define A_LONG_TIME 1000000
-volatile sig_atomic_t gotwinch = 0;
+volatile sig_atomic_t gotwinch;
/*
* The routine to do the actual talking
diff --git a/usr.bin/talk/look_up.c b/usr.bin/talk/look_up.c
index 7b8943815ad..695818306bc 100644
--- a/usr.bin/talk/look_up.c
+++ b/usr.bin/talk/look_up.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: look_up.c,v 1.11 2009/10/27 23:59:44 deraadt Exp $ */
+/* $OpenBSD: look_up.c,v 1.12 2010/08/12 23:31:29 tedu Exp $ */
/* $NetBSD: look_up.c,v 1.3 1994/12/09 02:14:21 jtc Exp $ */
/*
@@ -67,6 +67,7 @@ check_local(void)
sizeof (response.addr)) != -1)
return (1);
} while (errno == EINTR);
+
if (errno == ECONNREFUSED) {
/*
* The caller gave up, but his invitation somehow
@@ -94,11 +95,9 @@ look_for_invite(CTL_RESPONSE *rp)
ctl_transact(his_machine_addr, msg, LOOK_UP, rp);
/* the switch is for later options, such as multiple invitations */
switch (rp->answer) {
-
case SUCCESS:
msg.id_num = htonl(rp->id_num);
return (1);
-
default:
/* there wasn't an invitation waiting for us */
return (0);
diff --git a/usr.bin/talk/msgs.c b/usr.bin/talk/msgs.c
index f8e36a76c77..94de95d406a 100644
--- a/usr.bin/talk/msgs.c
+++ b/usr.bin/talk/msgs.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: msgs.c,v 1.9 2009/10/27 23:59:44 deraadt Exp $ */
+/* $OpenBSD: msgs.c,v 1.10 2010/08/12 23:31:29 tedu Exp $ */
/* $NetBSD: msgs.c,v 1.3 1994/12/09 02:14:22 jtc Exp $ */
/*
@@ -42,11 +42,10 @@
#define MSG_INTERVAL 4
char *current_state;
-int current_line = 0;
+int current_line;
void
-disp_msg(dummy)
- int dummy;
+disp_msg(int dummy)
{
message(current_state);
}
@@ -60,7 +59,7 @@ start_msgs(void)
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 itimerval *)0);
+ setitimer(ITIMER_REAL, &itimer, NULL);
}
void
@@ -70,6 +69,6 @@ end_msgs(void)
timerclear(&itimer.it_value);
timerclear(&itimer.it_interval);
- setitimer(ITIMER_REAL, &itimer, (struct itimerval *)0);
+ setitimer(ITIMER_REAL, &itimer, NULL);
signal(SIGALRM, SIG_DFL);
}