home *** CD-ROM | disk | FTP | other *** search
/ Usenet 1994 January / usenetsourcesnewsgroupsinfomagicjanuary1994.iso / sources / misc / volume1 / 8708 / 9 < prev    next >
Encoding:
Internet Message Format  |  1990-07-13  |  52.7 KB

  1. From: forys@boulder.Colorado.EDU (Jeff Forys)
  2. Newsgroups: comp.sources.misc
  3. Subject: talk(1) enhancements (1 of 2)
  4. Message-ID: <4114@ncoast.UUCP>
  5. Date: 11 Aug 87 00:15:32 GMT
  6. Sender: allbery@ncoast.UUCP
  7. Organization: University of Colorado, Boulder
  8. Lines: 1825
  9. Approved: allbery@ncoast.UUCP
  10. X-Archive: comp.sources.misc/8708/9
  11.  
  12. What follows is a set of patches that will enhance `talk' as
  13. distributed with 4.3BSD.  No functionality is lost if these patches
  14. are applied (i.e. it is still compatible with other machines who
  15. run stock 4.3BSD talk).  Here is a summary of what the patches do:
  16.  
  17.     1) Fix a bug in 4.3BSD talk which results in bogus error
  18.        messages being displayed under various circumstances.
  19.        I posted this fix back in November, everyone should
  20.        apply it, hence it is separate from the `enhancements'.
  21.  
  22.     2) Makes the 4.3BSD version of talk portable to the following
  23.        flavours of Unix: Pyramid (OSx2.5,OSx3.1,OSx4.0), Ultrix (1.2),
  24.        Sun (3.0,3.1,3.2).  This is nice, since few of these speak the
  25.        4.3BSD talk protocol; it'll probably port to 4.2BSD with OSx2.5.
  26.  
  27.     3) Allow for special control codes to be expanded locally.
  28.        (e.g. ^A maps into "<go ahead>", ^N displays a menu, etc)
  29.        While it is possible to send the *mappings* out to people
  30.        not running these enhancements, doing it `right' requires
  31.        awful code (e.g. some control chars are only meaningful
  32.        locally and shouldnt be sent).  Instead, because of #2
  33.        above (easy portability), we simply run it everywhere here.
  34.  
  35.     4) Resolve internet addresses (e.g. 128.138.240.1) so that
  36.        things like `talk user@128.138.240.1' will work, and
  37.        talkd may display "respond with: talk user@128.138.240.1".
  38.        (this is good for internet hosts that dont yet run a
  39.        nameserver, and dont have up-to-date /etc/hosts files)
  40.  
  41.     5) If a person you are trying to contact has messages off,
  42.        and they have a file called ".busy" in their home directory,
  43.        it will be sent to you and displayed in their half of the
  44.        screen.  The file generally contains the `reason' your
  45.        messages are off.
  46.  
  47.     6) A "dumb terminal" interface called `chat'.  This is good
  48.        for consoles and terminals without termcaps.  `chat' is
  49.        hard-linked to `talk' and each does the right thing.
  50.  
  51.     7) A revised manual page explaining these enhancements.
  52.  
  53. One thing that would be easy to add to the talk daemon, and probably will
  54. be added in the future (if you or I ever get the time) is a ".talkrc" file
  55. that would contain options to:
  56.  
  57.     1) list people you will talk to (when your messages are off).
  58.     2) list people who you wont talk to even though your messages are on.
  59.  
  60. I have tested these `enhancements' under many circumstances for
  61. compatibility with 4.3BSD.  Most of these mods have been running for
  62. a couple years and I've fixed any little bugs that have since appeared.
  63. Finally, this is available via anonymous ftp from boulder.Colorado.EDU.
  64.  
  65. What follows, is a shar archive containing the files:
  66.  
  67.     4.3talk_fix   - a fix that should be applied to every 4.3BSD talk.
  68.     talk.1_diffs  - patch to /usr/man/man1/talk.1 (move the patched
  69.             file to /usr/src/ucb/talk/talk.1 for `make install')
  70.     talk_diffs    - patches for talk; cd /usr/src/ucb/talk & patch...
  71.     talkd_diffs   - patches for talkd; cd /usr/src/etc/talkd & patch...
  72.     talkd.h_diffs - patch to /usr/include/protocols/talkd.h
  73.  
  74. [I split talkd_diffs into a separate file because of the 64K message limit
  75. on some machines.  ++bsa]
  76.  
  77. If you make any changes or fix a bug, please let me know... thanks!
  78. ---
  79. Jeff Forys @ UC/Boulder Engineering Research Comp Cntr (303-492-4991)
  80. forys@boulder.Colorado.Edu  -or-  ..!{hao|nbires}!boulder!forys
  81.  
  82. #--------------------------------CUT HERE-------------------------------------
  83. #! /bin/sh
  84. #
  85. # This is a shell archive.  Save this into a file, edit it
  86. # and delete all lines above this comment.  Then give this
  87. # file to sh by executing the command "sh file".  The files
  88. # will be extracted into the current directory owned by
  89. # you with default permissions.
  90. #
  91. # The files contained herein are:
  92. #
  93. # -rw-r--r--   1 allbery  System      1886 Aug 10 20:02 4.3talk_fix
  94. # -rw-r--r--   1 allbery  System      5947 Aug 10 20:02 talk.1_diffs
  95. # -rw-r--r--   1 allbery  System     38180 Aug 10 20:03 talk_diffs
  96. # -rw-r--r--   1 allbery  System       512 Aug 10 20:02 talkd.h_diffs
  97. #
  98. echo 'x - 4.3talk_fix'
  99. if test -f 4.3talk_fix; then echo 'shar: not overwriting 4.3talk_fix'; else
  100. sed 's/^X//' << '________This_Is_The_END________' > 4.3talk_fix
  101. XFrom: forys@sunybcs.UUCP (Jeff Forys)
  102. XNewsgroups: net.bugs.4bsd
  103. XSubject: talk(1) displays incorrect error messages
  104. XDate: 8 Nov 86 08:12:12 GMT
  105. X
  106. XIndex:    /usr/src/ucb/talk/invite.c 4.3BSD +FIX
  107. X
  108. XDescription:
  109. X
  110. X    talk(1) returns wrong error message under various circumstances.
  111. X
  112. XRepeat by:
  113. X
  114. X    % talk foo        # where `foo' is someone not logged in
  115. X      [No connection yet]
  116. X     >>>  [Target machine does not recognize us]  <<<
  117. X    % 
  118. X
  119. XFix:
  120. X    The error messages do not jibe with their respective #define's
  121. X    in "/usr/include/protocols/talkd.h".  The solution is to reorder
  122. X    the error messages properly as the following diff illustrates...
  123. X
  124. X*** invite.c_old    Sat Nov  8 00:46:33 1986
  125. X--- invite.c    Sat Nov  8 00:46:32 1986
  126. X***************
  127. X*** 92,102 ****
  128. X  }
  129. X  
  130. X  static    char *answers[] = {
  131. X      "Your party is not logged on",            /* NOT_HERE */
  132. X-     "Target machine does not recognize us",        /* MACHINE_UNKNOWN */
  133. X-     "Target machine can not handle remote talk",    /* UNKNOWN_REQUEST */
  134. X      "Target machine is too confused to talk to us",    /* FAILED */
  135. X      "Your party is refusing messages",        /* PERMISSION_REFUSED */
  136. X      "Target machine indicates protocol mismatch",    /* BADVERSION */
  137. X      "Target machine indicates protocol botch (addr)",/* BADADDR */
  138. X      "Target machine indicates protocol botch (ctl_addr)",/* BADCTLADDR */
  139. X--- 92,103 ----
  140. X  }
  141. X  
  142. X  static    char *answers[] = {
  143. X+     "",                        /* SUCCESS */
  144. X      "Your party is not logged on",            /* NOT_HERE */
  145. X      "Target machine is too confused to talk to us",    /* FAILED */
  146. X+     "Target machine does not recognize us",        /* MACHINE_UNKNOWN */
  147. X      "Your party is refusing messages",        /* PERMISSION_REFUSED */
  148. X+     "Target machine can not handle remote talk",    /* UNKNOWN_REQUEST */
  149. X      "Target machine indicates protocol mismatch",    /* BADVERSION */
  150. X      "Target machine indicates protocol botch (addr)",/* BADADDR */
  151. X      "Target machine indicates protocol botch (ctl_addr)",/* BADCTLADDR */
  152. ________This_Is_The_END________
  153. if test `wc -l < 4.3talk_fix` -ne 51; then
  154.     echo 'shar: 4.3talk_fix was damaged during transit (should have been 51 bytes)'
  155. fi
  156. fi        ; : end of overwriting check
  157. echo 'x - talk.1_diffs'
  158. if test -f talk.1_diffs; then echo 'shar: not overwriting talk.1_diffs'; else
  159. sed 's/^X//' << '________This_Is_The_END________' > talk.1_diffs
  160. X*** /tmp/,RCSt1019856    Fri Aug  7 17:36:46 1987
  161. X--- talk.1    Fri Aug  7 17:36:43 1987
  162. X***************
  163. X*** 4,28 ****
  164. X  .\"
  165. X  .\"    @(#)talk.1    6.2 (Berkeley) 5/5/86
  166. X  .\"
  167. X! .TH TALK 1 "May 5, 1986"
  168. X  .UC 5
  169. X  .SH NAME
  170. X! talk \- talk to another user
  171. X  .SH SYNOPSIS
  172. X  .B talk
  173. X! person [ ttyname ]
  174. X  .SH DESCRIPTION
  175. X  .I Talk
  176. X! is a visual communication program which
  177. X! copies lines from your terminal to that of
  178. X! another user.
  179. X  .PP 
  180. X! If you wish to talk to someone on you own machine, then
  181. X  .I person
  182. X  is just the person's login name. If you wish to talk to
  183. X! a user on another host, then
  184. X  .I person
  185. X! is of the form :
  186. X  .sp
  187. X  .in +2.0i
  188. X  .I host!user
  189. X--- 4,39 ----
  190. X  .\"
  191. X  .\"    @(#)talk.1    6.2 (Berkeley) 5/5/86
  192. X  .\"
  193. X! .TH TALK 1 "Jun 15, 1987"
  194. X  .UC 5
  195. X  .SH NAME
  196. X! talk, chat \- communicate with another user
  197. X  .SH SYNOPSIS
  198. X  .B talk
  199. X! person [tty]
  200. X! .br
  201. X! .B chat
  202. X! person [tty]
  203. X  .SH DESCRIPTION
  204. X  .I Talk
  205. X! and
  206. X! .I chat
  207. X! allow you to carry on conversations with other users.
  208. X! .I Talk
  209. X! uses windows to split the screen in half giving a clear
  210. X! picture of who is typing what.
  211. X! .I Chat
  212. X! displays characters in a line-by-line fashion which may
  213. X! cause confusion if both parties are typing at the same time.
  214. X! Characters are displayed and sent as soon as they are typed.
  215. X  .PP 
  216. X! The command line syntax for both programs is identical.
  217. X! If you wish to talk to someone on the same machine, then
  218. X  .I person
  219. X  is just the person's login name. If you wish to talk to
  220. X! a user on another machine, then
  221. X  .I person
  222. X! can be of the form:
  223. X  .sp
  224. X  .in +2.0i
  225. X  .I host!user
  226. X***************
  227. X*** 39,96 ****
  228. X  .in -2.0i
  229. X  .sp
  230. X  though
  231. X! .I host@user 
  232. X! is perhaps preferred.
  233. X  .PP
  234. X  If you want to talk to a user who is logged in more than once,
  235. X  the
  236. X! .I ttyname
  237. X  argument may be used to indicate the
  238. X  appropriate terminal name.
  239. X  .PP
  240. X! When first called,
  241. X! it sends the message
  242. X  .PP
  243. X!      Message from TalkDaemon@his_machine...
  244. X       talk: connection requested by your_name@your_machine.
  245. X!      talk: respond with: talk your_name@your_machine
  246. X  .PP
  247. X! to the user you wish to talk to. At this point, the recipient
  248. X! of the message should reply by 
  249. X! typing 
  250. X  .PP
  251. X       talk \ your_name@your_machine
  252. X  .PP
  253. X  It doesn't matter from 
  254. X  which machine the recipient replies, as long as his login-name is
  255. X  the same.
  256. X! Once communication is established, the two parties may type 
  257. X! simultaneously, with their output appearing in separate windows. 
  258. X! Typing control L will cause the screen to be reprinted, while your 
  259. X! erase, kill, and word kill characters will work in talk as normal.
  260. X! To exit,
  261. X! just type your interrupt character;
  262. X  .I talk
  263. X! then moves the cursor to the bottom of the screen and restores 
  264. X! the terminal.
  265. X  .PP
  266. X  Permission to talk may be denied or granted by use of the
  267. X  .I mesg
  268. X  command.
  269. X! At the outset talking is allowed.
  270. X! Certain commands, in particular
  271. X! .I nroff
  272. X! and
  273. X! .IR  pr (1)
  274. X! disallow
  275. X! messages in order to prevent messy output.
  276. X  .PP
  277. X  .SH FILES
  278. X  /etc/hosts    to find the recipient's machine
  279. X  .br
  280. X! /etc/utmp    to find the recipient's tty
  281. X  .SH "SEE ALSO"
  282. X! mesg(1), who(1), mail(1), write(1)
  283. X  .SH BUGS
  284. X  The version of 
  285. X  .IR talk (1)
  286. X--- 50,130 ----
  287. X  .in -2.0i
  288. X  .sp
  289. X  though
  290. X! .I user@host
  291. X! is perhaps preferred, since it allows
  292. X! .I host
  293. X! to be a domain name (e.g. boulder.Colorado.EDU)
  294. X! or an internet address (e.g. 128.138.240.1)
  295. X! as well as a local host.
  296. X  .PP
  297. X  If you want to talk to a user who is logged in more than once,
  298. X  the
  299. X! .I tty
  300. X  argument may be used to indicate the
  301. X  appropriate terminal name.
  302. X  .PP
  303. X! When first called the message:
  304. X  .PP
  305. X!      Message from Talk_Daemon@his_machine at <time> ...
  306. X       talk: connection requested by your_name@your_machine.
  307. X!      talk: respond with:  talk your_name@your_machine
  308. X  .PP
  309. X! is sent to the user you wish to talk to. At this point, the
  310. X! recipient of the message should reply with either
  311. X  .PP
  312. X       talk \ your_name@your_machine
  313. X+  or
  314. X+      chat \ your_name@your_machine
  315. X  .PP
  316. X+ depending on the interface one wants to use.
  317. X  It doesn't matter from 
  318. X  which machine the recipient replies, as long as his login-name is
  319. X  the same.
  320. X! .PP
  321. X! There are some special predefined commands.  Typing a control-A
  322. X! causes the message "<go ahead>" to appear on both terminals.
  323. X! Control-B toggles a beep which will accompany the message.  Control-N
  324. X! will display a list of available commands on only your screen.
  325. X! When someone is using
  326. X! .I chat
  327. X! you may find control-E (Sorry to interrupt you) and control-X
  328. X! (thats okay) useful.  When using
  329. X  .I talk
  330. X! a control-L will cause the screen to be reprinted and a control-F
  331. X! will clear your window (on both sides).  When you are finished
  332. X! conversing, a control-D can be used to display the message
  333. X! "<over and out>".
  334. X  .PP
  335. X+ Both programs use your erase, word kill, and line kill characters and
  336. X+ .I chat
  337. X+ provides for your line reprint character to work as well.
  338. X+ To exit, just type your interrupt character (usually control-C);
  339. X+ both programs will restore your terminal leaving the cursor at the
  340. X+ bottom of your screen.
  341. X+ .PP
  342. X  Permission to talk may be denied or granted by use of the
  343. X  .I mesg
  344. X  command.
  345. X! At the outset talking is allowed.  If the person you are trying
  346. X! to contact has messages off, the message "[Your party is refusing
  347. X! messages]" will be displayed.  If this person also has a file called
  348. X! .I .busy
  349. X! in his home directory, the contents of this file will be sent
  350. X! to you.  This file generally contains the reason messages were turned
  351. X! off (as an aid to good manners) and is limited to 512 characters.
  352. X  .PP
  353. X  .SH FILES
  354. X  /etc/hosts    to find the recipient's machine
  355. X  .br
  356. X! /etc/utmp        to find the recipient's tty
  357. X  .SH "SEE ALSO"
  358. X! mesg(1), who(1), rwho(1), mail(1), write(1), send(1)
  359. X! .SH "ENHANCEMENTS"
  360. X! Jeff Forys
  361. X! .RS 4
  362. X! Chat interface, Busy message, Special control codes,
  363. X! Internet address resolution.
  364. X! .RE
  365. X  .SH BUGS
  366. X  The version of 
  367. X  .IR talk (1)
  368. ________This_Is_The_END________
  369. if test `wc -l < talk.1_diffs` -ne 208; then
  370.     echo 'shar: talk.1_diffs was damaged during transit (should have been 208 bytes)'
  371. fi
  372. fi        ; : end of overwriting check
  373. echo 'x - talk_diffs'
  374. if test -f talk_diffs; then echo 'shar: not overwriting talk_diffs'; else
  375. sed 's/^X//' << '________This_Is_The_END________' > talk_diffs
  376. X*** /tmp/,RCSt1019480    Fri Aug  7 17:15:25 1987
  377. X--- Makefile    Fri Aug  7 17:07:45 1987
  378. X***************
  379. X*** 3,17 ****
  380. X  # All rights reserved.  The Berkeley software License Agreement
  381. X  # specifies the terms and conditions for redistribution.
  382. X  #
  383. X! #    @(#)Makefile    5.4 (Berkeley) 4/12/86
  384. X  #
  385. X! DESTDIR=
  386. X  OBJS=    talk.o get_names.o display.o io.o ctl.o init_disp.o \
  387. X      msgs.o get_addrs.o ctl_transact.o invite.o look_up.o
  388. X  SRCS=    talk.c get_names.c display.c io.c ctl.c init_disp.c \
  389. X      msgs.c get_addrs.c ctl_transact.c invite.c look_up.c
  390. X  INCLUDE=talk.h talk_ctl.h
  391. X- CFLAGS= -O
  392. X  
  393. X  all:    talk
  394. X  
  395. X--- 3,40 ----
  396. X  # All rights reserved.  The Berkeley software License Agreement
  397. X  # specifies the terms and conditions for redistribution.
  398. X  #
  399. X! #    @(#)Makefile    5.4.1 (Berkeley) 4/12/86
  400. X  #
  401. X! #
  402. X! 
  403. X! #    Sun Jan 11 20:08:22 MST 1987    JEF    forys@Boulder.Colorado.Edu
  404. X! #    Conditional compilations for different machines...
  405. X! #
  406. X! #    4.3 BSD
  407. X! CFLAGS=-O
  408. X! #
  409. X! #    Pyramid OSx2.5 OSx3.1
  410. X! #CFLAGS=-O -DPYRAMID
  411. X! #
  412. X! #    Pyramid OSx4.0
  413. X! #CFLAGS=-O -DPYRAMID -DBSD4_3
  414. X! #
  415. X! #    Sun 3.1, 3.0
  416. X! #CFLAGS=-O -DSUN3_1
  417. X! #
  418. X! #    Sun 3.2
  419. X! #CFLAGS=-O -DSUN3_2
  420. X! #
  421. X! #    Ultrix 1.2
  422. X! #CFLAGS=-O -DULTRIX1_2
  423. X! 
  424. X! DESTDIR=/usr/ucb
  425. X! MANDIR=/usr/man/man1
  426. X  OBJS=    talk.o get_names.o display.o io.o ctl.o init_disp.o \
  427. X      msgs.o get_addrs.o ctl_transact.o invite.o look_up.o
  428. X  SRCS=    talk.c get_names.c display.c io.c ctl.c init_disp.c \
  429. X      msgs.c get_addrs.c ctl_transact.c invite.c look_up.c
  430. X  INCLUDE=talk.h talk_ctl.h
  431. X  
  432. X  all:    talk
  433. X  
  434. X***************
  435. X*** 21,30 ****
  436. X  ${OBJS}: talk.h talk_ctl.h
  437. X  
  438. X  install: talk
  439. X!     install -g tty -m 2755 -s talk ${DESTDIR}/usr/ucb/talk
  440. X  
  441. X  clean:
  442. X!     rm -f ${OBJS} a.out errs core talk
  443. X  
  444. X  tags:    ${SRCS} ${INCLUDE}
  445. X      ctags ${SRCS} ${INCLUDE}
  446. X--- 44,57 ----
  447. X  ${OBJS}: talk.h talk_ctl.h
  448. X  
  449. X  install: talk
  450. X!     install -m 755 -s talk ${DESTDIR}/talk
  451. X!     rm -f ${DESTDIR}/chat ${MANDIR}/chat.1
  452. X!     ln ${DESTDIR}/talk ${DESTDIR}/chat
  453. X!     cp talk.1 ${MANDIR}
  454. X!     ln ${MANDIR}/talk.1 ${MANDIR}/chat.1
  455. X  
  456. X  clean:
  457. X!     rm -f ${OBJS} a.out errs core talk chat
  458. X  
  459. X  tags:    ${SRCS} ${INCLUDE}
  460. X      ctags ${SRCS} ${INCLUDE}
  461. X***************
  462. X*** 31,37 ****
  463. X  
  464. X  depend: ${SRCS}
  465. X      for i in ${SRCS}; do \
  466. X!         cc -M $$i | sed 's/\.o//' | \
  467. X          awk ' { if ($$1 != prev) \
  468. X          { if (rec != "") print rec; rec = $$0; prev = $$1; } \
  469. X          else { if (length(rec $$2) > 78) { print rec; rec = $$0; } \
  470. X--- 58,64 ----
  471. X  
  472. X  depend: ${SRCS}
  473. X      for i in ${SRCS}; do \
  474. X!         cc -M ${CFLAGS} $$i | sed 's/\.o//' | \
  475. X          awk ' { if ($$1 != prev) \
  476. X          { if (rec != "") print rec; rec = $$0; prev = $$1; } \
  477. X          else { if (length(rec $$2) > 78) { print rec; rec = $$0; } \
  478. X***************
  479. X*** 59,66 ****
  480. X  get_names: /usr/include/machine/machparam.h /usr/include/signal.h
  481. X  get_names: /usr/include/sys/types.h /usr/include/protocols/talkd.h
  482. X  get_names: /usr/include/sys/types.h /usr/include/sys/socket.h
  483. X! display: display.c ./talk.h /usr/include/curses.h /usr/include/stdio.h
  484. X! display: /usr/include/sgtty.h /usr/include/sys/ioctl.h
  485. X  display: /usr/include/sys/ttychars.h /usr/include/sys/ttydev.h
  486. X  display: /usr/include/utmp.h
  487. X  io: io.c ./talk.h /usr/include/curses.h /usr/include/stdio.h
  488. X--- 86,94 ----
  489. X  get_names: /usr/include/machine/machparam.h /usr/include/signal.h
  490. X  get_names: /usr/include/sys/types.h /usr/include/protocols/talkd.h
  491. X  get_names: /usr/include/sys/types.h /usr/include/sys/socket.h
  492. X! get_names: /usr/include/pwd.h
  493. X! display: display.c /usr/include/stdio.h ./talk.h /usr/include/curses.h
  494. X! display: /usr/include/stdio.h /usr/include/sgtty.h /usr/include/sys/ioctl.h
  495. X  display: /usr/include/sys/ttychars.h /usr/include/sys/ttydev.h
  496. X  display: /usr/include/utmp.h
  497. X  io: io.c ./talk.h /usr/include/curses.h /usr/include/stdio.h
  498. X***************
  499. X*** 76,82 ****
  500. X  init_disp: init_disp.c ./talk.h /usr/include/curses.h /usr/include/stdio.h
  501. X  init_disp: /usr/include/sgtty.h /usr/include/sys/ioctl.h
  502. X  init_disp: /usr/include/sys/ttychars.h /usr/include/sys/ttydev.h
  503. X! init_disp: /usr/include/utmp.h /usr/include/signal.h
  504. X  msgs: msgs.c /usr/include/signal.h /usr/include/stdio.h /usr/include/sys/time.h
  505. X  msgs: /usr/include/time.h ./talk.h /usr/include/curses.h /usr/include/stdio.h
  506. X  msgs: /usr/include/sgtty.h /usr/include/sys/ioctl.h /usr/include/sys/ttychars.h
  507. X--- 104,110 ----
  508. X  init_disp: init_disp.c ./talk.h /usr/include/curses.h /usr/include/stdio.h
  509. X  init_disp: /usr/include/sgtty.h /usr/include/sys/ioctl.h
  510. X  init_disp: /usr/include/sys/ttychars.h /usr/include/sys/ttydev.h
  511. X! init_disp: /usr/include/utmp.h /usr/include/signal.h /usr/include/sgtty.h
  512. X  msgs: msgs.c /usr/include/signal.h /usr/include/stdio.h /usr/include/sys/time.h
  513. X  msgs: /usr/include/time.h ./talk.h /usr/include/curses.h /usr/include/stdio.h
  514. X  msgs: /usr/include/sgtty.h /usr/include/sys/ioctl.h /usr/include/sys/ttychars.h
  515. X***************
  516. X*** 87,93 ****
  517. X  get_addrs: /usr/include/curses.h /usr/include/stdio.h /usr/include/sgtty.h
  518. X  get_addrs: /usr/include/sys/ioctl.h /usr/include/sys/ttychars.h
  519. X  get_addrs: /usr/include/sys/ttydev.h /usr/include/utmp.h /usr/include/errno.h
  520. X! get_addrs: /usr/include/netdb.h
  521. X  ctl_transact: ctl_transact.c ./talk_ctl.h /usr/include/sys/types.h
  522. X  ctl_transact: /usr/include/protocols/talkd.h /usr/include/sys/types.h
  523. X  ctl_transact: /usr/include/sys/socket.h /usr/include/netinet/in.h ./talk.h
  524. X--- 115,122 ----
  525. X  get_addrs: /usr/include/curses.h /usr/include/stdio.h /usr/include/sgtty.h
  526. X  get_addrs: /usr/include/sys/ioctl.h /usr/include/sys/ttychars.h
  527. X  get_addrs: /usr/include/sys/ttydev.h /usr/include/utmp.h /usr/include/errno.h
  528. X! get_addrs: /usr/include/sys/param.h /usr/include/machine/machparam.h
  529. X! get_addrs: /usr/include/signal.h /usr/include/sys/types.h /usr/include/netdb.h
  530. X  ctl_transact: ctl_transact.c ./talk_ctl.h /usr/include/sys/types.h
  531. X  ctl_transact: /usr/include/protocols/talkd.h /usr/include/sys/types.h
  532. X  ctl_transact: /usr/include/sys/socket.h /usr/include/netinet/in.h ./talk.h
  533. X*** /tmp/,RCSt1019480    Fri Aug  7 17:15:29 1987
  534. X--- ctl_transact.c    Fri Aug  7 17:08:25 1987
  535. X***************
  536. X*** 18,28 ****
  537. X   * not recieved an acknowledgement within a reasonable amount
  538. X   * of time
  539. X   */
  540. X! ctl_transact(target, msg, type, rp)
  541. X      struct in_addr target;
  542. X      CTL_MSG msg;
  543. X      int type;
  544. X      CTL_RESPONSE *rp;
  545. X  {
  546. X      int read_mask, ctl_mask, nready, cc;
  547. X      struct timeval wait;
  548. X--- 18,29 ----
  549. X   * not recieved an acknowledgement within a reasonable amount
  550. X   * of time
  551. X   */
  552. X! ctl_transact(target, msg, type, rp, busy)
  553. X      struct in_addr target;
  554. X      CTL_MSG msg;
  555. X      int type;
  556. X      CTL_RESPONSE *rp;
  557. X+     CTL_BUSY *busy;
  558. X  {
  559. X      int read_mask, ctl_mask, nready, cc;
  560. X      struct timeval wait;
  561. X***************
  562. X*** 68,73 ****
  563. X--- 69,88 ----
  564. X                      continue;
  565. X                  p_error("Error on read from talk daemon");
  566. X              }
  567. X+ 
  568. X+             read_mask = ctl_mask;
  569. X+             if (rp->answer == PERMISSION_DENIED &&
  570. X+                 select(32, &read_mask, 0, 0, &wait)) {
  571. X+ 
  572. X+                 /*
  573. X+                  * Read in what we hope is a `.busy' message.
  574. X+                  * Check later to make sure it's not junk.
  575. X+                  */
  576. X+ 
  577. X+                 (void) recv(ctl_sockt, (char *) busy,
  578. X+                         sizeof (*busy), 0);
  579. X+             }
  580. X+ 
  581. X              read_mask = ctl_mask;
  582. X              /* an immediate poll */
  583. X              timerclear(&wait);
  584. X*** /tmp/,RCSt1019480    Fri Aug  7 17:15:33 1987
  585. X--- display.c    Fri Aug  7 17:08:31 1987
  586. X***************
  587. X*** 12,24 ****
  588. X--- 12,45 ----
  589. X   * The window 'manager', initializes curses and handles the actual
  590. X   * displaying of text
  591. X   */
  592. X+ 
  593. X+ #include <stdio.h>
  594. X  #include "talk.h"
  595. X  
  596. X+ /*
  597. X+  * This local version contains some extra control codes:
  598. X+  *    ^N    Display menu
  599. X+  *    ^F    Clear window
  600. X+  *    ^B    Toggle beep
  601. X+  *    ^A    display <go ahead>\n
  602. X+  *    ^E    display <sorry to interrupt you>\n
  603. X+  *    ^X    display <thats ok>\n
  604. X+  *    ^D    display <over and out>\n
  605. X+  */
  606. X+ 
  607. X+ static char *cc_goahead = "<go ahead>";
  608. X+ static char *cc_beepon  = "<beep on>";
  609. X+ static char *cc_beepoff = "<beep off>";
  610. X+ static char *cc_sorry   = "<sorry to interrupt you>";
  611. X+ static char *cc_thatsok = "<thats okay>";
  612. X+ static char *cc_overout    = "<over and out>";
  613. X+ 
  614. X  xwin_t    my_win;
  615. X  xwin_t    his_win;
  616. X  WINDOW    *line_win;
  617. X  
  618. X  int    curses_initialized = 0;
  619. X+ int    beep = 0;
  620. X  
  621. X  /*
  622. X   * max HAS to be a function, it is called with
  623. X***************
  624. X*** 35,41 ****
  625. X   * Display some text on somebody's window, processing some control
  626. X   * characters while we are at it.
  627. X   */
  628. X! display(win, text, size)
  629. X      register xwin_t *win;
  630. X      register char *text;
  631. X      int size;
  632. X--- 56,62 ----
  633. X   * Display some text on somebody's window, processing some control
  634. X   * characters while we are at it.
  635. X   */
  636. X! talk_display(win, text, size)
  637. X      register xwin_t *win;
  638. X      register char *text;
  639. X      int size;
  640. X***************
  641. X*** 43,52 ****
  642. X      register int i;
  643. X      char cch;
  644. X  
  645. X!     for (i = 0; i < size; i++) {
  646. X          if (*text == '\n') {
  647. X              xscroll(win, 0);
  648. X-             text++;
  649. X              continue;
  650. X          }
  651. X          /* erase character */
  652. X--- 64,72 ----
  653. X      register int i;
  654. X      char cch;
  655. X  
  656. X!     for (i = 0; i < size; i++, text++) {
  657. X          if (*text == '\n') {
  658. X              xscroll(win, 0);
  659. X              continue;
  660. X          }
  661. X          /* erase character */
  662. X***************
  663. X*** 56,62 ****
  664. X              waddch(win->x_win, ' ');
  665. X              wmove(win->x_win, win->x_line, win->x_col);
  666. X              getyx(win->x_win, win->x_line, win->x_col);
  667. X-             text++;
  668. X              continue;
  669. X          }
  670. X          /*
  671. X--- 76,81 ----
  672. X***************
  673. X*** 93,105 ****
  674. X              wmove(win->x_win, win->x_line, 0);
  675. X              wclrtoeol(win->x_win);
  676. X              getyx(win->x_win, win->x_line, win->x_col);
  677. X-             text++;
  678. X              continue;
  679. X          }
  680. X          if (*text == '\f') {
  681. X              if (win == &my_win)
  682. X                  wrefresh(curscr);
  683. X-             text++;
  684. X              continue;
  685. X          }
  686. X          if (win->x_col == COLS-1) {
  687. X--- 112,123 ----
  688. X              wmove(win->x_win, win->x_line, 0);
  689. X              wclrtoeol(win->x_win);
  690. X              getyx(win->x_win, win->x_line, win->x_col);
  691. X              continue;
  692. X          }
  693. X+         /* clear screen */
  694. X          if (*text == '\f') {
  695. X              if (win == &my_win)
  696. X                  wrefresh(curscr);
  697. X              continue;
  698. X          }
  699. X          if (win->x_col == COLS-1) {
  700. X***************
  701. X*** 106,112 ****
  702. X              /* check for wraparound */
  703. X              xscroll(win, 0);
  704. X          }
  705. X!         if (*text < ' ' && *text != '\t') {
  706. X              waddch(win->x_win, '^');
  707. X              getyx(win->x_win, win->x_line, win->x_col);
  708. X              if (win->x_col == COLS-1) /* check for wraparound */
  709. X--- 124,188 ----
  710. X              /* check for wraparound */
  711. X              xscroll(win, 0);
  712. X          }
  713. X! 
  714. X!         switch(*text) {        /* Expand special control codes */
  715. X!             case '\001':
  716. X!                 if (win->x_col) xscroll(win,0);
  717. X!                 waddstr(win->x_win,cc_goahead);
  718. X!                 if (beep) putchar('\007');
  719. X!                 xscroll(win,0);
  720. X!                 continue;
  721. X!             case '\002':
  722. X!                 beep = !beep;
  723. X!                 if (win->x_col) xscroll(win,0);
  724. X!                 waddstr(win->x_win,beep?cc_beepon:cc_beepoff);
  725. X!                 xscroll(win,0);
  726. X!                 continue;
  727. X!             case '\004':
  728. X!                 if (win->x_col) xscroll(win,0);
  729. X!                 waddstr(win->x_win,cc_overout);
  730. X!                 xscroll(win,0);
  731. X!                 continue;
  732. X!             case '\005':
  733. X!                 if (win->x_col) xscroll(win,0);
  734. X!                 waddstr(win->x_win,cc_sorry);
  735. X!                 xscroll(win,0);
  736. X!                 continue;
  737. X!             case '\006':
  738. X!                 wclear(win->x_win);
  739. X!                 xscroll(win,-1);
  740. X!                 continue;
  741. X!             case '\030':
  742. X!                 if (win->x_col) xscroll(win,0);
  743. X!                 waddstr(win->x_win,cc_thatsok);
  744. X!                 xscroll(win,0);
  745. X!                 continue;
  746. X!             case '\016':
  747. X!                 wclear(win->x_win);
  748. X!                 xscroll(win,-1);
  749. X!                 waddstr(win->x_win,"\n^A\t\"<go ahead>\"");
  750. X!                 xscroll(win,0);
  751. X!                 waddstr(win->x_win,"^D\t\"<over and out>\"");
  752. X!                 xscroll(win,0);
  753. X!                 waddstr(win->x_win,"^E\t\"<sorry to interrupt you>\"");
  754. X!                 xscroll(win,0);
  755. X!                 waddstr(win->x_win,"^X\t\"<thats ok>\"");
  756. X!                 xscroll(win,0);
  757. X!                 waddstr(win->x_win,"^F\tClear your window");
  758. X!                 xscroll(win,0);
  759. X!                 waddstr(win->x_win,"^B\tToggle beep");
  760. X!                 xscroll(win,0);
  761. X!                 waddstr(win->x_win,"^C\tQuit talk");
  762. X!                 xscroll(win,0);
  763. X!                 waddstr(win->x_win,"^N\tThis menu");
  764. X!                 xscroll(win,0);
  765. X!                 xscroll(win,0); 
  766. X!                 continue;
  767. X!         };
  768. X! 
  769. X!         if (*text == '\007' && beep)    /* just send out the beep */
  770. X!             putchar(*text);
  771. X!         else if (*text < ' ' && *text != '\t') {
  772. X              waddch(win->x_win, '^');
  773. X              getyx(win->x_win, win->x_line, win->x_col);
  774. X              if (win->x_col == COLS-1) /* check for wraparound */
  775. X***************
  776. X*** 116,122 ****
  777. X          } else
  778. X              waddch(win->x_win, *text);
  779. X          getyx(win->x_win, win->x_line, win->x_col);
  780. X-         text++;
  781. X      }
  782. X      wrefresh(win->x_win);
  783. X  }
  784. X--- 192,197 ----
  785. X***************
  786. X*** 145,151 ****
  787. X      register xwin_t *win;
  788. X      int flag;
  789. X  {
  790. X- 
  791. X      if (flag == -1) {
  792. X          wmove(win->x_win, 0, 0);
  793. X          win->x_line = 0;
  794. X--- 220,225 ----
  795. X***************
  796. X*** 159,162 ****
  797. X--- 233,365 ----
  798. X      wmove(win->x_win, (win->x_line + 1) % win->x_nlines, win->x_col);
  799. X      wclrtoeol(win->x_win);
  800. X      wmove(win->x_win, win->x_line, win->x_col);
  801. X+ }
  802. X+ 
  803. X+ chat_display(win, text, size)    /* Display chars using the 'chat' interface */
  804. X+ register xwin_t *win;
  805. X+ register char *text;
  806. X+ int size;
  807. X+ {
  808. X+     register int i, j, c;
  809. X+ 
  810. X+     for (i=0; i<size; i++, text++) {
  811. X+ 
  812. X+     c = *text;
  813. X+ 
  814. X+     if (c == win->cerase && win->column) {    /* Character erase */
  815. X+         printf("\b \b");
  816. X+         win->column--;
  817. X+     } else if (c == win->werase) {        /* Word erase */
  818. X+         while (win->column && win->chatline[win->column-1]==' ') {
  819. X+             putchar('\b');
  820. X+             win->column--;
  821. X+         }
  822. X+         while (win->column && win->chatline[win->column-1]!=' ') {
  823. X+             printf("\b \b");
  824. X+             win->column--;
  825. X+         }
  826. X+     } else if (c == win->kill) {        /* Line erase */
  827. X+         while (win->column) {
  828. X+             printf("\b \b");
  829. X+             win->column--;
  830. X+         }
  831. X+     } else if (c == win->redraw) {        /* Line redraw */
  832. X+         if (c < ' ') {
  833. X+             putchar('^');
  834. X+             putchar(c+64);
  835. X+         } else if (c < 0177)
  836. X+             putchar(c);
  837. X+         printf("\r\n");
  838. X+         for(j=0; j<win->column; j++)
  839. X+             putchar(win->chatline[j]);
  840. X+     } else if (c == '\t') {            /* Tab display and expansion */
  841. X+         putchar('\t');
  842. X+         for (j=0; j<8-win->column%8 && win->column<CHAT_SIZ; j++)
  843. X+             win->chatline[win->column+j] = ' ';
  844. X+         win->column += j;
  845. X+     } else                    
  846. X+         switch(c) {        /* Expand special control codes */
  847. X+             case '\001':
  848. X+                 printf("%s%s%c\r\n", win->column? "\r\n": "",
  849. X+                     cc_goahead, beep? '\007': '\0');
  850. X+                 win->column = 0;
  851. X+                 break;
  852. X+             case '\002':
  853. X+                 beep = !beep;
  854. X+                 printf("%s%s\r\n", win->column? "\r\n": "",
  855. X+                     beep? cc_beepon: cc_beepoff);
  856. X+                 break;
  857. X+             case '\030':
  858. X+                 printf("%s%s\r\n", win->column? "\r\n": "",
  859. X+                     cc_thatsok);
  860. X+                 win->column = 0;
  861. X+                 break;
  862. X+             case '\004':
  863. X+                 printf("%s%s\r\n", win->column? "\r\n": "",
  864. X+                     cc_overout);
  865. X+                 win->column = 0;
  866. X+                 break;
  867. X+             case '\005':
  868. X+                 printf("%s%s\r\n", win->column? "\r\n": "",
  869. X+                     cc_sorry);
  870. X+                 win->column = 0;
  871. X+                 break;
  872. X+             case '\006':
  873. X+                 win->column = 0;
  874. X+                 break;
  875. X+             case '\016':
  876. X+                 if (win->column)
  877. X+                     printf("\r\n");
  878. X+                 printf("\r\n^A\t\"<go ahead>\"\r\n");
  879. X+                 printf("^D\t\"<over and out>\"\r\n");
  880. X+                 printf("^E\t\"<sorry to interrupt you>\"\r\n");
  881. X+                 printf("^X\t\"<thats okay>\"\r\n");
  882. X+                 printf("^F\tClear your window\r\n");
  883. X+                 printf("^B\tToggle beep\r\n");
  884. X+                 printf("^C\tQuit chat\r\n");
  885. X+                 printf("^N\tThis menu\r\n\r\n");
  886. X+                 break;
  887. X+             case '\n':
  888. X+                 printf("\r\n");
  889. X+                 win->column = 0;
  890. X+                 break;
  891. X+             case '\007':
  892. X+                 if (beep) {
  893. X+                     putchar(c);
  894. X+                     break;
  895. X+                 }
  896. X+             default:    /* Just a character -- display it */
  897. X+                 /* Display control chars like "cat -v" does */
  898. X+ 
  899. X+                 if (c > 0177) {        /* A meta character! */
  900. X+                     sendchar('M', win);
  901. X+                     sendchar('-', win);
  902. X+                     c &= 0177;    /* zero the high bit */
  903. X+                 }
  904. X+                 if (c < ' ' || c == 0177) {    /* ctrl char */
  905. X+                     if (c=='\007' && beep)    /* a beep */
  906. X+                         putchar(c);
  907. X+                     else {        /* Display '^' first */
  908. X+                         sendchar('^', win);
  909. X+                         if (c == 0177)
  910. X+                             c = '?';
  911. X+                         else
  912. X+                             c += 64;
  913. X+                     }
  914. X+                 }
  915. X+                 sendchar(c, win);    /* Display character */
  916. X+         }
  917. X+ 
  918. X+         (void) fflush(stdout);    /* One character at-a-time display */
  919. X+     }
  920. X+ }
  921. X+ 
  922. X+ sendchar(c, win)    /* Display char to tty and add it to users' line */
  923. X+ char c;
  924. X+ register xwin_t *win;
  925. X+ {
  926. X+     putchar(c);
  927. X+ 
  928. X+     if (win->column < CHAT_SIZ-1)    /* save char in users' line buffer */
  929. X+         win->chatline[win->column++] = c;
  930. X  }
  931. X*** /tmp/,RCSt1019480    Fri Aug  7 17:15:37 1987
  932. X--- get_addrs.c    Fri Aug  7 17:08:34 1987
  933. X***************
  934. X*** 9,14 ****
  935. X--- 9,15 ----
  936. X  #endif not lint
  937. X  
  938. X  #include "talk_ctl.h"
  939. X+ #include <sys/param.h>
  940. X  #include <netdb.h>
  941. X  
  942. X  get_addrs(my_machine_name, his_machine_name)
  943. X***************
  944. X*** 21,30 ****
  945. X      /* look up the address of the local host */
  946. X      hp = gethostbyname(my_machine_name);
  947. X      if (hp == (struct hostent *) 0) {
  948. X!         fprintf(stderr,
  949. X!             "talk: %s: Can't figure out network address.\n",
  950. X!             my_machine_name);
  951. X!         exit(-1);
  952. X      }
  953. X      bcopy(hp->h_addr, (char *)&my_machine_addr, hp->h_length);
  954. X      /*
  955. X--- 22,52 ----
  956. X      /* look up the address of the local host */
  957. X      hp = gethostbyname(my_machine_name);
  958. X      if (hp == (struct hostent *) 0) {
  959. X!         static struct hostent my_def;
  960. X!         static struct in_addr my_defaddr;
  961. X! #ifdef BSD4_3
  962. X!         static char *my_alist[1];
  963. X! #endif
  964. X!         static char my_namebuf[128];
  965. X!         int inet_addr();
  966. X! 
  967. X!         my_defaddr.s_addr = inet_addr(my_machine_name);
  968. X!         if (my_defaddr.s_addr == -1) {
  969. X!             fprintf(stderr,
  970. X!                 "talk: %s: Can't figure out network address.\n",
  971. X!                 my_machine_name);
  972. X!             exit(-1);
  973. X!         }
  974. X!         strcpy(my_namebuf, my_machine_name);
  975. X!         my_def.h_name = my_namebuf;
  976. X! #ifdef BSD4_3
  977. X!         my_def.h_addr_list = my_alist,
  978. X! #endif
  979. X!         my_def.h_addr = (char *)&my_defaddr;
  980. X!         my_def.h_length = sizeof (struct in_addr);
  981. X!         my_def.h_addrtype = AF_INET;
  982. X!         my_def.h_aliases = 0;
  983. X!         hp = &my_def;
  984. X      }
  985. X      bcopy(hp->h_addr, (char *)&my_machine_addr, hp->h_length);
  986. X      /*
  987. X***************
  988. X*** 34,43 ****
  989. X      if (strcmp(his_machine_name, my_machine_name)) {
  990. X          hp = gethostbyname(his_machine_name);
  991. X          if (hp == (struct hostent *) 0 ) {
  992. X!             fprintf(stderr,
  993. X!                 "talk: %s: Can't figure out network address.\n",
  994. X!                 his_machine_name);
  995. X!             exit(-1);
  996. X          }
  997. X          bcopy(hp->h_addr, (char *) &his_machine_addr, hp->h_length);
  998. X      } else
  999. X--- 56,86 ----
  1000. X      if (strcmp(his_machine_name, my_machine_name)) {
  1001. X          hp = gethostbyname(his_machine_name);
  1002. X          if (hp == (struct hostent *) 0 ) {
  1003. X!             static struct hostent his_def;
  1004. X!             static struct in_addr his_defaddr;
  1005. X! #ifdef BSD4_3
  1006. X!             static char *his_alist[1];
  1007. X! #endif
  1008. X!             static char his_namebuf[128];
  1009. X!             int inet_addr();
  1010. X! 
  1011. X!             his_defaddr.s_addr = inet_addr(his_machine_name);
  1012. X!             if (his_defaddr.s_addr == -1) {
  1013. X!                 fprintf(stderr,
  1014. X!                     "talk: %s: Can't figure out network address.\n",
  1015. X!                     his_machine_name);
  1016. X!                 exit(-1);
  1017. X!             }
  1018. X!             strcpy(his_namebuf, his_machine_name);
  1019. X!             his_def.h_name = his_namebuf;
  1020. X! #ifdef BSD4_3
  1021. X!             his_def.h_addr_list = his_alist,
  1022. X! #endif
  1023. X!             his_def.h_addr = (char *)&his_defaddr;
  1024. X!             his_def.h_length = sizeof (struct in_addr);
  1025. X!             his_def.h_addrtype = AF_INET;
  1026. X!             his_def.h_aliases = 0;
  1027. X!             hp = &his_def;
  1028. X          }
  1029. X          bcopy(hp->h_addr, (char *) &his_machine_addr, hp->h_length);
  1030. X      } else
  1031. X*** /tmp/,RCSt1019480    Fri Aug  7 17:15:41 1987
  1032. X--- get_names.c    Fri Aug  7 17:08:38 1987
  1033. X***************
  1034. X*** 11,17 ****
  1035. X--- 11,23 ----
  1036. X  #include "talk.h"
  1037. X  #include <sys/param.h>
  1038. X  #include <protocols/talkd.h>
  1039. X+ #include <pwd.h>
  1040. X  
  1041. X+ #if PYRAMID
  1042. X+ #define    htonl(x)    (x)
  1043. X+ #define    htons(x)    (x)
  1044. X+ #endif
  1045. X+ 
  1046. X  char    *getlogin();
  1047. X  char    *ttyname();
  1048. X  char    *rindex();
  1049. X***************
  1050. X*** 28,38 ****
  1051. X      char hostname[MAXHOSTNAMELEN];
  1052. X      char *his_name, *my_name;
  1053. X      char *my_machine_name, *his_machine_name;
  1054. X!     char *my_tty, *his_tty;
  1055. X      register char *cp;
  1056. X  
  1057. X      if (argc < 2 ) {
  1058. X!         printf("Usage: talk user [ttyname]\n");
  1059. X          exit(-1);
  1060. X      }
  1061. X      if (!isatty(0)) {
  1062. X--- 34,52 ----
  1063. X      char hostname[MAXHOSTNAMELEN];
  1064. X      char *his_name, *my_name;
  1065. X      char *my_machine_name, *his_machine_name;
  1066. X!     char *his_tty;
  1067. X      register char *cp;
  1068. X+     struct passwd *pw, *getpwuid();
  1069. X  
  1070. X+     argv[0] = (cp = rindex(argv[0],'/')) ? ++cp : *argv;    /* strip path */
  1071. X+ 
  1072. X+     if (!strcmp(argv[0], "talk"))        /* use the `talk' interface */
  1073. X+         my_interfac = I_TALK;
  1074. X+     else if (!strcmp(argv[0], "chat"))    /* use the `chat' interface */
  1075. X+         my_interfac = I_CHAT;
  1076. X+ 
  1077. X      if (argc < 2 ) {
  1078. X!         printf("Usage: %s user [ttyname]\n", argv[0]);
  1079. X          exit(-1);
  1080. X      }
  1081. X      if (!isatty(0)) {
  1082. X***************
  1083. X*** 41,52 ****
  1084. X      }
  1085. X      my_name = getlogin();
  1086. X      if (my_name == NULL) {
  1087. X!         printf("You don't exist. Go away.\n");
  1088. X!         exit(-1);
  1089. X      }
  1090. X      gethostname(hostname, sizeof (hostname));
  1091. X      my_machine_name = hostname;
  1092. X-     my_tty = rindex(ttyname(0), '/') + 1;
  1093. X      /* check for, and strip out, the machine name of the target */
  1094. X      for (cp = argv[1]; *cp && !any(*cp, "@:!."); cp++)
  1095. X          ;
  1096. X--- 55,68 ----
  1097. X      }
  1098. X      my_name = getlogin();
  1099. X      if (my_name == NULL) {
  1100. X!         if ((pw=getpwuid(getuid())) == NULL) {
  1101. X!             printf("You don't exist. Go away.\n");
  1102. X!             exit(-1);
  1103. X!         }
  1104. X!         my_name = pw->pw_name;
  1105. X      }
  1106. X      gethostname(hostname, sizeof (hostname));
  1107. X      my_machine_name = hostname;
  1108. X      /* check for, and strip out, the machine name of the target */
  1109. X      for (cp = argv[1]; *cp && !any(*cp, "@:!."); cp++)
  1110. X          ;
  1111. X*** /tmp/,RCSt1019480    Fri Aug  7 17:15:45 1987
  1112. X--- init_disp.c    Fri Aug  7 17:08:41 1987
  1113. X***************
  1114. X*** 15,21 ****
  1115. X--- 15,29 ----
  1116. X  
  1117. X  #include "talk.h"
  1118. X  #include <signal.h>
  1119. X+ #include <sgtty.h>
  1120. X  
  1121. X+ #if (SUN3_1 | PYRAMID | ULTRIX1_2)
  1122. X+ #define sigmask(m)    (1 << ((m)-1))
  1123. X+ #endif
  1124. X+ 
  1125. X+ static struct sgttyb old_t, new_t;
  1126. X+ int onstop();
  1127. X+ 
  1128. X  /* 
  1129. X   * Set up curses, catch the appropriate signals,
  1130. X   * and build the various windows.
  1131. X***************
  1132. X*** 25,58 ****
  1133. X      void sig_sent();
  1134. X      struct sigvec sigv;
  1135. X  
  1136. X!     initscr();
  1137. X      (void) sigvec(SIGTSTP, (struct sigvec *)0, &sigv);
  1138. X      sigv.sv_mask |= sigmask(SIGALRM);
  1139. X      (void) sigvec(SIGTSTP, &sigv, (struct sigvec *)0);
  1140. X-     curses_initialized = 1;
  1141. X-     clear();
  1142. X-     refresh();
  1143. X-     noecho();
  1144. X-     crmode();
  1145. X      signal(SIGINT, sig_sent);
  1146. X      signal(SIGPIPE, sig_sent);
  1147. X      /* curses takes care of ^Z */
  1148. X-     my_win.x_nlines = LINES / 2;
  1149. X-     my_win.x_ncols = COLS;
  1150. X-     my_win.x_win = newwin(my_win.x_nlines, my_win.x_ncols, 0, 0);
  1151. X-     scrollok(my_win.x_win, FALSE);
  1152. X-     wclear(my_win.x_win);
  1153. X  
  1154. X!     his_win.x_nlines = LINES / 2 - 1;
  1155. X!     his_win.x_ncols = COLS;
  1156. X!     his_win.x_win = newwin(his_win.x_nlines, his_win.x_ncols,
  1157. X!         my_win.x_nlines+1, 0);
  1158. X!     scrollok(his_win.x_win, FALSE);
  1159. X!     wclear(his_win.x_win);
  1160. X  
  1161. X!     line_win = newwin(1, COLS, my_win.x_nlines, 0);
  1162. X!     box(line_win, '-', '-');
  1163. X!     wrefresh(line_win);
  1164. X      /* let them know we are working on it */
  1165. X      current_state = "No connection yet";
  1166. X  }
  1167. X--- 33,80 ----
  1168. X      void sig_sent();
  1169. X      struct sigvec sigv;
  1170. X  
  1171. X!      ioctl(0, TIOCGETP, &old_t);    /* save old tty settings */
  1172. X! 
  1173. X!     if (my_interfac == I_TALK) {    /* do some window junk */
  1174. X!         initscr();
  1175. X!         curses_initialized = 1;
  1176. X!         clear();
  1177. X!         refresh();
  1178. X!         noecho();
  1179. X!         crmode();
  1180. X!     }
  1181. X! 
  1182. X      (void) sigvec(SIGTSTP, (struct sigvec *)0, &sigv);
  1183. X      sigv.sv_mask |= sigmask(SIGALRM);
  1184. X      (void) sigvec(SIGTSTP, &sigv, (struct sigvec *)0);
  1185. X      signal(SIGINT, sig_sent);
  1186. X      signal(SIGPIPE, sig_sent);
  1187. X      /* curses takes care of ^Z */
  1188. X  
  1189. X!     if (my_interfac == I_TALK) {    /* do more window junk */
  1190. X!         my_win.x_nlines = LINES / 2;
  1191. X!         my_win.x_ncols = COLS;
  1192. X!         my_win.x_win = newwin(my_win.x_nlines, my_win.x_ncols, 0, 0);
  1193. X!         scrollok(my_win.x_win, FALSE);
  1194. X  
  1195. X!         his_win.x_nlines = LINES / 2 - 1;
  1196. X!         his_win.x_ncols = COLS;
  1197. X!         his_win.x_win = newwin(his_win.x_nlines, his_win.x_ncols,
  1198. X!             my_win.x_nlines+1, 0);
  1199. X!         scrollok(his_win.x_win, FALSE);
  1200. X!         wclear(his_win.x_win);
  1201. X! 
  1202. X!         line_win = newwin(1, COLS, my_win.x_nlines, 0);
  1203. X!         box(line_win, '-', '-');
  1204. X!         wrefresh(line_win);
  1205. X!      } else if (my_interfac == I_CHAT) {    /* change tty for 'chat' */
  1206. X!          signal(SIGTSTP, onstop);    /* catch TSTP to reset tty */
  1207. X!          new_t = old_t;
  1208. X!          new_t.sg_flags &= ~ECHO;    /* turn off echo */
  1209. X!          new_t.sg_flags |= CBREAK;    /* get chars when typed */
  1210. X!          ioctl(0, TIOCSETP, &new_t);    /* make new tty settings */
  1211. X!      }
  1212. X! 
  1213. X      /* let them know we are working on it */
  1214. X      current_state = "No connection yet";
  1215. X  }
  1216. X***************
  1217. X*** 73,78 ****
  1218. X--- 95,104 ----
  1219. X      ioctl(0, TIOCGLTC, (struct sgttyb *)<c);
  1220. X      my_win.cerase = tty.sg_erase;
  1221. X      my_win.kill = tty.sg_kill;
  1222. X+     if (ltc.t_rprntc == (char) -1)
  1223. X+         my_win.redraw = '\022';  /* control R */
  1224. X+     else
  1225. X+         my_win.redraw = ltc.t_rprntc;
  1226. X      if (ltc.t_werasc == (char) -1)
  1227. X          my_win.werase = '\027';     /* control W */
  1228. X      else
  1229. X***************
  1230. X*** 89,100 ****
  1231. X      his_win.cerase = buf[0];
  1232. X      his_win.kill = buf[1];
  1233. X      his_win.werase = buf[2];
  1234. X  }
  1235. X  
  1236. X  void
  1237. X  sig_sent()
  1238. X  {
  1239. X- 
  1240. X      message("Connection closing. Exiting");
  1241. X      quit();
  1242. X  }
  1243. X--- 115,127 ----
  1244. X      his_win.cerase = buf[0];
  1245. X      his_win.kill = buf[1];
  1246. X      his_win.werase = buf[2];
  1247. X+     his_win.redraw = '\0';
  1248. X+     my_win.column = his_win.column = 0;
  1249. X  }
  1250. X  
  1251. X  void
  1252. X  sig_sent()
  1253. X  {
  1254. X      message("Connection closing. Exiting");
  1255. X      quit();
  1256. X  }
  1257. X***************
  1258. X*** 105,117 ****
  1259. X  quit()
  1260. X  {
  1261. X  
  1262. X!     if (curses_initialized) {
  1263. X          wmove(his_win.x_win, his_win.x_nlines-1, 0);
  1264. X          wclrtoeol(his_win.x_win);
  1265. X          wrefresh(his_win.x_win);
  1266. X          endwin();
  1267. X      }
  1268. X      if (invitation_waiting)
  1269. X          send_delete();
  1270. X      exit(0);
  1271. X  }
  1272. X--- 132,178 ----
  1273. X  quit()
  1274. X  {
  1275. X  
  1276. X!     if (curses_initialized && my_interfac == I_TALK) {
  1277. X          wmove(his_win.x_win, his_win.x_nlines-1, 0);
  1278. X          wclrtoeol(his_win.x_win);
  1279. X          wrefresh(his_win.x_win);
  1280. X          endwin();
  1281. X      }
  1282. X+ #ifdef NOFLUSH
  1283. X+     else if (my_interfac == I_CHAT) {
  1284. X+         ioctl(2, TIOCSETP, &old_t);
  1285. X+     }
  1286. X+ #endif
  1287. X+ 
  1288. X      if (invitation_waiting)
  1289. X          send_delete();
  1290. X+ 
  1291. X+     /*
  1292. X+      * The ioctl below is ONLY required for the `chat' inteface, however
  1293. X+      * it is used here to flush the input buffer.  If you dont want the
  1294. X+      * input buffer flushed when exiting `talk', define NOFLUSH...
  1295. X+      */
  1296. X+ 
  1297. X+ #ifndef NOFLUSH
  1298. X+     ioctl(2, TIOCSETP, &old_t);
  1299. X+ #endif
  1300. X      exit(0);
  1301. X+ }
  1302. X+ 
  1303. X+ #define    BIT(_a)        (1<<((_a)-1))
  1304. X+ 
  1305. X+ onstop()    /* when using `chat' trap to here on a SIGTSTP to restore tty */
  1306. X+ {
  1307. X+     int signo = SIGTSTP;
  1308. X+ 
  1309. X+     ioctl(0, TIOCSETP, &old_t);    /* restore tty to origional settings */
  1310. X+     signal(SIGTSTP, SIG_DFL);
  1311. X+     (void) sigsetmask(sigblock(0) & ~BIT(signo));
  1312. X+     (void) kill(getpid(), SIGTSTP);
  1313. X+ 
  1314. X+     /* Wait until we are started up again */
  1315. X+ 
  1316. X+     signal(SIGTSTP, onstop);    /* put the trap back */
  1317. X+     (void) sigsetmask(sigblock(0) | BIT(signo));
  1318. X+     ioctl(0, TIOCSETP, &new_t);    /* change the tty for 'chat' again */
  1319. X  }
  1320. X*** /tmp/,RCSt1019480    Fri Aug  7 17:15:50 1987
  1321. X--- invite.c    Fri Aug  7 17:08:45 1987
  1322. X***************
  1323. X*** 13,18 ****
  1324. X--- 13,23 ----
  1325. X  #include <signal.h>
  1326. X  #include <setjmp.h>
  1327. X  
  1328. X+ #if PYRAMID
  1329. X+ #define    htonl(x)    (x)
  1330. X+ #define    htons(x)    (x)
  1331. X+ #endif
  1332. X+ 
  1333. X  /*
  1334. X   * There wasn't an invitation waiting, so send a request containing
  1335. X   * our sockt address to the remote talk daemon so it can invite
  1336. X***************
  1337. X*** 31,39 ****
  1338. X  
  1339. X  invite_remote()
  1340. X  {
  1341. X!     int nfd, read_mask, template, new_sockt;
  1342. X      struct itimerval itimer;
  1343. X      CTL_RESPONSE response;
  1344. X  
  1345. X      itimer.it_value.tv_sec = RING_WAIT;
  1346. X      itimer.it_value.tv_usec = 0;
  1347. X--- 36,45 ----
  1348. X  
  1349. X  invite_remote()
  1350. X  {
  1351. X!     int new_sockt;
  1352. X      struct itimerval itimer;
  1353. X      CTL_RESPONSE response;
  1354. X+     CTL_BUSY busy;
  1355. X  
  1356. X      itimer.it_value.tv_sec = RING_WAIT;
  1357. X      itimer.it_value.tv_usec = 0;
  1358. X***************
  1359. X*** 70,78 ****
  1360. X      start_msgs();
  1361. X  
  1362. X      msg.id_num = htonl(local_id);
  1363. X!     ctl_transact(my_machine_addr, msg, DELETE, &response);
  1364. X      msg.id_num = htonl(remote_id);
  1365. X!     ctl_transact(his_machine_addr, msg, DELETE, &response);
  1366. X      invitation_waiting = 0;
  1367. X  }
  1368. X  
  1369. X--- 76,84 ----
  1370. X      start_msgs();
  1371. X  
  1372. X      msg.id_num = htonl(local_id);
  1373. X!     ctl_transact(my_machine_addr, msg, DELETE, &response, &busy);
  1374. X      msg.id_num = htonl(remote_id);
  1375. X!     ctl_transact(his_machine_addr, msg, DELETE, &response, &busy);
  1376. X      invitation_waiting = 0;
  1377. X  }
  1378. X  
  1379. X***************
  1380. X*** 109,125 ****
  1381. X  announce_invite()
  1382. X  {
  1383. X      CTL_RESPONSE response;
  1384. X  
  1385. X      current_state = "Trying to connect to your party's talk daemon";
  1386. X!     ctl_transact(his_machine_addr, msg, ANNOUNCE, &response);
  1387. X      remote_id = response.id_num;
  1388. X      if (response.answer != SUCCESS) {
  1389. X          if (response.answer < NANSWERS)
  1390. X              message(answers[response.answer]);
  1391. X          quit();
  1392. X      }
  1393. X      /* leave the actual invitation on my talk daemon */
  1394. X!     ctl_transact(my_machine_addr, msg, LEAVE_INVITE, &response);
  1395. X      local_id = response.id_num;
  1396. X  }
  1397. X  
  1398. X--- 116,143 ----
  1399. X  announce_invite()
  1400. X  {
  1401. X      CTL_RESPONSE response;
  1402. X+     CTL_BUSY busy;
  1403. X+     int valid();
  1404. X  
  1405. X      current_state = "Trying to connect to your party's talk daemon";
  1406. X!     ctl_transact(his_machine_addr, msg, ANNOUNCE, &response, &busy);
  1407. X      remote_id = response.id_num;
  1408. X      if (response.answer != SUCCESS) {
  1409. X          if (response.answer < NANSWERS)
  1410. X              message(answers[response.answer]);
  1411. X+         if (response.answer == PERMISSION_DENIED && valid(&busy)) {
  1412. X+             if (my_interfac == I_TALK)
  1413. X+                 talk_display(&his_win, busy.busy, strlen(busy.busy));
  1414. X+             else if (my_interfac == I_CHAT) {
  1415. X+                 putchar('\n');
  1416. X+                 chat_display(&his_win, busy.busy, strlen(busy.busy));
  1417. X+                 putchar('\n');
  1418. X+             }
  1419. X+         }
  1420. X          quit();
  1421. X      }
  1422. X      /* leave the actual invitation on my talk daemon */
  1423. X!     ctl_transact(my_machine_addr, msg, LEAVE_INVITE, &response, &busy);
  1424. X      local_id = response.id_num;
  1425. X  }
  1426. X  
  1427. X***************
  1428. X*** 144,147 ****
  1429. X--- 162,177 ----
  1430. X      if (sendto(ctl_sockt, &msg, sizeof (msg), 0, &daemon_addr,
  1431. X          sizeof (daemon_addr)) != sizeof (msg))
  1432. X          perror("send_delete (local)");
  1433. X+ }
  1434. X+ 
  1435. X+ int valid(busy)        /* see if checksum is correct */
  1436. X+ CTL_BUSY *busy;
  1437. X+ {
  1438. X+     long total = 0;
  1439. X+     register char *s;
  1440. X+ 
  1441. X+     for (s=busy->busy; *s; s++)
  1442. X+         total += (long) *s;
  1443. X+ 
  1444. X+     return(total==ntohl(busy->chksum));
  1445. X  }
  1446. X*** /tmp/,RCSt1019480    Fri Aug  7 17:15:57 1987
  1447. X--- io.c    Fri Aug  7 17:08:48 1987
  1448. X***************
  1449. X*** 23,39 ****
  1450. X  #define STDIN_MASK (1<<fileno(stdin))    /* the bit mask for standard
  1451. X                         input */
  1452. X  extern int errno;
  1453. X- 
  1454. X  /*
  1455. X   * The routine to do the actual talking
  1456. X   */
  1457. X  talk()
  1458. X  {
  1459. X!     register int read_template, sockt_mask;
  1460. X      int read_set, nb;
  1461. X      char buf[BUFSIZ];
  1462. X      struct timeval wait;
  1463. X  
  1464. X      message("Connection established\007\007\007");
  1465. X      current_line = 0;
  1466. X      sockt_mask = (1<<sockt);
  1467. X--- 23,42 ----
  1468. X  #define STDIN_MASK (1<<fileno(stdin))    /* the bit mask for standard
  1469. X                         input */
  1470. X  extern int errno;
  1471. X  /*
  1472. X   * The routine to do the actual talking
  1473. X   */
  1474. X  talk()
  1475. X  {
  1476. X!     register int read_template, sockt_mask, i, j;
  1477. X      int read_set, nb;
  1478. X      char buf[BUFSIZ];
  1479. X      struct timeval wait;
  1480. X+     static char *chat_mesg = "[I am using the 'chat' interface]\n";
  1481. X  
  1482. X+     if (my_interfac != I_CHAT)
  1483. X+         *chat_mesg = '\0';
  1484. X+ 
  1485. X      message("Connection established\007\007\007");
  1486. X      current_line = 0;
  1487. X      sockt_mask = (1<<sockt);
  1488. X***************
  1489. X*** 63,70 ****
  1490. X              if (nb <= 0) {
  1491. X                  message("Connection closed. Exiting");
  1492. X                  quit();
  1493. X              }
  1494. X-             display(&his_win, buf, nb);
  1495. X          }
  1496. X          if (read_set & STDIN_MASK) {
  1497. X              /*
  1498. X--- 66,84 ----
  1499. X              if (nb <= 0) {
  1500. X                  message("Connection closed. Exiting");
  1501. X                  quit();
  1502. X+             } else {    /* Don't accept ^B and ^N */
  1503. X+                 for (i=j=0; i<nb; i++) {
  1504. X+                     if (buf[i]=='\002' || buf[i]=='\016')
  1505. X+                         continue;
  1506. X+                     buf[j++] = buf[i];
  1507. X+                 }
  1508. X+                 if (j) {    /* use the correct interface */
  1509. X+                     if (my_interfac == I_TALK)
  1510. X+                         talk_display(&his_win, buf, j);
  1511. X+                     else if (my_interfac == I_CHAT)
  1512. X+                         chat_display(&his_win, buf, j);
  1513. X+                 }
  1514. X              }
  1515. X          }
  1516. X          if (read_set & STDIN_MASK) {
  1517. X              /*
  1518. X***************
  1519. X*** 73,79 ****
  1520. X               */
  1521. X              ioctl(0, FIONREAD, (struct sgttyb *) &nb);
  1522. X              nb = read(0, buf, nb);
  1523. X!             display(&my_win, buf, nb);
  1524. X              /* might lose data here because sockt is non-blocking */
  1525. X              write(sockt, buf, nb);
  1526. X          }
  1527. X--- 87,113 ----
  1528. X               */
  1529. X              ioctl(0, FIONREAD, (struct sgttyb *) &nb);
  1530. X              nb = read(0, buf, nb);
  1531. X! 
  1532. X!             if (my_interfac == I_TALK)
  1533. X!                 talk_display(&my_win, buf, nb);
  1534. X!             else if (my_interfac == I_CHAT) {
  1535. X!                 for (i=0; i<nb; i++)    /* strip high bit */
  1536. X!                     buf[i] &= 0177;
  1537. X!                 chat_display(&my_win, buf, nb);
  1538. X! 
  1539. X!                 /* Do not send the redraw, it looks stupid */
  1540. X!                 for (i=j=0; i<nb; i++) {
  1541. X!                     if (buf[i] != my_win.redraw)
  1542. X!                         buf[j++] = buf[i];
  1543. X!                 }
  1544. X!                 nb = j;
  1545. X!             }
  1546. X! 
  1547. X!             if (*chat_mesg) {   /* inform them we are using chat */
  1548. X!                 write(sockt, chat_mesg, strlen(chat_mesg));
  1549. X!                 *chat_mesg = '\0';
  1550. X!             }
  1551. X! 
  1552. X              /* might lose data here because sockt is non-blocking */
  1553. X              write(sockt, buf, nb);
  1554. X          }
  1555. X***************
  1556. X*** 96,107 ****
  1557. X      sys = "Unknown error";
  1558. X      if (errno < sys_nerr)
  1559. X          sys = sys_errlist[errno];
  1560. X!     wmove(my_win.x_win, current_line%my_win.x_nlines, 0);
  1561. X!     wprintw(my_win.x_win, "[%s : %s (%d)]\n", string, sys, errno);
  1562. X!     wrefresh(my_win.x_win);
  1563. X!     move(LINES-1, 0);
  1564. X!     refresh();
  1565. X!     quit();
  1566. X  }
  1567. X  
  1568. X  /*
  1569. X--- 130,145 ----
  1570. X      sys = "Unknown error";
  1571. X      if (errno < sys_nerr)
  1572. X          sys = sys_errlist[errno];
  1573. X! 
  1574. X!     if (my_interfac == I_TALK) {
  1575. X!         wmove(my_win.x_win, current_line%my_win.x_nlines, 0);
  1576. X!         wprintw(my_win.x_win, "[%s : %s (%d)]\n", string, sys, errno);
  1577. X!         wrefresh(my_win.x_win);
  1578. X!         move(LINES-1, 0);
  1579. X!         refresh();
  1580. X!         quit();
  1581. X!     } else if (my_interfac == I_CHAT)
  1582. X!         printf("[%s : %s (%d)]\r\n", string, sys, errno);
  1583. X  }
  1584. X  
  1585. X  /*
  1586. X***************
  1587. X*** 111,117 ****
  1588. X      char *string;
  1589. X  {
  1590. X  
  1591. X!     wmove(my_win.x_win, current_line%my_win.x_nlines, 0);
  1592. X!     wprintw(my_win.x_win, "[%s]\n", string);
  1593. X!     wrefresh(my_win.x_win);
  1594. X  }
  1595. X--- 149,158 ----
  1596. X      char *string;
  1597. X  {
  1598. X  
  1599. X!     if (my_interfac == I_TALK) {
  1600. X!         wmove(my_win.x_win, current_line%my_win.x_nlines, 0);
  1601. X!         wprintw(my_win.x_win, "[%s]\n", string);
  1602. X!         wrefresh(my_win.x_win);
  1603. X!     } else if (my_interfac == I_CHAT)
  1604. X!         printf("[%s]\r\n", string);
  1605. X  }
  1606. X*** /tmp/,RCSt1019480    Fri Aug  7 17:16:01 1987
  1607. X--- look_up.c    Fri Aug  7 17:08:51 1987
  1608. X***************
  1609. X*** 10,15 ****
  1610. X--- 10,20 ----
  1611. X  
  1612. X  #include "talk_ctl.h"
  1613. X  
  1614. X+ #if PYRAMID
  1615. X+ #define    htonl(x)    (x)
  1616. X+ #define    htons(x)    (x)
  1617. X+ #endif
  1618. X+ 
  1619. X  /*
  1620. X   * See if the local daemon has an invitation for us.
  1621. X   */
  1622. X***************
  1623. X*** 17,28 ****
  1624. X  {
  1625. X      CTL_RESPONSE response;
  1626. X      register CTL_RESPONSE *rp = &response;
  1627. X  
  1628. X      /* the rest of msg was set up in get_names */
  1629. X      msg.ctl_addr = *(struct sockaddr *)&ctl_addr;
  1630. X      msg.ctl_addr.sa_family = htons(msg.ctl_addr.sa_family);
  1631. X      /* must be initiating a talk */
  1632. X!     if (!look_for_invite(rp))
  1633. X          return (0);
  1634. X      /*
  1635. X       * There was an invitation waiting for us, 
  1636. X--- 22,34 ----
  1637. X  {
  1638. X      CTL_RESPONSE response;
  1639. X      register CTL_RESPONSE *rp = &response;
  1640. X+     CTL_BUSY busy;
  1641. X  
  1642. X      /* the rest of msg was set up in get_names */
  1643. X      msg.ctl_addr = *(struct sockaddr *)&ctl_addr;
  1644. X      msg.ctl_addr.sa_family = htons(msg.ctl_addr.sa_family);
  1645. X      /* must be initiating a talk */
  1646. X!     if (!look_for_invite(rp, &busy))
  1647. X          return (0);
  1648. X      /*
  1649. X       * There was an invitation waiting for us, 
  1650. X***************
  1651. X*** 43,49 ****
  1652. X           * invitation. (We know there are no newer invitations,
  1653. X           * the talkd works LIFO.)
  1654. X           */
  1655. X!         ctl_transact(his_machine_addr, msg, DELETE, rp);
  1656. X          close(sockt);
  1657. X          open_sockt();
  1658. X          return (0);
  1659. X--- 49,55 ----
  1660. X           * invitation. (We know there are no newer invitations,
  1661. X           * the talkd works LIFO.)
  1662. X           */
  1663. X!         ctl_transact(his_machine_addr, msg, DELETE, rp, &busy);
  1664. X          close(sockt);
  1665. X          open_sockt();
  1666. X          return (0);
  1667. X***************
  1668. X*** 55,67 ****
  1669. X  /*
  1670. X   * Look for an invitation on 'machine'
  1671. X   */
  1672. X! look_for_invite(rp)
  1673. X      CTL_RESPONSE *rp;
  1674. X  {
  1675. X      struct in_addr machine_addr;
  1676. X  
  1677. X      current_state = "Checking for invitation on caller's machine";
  1678. X!     ctl_transact(his_machine_addr, msg, LOOK_UP, rp);
  1679. X      /* the switch is for later options, such as multiple invitations */
  1680. X      switch (rp->answer) {
  1681. X  
  1682. X--- 61,74 ----
  1683. X  /*
  1684. X   * Look for an invitation on 'machine'
  1685. X   */
  1686. X! look_for_invite(rp, busy)
  1687. X      CTL_RESPONSE *rp;
  1688. X+     CTL_BUSY *busy;
  1689. X  {
  1690. X      struct in_addr machine_addr;
  1691. X  
  1692. X      current_state = "Checking for invitation on caller's machine";
  1693. X!     ctl_transact(his_machine_addr, msg, LOOK_UP, rp, busy);
  1694. X      /* the switch is for later options, such as multiple invitations */
  1695. X      switch (rp->answer) {
  1696. X  
  1697. X*** /tmp/,RCSt1019480    Fri Aug  7 17:16:05 1987
  1698. X--- msgs.c    Fri Aug  7 17:08:54 1987
  1699. X***************
  1700. X*** 40,46 ****
  1701. X      message(current_state);
  1702. X      signal(SIGALRM, disp_msg);
  1703. X      itimer.it_value = itimer.it_interval = wait;
  1704. X!     setitimer(ITIMER_REAL, &itimer, (struct timerval *)0);
  1705. X  }
  1706. X  
  1707. X  end_msgs()
  1708. X--- 40,46 ----
  1709. X      message(current_state);
  1710. X      signal(SIGALRM, disp_msg);
  1711. X      itimer.it_value = itimer.it_interval = wait;
  1712. X!     setitimer(ITIMER_REAL, &itimer, (struct itimerval *)0);
  1713. X  }
  1714. X  
  1715. X  end_msgs()
  1716. X***************
  1717. X*** 49,53 ****
  1718. X      signal(SIGALRM, SIG_IGN);
  1719. X      timerclear(&itimer.it_value);
  1720. X      timerclear(&itimer.it_interval);
  1721. X!     setitimer(ITIMER_REAL, &itimer, (struct timerval *)0);
  1722. X  }
  1723. X--- 49,53 ----
  1724. X      signal(SIGALRM, SIG_IGN);
  1725. X      timerclear(&itimer.it_value);
  1726. X      timerclear(&itimer.it_interval);
  1727. X!     setitimer(ITIMER_REAL, &itimer, (struct itimerval *)0);
  1728. X  }
  1729. X*** /tmp/,RCSt1019480    Fri Aug  7 17:16:08 1987
  1730. X--- talk.c    Fri Aug  7 17:08:56 1987
  1731. X***************
  1732. X*** 16,21 ****
  1733. X--- 16,23 ----
  1734. X  
  1735. X  #include "talk.h"
  1736. X  
  1737. X+ char my_interfac;    /* set appropriately to I_CHAT or I_TALK */
  1738. X+ 
  1739. X  /*
  1740. X   * talk:    A visual form of write. Using sockets, a two way 
  1741. X   *        connection is set up between the two people talking. 
  1742. X***************
  1743. X*** 28,33 ****
  1744. X--- 30,48 ----
  1745. X   *        Modified to run under 4.1a by Clem Cole and Peter Moore
  1746. X   *        Modified to run between hosts by Peter Moore, 8/19/82
  1747. X   *        Modified to run under 4.1c by Peter Moore 3/17/83
  1748. X+  *
  1749. X+  *    8/11/85        JEF    decvax!sunybcs!forys
  1750. X+  *        - Introduced 'chat' interface, 'busy' file and some extra
  1751. X+  *          control codes.
  1752. X+  *    11/10/86    JEF    decvax!sunybcs!forys
  1753. X+  *        - Ported above changes to 4.3Final.
  1754. X+  *
  1755. X+  *    1/11/87        JEF    forys@boulder.Colorado.EDU
  1756. X+  *        - Added ifdef's for compilation on a variety of machines.
  1757. X+  *        - Added one more control code, cleaned my stuff up.
  1758. X+  *
  1759. X+  *    7/21/87        JEF    forys@boulder.Colorado.EDU
  1760. X+  *        - Internet address resolution and 2 more bug fixes.
  1761. X   */
  1762. X  
  1763. X  main(argc, argv)
  1764. X*** /tmp/,RCSt1019480    Fri Aug  7 17:16:11 1987
  1765. X--- talk.h    Fri Aug  7 17:08:59 1987
  1766. X***************
  1767. X*** 11,18 ****
  1768. X--- 11,26 ----
  1769. X  
  1770. X  #define forever        for(;;)
  1771. X  
  1772. X+ #if (SUN3_1 | SUN3_2 | PYRAMID | ULTRIX1_2)
  1773. X+ #define    MAXHOSTNAMELEN    64
  1774. X+ #endif
  1775. X+ 
  1776. X  #define BUF_SIZE    512
  1777. X+ #define CHAT_SIZ    256
  1778. X  
  1779. X+ #define I_TALK    0
  1780. X+ #define I_CHAT    1
  1781. X+ 
  1782. X  FILE    *popen();
  1783. X  int    quit();
  1784. X  int    sleeper();
  1785. X***************
  1786. X*** 33,40 ****
  1787. X--- 41,53 ----
  1788. X      char    kill;
  1789. X      char    cerase;
  1790. X      char    werase;
  1791. X+     char    redraw;
  1792. X+     char    chatline[CHAT_SIZ];
  1793. X+     int    column;
  1794. X  } xwin_t;
  1795. X  
  1796. X  extern    xwin_t my_win;
  1797. X  extern    xwin_t his_win;
  1798. X  extern    WINDOW *line_win;
  1799. X+ 
  1800. X+ extern char my_interfac;
  1801. ________This_Is_The_END________
  1802. if test `wc -l < talk_diffs` -ne 1425; then
  1803.     echo 'shar: talk_diffs was damaged during transit (should have been 1425 bytes)'
  1804. fi
  1805. fi        ; : end of overwriting check
  1806. echo 'x - talkd.h_diffs'
  1807. if test -f talkd.h_diffs; then echo 'shar: not overwriting talkd.h_diffs'; else
  1808. sed 's/^X//' << '________This_Is_The_END________' > talkd.h_diffs
  1809. X*** /tmp/,RCSt1020126    Fri Aug  7 17:48:21 1987
  1810. X--- talkd.h    Fri Aug  7 17:47:51 1987
  1811. X***************
  1812. X*** 57,62 ****
  1813. X--- 57,73 ----
  1814. X      struct    sockaddr addr;    /* address for establishing conversation */
  1815. X  } CTL_RESPONSE;
  1816. X  
  1817. X+ /*
  1818. X+  * One packet of this type might be sent following PERMISSION_DENIED.
  1819. X+  */
  1820. X+ typedef struct {
  1821. X+     long chksum;
  1822. X+ #define BUSYSIZE    512
  1823. X+     char busy[BUSYSIZE];
  1824. X+ } CTL_BUSY;
  1825. X+ 
  1826. X+ #define    BUSYFLNM    ".busy"
  1827. X+ 
  1828. X  #define    TALK_VERSION    1        /* protocol version */
  1829. X  
  1830. X  /* message type values */
  1831. ________This_Is_The_END________
  1832. if test `wc -l < talkd.h_diffs` -ne 22; then
  1833.     echo 'shar: talkd.h_diffs was damaged during transit (should have been 22 bytes)'
  1834. fi
  1835. fi        ; : end of overwriting check
  1836. exit 0
  1837.