unstick r69113

Revision 69113

Date:
1995/04/29 10:09:51
Author:
bostic
Revision Log:
It failed to compile on the sparc because `swapresponse' was
ifdef'ed on vax, sun, i386 (but not sparc). I made it pass gcc2 -Wall.
From: Chris Torek <torek@BSDI.COM>

Files:

Legend:

 
Added
 
Removed
 
Modified
  • old/talk/talk/ctl.c

     
    33 33
    34 34 CTL_MSG msg;
    35 35
    36 void
    36 37 open_sockt()
    37 38 {
    38 39 int length;
     
    50 51 }
    51 52
    52 53 /* open the ctl socket */
    54 void
    53 55 open_ctl()
    54 56 {
    55 57 int length;
     
    67 69 }
    68 70
    69 71 /* print_addr is a debug print routine */
    72 void
    70 73 print_addr(addr)
    71 struct sockaddr_in addr;
    74 struct sockaddr_in addr;
    72 75 {
    73 76 int i;
    74 77
    75 printf("addr = %x, port = %o, family = %o zero = ",
    76 addr.sin_addr, addr.sin_port, addr.sin_family);
    78 printf("addr = %lx, port = %o, family = %o zero = ",
    79 (long)addr.sin_addr.s_addr, addr.sin_port, addr.sin_family);
    77 80 for (i = 0; i<8;i++)
    78 81 printf("%o ", (int)addr.sin_zero[i]);
    79 82 putchar('\n');
  • old/talk/talk/ctl_transact.c

     
    11 11
    12 12 #include "talk_ctl.h"
    13 13 #include <sys/time.h>
    14 #include <unistd.h>
    14 15
    15 16 #define CTL_WAIT 2 /* time to wait for a response, in seconds */
    16 17
     
    19 20 * not recieved an acknowledgement within a reasonable amount
    20 21 * of time
    21 22 */
    23 void
    22 24 ctl_transact(target, msg, type, response)
    23 25 struct in_addr target;
    24 26 CTL_MSG msg;
     
    57 59 p_error("Error on write to talk daemon");
    58 60 }
    59 61 read_mask = ctl_mask;
    60 if ((nready = select(32, &read_mask, 0, 0, &wait)) < 0) {
    62 if ((nready = select(32, (fd_set *)&read_mask, 0, 0, &wait)) < 0) {
    61 63 if (errno == EINTR)
    62 64 continue;
    63 65 p_error("Error waiting for daemon response");
     
    79 81 read_mask = ctl_mask;
    80 82 /* an immediate poll */
    81 83 timerclear(&wait);
    82 nready = select(32, &read_mask, 0, 0, &wait);
    84 nready = select(32, (fd_set *)&read_mask, 0, 0, &wait);
    83 85 } while (nready > 0 && response->type != type);
    84 86 } while (response->type != type);
    85 87 }
  • old/talk/talk/display.c

     
    21 21
    22 22 int curses_initialized = 0;
    23 23
    24 int readwin __P((WINDOW *, int, int));
    25 void xscroll __P((xwin_t *, int));
    26
    24 27 /*
    25 28 * max HAS to be a function, it is called with
    26 29 * a argument of the form --foo at least once.
    27 30 */
    28 max(a,b)
    31 int
    32 max(a, b)
    29 33 int a, b;
    30 34 {
    31 35
     
    36 40 * Display some text on somebody's window, processing some control
    37 41 * characters while we are at it.
    38 42 */
    43 void
    39 44 display(win, text, size)
    40 45 register xwin_t *win;
    41 46 register char *text;
     
    125 130 /*
    126 131 * Read the character at the indicated position in win
    127 132 */
    133 int
    128 134 readwin(win, line, col)
    129 135 WINDOW *win;
    136 int line, col;
    130 137 {
    131 138 int oldline, oldcol;
    132 139 register int c;
     
    142 149 * Scroll a window, blanking out the line following the current line
    143 150 * so that the current position is obvious
    144 151 */
    152 void
    145 153 xscroll(win, flag)
    146 154 register xwin_t *win;
    147 155 int flag;
  • old/talk/talk/get_addrs.c

     
    10 10 #endif not lint
    11 11
    12 12 #include "talk_ctl.h"
    13 #include <netdb.h>
    14 #include <stdlib.h>
    15 #include <string.h>
    16 #include <unistd.h>
    13 17
    14 struct hostent *gethostbyname();
    15 struct servent *getservbyname();
    16
    18 void
    17 19 get_addrs(my_machine_name, his_machine_name)
    18 20 char *my_machine_name;
    19 21 char *his_machine_name;
  • old/talk/talk/get_names.c

     
    11 11
    12 12 #include "talk.h"
    13 13 #include "ctl.h"
    14 #include <netdb.h>
    15 #include <stdlib.h>
    16 #include <string.h>
    17 #include <unistd.h>
    14 18
    15 char *getlogin(), *ttyname(), *rindex();
    16
    17 19 extern CTL_MSG msg;
    18 20
    19 struct hostent *gethostbyname();
    20
    21 21 /*
    22 22 * Determine the local and remote user, tty, and machines
    23 23 */
    24 void
    24 25 get_names(argc, argv)
    25 26 int argc;
    26 27 char *argv[];
  • old/talk/talk/init_disp.c

     
    17 17 #define USE_OLD_TTY
    18 18 #include "talk.h"
    19 19 #include <sgtty.h>
    20 #include <stdlib.h>
    20 21 #include <signal.h>
    22 #include <unistd.h>
    21 23
    24 void sig_sent();
    25
    22 26 /*
    23 27 * Set up curses, catch the appropriate signals,
    24 28 * and build the various windows.
    25 29 */
    30 void
    26 31 init_display()
    27 32 {
    28 void sig_sent();
    29 33 struct sigvec sigv;
    30 34
    31 35 initscr();
     
    65 69 * the first three characters each talk transmits after
    66 70 * connection are the three edit characters.
    67 71 */
    72 void
    68 73 set_edit_chars()
    69 74 {
    70 75 char buf[3];
     
    105 110 /*
    106 111 * All done talking...hang up the phone and reset terminal thingy's
    107 112 */
    113 __dead void
    108 114 quit()
    109 115 {
    110 116
  • old/talk/talk/invite.c

     
    13 13 #include <sys/time.h>
    14 14 #include <signal.h>
    15 15 #include <setjmp.h>
    16 #include <unistd.h>
    16 17
    17 18 /*
    18 19 * There wasn't an invitation waiting, so send a request containing
     
    30 31 void re_invite();
    31 32 jmp_buf invitebuf;
    32 33
    34 void
    33 35 invite_remote()
    34 36 {
    35 int nfd, read_mask, template, new_sockt;
    37 int new_sockt;
    36 38 struct itimerval itimer;
    37 39 CTL_RESPONSE response;
    38 40
     
    94 96 /*
    95 97 * Transmit the invitation and process the response
    96 98 */
    99 void
    97 100 announce_invite()
    98 101 {
    99 102 CTL_RESPONSE response;
     
    134 137 /*
    135 138 * Tell the daemon to remove your invitation
    136 139 */
    140 void
    137 141 send_delete()
    138 142 {
    139 143
  • old/talk/talk/io.c

     
    17 17
    18 18 #include "talk.h"
    19 19 #include <sys/ioctl.h>
    20 #include <sys/time.h>
    21 #include <errno.h>
    20 22 #include <stdio.h>
    21 #include <errno.h>
    22 #include <sys/time.h>
    23 #include <string.h>
    24 #include <unistd.h>
    23 25
    24 26 #define A_LONG_TIME 10000000
    25 27 #define STDIN_MASK (1<<fileno(stdin)) /* the bit mask for standard
     
    29 31 /*
    30 32 * The routine to do the actual talking
    31 33 */
    34 void
    32 35 talk()
    33 36 {
    34 37 register int read_template, sockt_mask;
     
    49 52 read_set = read_template;
    50 53 wait.tv_sec = A_LONG_TIME;
    51 54 wait.tv_usec = 0;
    52 nb = select(32, &read_set, 0, 0, &wait);
    55 nb = select(32, (fd_set *)&read_set, 0, 0, &wait);
    53 56 if (nb <= 0) {
    54 57 if (errno == EINTR) {
    55 58 read_set = read_template;
     
    83 86 }
    84 87
    85 88 extern int errno;
    86 extern int sys_nerr;
    87 extern char *sys_errlist[];
    88 89
    89 90 /*
    90 91 * p_error prints the system error message on the standard location
    91 92 * on the screen and then exits. (i.e. a curses version of perror)
    92 93 */
    94 __dead void
    93 95 p_error(string)
    94 char *string;
    96 const char *string;
    95 97 {
    96 98 char *sys;
    97 99
    98 sys = "Unknown error";
    99 if (errno < sys_nerr)
    100 sys = sys_errlist[errno];
    100 sys = strerror(errno);
    101 101 wmove(my_win.x_win, current_line%my_win.x_nlines, 0);
    102 102 wprintw(my_win.x_win, "[%s : %s (%d)]\n", string, sys, errno);
    103 103 wrefresh(my_win.x_win);
     
    109 109 /*
    110 110 * Display string in the standard location
    111 111 */
    112 void
    112 113 message(string)
    113 char *string;
    114 const char *string;
    114 115 {
    115 116
    116 117 wmove(my_win.x_win, current_line%my_win.x_nlines, 0);
  • old/talk/talk/look_up.c

     
    8 8 /* from "@(#)look_up.c 5.1 (Berkeley) 6/6/85"; */
    9 9
    10 10 #ifndef lint
    11 static char sccsid[] = "@(#)look_up.c 6.4 (Berkeley) 04/02/94";
    11 static char sccsid[] = "@(#)look_up.c 6.5 (Berkeley) 04/29/95";
    12 12 #endif not lint
    13 13
    14 14 #include "talk_ctl.h"
    15 #include <machine/endian.h>
    16 #include <string.h>
    17 #include <unistd.h>
    15 18
    19 int look_for_invite __P((CTL_RESPONSE *));
    20 void swapresponse __P((CTL_RESPONSE *));
    16 21
    17 22 /*
    18 23 * See if the local daemon has a invitation for us
    19 24 */
    25 int
    20 26 check_local()
    21 27 {
    22 28 CTL_RESPONSE response;
     
    58 64 /*
    59 65 * Look for an invitation on 'machine'
    60 66 */
    67 int
    61 68 look_for_invite(response)
    62 69 CTL_RESPONSE *response;
    63 70 {
    64 struct in_addr machine_addr;
    65 71
    66 72 current_state = "Checking for invitation on caller's machine";
    67 73 ctl_transact(his_machine_addr, msg, LOOK_UP, response);
     
    85 91 #define swapshort(a) (((a << 8) | ((unsigned short) a >> 8)) & 0xffff)
    86 92 #define swaplong(a) ((swapshort(a) << 16) | (swapshort(((unsigned)a >> 16))))
    87 93
    88 #ifdef sun
    94 #if BYTE_ORDER == BIG_ENDIAN
    89 95 struct ctl_response_vax {
    90 96 char type;
    91 97 char answer;
     
    94 100 struct sockaddr_in addr;
    95 101 };
    96 102
    103 void
    97 104 swapresponse(rsp)
    98 105 CTL_RESPONSE *rsp;
    99 106 {
     
    112 119 }
    113 120 #endif
    114 121
    115 #ifdef vax
    122 #if BYTE_ORDER == LITTLE_ENDIAN
    116 123 struct ctl_response_sun {
    117 124 char type;
    118 125 char answer;
     
    124 131 short sin_addr1;
    125 132 };
    126 133
    134 void
    127 135 swapresponse(rsp)
    128 136 CTL_RESPONSE *rsp;
    129 137 {
  • old/talk/talk/msgs.c

     
    20 20 #include "talk.h"
    21 21
    22 22 #define MSG_INTERVAL 4
    23 #define LONG_TIME 100000
    24 23
    25 24 char *current_state;
    26 25 int current_line = 0;
    27 26
    28 27 static struct itimerval itimer;
    29 28 static struct timeval wait = { MSG_INTERVAL , 0};
    30 static struct timeval undo = { LONG_TIME, 0};
    31
    29
    32 30 void
    33 31 disp_msg()
    34 32 {
     
    36 34 message(current_state);
    37 35 }
    38 36
    37 void
    39 38 start_msgs()
    40 39 {
    41 40
     
    45 44 setitimer(ITIMER_REAL, &itimer, (struct itimerval *)0);
    46 45 }
    47 46
    47 void
    48 48 end_msgs()
    49 49 {
    50 50
  • old/talk/talk/talk.c

     
    31 31 * Modified to run under 4.1c by Peter Moore 3/17/83
    32 32 */
    33 33
    34 int
    34 35 main(argc, argv)
    35 36 int argc;
    36 37 char *argv[];
     
    41 42 open_ctl();
    42 43 open_sockt();
    43 44 start_msgs();
    44 if (!check_local() )
    45 if (!check_local())
    45 46 invite_remote();
    46 47 end_msgs();
    47 48 set_edit_chars();
    48 49 talk();
    50 return (0);
    49 51 }
  • old/talk/talk/talk.h

     
    15 15
    16 16 #define BUF_SIZE 512
    17 17
    18 FILE *popen();
    19 int quit();
    20 int sleeper();
    21
    22 18 extern int sockt;
    23 19 extern int curses_initialized;
    24 20 extern int invitation_waiting;
     
    40 36 extern xwin_t my_win;
    41 37 extern xwin_t his_win;
    42 38 extern WINDOW *line_win;
    39
    40 void announce_invite __P((void));
    41 int check_local __P((void));
    42 void display __P((xwin_t *, char *, int));
    43 void end_msgs __P((void));
    44 void get_addrs __P((char *, char *));
    45 void get_names __P((int, char **));
    46 void init_display __P((void));
    47 void invite_remote __P((void));
    48 void message __P((const char *));
    49 void open_ctl __P((void));
    50 void open_sockt __P((void));
    51 __dead void p_error __P((const char *)) __attribute__((volatile));
    52 __dead void quit __P((void)) __attribute__((volatile));
    53 void send_delete __P((void));
    54 void set_edit_chars __P((void));
    55 void start_msgs __P((void));
    56 void talk __P((void));
  • old/talk/talk/talk_ctl.h

     
    21 21 extern u_short daemon_port;
    22 22 extern int ctl_sockt;
    23 23 extern CTL_MSG msg;
    24
    25 void ctl_transact __P((struct in_addr, CTL_MSG, int, CTL_RESPONSE *));