´ÙÀ½ ÀÌÀü Â÷·Ê

12. ³×¹ø° ¿¹: Hearts

À̹ø¿¡´Â 80³â´ë¿¡ Bob Ankeney°¡ À¯´Ð½º ½Ã½ºÅÛÀ» À§ÇØ ÀÛ¼ºÇß°í, 1992³â¿¡ Mike YangÀÌ °íÃÆÀ¸¸ç, Áö±ÝÀº Jonathan Badger°¡ °ü¸®ÇÏ°í ÀÖ´Â °í»ö⿬ÇÑ ¿¾ °ÔÀÓÀÎ Hearts´Ù. ±× ¼±Á¶´Â Oregon ¼ÒÇÁÆ®¿þ¾îÀÇ Don Backus°¡ ¾´ ÈξÀ ´õ ¿À·¡µÈ ÆĽºÄ® ÇÁ·Î±×·¥À¸·Î ³ªÁß¿¡ Jeff HemmerlingÀÌ °³Á¤Çß´Ù. ¿ø·¡´Â ´ÙÁß »ç¿ëÀÚ Å¬¶óÀ̾ðÆ®¸¦ ¿°µÎ¿¡ µÐ °ÍÀÌÁö¸¸, ÄÄÇ»Å͸¦ »ó´ë·Î ÇÑ ´ÜÀÏ »ç¿ëÀÚ ¸ðµåµµ °¡´ÉÇÏ´Ù. ¼¼·ÃµÈ ¸éÀÌ ºÎÁ·ÇÏ°í ÄÄÇ»ÅÍ »ó´ë°¡ º°·Î °­ÇÏÁö ¾ÊÁö¸¸, ±×·¡ÇÈÀº ÈǸ¢ÇÏ´Ù. À¯´Ð½º¿Í ¸®´ª½º¿¡¼­ °¡´ÉÇÑ °ÍÀº Áö±ÝÀ¸·Î¼­µµ Ä£ÀýÇÑ Hearts °ÔÀÓ ¹Û¿¡´Â ¾ø´Â µí ÇÏ´Ù.

±× ³ªÀÌ¿Í Ç÷Åë ¶§¹®¿¡, ÀÌ ÆÐÅ°Áö´Â ƯÈ÷ ¸®´ª½º ½Ã½ºÅÛ¿¡ ¼³Ä¡Çϱ⠾î·Æ´Ù. ¼³Ä¡¸¦ À§Çؼ­´Â ±æ°í °ñÄ¡¾ÆÇ ÀÏ·ÃÀÇ ÆÛÁñÀ» Ç®¾î¾ß ÇÑ´Ù. ÀÌ °úÁ¤Àº Àγ»¿Í °áÀÇÀÇ ÈÆ·ÃÀ̶ó ÇÒ ¼ö ÀÖ´Ù.

½ÃÀÛÇϱâ Àü¿¡, motif ³ª lesstif ¶óÀ̺귯¸®°¡ ¼³Ä¡µÇ¾î ÀÖ´ÂÁö È®ÀÎÇϵµ·Ï Ç϶ó.

xmkmf

make

client.c: In function `read_card':
client.c:430: `_tty' undeclared (first use in this function)
client.c:430: (Each undeclared identifier is reported only once
client.c:430: for each function it appears in.)
client.c: In function `scan':
client.c:685: `_tty' undeclared (first use in this function)
make: *** [client.o] Error 1

client.c¿¡ ¹üÀÎÀÌ ÀÖ´Ù.

