�b Linux �U�إ߳n��M��
�@��: [1]Mendel Leo Cooper [2]
http://personal.riverusers.com/~thegrendel/
��: [3]J.S.Lin
v1.52, 27 December 1997
_________________________________________________________________
�o�O���s�x���ޤ��,�i�Ψӫإ�"�@���" UNIX �n��o��M��b Linux �U.
_________________________________________________________________
1. ²��
2. �q���o�}�l
3. �ϥ� Make
4. �J�A�x�
* 4.1 �s�����~
* 4.2 �䥦���D
* 4.3 �ۧ�P�L��
* 4.4 �h�����o�i�@�B����U
5. �̫�B�J
6. �Ĥ@�ӨҤl: Xscrabble
7. �ĤG�ӨҤl: Xloadimage
8. �ĤT�ӨҤl: Fortune
9. ���إi����l�X�ɮ�
10. ���y
11. �ѦһP�i�@�B�\Ū���
_________________________________________________________________
1. ²��
�ܦh�n��M�ѵ��U�� UNIX, �]�A Linux, �O�N��l�X�ɮ���Y����
��(archives)�ӵo�檺. �ۦP���M��i�H�إߥH�K�b���P��H�������W����, ��
�B�o�i�`�٨dzn�馨�~�ӧK���s�y�U�صo�檩��. �n��M��@�o�檩��
���G����b�U������(incarnations), ���O�b Intel ����, DEC Alpha, RISC
�u�@��, �ƦܬO�q��D��. ���������O, �o�N"�إ�"�n�骺�u�@�����F�̲רϥ�
��(end user), ��ڤW�O"�t�κz��", �Y���b��L�e���P��...�A. ���M�o��,
�{�u�ӻ��o�L�{�ä��O�����ݰ_�Ө���i�ȩΤ��i��ij, �N���o���ީҸѻ��@
��.
2. �q���o�}�l
�A���U���Ψ䥦�覡���o�@�ӳn��M��. �̱`�����p�O���Q���]�_�� (tarred)
�ӥB�Q���Y (gzipped), ���� .tar.gz �� .tgz �Φ�. �����N���ƻs��@�u�@��
��. �M��� untar �M gunzip �B�z��. �B�z���̾A�X���R�O�O tar xzvf
filename, �o�ت� filename ��M�O�n��ɦW. �o�ظѶ}�{�DZ`�`�|�w�˾A���
�צb���Ҷ}�Ҫ��l�ؿ���. �`�N���O�p�G�M��W�٦� .Z ����, ���N�n�ϥ�
uncompress PACKAGENAME, �M��A�� tar xvf PACKAGENAME �Ӥ��n�Τ��e���B
�J.
���ɥ��]�_�Ӫ��ɮץ��� untarred �B�w�˦ۨϥΪ̪��a�ؿ�(home
directory), �Ϊ̤]�\�O�b�Y�Ө䥦�ؿ�, ���O�M��]�w��Ʃҫ��w��. ���Y�A
�]�k�n untar ���ӱo�쪺�O���~�T��, �]�\�N�O����]. Ū�@�U�M����, �S�O
�O README �M/�� Install �ɮ�, �p�G�s�b, �s��]�w�ɮשM/�� Makefiles �p
�һݭn��, �Y�P�w�˫��ܲŦX. �`�N���O�q�` �� �h��� Imake �ɮ�, �]���o�i
����w�������G. �Y�dzn��M�\�۰ʦw�˵{��,���O�ǥѰ��� make
install �ө�m�G���X�b�A��t�Φ�m.
����, �A�i��ݭn�ϥ� patch�ɮ�,��ɮצ��C�X�쥻���P�s����l�ɮת��t��,
�ӤɯũΥ[�J����(bug)���ץ��ܥ����](unarchived)����l�ɮ�. doc�ɮP/��
README �ɮ|�i���A�o�⤣��ӱ��p. ���ϥ� Larry Wall ���j�O ��
��(patch) �u�㤧���`���y�k(syntax)�O patch < patchfile.
�A�{�b�i�H�}�l�i�� �إ� �L�{���q�F.
3. �ϥ� Make
Makefile �O�إ߹L�{�����I. �b������²�檺�Φ�, Makefile �N�O�� script
,���O�ΨӽsĶ�Ϋإ�"�G���X",�M�i���泡��. Makefile�]�i�H���ѳn��M
��ɯŪ��u��,�Ӥ��ݭn���s�sĶ�C�@�Ӧb�M����l�ɮ�, ���䦳���P����
�p(�άO���P�����w).
�Y�ǯS�I�O, Makefile �}�� cc �� gcc. �o��ڤW�O�ӫe�B�z��, C (or C++)
�sĶ��, �M �s����, ���Ө��Ӷ���. �o�L�{�ഫ��l�X(source)���i�u���h����
���G���X(binaries).
�U���O make �q�`�u�n��J make. �o�q�`�إ߰Q�פ����M��Ҧ��ݭn���i����
��. �M��, make �]����L�u�@,���O�w��ɮצܦX�A���ؿ� (make install) ��
�B�R���ª� object �ɮ� (make clean). ���� make -n ���\�w��إ߹L�{, �N
�O�C�X�Ҧ� make �ҳ�_��(triggered)�Ҧ��R�O, ���S���u���h���楦��.
�u���b��²�檺�n��ϥΤ@��ʪ� Makefile. ��������w�˻ݭn�ھڨ禡
�w(libraries), include �ɮץH�ΧA�ӧO�����귽�Ҧb�ؿ��Ӷq���w�s. �o�S�O
�O��ݭn X11 libraries �Ӧw�˫إ߮�. Imake �M xmkmf �i�����o�˪��u�@.
�ޥΦ� man page,Imakefile �O��"�ҪO(template)"�� Makefile. imake �u���
�� Imakefile �ھڧA���t�γy�X�X�A�� Makefile. �M��,�X�G�b�Ҧ������p�U,
�A�n���� xmkmf, ���O�n�U imake ���O�Ϊ� shell script, �]�N�O�ӫe�ݤ�
��(front end). ��\�@�U�����b�n��ɮ��� README �� INSTALL �ɮץH���o
�S�O������. �ܩ��ԲӪ��B�J���R,�о\Ū imake �M xmkmf �� man pages.
�n���D���O xmkmf �M make �i��ݭn�H root �����ӤU���O, �S�O�O�� make
install �ӷh���G���X�� /usr/bin �� /usr/local/bin �ؿ�. �H�@��ϥΪ̪�
�����Ӥ��� root �v�O �Өϥ� make �N�i��|�ɭP write access denied ����
�~�T��, �]���A�ʤּg�J(write)�ܨt�Υؿ����v��. �]�ˬd�@�U, �ҳy�X�Ӫ��G
���X��A�P����L�A�Ϊ��ϥΪ̦��A�X������(execute)�v��.
�U���O xmkmf �Өϥ� Imake �ɮ�, �إߤ@�ӷs���ӥB�A�X�A�t�Ϊ� Makefile.
���`�a�U���O xmkmf ���|���[ -a ��, �]�Ӧ۰ʦa�� make Makefiles, make
includes, �M make depend ���ʧ@. �o�|�]�w�ܼ�(variables)�M���w�禡
�w(library) ��m���sĶ���M�s����. ���ɷ|�S�� Imake �ɮ�, �ަӥN�����O��
INSTALL �M configure �� script, �]�|��o�˪��ت�. �`�N���O�p�G�A�n����
configure, ���n�U���O ./configure �H�T�O�b�ثe�ؿ��U���T�� script
configure �O�Q�I�s. �b�j���������p, �b�o��M�� README �ɮ|�����w
�˨B�J.
�q�`�@�Ӧn����k�O�q�~�[�˵��@�U Makefile �O xmkmf �� �䤤�@�Ӧw�˪�
scripts �ҳy�X�Ӫ�. Makefile ���`�U�|���A���t�Φӭץ�, ���A���ӥi���
�n"�ۧ�(tweak)"�Τ�ʦa�ץ����~.
�A���@��w�˨B�J�N�|�O:
* Ū�@�U README �ɮשM�䥦�X�Ϊ����.
* ���� xmkmf -a, �٬O INSTALL �� configure script.
* �ˬd�@�U Makefile.
* �p�G�ݭn, ����@�U make clean, make Makefiles, make includes, and
make depend.
* ���� make.
* �ˬd�@�U�v��.
* �p�G�ݭn, ����@�U make install.
4. �J�A�x�
�p�G�� xmkmf �M/�� make �ܦ��\�S�����~, �A�i�H�ۤ�� [4]next section.
�M��, �b�u��ͬ�, �ܤ֨Ʊ��b�Ĥ@���N���T���u�@. �o�N�O��A�������״I
��,�n�i���.
4.1 �s�����~
* �p�G make ���ѦӥX�{�� Link error: -lX11: No such file or
directory, �ƦܬO�b�ϥ� xmkmf ��. �o�i��N���� Imake �ɮרS���A��a
�˦n. �ˬd Makefile ���Ĥ@�������S�����o�˪��X��:
LIB= -L/usr/X11/lib
INCLUDE= -I/usr/X11/include/X11
LIBS= -lX11 -lc -lm
-L �M -I ������(switches)�|�q�i�sĶ���M�s�������O�h���شM��
library �M include �ɮ�. �b�o�Ҥl, X11 libraries ���ӬO�b
/usr/X11/lib �ؿ�, �� X11 include �ɮ� ���ӬO�b
/usr/X11/include/X11�ؿ�. �p�G�o�b�A�������W�O���諸, ��������
Makefile �ӥB�A�ո� make.
* �b�D�`�֪����p, �H root �����]�@�U ldconfig �]�\�O�ӵ���: #
/etc/ldconfig -n /lib �N�|��s�@�ɦ��禡�w�Ÿ��s�� (shared library
symbolic links). �o�b���`�����ΤU���O�ݭn��.
* �ثe�t�@��ƬO�p�G xmkmf ����, �h�ոդU�C script:
make -DUseInstalled -I/usr/X386/lib/X11/config
* ���ɭ�l�X�ݭn�ϥ��ª��� X11R5 libraries �ӫإ�. �p�G�A�� R5 libs
�b /usr/X11R6/lib (��A�����b�w�� Linux ��, �A�O����ܬO�_�w�˥���
��), �M��A�u�ݭn�T�w,�A���s����n��һݭn�إߪ��a��. R5 libs �O��
libX11.so.3.1.0, libXaw.so.3.1.0, �M libXt.so.3.1.0. �@��A�ݭn�s��
��, ���O libX11.so.3 -> libX11.so.3.1.0. �j���n��]�ݭn�o�ӧΦ��s��
libX11.so -> libX11.so.3.1.0. ��M, �n�N�o"�_��(missing)"���s����
�n, �n�H root �����ϥγo���O ln -s libX11.so.3.1.0 libX11.so.
* �Y�ǮM��|�n�D�A�h�w�ˤ@�өΥH�W���ɯŪ���. �|�ҦӨ�, StarDivision
GmbH �� StarOffice �ե�(suite)�O�c�W�L��(notorious)���n�D libc
version 5.4.4 �Χ�s. �H root����, �A�ݭn�ƻs�@�өΥH�W���禡
�w(libraries)�ܦX�A���ؿ�, �R�h�ª��禡�w(libraries),�M�᭫�]�Ÿ��s
��. �p��: �b�o�n��~�`�N, �]���p�G�A��V, �A�i��|�I�X�A���t����
�B�@���N��. �A�q�`�i�H���ɯŪ��禡�w(libraries)�b [5]Sunsite.
4.2 �䥦���D
* �b�w�˦n�� Perl �� shell script ���A�@�� No such file or directory
���~�T��. �b�o���p,�ˬd�ɮ��v���ӽT�w�ɮץi���� �H��ˬd�ɮ�Y�O
�_�t���ϥ� shell �ε{��, ���� script �Ҧb�a��. �|�ҦӨ�, script �}
�l�p:
#!/usr/local/bin/perl
�p�G Perl ��ڸ˦b�A�� /usr/bin �ؿ�, �Ӥ��O /usr/local/bin �ؿ�,
���� script �L�k����. ����Ӥ�k�ӭק�. script �ɮ�Y�令
#!/usr/bin/perl, �ΥβŸ��s���ܥ��T���ؿ�, ln -s /usr/bin/perl
/usr/local/bin/perl.
* �Y�� X11 �n��n�D�� Motif �禡�w(libraries)�~��إ�. �ӼзǪ�
Linux �o��M��èS���w�� Motif libraries, �ӥB�ثe Motif �٭n�B�~
$100-$200 ����O (���M�K�O�n�� [6]Lesstif �b�Y�dz��X�]����). �p�G
�A�ݭn Motif �ӫإ߬Y�@�M��, ���ʤ� Motif libraries, ����]�\�i�H��
�o �R�A�s�����G���X(statically linked binaries). �R�A�s���b�G���X��
���ǤJ�禡�w��{(library routines). �o�y���G���X�ɮפj�F�\�h, ���O
�X�i�b�ʤָӨ禡�w���t�ΤW����.
* ���� configure script �|�гy�_�Ǫ� Makefile, �����O�P�A�ҭn�]�k�إ�
���M���ۤz. �o��ܶ]�ۿ��~�� configure, ����A�� path �W�Y�B
��L�� configure. �ҥH�n�U configure ���O ���ӭn�U�� ./configure �Y
�ثe�ؿ��U��.
* �Y�ǵ{���|�n�D�� setuid root, ���F�n�H�� root �v�O �Ӱ���. �n�F���o
�ؿ������O�O �Hroot �U���O chmod u+s filename. (�`�N���O�o�{���w�g
�O root �Ҿ֦��F). �o�b�]�w�ɮ��v������ setuid bit �ܦ���. �o�˥Φb
��{���b�s���t�εw��,���O modem �� CD ROM drive, �η� SVGA libs �Q
�Ϧb��D���x�Ҧ�(console mode), ���O�b�@�ӯS�O�c�W�L��
��(notorious)�����(emulation)�M��. �p�G�{�����Q root ����, �����@
��ϥΪ̤@�� access denied �����~�T��, �Q���N�O�o�˳y����.
ĵ�i: �@�Ӧ� setuid �� root ���{���i�ണ�X��A���t�Φ��w���W����
�I. �o�ӵ{���i�H root �v�O�Ӷ]�өҥH���Y�ǯ}�`����b��. �b�]�w
setuid bit �e, �T�w�A���D�ӵ{���b������, ���n�ɬݤ@�U��l�X.
4.3 �ۧ�P�L��
�A�i��Ʊ�ˬd Makefile �ӽT�w����ι�A�t�γ̨νsĶ�ﶵ. �|�Ҩӻ�, �]
�w -O2 �X�Шӿ�̰��h�Ū��̨ΤƦ� -fomit-frame-pointer �X�Шӳy�̤p�G��
�X (���M debugging �|�S�����}). ���D�A���D�A�b������, �ӥB�b��p
�U, ���D�}�W�إߪ��u�@�w����, �_�h���n���o��.
4.4 �h�����o�i�@�B����U
�b�ڪ��g��, �j��25%�����ε{���إ�"�����S���x�". �t�~�j��50%��"�Q���A"
���إ�, �n�I�X�V�O���d��q�L��췥���x�. �����M��ܦ��Y�ǮM��L�צp��
���L�k�إ�. �Y�Ϩ���, ���� Intel ELF �M/�� a.out �G���X, �]�i��b
[7]Sunsite, [8]TSX-11 archive �Ψ䥦�a����. �]�\, �n�骺�гy�̥i�H��
�ѽsĶ�n���G���X���A���S�O�������ϥ�.
�`�N���O�p�G�A���o�w���sĶ�n���G���X, �A�|�ݭn�ˬd�O�_�P�A���t�άۮe:
* �o�G���X�����b�A�� �w��W�] (i.e., Intel x86).
* �o�G���X�����P�A���֤�(kernel)�ۮe (i.e., a.out �� ELF).
* �A���禡�w(libraries)�����O�̷s��.
�p�G��������, �A�i�H�b�X�A�� �s�D�s�մM�D����, ���O�b
[9]comp.os.linux.x �� [10]comp.os.linux.development. �U�@�A�u�O�������B
����, �K, �ոդ]�O���쪺.
5. �̫�B�J
Ū�@�U�n��M���ӨM�w�O�_���Y�����ܼƻݭn�] (�b .bashrc ��
.cshrc) �H�� �O�_ .Xdefaults �M .Xresources �ɮݭn�վ�.
�i�����ε{�����w���ɮ�, �q�`�s�� Xfoo.ad �b�쥻�� Xfoo �o��M��. �p
�G�o��, �s�� Xfoo.ad �ɮA�X�A������, �M�᭫�s�R�W (mv) �� Xfoo �ӥB
�H root ���� �w�˥��� /usr/lib/X11/app-defaults �ؿ�, �S�o�˰��i��|�y
���n��欰�ܩ_��, �Ʀܩڵ�����.
�j�h�ƪ��n��M����@�өΥH�W���榡�� man pages. �H root ����, �ƻs
Xfoo.man �ɮר�X�A�� /usr/man �ؿ� (man1 - man9), �Ӯھڨ��A���s�R�W.
�|�ҦӨ�, �p�G Xfoo.man ���G�O�b /usr/man/man4, �����өR�W�� Xfoo.4
(mv Xfoo.man Xfoo.4). �ھڤ@���w�ϥΪ̪��R�O�\�b man1, �C���O�b
man6, �Ӻz���M��O�b man8 (�ݤ@�U man ��� �H���o��ԲӸ��).��M,�b
�A�t�ΧA�i�H���ӳo�Ӭ��w, �u�n�A���w.
�Y�ǮM�|�w�ˤG���X(binaries)�b�X�A���t�Υؿ�, ���y�ܻ�, �L�̨S��
install �ﶵ�b Makefile ��. �p�G�O�o���p, �A�i�H�� root �����ƻs�G��
�X(binaries)�� usr/local/bin �ؿ��Ӥ�ʦw�ˤG���X(binaries).
�`�N���O�Y�ǩΥ����W�z�B�J,�b�j�������ΤU,���ӷ|�� make install �Ӧ۰�
�ާ@. �p�G�O�o��, README �� INSTALL ���ɷ|����o��.
6. �Ĥ@�ӨҤl: Xscrabble
Matt Chapman�� Xscrabble ���G���O�ӻᦳ�쪺�{��, �]���ڴ��O�ӳg����
Scrabble™(���r�C��)���a.�ڤU���U,���, �ӥB�إߥ��H README �ɮפ�
���U�C�B�J:
xmkmf
make Makefiles
make includes
make
��M�����ॿ�`�B�@...
_________________________________________________________________
gcc -o xscrab -O2 -O -L/usr/X11R6/lib
init.o xinit.o misc.o moves.o cmove.o main.o xutils.o mess.o popup.o
widgets.o display.o user.o CircPerc.o
-lXaw -lXmu -lXExExt -lXext -lX11 -lXt -lSM -lICE -lXExExt -lXext -lX11
-lXpm -L../Xc -lXc
BarGraf.o(.text+0xe7): undefined reference to `XtAddConverter'
BarGraf.o(.text+0x29a): undefined reference to `XSetClipMask'
BarGraf.o(.text+0x2ff): undefined reference to `XSetClipRectangles'
BarGraf.o(.text+0x375): undefined reference to `XDrawString'
BarGraf.o(.text+0x3e7): undefined reference to `XDrawLine'
etc.
etc.
etc...
_________________________________________________________________
�ڦb [11]comp.os.linux.x ���s�D�s�ո߰ݹL, �ӥB���ǤH�n�ߪ����X���G
Xt, Xaw, Xmu, �M X11 libs �S����s����(linker)��o��. ��...
����ӥD�n�� Makefiles, �ӥB�b src �ؿ��U��������ڷP����. �b Makefile
�@�榳�w�q LOCAL_LIBS ��: LOCAL_LIBS = $(XAWLIB) $(XMULIB) $(XTOOLLIB)
$(XLIB) �o�ҫ��� libs �èS���Q�s�������.
���U�ӫ��� LOCAL_LIBS ���a��, �ڬݨ�Ӧb Makerfile ��495��:
$(CCLINK) -o $@ $(LDOPTIONS) $(OBJS) $(LOCAL_LIBS) $(LDLIBS)
$(EXTRA_LOAD_FLAGS)
�Ӳ{�b LDLIBS �O����O?
LDLIBS = $(LDPOSTLIB) $(THREADS_LIBS) $(SYS_LIBRARIES)
$(EXTRA_LIBRARIES)
SYS_LIBRARIES �O:
SYS_LIBRARIES = -lXpm -L../Xc -lXc
�O��! �N�O�o�˿� libraries.
�j���s�����ݭn�b LOCAL_LIBS ���e�ݨ� LDLIBS... �ҥH, �Ĥ@��ƭn���եh��
�� Makefile �N�O��g�b495�檺 $(LOCAL_LIBS) �M $(LDLIBS) , �ҥH���{�b��
��:
$(CCLINK) -o $@ $(LDOPTIONS) $(OBJS) $(LDLIBS) $(LOCAL_LIBS)
$(EXTRA_LOAD_FLAGS) ^^^^^^^^^^^^^^^^^^^^^^^
�b�W�������,�ڸյۦA������ make , �@, ���o���i���`�]�F. ��M,
Xscrabble ���M�ݭn�@�ǷL��(fine tuning]�P����(twiddling), ���O���s�R�W
�r��H�μе��Y�ǻ��U���ԭz�b��l�X�ɮפ��@, �����]������,���w���ڦn�X��
�p�ɪ�����.
�A�i�H�H e-mail [12]Matt Chapman, �ӥB�q�L�� [13]home page �U��
Xscrabble.
_________________________________________________________________
Scrabble �O Milton Bradley Co., Inc. �����U�Ӽ�.
_________________________________________________________________
7. �ĤG�ӨҤl: Xloadimage
�o�ӨҤl���X��²�檺���D. xloadimage �{���[�J��ڪ��ϧΤu�@�զ��G�O�ܦ�
��. �ڱq�@���� Mui �M Quercia �ҵ۪��n�� [14]X User Tools �Ҫ��� CD �W
����l�X�ؿ�(source directory), �����ƻs xloadi41.gz �ɮפU��. �p�w��
��, �� tar xzvf �Ѷ}�Ҧ��ɮ�. �M��, make �X�{�F�O�H�Q�������~�ӥB���_.
_________________________________________________________________
gcc -c -O -fstrength-reduce -finline-functions -fforce-mem
-fforce-addr -DSYSV -I/usr/X11R6/include
-DSYSPATHFILE=\"/usr/lib/X11/Xloadimage\" mcidas.c
In file included from /usr/include/stdlib.h:32,
from image.h:23,
from xloadimage.h:15,
from mcidas.c:7:
/usr/lib/gcc-lib/i486-linux/2.6.3/include/stddef.h:215:
conflicting types for `wchar_t'
/usr/X11R6/include/X11/Xlib.h:74: previous declaration of
`wchar_t'
make[1]: *** [mcidas.o] Error 1
make[1]: Leaving directory
`/home/thegrendel/tst/xloadimage.4.1'
make: *** [default] Error 2
_________________________________________________________________
�o���~�T���t���̮ڥ����u��.
�ݤ@�U�ɮ� image.h ��23��.
_________________________________________________________________
#include <stdlib.h>
_________________________________________________________________
�ګ�! �b xloadimage, wchar_t ��l�X���Y�B�w�g���Ʃw�q�F�b�з� include
�ɮ� stdlib.h �w�w�q���F��. �����ոձN�b image.h ��23��е�(commenting
out)�_��, �]�\ stdlib.h include �O���j�ݭn��.
����, build �L�{�S����j���~. xloadimage �{���{�b�\�ೣ���`.
8. �ĤT�ӨҤl: Fortune
�̫�Ҥl�ݭn�Y�� C �{���]�p����. �j������ Linux �n��O�� C �g��, �ӥB��
�־��I C ���㪺����Q�n��w�˪��H�|���U�q.
�c�W�L����(notorious) fortune �{���b�C�� Linux �}���_�Ӯɨq�X��q���λy
"fortune cookie". �����a (�����N�䪺), �]�k�b Red Hat �o��M��
2.0.30 ���֤ߤU�إ�,�X�{�F �@���Y�������~.
_________________________________________________________________
~/fortune# make all
gcc -O2 -Wall -fomit-frame-pointer -pipe -c fortune.c -o
fortune.o
fortune.c: In function `add_dir':
fortune.c:551: structure has no member named `d_namlen'
fortune.c:553: structure has no member named `d_namlen'
make[1]: *** [fortune.o] Error 1
make[1]: Leaving directory `/home/thegrendel/for/fortune/fortune'
make: *** [fortune-bin] Error 2
_________________________________________________________________
�ݤ@�U fortune.c, ����p���X��b�o.
_________________________________________________________________
if (dirent->d_namlen == 0)
continue;
name = copy(dirent->d_name, dirent->d_namlen);
_________________________________________________________________
�ڭ̻ݭn��X dirent �� structure, �����S���ŧi(declared)�b fortune.c ��
�פ�, �Q�� grep dirent �Өq�X�O�_�b�䥦��l�X���ɮפ�, ���]�S��. �M��,
�b fortune.c �ɪ��̤W�観�U�C�o��.
_________________________________________________________________
#include <dirent.h>
_________________________________________________________________
�o���G�O�t�Ψ禡�w�� include �ɮ�, �ҥH�n�� dirent.h ���X�z��m�O�b
/usr/include. �ƹ�W, dirent.h ���T���b /usr/include ��, ����ɨS���]�t
dirent �� structure. �M��, �Ѧҥt�@�� dirent.h ��.
_________________________________________________________________
#include <linux/dirent.h>
_________________________________________________________________
�̫�, �h /usr/include/linux/dirent.h, �ڭ̥i���ڭ̩һݭn�ŧi��
structure.
_________________________________________________________________
struct dirent {
long d_ino;
__kernel_off_t d_off;
unsigned short d_reclen;
char d_name[256]; /* We must not include
limits.h! */
};
_________________________________________________________________
�����a�T�w, �o�� structure �ŧi�S���]�t d_namelen, �����@��P��۷���
��. �䤤�̥i��O d_reclen, �]�� �o�� structure member ��ܬY�˪F�誺
length �ӥB���O short integer. ��L�j��, d_ino, �i��O inode number, �P
�_���� name �M type. �ƹ�W, �ڭ̤j���O�B�z "directory entry"
structure, �Ӥ������ɮ��ݩ�, �����W��, inode, �M length (�H blocks �@
���). �o���G��ڭ̪��q�Q�ܦX�z.
�ڭ̽s��ɮ� fortune.c, �ӥB���ܦb551��M553�檺 d_namelen �ܦ�
d_reclen. �A�ո� make all. Success. �o���إߨS�����~. �ڭ̲{�b���q
fortune ��o "cheap thrills"
9. ���إi����l�X�ɮ�
�{�b�A�ܴ��檺�ϥΧA�̷s��o�����Ѩӥ[�J�@�Ǥu��M�䥦�n�F���A���t
��, �A�i�H�b�u�W��쥦��, [15]Linux Applications and Utilities Page, ��
�̦b�ܦX�z���쪺 CD ROM ���ɮ�, �ǥ� [16]Red Hat, [17]InfoMagic, �H�Ψ�
����.
�@�Ӳ��h��l�X���_�w�O�b [18]comp sources UNIX archive.
�ܦh UNIX ��l�X�o��b [19]alt.sources �s�D�s��. �p�G�A�n��S�O����l�X
�]�˪�, �A�i�H�K�b����� [20]alt.sources.wanted �s�D�s��. �t�~�@�Ӥ���
���a��O�d�� [21]comp.os.linux.announce �s�D�s��. �n���o�b [22]Unix
sources ���q�H��, �бH�� subscribe �T���쨺.
�ܩ� [23]alt.sources �s�D�s�ժ��ɮO�b�U�� ftp ��:
* [24]ftp.sterling.com/usenet/alt.sources/
* [25]wuarchive.wustl.edu/usenet/alt.sources/articles
* [26]src.doc.ic.ac.uk/usenet/alt.sources/articles
10. ���y
�`��, �ʧ餣���|�Ϥ����ܦ����@�� (�ӥB��������e����|�����U). ��
�X���O,�q���Ѥ���o�Dzߧ�O���n. �b�C�ӹL�����B��, �C�ӥ��ѳy�N�F���x
�� �إ߳n����N �����ѭ���.
11. �ѦһP�i�@�B�\Ū���
BORLAND C++ TOOLS AND UTILITIES GUIDE, Borland International, 1992,
pp. 9-42.
[Borland C++, ver. 3.1. ���o���U���@. ���F�ܦn���Цb�y�k�M�����W,
�ϥ� Borland �b DOS �U�ݾl����@.]
DuBois, Paul: SOFTWARE PORTABILITY WITH IMAKE, O'Reilly and Associates,
1996, ISBN 1-56592-226-3.
[�o�ڻ��O���㪺 imake �ѦҸ��, ���M�ڦb�g�����,�٥����o.]
Frisch, Aeleen: ESSENTIAL SYSTEM ADMINISTRATION, O'Reilly and
Associates, 1995, ISBN 1-56592-127-5.
[�o�O�䥦��V���t�κz��U�w�g�������h�����ͨ�إ߳n��.]
Lehey, Greg: PORTING UNIX SOFTWARE, O'Reilly and Associates, 1995, ISBN
1-56592-126-7.
Mui, Linda �M Valerie Quercia: X USER TOOLS, O'Reilly and Associates,
1994, ISBN 1-56592-019-8, pp. 734-760.
Oram, Andrew �M Steve Talbott: MANAGING PROJECTS WITH MAKE, O'Reilly
and Associates, 1991, ISBN 0-937175-90-0.
Peek, Jerry �M Tim O'Reilly �P Mike Loukides: UNIX POWER TOOLS,
O'Reilly and Associates / Random House, 1997, ISBN 1-56592-260-3.
[�ܴΪ������ӷ�, �ӥB���j�q�ϥΤu��A�i��q��l�X�ӫإ�,
�ϥΦb���夤�Q�ת���k.]
Stallman, Richard M. �M Roland McGrath: GNU MAKE, Free Software
Foundation, 1995, ISBN 1-882114-78-7.
[���ӬO�ݭn�\Ū��.]
Welsh, Matt �M Lar Kaufman: RUNNING LINUX, O'Reilly and Associates,
1996, ISBN 1-56592-151-8.
[���M�O���� Linux �ѦҸ�Ƴ̦n��, ���M�b�Y�Ǧa��ʤ֤�`�J�Q��.]
��M�٦� make, imake, xmkmf, gcc, ldconfig, gzip, tar, �M patch �� man
pages.
References
1. mailto:
[email protected]
2.
http://personal.riverusers.com/~thegrendel/
3. mailto:
[email protected]
4. file://localhost/tmp/zh-sgmltools.18133/Software-Building-HOWTO.txt.html#finalsteps
5.
ftp://sunsite.unc.edu/
6.
http://www.lesstif.org/
7.
ftp://sunsite.unc.edu/
8.
ftp://tsx-11.mit.edu/
9.
news://comp.os.linux.x/
10.
news://comp.os.linux.development/
11.
news://comp.os.linux.x/
12. mailto:
[email protected]
13.
http://www.belgarath.demon.co.uk/programs/index.html
14. file://localhost/tmp/zh-sgmltools.18133/Software-Building-HOWTO.txt.html#refs
15.
http://www.redhat.com/linux-info/linux-app-list/linapps.html
16.
http://www.redhat.com/
17. mailto:
[email protected]
18.
ftp://ftp.vix.com/pub/usenet/comp.sources.unix/
19.
news://alt.sources/
20.
news://alt.sources.wanted/
21.
news://comp.os.linux.announce/
22. mailto:
[email protected]
23.
news://alt.sources/
24.
ftp://ftp.sterling.com/usenet/alt.sources/
25.
ftp://wuarchive.wustl.edu/usenet/alt.sources/articles
26.
ftp://src.doc.ic.ac.uk/usenet/alt.sources/articles