home *** CD-ROM | disk | FTP | other *** search
/ Source Code 1994 March / Source_Code_CD-ROM_Walnut_Creek_March_1994.iso / compsrcs / games / volume15 / robothnt / part04 < prev    next >
Encoding:
Internet Message Format  |  1993-01-26  |  16.5 KB

  1. Path: uunet!news.tek.com!master!saab!billr
  2. From: billr@saab.CNA.TEK.COM (Bill Randle)
  3. Newsgroups: comp.sources.games
  4. Subject: v15i035:  robot_hunt - original hunt with a robot, Part04/04
  5. Message-ID: <4191@master.CNA.TEK.COM>
  6. Date: 14 Jan 93 03:14:35 GMT
  7. Sender: news@master.CNA.TEK.COM
  8. Lines: 598
  9. Approved: billr@saab.CNA.TEK.COM
  10. Xref: uunet comp.sources.games:1534
  11.  
  12. Submitted-by: whatis@ucsd.edu (Steve Boswell)
  13. Posting-number: Volume 15, Issue 35
  14. Archive-name: robot_hunt/Part04
  15. Environment: Curses, Sockets
  16.  
  17.  
  18. #! /bin/sh
  19. # This is a shell archive.  Remove anything before this line, then unpack
  20. # it by saving it into a file and typing "sh file".  To overwrite existing
  21. # files, type "sh file -c".  You can also feed this as standard input via
  22. # unshar, or by typing "sh <file", e.g..  If this archive is complete, you
  23. # will see the following message at the end:
  24. #        "End of archive 4 (of 4)."
  25. # Contents:  Makefile connect.c makemaze.c pathname.c terminal.c
  26. # Wrapped by billr@saab on Wed Jan 13 19:04:32 1993
  27. PATH=/bin:/usr/bin:/usr/ucb ; export PATH
  28. if test -f 'Makefile' -a "${1}" != "-c" ; then 
  29.   echo shar: Will not clobber existing file \"'Makefile'\"
  30. else
  31. echo shar: Extracting \"'Makefile'\" \(3332 characters\)
  32. sed "s/^X//" >'Makefile' <<'END_OF_FILE'
  33. X#
  34. X# Copyright (c) 1985 Regents of the University of California.
  35. X# All rights reserved.
  36. X#
  37. X# Redistribution and use in source and binary forms are permitted
  38. X# provided that the above copyright notice and this paragraph are
  39. X# duplicated in all such forms and that any documentation,
  40. X# advertising materials, and other materials related to such
  41. X# distribution and use acknowledge that the software was developed
  42. X# by the University of California, Berkeley.  The name of the
  43. X# University may not be used to endorse or promote products derived
  44. X# from this software without specific prior written permission.
  45. X# THIS SOFTWARE IS PROVIDED ``AS IS'' AND WITHOUT ANY EXPRESS OR
  46. X# IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED
  47. X# WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR A PARTICULAR PURPOSE.
  48. X#
  49. X#    @(#)Makefile    5.7 (Berkeley) 9/23/88
  50. X#
  51. X#  Hunt
  52. X#  Copyright (c) 1985 Conrad C. Huang, Gregory S. Couch, Kenneth C.R.C. Arnold
  53. X#  San Francisco, California
  54. X#
  55. X
  56. XHDR=    hunt.h
  57. XDSRC=    answer.c driver.c draw.c execute.c expl.c makemaze.c shots.c \
  58. X    terminal.c extern.c pathname.c
  59. XDOBJ=    answer.o driver.o draw.o execute.o expl.o makemaze.o shots.o \
  60. X    terminal.o extern.o
  61. XPSRC=    hunt.c connect.c playit.c pathname.c robot.c
  62. XPOBJ=    hunt.o connect.o playit.o robot.o
  63. XMAN=    hunt.0
  64. X
  65. X# Flags are:
  66. X#    DEBUG    Don't trust everything in the code
  67. X#    INTERNET    Use the Internet domain IPC instead of UNIX domain
  68. X#    BROADCAST    Use internet broadcasting code when looking for driver
  69. X#    OLDIPC        Use 4.1a internet system calls (must also define
  70. X#            INTERNET but not BROADCAST)
  71. X#    RANDOM    Include doors which disperse shots randomly
  72. X#    REFLECT    Include diagonal walls that reflect shots
  73. X#    MONITOR    Include code for watching the game from the sidelines
  74. X#    OOZE    Include slime shots
  75. X#    FLY    Make people fly when walls regenerate under them
  76. X#    START_FLYING    Players enter flying (FLY must also be defined)
  77. X#    VOLCANO    Include occasional large slime explosions
  78. X#    ROBOT    Allow "-r" to turn on a hunt robot.
  79. X#    DAEMON    Run as a daemon.  ROBOT must be on, too.
  80. X#
  81. X# NOTE: if you change the domain (INTERNET vs UNIX) then "make newdomain"
  82. X#
  83. XDEFS=    -DBROADCAST -DRANDOM -DREFLECT -DMONITOR -DINTERNET \
  84. X    -DOOZE -DFLY -DROBOT -DDAEMON
  85. XCFLAGS=    -g ${DEFS}
  86. X
  87. Xall: hunt hunt.driver
  88. X
  89. Xhunt: ${POBJ} pathname.o
  90. X    ${CC} -o $@ ${POBJ} pathname.o -lcurses -ltermlib
  91. X
  92. Xhunt.driver: ${DOBJ} pathname.o
  93. X    ${CC} -o $@ ${DOBJ} pathname.o
  94. X
  95. Xdebug: hunt.dbg hunt.driver.dbg
  96. X
  97. Xhunt.dbg: ${POBJ} pathname.dbg.o
  98. X    ${CC} -o $@ ${POBJ} pathname.dbg.o -lcurses -ltermlib
  99. X
  100. Xhunt.driver.dbg: ${DOBJ} pathname.dbg.o
  101. X    ${CC} -o $@ ${DOBJ} pathname.dbg.o
  102. X
  103. Xpathname.dbg.o: pathname.c
  104. X    @echo ${CC} ${CFLAGS} -DDEBUG -c pathname.c -o pathname.dbg.o
  105. X    @rm -f x.c
  106. X    @ln pathname.c x.c
  107. X    @${CC} ${CFLAGS} -DDEBUG -c x.c
  108. X    @mv x.o pathname.dbg.o
  109. X    @rm -f x.c
  110. X
  111. Xinstall: ${MAN}
  112. X    install -s -o games -g bin -m 700 hunt.driver ${DESTDIR}/usr/games/lib/hunt.driver
  113. X    install -s -o games -g bin -m 700 hunt ${DESTDIR}/usr/games/hide
  114. X    install -c -o bin -g bin -m 444 ${MAN} ${DESTDIR}/usr/man/cat6
  115. X    (cd ${DESTDIR}/usr/games; rm -f hunt; ln -s dm hunt; chown games.bin hunt)
  116. X
  117. Xlint: ${DSRC} ${PSRC}
  118. X    lint -chapbx ${DEFS} ${DSRC}
  119. X    lint -chapbx ${DEFS} ${PSRC} -lcurses
  120. X
  121. Xtags: ${DSRC} ${PSRC}
  122. X    ctags ${DSRC} ${PSRC}
  123. X
  124. Xclean:
  125. X    rm -f hunt hunt.driver *.o tags core tmp debug_file
  126. X
  127. Xcleandir: clean
  128. X    rm -f ${MAN} tags .depend
  129. X
  130. Xdepend:
  131. X    mkdep ${DSRC} ${PSRC}
  132. END_OF_FILE
  133. if test 3332 -ne `wc -c <'Makefile'`; then
  134.     echo shar: \"'Makefile'\" unpacked with wrong size!
  135. fi
  136. # end of 'Makefile'
  137. fi
  138. if test -f 'connect.c' -a "${1}" != "-c" ; then 
  139.   echo shar: Will not clobber existing file \"'connect.c'\"
  140. else
  141. echo shar: Extracting \"'connect.c'\" \(1493 characters\)
  142. sed "s/^X//" >'connect.c' <<'END_OF_FILE'
  143. X/*
  144. X * Copyright (c) 1985 Regents of the University of California.
  145. X * All rights reserved.
  146. X *
  147. X * Redistribution and use in source and binary forms are permitted
  148. X * provided that the above copyright notice and this paragraph are
  149. X * duplicated in all such forms and that any documentation,
  150. X * advertising materials, and other materials related to such
  151. X * distribution and use acknowledge that the software was developed
  152. X * by the University of California, Berkeley.  The name of the
  153. X * University may not be used to endorse or promote products derived
  154. X * from this software without specific prior written permission.
  155. X * THIS SOFTWARE IS PROVIDED ``AS IS'' AND WITHOUT ANY EXPRESS OR
  156. X * IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED
  157. X * WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR A PARTICULAR PURPOSE.
  158. X */
  159. X
  160. X#ifndef lint
  161. Xstatic char sccsid[] = "@(#)connect.c    5.2 (Berkeley) 6/27/88";
  162. X#endif /* not lint */
  163. X
  164. X/*
  165. X *  Hunt
  166. X *  Copyright (c) 1985 Conrad C. Huang, Gregory S. Couch, Kenneth C.R.C. Arnold
  167. X *  San Francisco, California
  168. X */
  169. X
  170. X# include    "hunt.h"
  171. X# include    <signal.h>
  172. X
  173. Xdo_connect(name)
  174. Xchar    *name;
  175. X{
  176. X    static long    uid;
  177. X    extern char    *ttyname();
  178. X
  179. X    uid = htonl(getuid());
  180. X    (void) write(Socket, (char *) &uid, sizeof uid);
  181. X    (void) write(Socket, name, NAMELEN);
  182. X    (void) strcpy(Buf, (isatty (fileno (stderr)))
  183. X        ? ttyname(fileno(stderr)) : "");
  184. X    (void) write(Socket, Buf, NAMELEN);
  185. X# ifdef MONITOR
  186. X    (void) write(Socket, (char *) &Am_monitor, sizeof Am_monitor);
  187. X# endif MONITOR
  188. X}
  189. END_OF_FILE
  190. if test 1493 -ne `wc -c <'connect.c'`; then
  191.     echo shar: \"'connect.c'\" unpacked with wrong size!
  192. fi
  193. # end of 'connect.c'
  194. fi
  195. if test -f 'makemaze.c' -a "${1}" != "-c" ; then 
  196.   echo shar: Will not clobber existing file \"'makemaze.c'\"
  197. else
  198. echo shar: Extracting \"'makemaze.c'\" \(3700 characters\)
  199. sed "s/^X//" >'makemaze.c' <<'END_OF_FILE'
  200. X/*
  201. X * Copyright (c) 1985 Regents of the University of California.
  202. X * All rights reserved.
  203. X *
  204. X * Redistribution and use in source and binary forms are permitted
  205. X * provided that the above copyright notice and this paragraph are
  206. X * duplicated in all such forms and that any documentation,
  207. X * advertising materials, and other materials related to such
  208. X * distribution and use acknowledge that the software was developed
  209. X * by the University of California, Berkeley.  The name of the
  210. X * University may not be used to endorse or promote products derived
  211. X * from this software without specific prior written permission.
  212. X * THIS SOFTWARE IS PROVIDED ``AS IS'' AND WITHOUT ANY EXPRESS OR
  213. X * IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED
  214. X * WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR A PARTICULAR PURPOSE.
  215. X */
  216. X
  217. X#ifndef lint
  218. Xstatic char sccsid[] = "@(#)makemaze.c    5.2 (Berkeley) 6/27/88";
  219. X#endif /* not lint */
  220. X
  221. X/*
  222. X *  Hunt
  223. X *  Copyright (c) 1985 Conrad C. Huang, Gregory S. Couch, Kenneth C.R.C. Arnold
  224. X *  San Francisco, California
  225. X */
  226. X
  227. X# include    "hunt.h"
  228. X
  229. X# define    ISCLEAR(y,x)    (Maze[y][x] == SPACE)
  230. X# define    ODD(n)        ((n) & 01)
  231. X
  232. Xmakemaze()
  233. X{
  234. X    register char    *sp;
  235. X    register int    y, x;
  236. X
  237. X    /*
  238. X     * fill maze with walls
  239. X     */
  240. X    sp = &Maze[0][0];
  241. X    while (sp < &Maze[HEIGHT - 1][WIDTH])
  242. X        *sp++ = DOOR;
  243. X
  244. X    y = rand_num(DBOUND - UBOUND) + UBOUND;
  245. X    x = rand_num(RBOUND - LBOUND) + LBOUND;
  246. X    dig(y, x);                /* Dig out the maze */
  247. X    remap();
  248. X}
  249. X
  250. X# define    NPERM    24
  251. X# define    NDIR    4
  252. X
  253. Xint    dirs[NPERM][NDIR] = {
  254. X        {0,1,2,3},    {3,0,1,2},    {0,2,3,1},    {0,3,2,1},
  255. X        {1,0,2,3},    {2,3,0,1},    {0,2,1,3},    {2,3,1,0},
  256. X        {1,0,3,2},    {1,2,0,3},    {3,1,2,0},    {2,0,3,1},
  257. X        {1,3,0,2},    {0,3,1,2},    {1,3,2,0},    {2,0,1,3},
  258. X        {0,1,3,2},    {3,1,0,2},    {2,1,0,3},    {1,2,3,0},
  259. X        {2,1,3,0},    {3,0,2,1},    {3,2,0,1},    {3,2,1,0}
  260. X    };
  261. X
  262. Xint    incr[NDIR][2] = {
  263. X        {0, 1}, {1, 0}, {0, -1}, {-1, 0}
  264. X    };
  265. X
  266. Xdig(y, x)
  267. Xint    y, x;
  268. X{
  269. X    register int    *dp;
  270. X    register int    *ip;
  271. X    register int    ny, nx;
  272. X    register int    *endp;
  273. X
  274. X    Maze[y][x] = SPACE;            /* Clear this spot */
  275. X    dp = dirs[rand_num(NPERM)];
  276. X    endp = &dp[NDIR];
  277. X    while (dp < endp) {
  278. X        ip = &incr[*dp++][0];
  279. X        ny = y + *ip++;
  280. X        nx = x + *ip;
  281. X        if (candig(ny, nx))
  282. X            dig(ny, nx);
  283. X    }
  284. X}
  285. X
  286. X/*
  287. X * candig:
  288. X *    Is it legal to clear this spot?
  289. X */
  290. Xcandig(y, x)
  291. Xregister int    y, x;
  292. X{
  293. X    register int    i;
  294. X
  295. X    if (ODD(x) && ODD(y))
  296. X        return FALSE;        /* can't touch ODD spots */
  297. X
  298. X    if (y < UBOUND || y >= DBOUND)
  299. X        return FALSE;        /* Beyond vertical bounds, NO */
  300. X    if (x < LBOUND || x >= RBOUND)
  301. X        return FALSE;        /* Beyond horizontal bounds, NO */
  302. X
  303. X    if (ISCLEAR(y, x))
  304. X        return FALSE;        /* Already clear, NO */
  305. X
  306. X    i = ISCLEAR(y, x + 1);
  307. X    i += ISCLEAR(y, x - 1);
  308. X    if (i > 1)
  309. X        return FALSE;        /* Introduces cycle, NO */
  310. X    i += ISCLEAR(y + 1, x);
  311. X    if (i > 1)
  312. X        return FALSE;        /* Introduces cycle, NO */
  313. X    i += ISCLEAR(y - 1, x);
  314. X    if (i > 1)
  315. X        return FALSE;        /* Introduces cycle, NO */
  316. X
  317. X    return TRUE;            /* OK */
  318. X}
  319. X
  320. Xremap()
  321. X{
  322. X    register int    y, x;
  323. X    register char    *sp;
  324. X    register int    stat;
  325. X
  326. X    for (y = 0; y < HEIGHT; y++)
  327. X        for (x = 0; x < WIDTH; x++) {
  328. X            sp = &Maze[y][x];
  329. X            if (*sp == SPACE)
  330. X                continue;
  331. X            stat = 0;
  332. X            if (y - 1 >= 0 && Maze[y - 1][x] != SPACE)
  333. X                stat |= NORTH;
  334. X            if (y + 1 < HEIGHT && Maze[y + 1][x] != SPACE)
  335. X                stat |= SOUTH;
  336. X            if (x + 1 < WIDTH && Maze[y][x + 1] != SPACE)
  337. X                stat |= EAST;
  338. X            if (x - 1 >= 0 && Maze[y][x - 1] != SPACE)
  339. X                stat |= WEST;
  340. X            switch (stat) {
  341. X              case WEST | EAST:
  342. X                *sp = WALL1;
  343. X                break;
  344. X              case NORTH | SOUTH:
  345. X                *sp = WALL2;
  346. X                break;
  347. X              case 0:
  348. X# ifdef RANDOM
  349. X                *sp = DOOR;
  350. X# endif RANDOM
  351. X# ifdef REFLECT
  352. X                *sp = rand_num(2) ? WALL4 : WALL5;
  353. X# endif REFLECT
  354. X                break;
  355. X              default:
  356. X                *sp = WALL3;
  357. X                break;
  358. X            }
  359. X        }
  360. X    bcopy((char *) Maze, (char *) Orig_maze, sizeof Maze);
  361. X}
  362. END_OF_FILE
  363. if test 3700 -ne `wc -c <'makemaze.c'`; then
  364.     echo shar: \"'makemaze.c'\" unpacked with wrong size!
  365. fi
  366. # end of 'makemaze.c'
  367. fi
  368. if test -f 'pathname.c' -a "${1}" != "-c" ; then 
  369.   echo shar: Will not clobber existing file \"'pathname.c'\"
  370. else
  371. echo shar: Extracting \"'pathname.c'\" \(1992 characters\)
  372. sed "s/^X//" >'pathname.c' <<'END_OF_FILE'
  373. X/*
  374. X * Copyright (c) 1985 Regents of the University of California.
  375. X * All rights reserved.
  376. X *
  377. X * Redistribution and use in source and binary forms are permitted
  378. X * provided that the above copyright notice and this paragraph are
  379. X * duplicated in all such forms and that any documentation,
  380. X * advertising materials, and other materials related to such
  381. X * distribution and use acknowledge that the software was developed
  382. X * by the University of California, Berkeley.  The name of the
  383. X * University may not be used to endorse or promote products derived
  384. X * from this software without specific prior written permission.
  385. X * THIS SOFTWARE IS PROVIDED ``AS IS'' AND WITHOUT ANY EXPRESS OR
  386. X * IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED
  387. X * WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR A PARTICULAR PURPOSE.
  388. X */
  389. X
  390. X#ifndef lint
  391. Xstatic char sccsid[] = "@(#)pathname.c    5.2 (Berkeley) 6/27/88";
  392. X#endif /* not lint */
  393. X
  394. X/*
  395. X *  Hunt
  396. X *  Copyright (c) 1985 Conrad C. Huang, Gregory S. Couch, Kenneth C.R.C. Arnold
  397. X *  San Francisco, California
  398. X */
  399. X
  400. X/*
  401. X * There is no particular significance to the numbers assigned
  402. X * to Test_port and Sock_port.  They're just random numbers greater
  403. X * than then range reserved for privileged sockets.
  404. X */
  405. X
  406. X# ifdef DEBUG
  407. X
  408. Xchar    *Driver =    "/va/conrad/games/src/hunt/hunt.driver.dbg";
  409. X# ifdef INTERNET
  410. Xint    Test_port =    ('h' << 8) | 't';
  411. Xint    Sock_port =    ('h' << 8) | 's';
  412. X# else INTERNET
  413. Xchar    *Sock_name =    "/tmp/hunt";
  414. X# endif INTERNET
  415. X
  416. X# else DEBUG
  417. X
  418. Xchar    *Driver =    "/a/beowulf/home/beowulf/class/cse264c/cse264ce/Hunt/hunt.driver";
  419. X# ifdef INTERNET
  420. Xint    Test_port =    ('h' << 8) | 't';
  421. Xint    Sock_port =    ('h' << 8) | 's';
  422. X# else INTERNET
  423. Xchar    *Sock_name =    "/tmp/hunt";
  424. X# endif INTERNET
  425. X
  426. X# endif DEBUG
  427. X
  428. X# ifndef pdp11
  429. X# define    RN    random()
  430. X# else pdp11
  431. X# define    RN    ((Seed = Seed * 11109 + 13849) & 0x7fff)
  432. X# endif pdp11
  433. X
  434. Xint    Seed = 0;
  435. X
  436. X/*
  437. X * rand_num:
  438. X *    Return a random number in a given range.
  439. X */
  440. Xrand_num(range)
  441. Xint    range;
  442. X{
  443. X    return (range == 0 ? 0 : RN % range);
  444. X}
  445. END_OF_FILE
  446. if test 1992 -ne `wc -c <'pathname.c'`; then
  447.     echo shar: \"'pathname.c'\" unpacked with wrong size!
  448. fi
  449. # end of 'pathname.c'
  450. fi
  451. if test -f 'terminal.c' -a "${1}" != "-c" ; then 
  452.   echo shar: Will not clobber existing file \"'terminal.c'\"
  453. else
  454. echo shar: Extracting \"'terminal.c'\" \(2652 characters\)
  455. sed "s/^X//" >'terminal.c' <<'END_OF_FILE'
  456. X/*
  457. X * Copyright (c) 1985 Regents of the University of California.
  458. X * All rights reserved.
  459. X *
  460. X * Redistribution and use in source and binary forms are permitted
  461. X * provided that the above copyright notice and this paragraph are
  462. X * duplicated in all such forms and that any documentation,
  463. X * advertising materials, and other materials related to such
  464. X * distribution and use acknowledge that the software was developed
  465. X * by the University of California, Berkeley.  The name of the
  466. X * University may not be used to endorse or promote products derived
  467. X * from this software without specific prior written permission.
  468. X * THIS SOFTWARE IS PROVIDED ``AS IS'' AND WITHOUT ANY EXPRESS OR
  469. X * IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED
  470. X * WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR A PARTICULAR PURPOSE.
  471. X */
  472. X
  473. X#ifndef lint
  474. Xstatic char sccsid[] = "@(#)terminal.c    5.2 (Berkeley) 6/27/88";
  475. X#endif /* not lint */
  476. X
  477. X/*
  478. X *  Hunt
  479. X *  Copyright (c) 1985 Conrad C. Huang, Gregory S. Couch, Kenneth C.R.C. Arnold
  480. X *  San Francisco, California
  481. X */
  482. X
  483. X# include    "hunt.h"
  484. X# define    TERM_WIDTH    80    /* Assume terminals are 80-char wide */
  485. X
  486. X/*
  487. X * cgoto:
  488. X *    Move the cursor to the given position on the given player's
  489. X *    terminal.
  490. X */
  491. Xcgoto(pp, y, x)
  492. Xregister PLAYER    *pp;
  493. Xregister int    y, x;
  494. X{
  495. X    if (x == pp->p_curx && y == pp->p_cury)
  496. X        return;
  497. X    sendcom(pp, MOVE, y, x);
  498. X    pp->p_cury = y;
  499. X    pp->p_curx = x;
  500. X}
  501. X
  502. X/*
  503. X * outch:
  504. X *    Put out a single character.
  505. X */
  506. Xoutch(pp, ch)
  507. Xregister PLAYER    *pp;
  508. Xchar        ch;
  509. X{
  510. X    if (++pp->p_curx >= TERM_WIDTH) {
  511. X        pp->p_curx = 0;
  512. X        pp->p_cury++;
  513. X    }
  514. X    (void) putc(ch, pp->p_output);
  515. X}
  516. X
  517. X/*
  518. X * outstr:
  519. X *    Put out a string of the given length.
  520. X */
  521. Xoutstr(pp, str, len)
  522. Xregister PLAYER    *pp;
  523. Xregister char    *str;
  524. Xregister int    len;
  525. X{
  526. X    pp->p_curx += len;
  527. X    pp->p_cury += (pp->p_curx / TERM_WIDTH);
  528. X    pp->p_curx %= TERM_WIDTH;
  529. X    while (len--)
  530. X        (void) putc(*str++, pp->p_output);
  531. X}
  532. X
  533. X/*
  534. X * clrscr:
  535. X *    Clear the screen, and reset the current position on the screen.
  536. X */
  537. Xclrscr(pp)
  538. Xregister PLAYER    *pp;
  539. X{
  540. X    sendcom(pp, CLEAR);
  541. X    pp->p_cury = 0;
  542. X    pp->p_curx = 0;
  543. X}
  544. X
  545. X/*
  546. X * ce:
  547. X *    Clear to the end of the line
  548. X */
  549. Xce(pp)
  550. XPLAYER    *pp;
  551. X{
  552. X    sendcom(pp, CLRTOEOL);
  553. X}
  554. X
  555. X/*
  556. X * ref;
  557. X *    Refresh the screen
  558. X */
  559. Xref(pp)
  560. Xregister PLAYER    *pp;
  561. X{
  562. X    sendcom(pp, REFRESH);
  563. X}
  564. X
  565. X/*
  566. X * sendcom:
  567. X *    Send a command to the given user
  568. X */
  569. X/* VARARGS2 */
  570. Xsendcom(pp, command, arg1, arg2)
  571. Xregister PLAYER        *pp;
  572. Xregister int    command;
  573. Xint            arg1, arg2;
  574. X{
  575. X    (void) putc(command, pp->p_output);
  576. X    switch (command & 0377) {
  577. X      case MOVE:
  578. X        (void) putc(arg1, pp->p_output);
  579. X        (void) putc(arg2, pp->p_output);
  580. X        break;
  581. X      case ADDCH:
  582. X      case READY:
  583. X        (void) putc(arg1, pp->p_output);
  584. X        break;
  585. X    }
  586. X}
  587. END_OF_FILE
  588. if test 2652 -ne `wc -c <'terminal.c'`; then
  589.     echo shar: \"'terminal.c'\" unpacked with wrong size!
  590. fi
  591. # end of 'terminal.c'
  592. fi
  593. echo shar: End of archive 4 \(of 4\).
  594. cp /dev/null ark4isdone
  595. MISSING=""
  596. for I in 1 2 3 4 ; do
  597.     if test ! -f ark${I}isdone ; then
  598.     MISSING="${MISSING} ${I}"
  599.     fi
  600. done
  601. if test "${MISSING}" = "" ; then
  602.     echo You have unpacked all 4 archives.
  603.     rm -f ark[1-9]isdone
  604. else
  605.     echo You still need to unpack the following archives:
  606.     echo "        " ${MISSING}
  607. fi
  608. ##  End of shell archive.
  609. exit 0
  610.