���Υڡ��� ���Υڡ��� �ܼ���

12. 4 ���ܤ���: Hearts

�ȤƤ�Ť� Hearts �Ȥ��������ब����ޤ�������� 1980 ǯ��Τɤ����� Bob Ankeney �� UNIX �Ѥ˺�������1992 ǯ�� Mike Yang �������������ߤ� Jonathan Badger �����ƥʥ󥹤��Ƥ��ޤ����������Ȥϡ�Oregon Software �� Don Backus �� �񤤤���äȸŤ� Pascal �Υץ������Ǥ��ꡢ��� Jeff Hemmerling ���� �����Ƥ��ޤ�����Ȥ�Ȥ�ʣ���οʹ֤�ͷ�֤��Ȥ����ꤷ��������Ǥ����� ����ԥ塼�������ˤ��ư�ͤ�ͷ�֤��Ȥ�Ǥ��ޤ�������ե��å����Ϥ��� �����Ǥ��������Υ�����ˤ϶Ťä���ǽ�Ϥ���ޤ��󤷡�����ԥ塼�������� ���Ƥ⤢�ޤ궯������ޤ��󡣤���ˤ⤫����餺�����ߤˤ����Ƥ� UNIX �ޥ���� Linux �ޥ���������ĤäƤ��륲����Ϥ��� Hearts �����Τ褦�Ǥ���

�Ť����ᡢ�ޤ����Ū�ʷаޤΤ��ᡢ���Υѥå������� Linux �����ƥ��ǹ��ۤ���Τ��ä� ����Ǥ������κ�ȤǤ�Ĺ����ʣ���ʥѥ�����ɬ�פ�����ޤ���Ǧ�Ѥ� �����Ϥη����ˤʤ�Ǥ��礦��

��Ȥ�Ϥ�����ˤϡ�ɬ�� 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 �� 30 ���ܤ�

#define SYSV
���ɲä��Ƥ�������������ˤ�� _tty �ؤλ��Ȥ����򤵤�ޤ���

make

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

���󥯥롼�ɥե����� termio.h �� Linux �����ƥ�Ǥ� /usr/include �ǥ��쥯�ȥ�ˤ���ޤ������Ū�Ť� UNIX �ޥ���� ���Τ褦�� /usr/include/sys �ǤϤ���ޤ��󡣤������äơ� client.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

�Ƕ�� Linux �ǥ����ȥ�ӥ塼�����ϡ������٤�� 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

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!

hearts ��°�� README �򸫤�Ȱʲ��Τ褦�˽񤤤Ƥ��� �ޤ�:

     heartsd, hearts_dist, hearts.instr �ե������ local.h ���������
     �Ƥ��� HEARTSLIB �ǥ��쥯�ȥ���֤���ï�Ǥ⥢�������Ǥ���褦�ˤ�
     �Ƥ���������

local.h �ˤϰʲ��Τ褦�˽񤤤Ƥ���ޤ�:

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

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

����ϡ֥ޥ˥奢���������ɤ�!�פ�ŵ����Ǥ��͡�

root �ˤʤäưʲ��κ�Ȥ�Ԥ��ޤ���

cd /usr/local/lib

mkdir hearts

cd !$

���줫�顢distributor �ե�����򤳤Υǥ��쥯�ȥ�˥��ԡ����� ����

cp /home/username/hearts/heartsd .

cp /home/username/hearts/hearts_dist .

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

�⤦���ټ¹ԥƥ��Ȥ򤷤Ƥߤޤ��礦��

xmhearts

�����ư�����Ȥ��������ޤ���������ξ��� dealer died! �� ������å�������Ф��ƻߤޤäƤ��ޤ��Ǥ��礦��

"distributor" �� "dealer" �ϥϡ��ɥ������Υݡ��Ȥ�á���ޤ����������äơ� �����Υץ�����ब root ���¤�ɬ�פȤ��Ƥ��뤳�Ȥ򵿤��٤��Ǥ���

root �ˤʤäưʲ��κ�Ȥ򤷤Ƥߤޤ��礦��

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

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

(���ˤ�Ҥ٤ޤ�������suid �����Х��ʥ�ϥ������ƥ��ۡ���� �ʤ뤫�⤷��ʤ��Τ����դ��Ƥ���������)

xmhearts

����Ǥ�ä�ư���褦�ˤʤ�ޤ���!

Hearts �� Sunsite ��������Ǥ��ޤ���


���Υڡ��� ���Υڡ��� �ܼ���