#ifndef SYSV
        (buf[2] != _tty.sg_erase) && (buf[2] != _tty.sg_kill)) {
 #else
        (buf[2] != CERASE) && (buf[2] != CKILL)) {
#endif

client.cÀÇ 39° ÁÙ¿¡

#define SYSV
¸¦ ´õÇÑ´Ù. ÀÌ·¸°Ô Çϸé _tty·ÎÀÇ ÂüÁ¶¸¦ ¹«½ÃÇÑ´Ù.

make

client.c:41: sys/termio.h: No such file or directory
make: *** [client.o] Error 1

¸®´ª½º ½Ã½ºÅÛ¿¡¼­´Â termio.h ÆÄÀÏÀÌ /usr/include ¿¡ ÀÖ´Ù. ´õ ¿À·¡µÈ À¯´Ð½º¿¡¼­´Â /usr/include/sys¿¡ ÀÖ´Ù. µû¶ó¼­, clinet.cÀÇ 41° ÁÙÀ»

#include <sys/termio.h>
¿¡¼­
#include <termio.h>
·Î ¹Ù²Û´Ù.

make

gcc -o hearts -g      -L/usr/X11R6/lib client.o hearts.o select.o connect.o
sockio.o start_dist.o  -lcurses -ltermlib       
/usr/bin/ld: cannot open -ltermlib: No such file or directory
collect2: ld returned 1 exit status
make: *** [hearts] Error 1

¿äÁòÀÇ ¸®´ª½º ¹èÆ÷º»Àº ±¸½ÄÀÇ termlib µ¥ÀÌÅͺ£À̽º º¸´Ù´Â terminfo³ª termcapÀ» »ç¿ëÇÑ´Ù.

MakefileÀÇ 655° ÁÙ,

CURSES_LIBRARIES = -lcurses -ltermlib
¸¦

CURSES_LIBRARIES = -lcurses -ltermcap
·Î ¹Ù²Û´Ù.

make

gcc -o xmhearts -g      -L/usr/X11R6/lib xmclient.o hearts.o select.o
connect.o sockio.o start_dist.o gfx.o  -lXm_s -lXt -lSM -lICE -lXext -lX11
-lPW       
/usr/bin/ld: cannot open -lXm_s: No such file or directory
collect2: ld returned 1 exit status

lesstifÀÇ ÁÖ ¶óÀ̺귯¸®´Â libXm_s°¡ ¾Æ´Ï¶ó libXmÀÌ´Ù. µû¶ó¼­ Makefile¸¦ °íÄ£´Ù.

653° ÁÙ:

XMLIB = -lXm_s $(XTOOLLIB) $(XLIB) -lPW

´ÙÀ½°ú °°ÀÌ ÇÑ´Ù.

XMLIB = -lXm $(XTOOLLIB) $(XLIB) -lPW

make

gcc -o xmhearts -g      -L/usr/X11R6/lib xmclient.o hearts.o select.o
connect.o sockio.o start_dist.o gfx.o  -lXm -lXt -lSM -lICE -lXext -lX11 -lPW       
/usr/bin/ld: cannot open -lPW: No such file or directory
collect2: ld returned 1 exit status
make: *** [xmhearts] Error 1

´Ã ÇÏ´ø ÀǽÉÀ» Çغ¸ÀÚ

PW¶óÀ̺귯¸®°¡ ¾ø´Ù. Makefile¸¦ °íÄ£´Ù.

653° ÁÙ,

XMLIB = -lXm $(XTOOLLIB) $(XLIB) -lPW

¸¦ ´ÙÀ½°ú °°ÀÌ ÇÑ´Ù.

XMLIB = -lXm $(XTOOLLIB) $(XLIB) -lPEX5
(The PEX5 lib comes closest to PW.)

make

rm -f xmhearts
gcc -o xmhearts -g      -L/usr/X11R6/lib xmclient.o hearts.o select.o
connect.o sockio.o start_dist.o gfx.o  -lXm -lXt -lSM -lICE -lXext -lX11 -lPEX5       

µåµð¾î make¿¡ ¼º°øÇß´Ù. (¸¸¼¼!)

¼³Ä¡:

root·Î¼­ ´ÙÀ½°ú °°ÀÌ ÇÑ´Ù.

[root@localhost hearts]# make install
install -c -s  hearts /usr/X11R6/bin/hearts
install -c -s  xmhearts /usr/X11R6/bin/xmhearts
install -c -s  xawhearts /usr/X11R6/bin/xawhearts
install in . done

½ÃÇè»ï¾Æ µ¹·Áº¸ÀÚ.

rehash

(¿ì¸®´Â tcsh ½©À» ¾²°í ÀÖ´Ù.)

xmhearts

localhost:~/% xmhearts
Can't invoke distributor!

heats ÆÐÅ°ÁöÀÇ README ÆÄÀÏ¿¡ ´ÙÀ½°ú °°ÀÌ ÀûÇô ÀÖ´Ù.

     heartsd, hearts_dist¿Í hearts.instr¸¦ local.h¿¡ Á¤ÀÇµÈ HEARTSLIB µð·ºÅ͸® 
     ¾È¿¡ µÎ°í, ÀÌ ÆÄÀϵ鿡 ´©±¸³ª Á¢±ÙÇÒ ¼ö ÀÖµµ·Ï Ç϶ó.

local.h ÆÄÀÏ ³»¿ë:

/* where the distributor, dealer and instructions live */

#define HEARTSLIB "/usr/local/lib/hearts"

ÀÌ°ÍÀº RTFMÀÇ °íÀüÀûÀÎ °æ¿ì´Ù.

root·Î¼­ ´ÙÀ½°ú °°ÀÌ ÇÑ´Ù.

cd /usr/local/lib

mkdir hearts

cd !$

¼³Ä¡µÉ ÆÄÀϵéÀ» ÀÌ µð·ºÅ͸®¿¡ º¹»çÇÑ´Ù.

cp /home/username/hearts/heartsd .

cp /home/username/hearts/hearts_dist .

cp /home/username/hearts/hearts.instr .

´Ù½Ã ÇÑ ¹ø ½ÃÇè»ï¾Æ µ¹·Áº¸ÀÚ.

xmhearts

Çѵ¿¾È µ¹¾Æ°¡´Ù°¡ dealer died! ¶ó´Â ¸Þ½ÃÁö¸¦ ³»¸ç Á״´Ù.

"distributor"¿Í "dealer"´Â Çϵå¿þ¾îÀÇ Æ÷Æ®µéÀ» Á¶»ç(scan)ÇÑ´Ù. µû¶ó¼­ ¿ì¸®´Â ÀÌ ÇÁ·Î±×·¥µéÀÌ rootÀÇ ±ÇÇÑÀ» ÇÊ¿ä·Î ÇÏ´ÂÁö ÀǽÉÇØ¾ß ÇÑ´Ù.

root·Î¼­ ´ÙÀ½°ú °°ÀÌ Çغ¸ÀÚ,

chmod u+s /usr/local/lib/heartsd

chmod u+s /usr/local/lib/hearts_dist

(¾Õ¼­ À̾߱âÇßµíÀÌ, suidµÈ ¹ÙÀ̳ʸ®´Â º¸¾È »óÀÇ ÇãÁ¡À» ¸¸µé ¼öµµ ÀÖ´Ù´Â °Í¿¡ ÁÖÀÇÇ϶ó.)

xmhearts

µåµð¾î µ¹¾Æ°£´Ù!

Hearts´Â ¼±»çÀÌÆ®¿¡¼­ ±¸ÇÒ ¼ö ÀÖ´Ù.


´ÙÀ½ ÀÌÀü Â÷·Ê