small talk cleanup

Previous message: [thread] [date] [author]
Next message: [thread] [date] [author]
From: Ted Unangst
Date: Wednesday, August 11, 2010 - 10:16 pm

nothing major, just some fluff here and there.

Index: ctl.c
===================================================================
RCS file: /home/tedu/cvs/src/usr.bin/talk/ctl.c,v
retrieving revision 1.11
diff -u -r1.11 ctl.c
--- ctl.c	27 Oct 2009 23:59:44 -0000	1.11
+++ ctl.c	12 Aug 2010 05:05:49 -0000
@@ -52,7 +52,7 @@
 
 int	ctl_sockt;
 int	sockt;
-int	invitation_waiting = 0;
+int	invitation_waiting;
 
 CTL_MSG msg;
 
Index: ctl_transact.c
===================================================================
RCS file: /home/tedu/cvs/src/usr.bin/talk/ctl_transact.c,v
retrieving revision 1.11
diff -u -r1.11 ctl_transact.c
--- ctl_transact.c	27 Oct 2009 23:59:44 -0000	1.11
+++ ctl_transact.c	12 Aug 2010 05:12:26 -0000
@@ -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;
Index: display.c
===================================================================
RCS file: /home/tedu/cvs/src/usr.bin/talk/display.c,v
retrieving revision 1.15
diff -u -r1.15 display.c
--- display.c	27 Oct 2009 23:59:44 -0000	1.15
+++ display.c	12 Aug 2010 05:13:02 -0000
@@ -41,17 +41,16 @@
 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 @@
  * 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 @@
  * 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 @@
  * 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) {
Index: get_addrs.c
===================================================================
RCS file: /home/tedu/cvs/src/usr.bin/talk/get_addrs.c,v
retrieving revision 1.8
diff -u -r1.8 get_addrs.c
--- get_addrs.c	27 Oct 2009 23:59:44 -0000	1.8
+++ get_addrs.c	12 Aug 2010 05:15:03 -0000
@@ -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 @@
 	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 @@
 		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 */
Index: get_names.c
===================================================================
RCS file: /home/tedu/cvs/src/usr.bin/talk/get_names.c,v
retrieving revision 1.18
diff -u -r1.18 get_names.c
--- get_names.c	27 Oct 2009 23:59:44 -0000	1.18
+++ get_names.c	12 Aug 2010 05:14:47 -0000
@@ -42,9 +42,7 @@
  * 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;
Index: io.c
===================================================================
RCS file: /home/tedu/cvs/src/usr.bin/talk/io.c,v
retrieving revision 1.17
diff -u -r1.17 io.c
--- io.c	27 Oct 2009 23:59:44 -0000	1.17
+++ io.c	12 Aug 2010 05:10:55 -0000
@@ -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
Index: look_up.c
===================================================================
RCS file: /home/tedu/cvs/src/usr.bin/talk/look_up.c,v
retrieving revision 1.11
diff -u -r1.11 look_up.c
--- look_up.c	27 Oct 2009 23:59:44 -0000	1.11
+++ look_up.c	12 Aug 2010 05:11:17 -0000
@@ -67,6 +67,7 @@
 			    sizeof (response.addr)) != -1)
 			return (1);
 	} while (errno == EINTR);
+
 	if (errno == ECONNREFUSED) {
 		/*
 		 * The caller gave up, but his invitation somehow
@@ -94,11 +95,9 @@
 	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);
Index: msgs.c
===================================================================
RCS file: /home/tedu/cvs/src/usr.bin/talk/msgs.c,v
retrieving revision 1.9
diff -u -r1.9 msgs.c
--- msgs.c	27 Oct 2009 23:59:44 -0000	1.9
+++ msgs.c	12 Aug 2010 05:04:47 -0000
@@ -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 @@
 	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 @@
 
 	timerclear(&itimer.it_value);
 	timerclear(&itimer.it_interval);
-	setitimer(ITIMER_REAL, &itimer, (struct itimerval *)0);
+	setitimer(ITIMER_REAL, &itimer, NULL);
 	signal(SIGALRM, SIG_DFL);
 }
Previous message: [thread] [date] [author]
Next message: [thread] [date] [author]

Messages in current thread:
small talk cleanup, Ted Unangst, (Wed Aug 11, 10:16 pm)