1: Update somepart of handbook/ports-handbook.

2: Add zh-tut, it's Chinese Tutorial from Taiwan.

Submitted by:   chinsan dot tw at gmail.com
PR:             docs/91380
This commit is contained in:
Vanilla I. Shu 2006-01-06 09:15:41 +00:00
parent e140896ec8
commit 23b888c953
Notes: svn2git 2020-12-08 03:00:23 +00:00
svn path=/head/; revision=26780
119 changed files with 100316 additions and 850 deletions

View file

@ -1,6 +1,7 @@
# $FreeBSD$
SUBDIR = books
#SUBDIR = articles
SUBDIR += books
COMPAT_SYMLINK = zh

View file

@ -1,6 +1,9 @@
# $FreeBSD$
SUBDIR = faq
#SUBDIR+= handbook
#SUBDIR+= porters-handbook
SUBDIR+= zh-tut
ROOT_SYMLINKS = faq

File diff suppressed because it is too large Load diff

View file

@ -0,0 +1,265 @@
#
# $FreeBSD$
#
# Build the FreeBSD Handbook.
#
# ------------------------------------------------------------------------
#
# Handbook-specific variables
#
# WITH_PGPKEYS The print version of the handbook only prints PGP
# fingerprints by default. If you would like for the
# entire key to be displayed, then set this variable.
# This option has no affect on the HTML formats.
#
# Handbook-specific targets
#
# pgpkeyring This target will read the contents of
# pgpkeys/chapter.sgml and will extract all of
# the pgpkeys to standard out. This output can then
# be redirected into a file and distributed as a
# public keyring of FreeBSD developers that can
# easily be imported into PGP/GPG.
#
# ------------------------------------------------------------------------
.PATH: ${.CURDIR}/../../share/sgml/glossary
MAINTAINER= doc@FreeBSD.org
DOC?= book
FORMATS?= html-split
HAS_INDEX= true
INSTALL_COMPRESSED?= gz
INSTALL_ONLY_COMPRESSED?=
IMAGES_EN = advanced-networking/isdn-bus.eps
IMAGES_EN+= advanced-networking/isdn-twisted-pair.eps
IMAGES_EN+= advanced-networking/natd.eps
IMAGES_EN+= advanced-networking/net-routing.pic
IMAGES_EN+= advanced-networking/static-routes.pic
IMAGES_EN+= geom/striping.pic
IMAGES_EN+= install/adduser1.scr
IMAGES_EN+= install/adduser2.scr
IMAGES_EN+= install/adduser3.scr
IMAGES_EN+= install/boot-mgr.scr
IMAGES_EN+= install/console-saver1.scr
IMAGES_EN+= install/console-saver2.scr
IMAGES_EN+= install/console-saver3.scr
IMAGES_EN+= install/console-saver4.scr
IMAGES_EN+= install/desktop.scr
IMAGES_EN+= install/disklabel-auto.scr
IMAGES_EN+= install/disklabel-ed1.scr
IMAGES_EN+= install/disklabel-ed2.scr
IMAGES_EN+= install/disklabel-fs.scr
IMAGES_EN+= install/disklabel-root1.scr
IMAGES_EN+= install/disklabel-root2.scr
IMAGES_EN+= install/disklabel-root3.scr
IMAGES_EN+= install/disk-layout.eps
IMAGES_EN+= install/dist-set.scr
IMAGES_EN+= install/dist-set2.scr
IMAGES_EN+= install/docmenu1.scr
IMAGES_EN+= install/ed0-conf.scr
IMAGES_EN+= install/ed0-conf2.scr
IMAGES_EN+= install/edit-inetd-conf.scr
IMAGES_EN+= install/fdisk-drive1.scr
IMAGES_EN+= install/fdisk-drive2.scr
IMAGES_EN+= install/fdisk-edit1.scr
IMAGES_EN+= install/fdisk-edit2.scr
IMAGES_EN+= install/ftp-anon1.scr
IMAGES_EN+= install/ftp-anon2.scr
IMAGES_EN+= install/hdwrconf.scr
IMAGES_EN+= install/keymap.scr
IMAGES_EN+= install/main1.scr
IMAGES_EN+= install/mainexit.scr
IMAGES_EN+= install/main-std.scr
IMAGES_EN+= install/main-options.scr
IMAGES_EN+= install/main-doc.scr
IMAGES_EN+= install/main-keymap.scr
IMAGES_EN+= install/media.scr
IMAGES_EN+= install/mouse1.scr
IMAGES_EN+= install/mouse2.scr
IMAGES_EN+= install/mouse3.scr
IMAGES_EN+= install/mouse4.scr
IMAGES_EN+= install/mouse5.scr
IMAGES_EN+= install/mouse6.scr
IMAGES_EN+= install/mta-main.scr
IMAGES_EN+= install/net-config-menu1.scr
IMAGES_EN+= install/net-config-menu2.scr
IMAGES_EN+= install/nfs-server-edit.scr
IMAGES_EN+= install/ntp-config.scr
IMAGES_EN+= install/options.scr
IMAGES_EN+= install/pkg-cat.scr
IMAGES_EN+= install/pkg-confirm.scr
IMAGES_EN+= install/pkg-install.scr
IMAGES_EN+= install/pkg-sel.scr
IMAGES_EN+= install/probstart.scr
IMAGES_EN+= install/routed.scr
IMAGES_EN+= install/security.scr
IMAGES_EN+= install/sysinstall-exit.scr
IMAGES_EN+= install/timezone1.scr
IMAGES_EN+= install/timezone2.scr
IMAGES_EN+= install/timezone3.scr
IMAGES_EN+= install/userconfig.scr
IMAGES_EN+= install/userconfig2.scr
IMAGES_EN+= install/xf86setup.scr
IMAGES_EN+= mail/mutt1.scr
IMAGES_EN+= mail/mutt2.scr
IMAGES_EN+= mail/mutt3.scr
IMAGES_EN+= mail/pine1.scr
IMAGES_EN+= mail/pine2.scr
IMAGES_EN+= mail/pine3.scr
IMAGES_EN+= mail/pine4.scr
IMAGES_EN+= mail/pine5.scr
IMAGES_EN+= install/example-dir1.eps
IMAGES_EN+= install/example-dir2.eps
IMAGES_EN+= install/example-dir3.eps
IMAGES_EN+= install/example-dir4.eps
IMAGES_EN+= install/example-dir5.eps
IMAGES_EN+= security/ipsec-network.pic
IMAGES_EN+= security/ipsec-crypt-pkt.pic
IMAGES_EN+= security/ipsec-encap-pkt.pic
IMAGES_EN+= security/ipsec-out-pkt.pic
IMAGES_EN+= vinum/vinum-concat.pic
IMAGES_EN+= vinum/vinum-mirrored-vol.pic
IMAGES_EN+= vinum/vinum-raid10-vol.pic
IMAGES_EN+= vinum/vinum-raid5-org.pic
IMAGES_EN+= vinum/vinum-simple-vol.pic
IMAGES_EN+= vinum/vinum-striped-vol.pic
IMAGES_EN+= vinum/vinum-striped.pic
# Images from the cross-document image library
IMAGES_LIB= callouts/1.png
IMAGES_LIB+= callouts/2.png
IMAGES_LIB+= callouts/3.png
IMAGES_LIB+= callouts/4.png
IMAGES_LIB+= callouts/5.png
IMAGES_LIB+= callouts/6.png
IMAGES_LIB+= callouts/7.png
IMAGES_LIB+= callouts/8.png
IMAGES_LIB+= callouts/9.png
IMAGES_LIB+= callouts/10.png
#
# SRCS lists the individual SGML files that make up the document. Changes
# to any of these files will force a rebuild
#
# SGML content
SRCS+= audit/chapter.sgml
SRCS+= book.sgml
SRCS+= colophon.sgml
SRCS+= freebsd-glossary.sgml
SRCS+= advanced-networking/chapter.sgml
SRCS+= basics/chapter.sgml
SRCS+= bibliography/chapter.sgml
SRCS+= boot/chapter.sgml
SRCS+= config/chapter.sgml
SRCS+= cutting-edge/chapter.sgml
SRCS+= desktop/chapter.sgml
SRCS+= disks/chapter.sgml
SRCS+= eresources/chapter.sgml
SRCS+= firewalls/chapter.sgml
SRCS+= geom/chapter.sgml
SRCS+= install/chapter.sgml
SRCS+= introduction/chapter.sgml
SRCS+= kernelconfig/chapter.sgml
SRCS+= l10n/chapter.sgml
SRCS+= linuxemu/chapter.sgml
SRCS+= mac/chapter.sgml
SRCS+= mail/chapter.sgml
SRCS+= mirrors/chapter.sgml
SRCS+= multimedia/chapter.sgml
SRCS+= network-servers/chapter.sgml
SRCS+= pgpkeys/chapter.sgml
SRCS+= ports/chapter.sgml
SRCS+= ppp-and-slip/chapter.sgml
SRCS+= preface/preface.sgml
SRCS+= printing/chapter.sgml
SRCS+= security/chapter.sgml
SRCS+= serialcomms/chapter.sgml
SRCS+= users/chapter.sgml
SRCS+= vinum/chapter.sgml
SRCS+= x11/chapter.sgml
# Entities
SRCS+= chapters.ent
SYMLINKS= ${DESTDIR} index.html handbook.html
# Turn on all the chapters.
CHAPTERS?= ${SRCS:M*chapter.sgml}
SGMLFLAGS+= ${CHAPTERS:S/\/chapter.sgml//:S/^/-i chap./}
SGMLFLAGS+= -i chap.freebsd-glossary
# XXX The Handbook build currently overflows some internal, hardcoded
# limits in pdftex. Until we split the Handbook up, build the PDF
# version using ps2pdf instead of pdftex.
PS2PDF?= ${PREFIX}/bin/ps2pdf
book.tex-pdf:
${TOUCH} book.tex-pdf
book.pdf: book.ps
${PS2PDF} book.ps book.pdf
pgpkeyring: pgpkeys/chapter.sgml
@${JADE} -V nochunks ${OTHERFLAGS} ${JADEOPTS} -d ${DSLPGP} -t sgml ${MASTERDOC}
#
# Handbook-specific variables
#
.if defined(WITH_PGPKEYS)
JADEFLAGS+= -V withpgpkeys
.endif
URL_RELPREFIX?= ../../../..
DOC_PREFIX?= ${.CURDIR}/../../..
#
# rules generating lists of mirror site from XML database.
#
XMLDOCS= mirrors-ftp:::mirrors.sgml.ftp.inc.tmp \
mirrors-cvsup:::mirrors.sgml.cvsup.inc.tmp \
eresources:::eresources.sgml.www.inc.tmp
DEPENDSET.DEFAULT= transtable mirror
XSLT.DEFAULT= ${XSL_MIRRORS}
XML.DEFAULT= ${XML_MIRRORS}
NO_TIDY.DEFAULT= yes
PARAMS.mirrors-ftp+= --param 'type' "'ftp'" \
--param 'proto' "'ftp'" \
--param 'target' "'handbook/mirrors/chapter.sgml'"
PARAMS.mirrors-cvsup+= --param 'type' "'cvsup'" \
--param 'proto' "'cvsup'" \
--param 'target' "'handbook/mirrors/chapter.sgml'"
PARAMS.eresources+= --param 'type' "'www'" \
--param 'proto' "'http'" \
--param 'target' "'handbook/eresources/chapter.sgml'"
SRCS+= mirrors.sgml.ftp.inc \
mirrors.sgml.cvsup.inc \
eresources.sgml.www.inc
CLEANFILES+= mirrors.sgml.ftp.inc mirrors.sgml.ftp.inc.tmp \
mirrors.sgml.cvsup.inc mirrors.sgml.cvsup.inc.tmp \
eresources.sgml.www.inc eresources.sgml.www.inc.tmp
.include "${DOC_PREFIX}/share/mk/doc.project.mk"
.for p in ftp cvsup
mirrors.sgml.${p}.inc: mirrors.sgml.${p}.inc.tmp
${SED} -e 's,<\([^ >]*\)\([^>]*\)/>,<\1\2></\1>,;s,</anchor>,,'\
< $@.tmp > $@ || (${RM} -f $@ && false)
.endfor
eresources.sgml.www.inc: eresources.sgml.www.inc.tmp
${SED} -e 's,<\([^ >]*\)\([^>]*\)/>,<\1\2></\1>,;s,</anchor>,,'\
< $@.tmp > $@ || (${RM} -f $@ && false)

View file

@ -0,0 +1,15 @@
#
# Build the Handbook with just the content from this chapter.
#
# $FreeBSD$
#
CHAPTERS= advanced-networking/chapter.sgml
VPATH= ..
MASTERDOC= ${.CURDIR}/../${DOC}.${DOCBOOKSUFFIX}
DOC_PREFIX?= ${.CURDIR}/../../../..
.include "../Makefile"

File diff suppressed because it is too large Load diff

View file

@ -0,0 +1,2 @@
<!-- $FreeBSD$ -->
<!DOCTYPE appendix PUBLIC "-//FreeBSD//DTD DocBook V3.1-Based Extension//EN">

View file

@ -0,0 +1,15 @@
#
# Build the Handbook with just the content from this chapter.
#
# $FreeBSD$
#
CHAPTERS= audit/chapter.sgml
VPATH= ..
MASTERDOC= ${.CURDIR}/../${DOC}.${DOCBOOKSUFFIX}
DOC_PREFIX?= ${.CURDIR}/../../../..
.include "../Makefile"

View file

@ -0,0 +1,530 @@
<!--
The FreeBSD Documentation Project
$FreeBSD$
-->
<!--
This version of the document assumes that the Audit system needs to be
installed as part of the trustedbsd/audit project. When/if audit becomes
part of FreeBSD proper, then these sections should be removed, or at least
reworded. The sections in question are marked with 'PROTOTYPE' labels in
commentary.
-->
<!-- Need more documenation on praudit, audtreduce, etc. Plus more info
on the triggers from the kernel (log rotation, out of space, etc).
And the /dev/audit special file if we choose to support that. Could use
some coverage of integrating MAC with Event auditing and perhaps discussion
on how some companies or organizations handle auditing and auditing
requirements. -->
<chapter id="audit">
<chapterinfo>
<authorgroup>
<author>
<firstname>Tom</firstname>
<surname>Rhodes</surname>
<contrib>Written by </contrib>
</author>
</authorgroup>
</chapterinfo>
<title>Kernel Event Auditing</title>
<sect1 id="audit-synopsis">
<title>Synopsis</title>
<indexterm><primary>AUDIT</primary></indexterm>
<indexterm>
<primary>Kernel Event Auditing</primary>
<see>MAC</see>
</indexterm>
<para>The &os;&nbsp;6.0 operating system release has included
support for Event Auditing based on the &posix;.1e draft and
the &sun; <acronym>BSM</acronym> implementation. Event auditing
permits the selective logging of security-relevant system events
for the purposes of system analysis, system monitoring, and
security evaluation.</para>
<para>This chapter will focus mainly on the installation and
configuration of Event Auditing. Explanation of audit policies,
and an example configuration will be provided for the
convenience of the reader.</para>
<para>After reading this chapter, you will know:</para>
<itemizedlist>
<listitem>
<para>What Event Auditing is and how it works.</para>
</listitem>
<listitem>
<para>How to configure Event Auditing on &os; for users
and processes.</para>
</listitem>
</itemizedlist>
<para>Before reading this chapter, you should:</para>
<itemizedlist>
<listitem>
<para>Understand &unix; and &os; basics
(<xref linkend="basics">).</para>
</listitem>
<listitem>
<para>Be familiar with the basics of kernel
configuration/compilation
(<xref linkend="kernelconfig">).</para>
</listitem>
<listitem>
<para>Have some familiarity with security and how it
pertains to &os; (<xref linkend="security">).</para>
</listitem>
</itemizedlist>
<warning>
<para>Event auditing can generate a great deal of log file
data, exceeding gigabytes a week in some configurations. An administrator
should read this chapter in its entirety to avoid possible
self inflicted <acronym>DoS</acronym> attacks due to improper
configuration.</para>
</warning>
<para>The implementation of Event Auditing in &os; is similar to
that of the &sun; Basic Security Module, or <acronym>BSM</acronym>
library. Thus, the configuration is almost completely
interchangeable with &solaris; and Darwin operating systems.</para>
</sect1>
<sect1 id="audit-inline-glossary">
<title>Key Terms - Words to Know</title>
<para>Before reading this chapter, a few key terms must be
explained. This is intended to clear up any confusion that
may occur and to avoid the abrupt introduction of new terms
and information.</para>
<itemizedlist>
<listitem>
<para><emphasis>class</emphasis>: A class specifies the category
different actions the system are placed in. For example,
use of &man.login.1; could be placed in a class.</para>
</listitem>
<listitem>
<para><emphasis>event</emphasis>: An event could be considered
an action taken on the system. Creating a file would be
an event.</para>
</listitem>
<listitem>
<para><emphasis>record</emphasis>: A record is a log or a note
about a specific action.</para>
</listitem>
<listitem>
<para><emphasis>prefix</emphasis>: A prefix is considered to
be the configuration element used to toggle auditing for
success and failed events.</para>
</listitem>
</itemizedlist>
</sect1>
<sect1 id="audit-install">
<title>Installing Audit Support</title>
<para>Support for Event Auditing should have been installed with
the normal <maketarget>installworld</maketarget> process. An
administrator may confirm this by viewing the contents
of <filename role="directory">/etc/security</filename>. Files
beginning with the word <emphasis>audit</emphasis> should be present.
For example, <filename>audit_event</filename>.</para>
<para>In-kernel support for the framework must also exist. This
may be done by adding the following lines to the local kernel
configuration file:</para>
<programlisting>options AUDIT</programlisting>
<para>Rebuild and reinstall
the kernel via the normal process explained in
<xref linkend="kernelconfig">.</para>
<para>Once completed, enable the audit daemon by adding the
following line to &man.rc.conf.5;:</para>
<programlisting>auditd_enable="YES"</programlisting>
<para>Functionality not provided by the default may be added
here with the <option>auditd_flags</option> option.</para>
</sect1>
<sect1 id="audit-config">
<title>Audit Configuration</title>
<para>By default, all configuration is done within the realm of
<filename role="directory">/etc/security</filename> and the
files contained within. The following files must be present
before the audit daemon is started:</para>
<itemizedlist>
<listitem>
<para><filename>audit_class</filename> - Contains the
definitions of the audit classes.</para>
</listitem>
<listitem>
<para><filename>audit_control</filename> - Controls aspects
of the audit subsystem, such as default audit classes,
minimum disk space to leave on the audit log volume,
etc.</para>
</listitem>
<listitem>
<para><filename>audit_event</filename> - Defines the kernel
audit events. These map, mostly, to system calls.</para>
</listitem>
<listitem>
<para><filename>audit_user</filename> - The events to audit
for individual users. A user name does not need to appear
in here.</para>
</listitem>
<listitem>
<para><filename>audit_warn</filename> - A shell script
used by auditd to form warning messages.</para>
</listitem>
</itemizedlist>
<para>If these files do not exist, for whatever reason, they can
be installed easily by issuing the following commands:</para>
<screen>&prompt.root; <userinput>cd /usr/src/contrib/bsm/etc &amp;&amp; make install</userinput></screen>
<sect2>
<title>Audit File Syntax</title>
<para>The configuration file syntax is rather arcane, albeit easy
to work with. One thing an administrator must be leery about
is overriding system defaults. This could create potential
openings for audit data to not be collected properly.</para>
<para>The audit subsystem will accept both the short name and
long name with regards to configuration syntax. A syntax
map has been included below.</para>
<para>The following list contains all supported audit
classes:</para>
<itemizedlist>
<listitem>
<para><option>all</option> - <literal>all</literal> - All
audit flags set.</para>
</listitem>
<listitem>
<para><option>ad</option> - <literal>administrative</literal>
- Administrative actions performed on the system as a
whole.</para>
</listitem>
<listitem>
<para><option>ap</option> - <literal>application</literal> -
Application defined action.</para>
</listitem>
<listitem>
<para><option>cl</option> - <literal>file_close</literal> -
Audit calls to the <function>close</function> system
call.</para>
</listitem>
<listitem>
<para><option>ex</option> - <literal>exec</literal> - Audit
program or utility execution.</para>
</listitem>
<listitem>
<para><option>fa</option> - <literal>file_attr_acc</literal>
- Audit the access of object attributes such as
&man.stat.1;, &man.pathconf.2; and similar events.</para>
</listitem>
<listitem>
<para><option>fc</option> - <literal>file_creation</literal>
- Audit events where a file is created as a result.</para>
</listitem>
<listitem>
<para><option>fd</option> - <literal>file_deletion</literal>
- Audit events where file deletion occurs.</para>
</listitem>
<listitem>
<para><option>fm</option> - <literal>file_attr_mod</literal>
- Audit events where file attribute modification occurs,
such as &man.chown.8;, &man.chflags.1;, &man.flock.2;,
etc.</para>
</listitem>
<listitem>
<para><option>fr</option> - <literal>file_read</literal>
- Audit events in which data is read, files are opened for
reading, etc.</para>
</listitem>
<listitem>
<para><option>fw</option> - <literal>file_write</literal> -
Audit events in which data is written, files are written
or modified, etc.</para>
</listitem>
<listitem>
<para><option>io</option> - <literal>ioctl</literal> - Audit
use of the &man.ioctl.2; system call.</para>
</listitem>
<listitem>
<para><option>ip</option> - <literal>ipc</literal> - Audit
System V <acronym>IPC</acronym> operations.</para>
</listitem>
<listitem>
<para><option>lo</option> - <literal>login_logout</literal> -
Audit &man.login.1; and &man.logout.1; events occurring
on the system.</para>
</listitem>
<listitem>
<para><option>na</option> - <literal>non_attrib</literal> -
Audit non-attributable events.</para>
</listitem>
<listitem>
<para><option>no</option> - <literal>no_class</literal> -
Null class used to disable event auditing.</para>
</listitem>
<listitem>
<para><option>nt</option> - <literal>network</literal> -
Audit events related to network actions, such as
&man.connect.2; and &man.accept.2;.</para>
</listitem>
<listitem>
<para><option>ot</option> - <literal>other</literal> -
Audit miscellaneous events.</para>
</listitem>
<listitem>
<para><option>pc</option> - <literal>process</literal> -
Audit process operations, such as &man.exec.3; and
&man.exit.3;.</para>
</listitem>
<listitem>
<para><option>tf</option> - <literal>tfm</literal> -
I HAVE NO CLUE!</para>
</listitem>
</itemizedlist>
<para>Following is a list of all supported audit prefixes:</para>
<itemizedlist>
<listitem>
<para><literal>none</literal> - Audit both the success
or failure of an event. For example, just listing a
class will result in the auditing of both success and
failure.</para>
</listitem>
<listitem>
<para><literal>+</literal> - Audit successful events
only.</para>
</listitem>
<listitem>
<para><literal>-</literal> - Audit failed events
only.</para>
</listitem>
</itemizedlist>
<warning>
<para>Using the <option>all</option> class with either the
positive or negative prefix can generate a large amount
of data at an extremely rapid rate.</para>
</warning>
<para>Extra prefixes used to modify the default configuration
values:</para>
<!-- XXX: Perhaps a variable listing here. -->
<itemizedlist>
<listitem>
<para>^- - Disable auditing of failed events.</para>
</listitem>
<listitem>
<para>^+ - Enable auditing of successful events.</para>
</listitem>
<listitem>
<para>^ - Disable auditing of both successful and failed
events.</para>
</listitem>
</itemizedlist>
</sect2>
<sect2>
<title>Configuration Files</title>
<para>Configuration is set in only two files, the first being
<filename>audit_control</filename> and
<filename>audit_user</filename> being the second. The first
is system-wide, controlling every aspect of event auditing
in the system. The latter may be used for fine grained user
auditing.</para>
<sect3 id="audit-auditcontrol">
<title>The <filename>audit_control</filename> File</title>
<para>The <filename>audit_control</filename> contains some basic
defaults that the administrator may wish to modify. Perhaps
even set some new ones. Viewing the contents of this file,
we see the following:</para>
<programlisting>dir:/var/audit
flags:lo,ad,-all,^-fa,^-fc,^-cl
minfree:20
naflags:lo</programlisting>
<para>The <option>dir</option> is used to set the default
directory where audit logs are stored.</para>
<para>The <option>flags</option> is used to set the system-wide
defaults. The current setting,
<option>lo,ad,-all,^-fa,^-fc,^-cl</option> audits all system
&man.login.1; and &man.logout.1; actions, all administrator
actions, all failed events in the system, and finally disable
auditing of failed attempts for <option>fa</option>,
<option>fc</option>, and <option>cl</option>. Even though
the <option>-all</option> turned on the auditing of all
failed attempts, the <option>^-</option> prefix will override
that for the latter options.</para>
<para>Notice that the previous paragraph shows the file is
read from left to right. As such, values further on the
right side may override a previous value specified to
its left.</para>
<para>The <option>minfree</option> option defines the minimum
percentage of free space for audit file systems. This
relates to the file system where audit logs are stored.
For example, if the <option>dir</option> specifies
<filename role="directory">/var/audit</filename> and
<option>minfree</option> is set to twenty (20), warning
messages will be generated when the
<filename role="directory">/var</filename> file system grows
to eighty (80) percent full.</para>
<para>The <option>naflags</option> option specifies audit
flags to be considered non attributable; i.e.: classes of
events which cannot be attributed to a specific user
on the system. This can be overridden with the
<filename>audit_user</filename> configuration file.</para>
</sect3>
<sect3 id="audit-audituser">
<title>The <filename>audit_user</filename> File</title>
<para>The <filename>audit_user</filename> permits the
administrator to map audit specific events to directly
to users. This adds a finer-grained control mechanism
for all system users.</para>
<para>The following is the defaults currently placed in
the <filename>audit_user</filename> file:</para>
<programlisting>root:lo:no
audit:fc:no</programlisting>
<para>Notice how the default is to audit all cases of
<command>login</command>/<command>logout</command>
and disable auditing of all other actions for
<username>root</username>. This configuration
also audits all file creation and disables all
other auditing for the <username>audit</username>
user. While event auditing does not require a special
user exist, some configurations, specifically environments
making use of <acronym>MAC</acronym> may require it.</para>
</sect3>
</sect2>
</sect1>
<sect1 id="audit-administration">
<title>Event Audit Administration</title>
<para>Events from the <command>auditd</command> daemon cannot
be altered or read in plain text. Data is stored and accessed
in a method similar to that of &man.ktrace.1; and &man.kdump.1,
that is, they may only be viewed by dumping them using the
<command>praudit</command> or <command>auditreduce</command>
utilities.</para>
<para>There are two utilities because of different requirements.
For example, the <command>praudit</command> will dump the entire
contents of a specified audit log in plain text. To dump an
audit log in its entirety, use:</para>
<screen>&prompt.root; <userinput>praudit /var/audit/AUDITFILE</userinput></screen>
<para>Where <replaceable>AUDITFILE</replaceable> is the audit log
of viewing choice. Since audit logs may contain enormous
amounts of data, an administrator may prefer to select records
for specific users. This is made possible with the following
command, where <username>trhodes</username> is the user of
choice:</para>
<screen>&prompt.root; <userinput>auditreduce -e trhodes /var/audit/AUDITFILE</userinput></screen>
<para>This will select all audit records produced by the user
<username>trhodes</username> stored in the
<replaceable>AUDITFILE</replaceable> file.</para>
<para>There are several other options available for reading audit
records, see the aforementioned command's manual pages for
a more in depth explanation.</para>
<sect2>
<title>Rotating Audit Log Files</title>
<para>Manually rotating audit log files will cause great
havoc within the system. Therefore, adding a line to
&man.newsyslog.conf.5; will provide no usefulness. So how
are the logs to be rotated? Sending the appropriate flag
to the <command>audit</command> utility will shut down
event auditing and safely rotate. The following command
should handle everything for an administrator:</para>
<screen>&prompt.root; <userinput>audit -n</userinput></screen>
<warning>
<para>If the <command>auditd</command> daemon is not currently
running, the previous command will fail and an error message
will be produced.</para>
</warning>
<para>Adding the following line to
<filename>/etc/crontab</filename> will force the rotation
every twelve hours from &man.cron.8;:</para>
<programlisting>* */12 * * * root /usr/sbin/audit -n</programlisting>
<para>The change will take effect once you have saved the
new <filename>/etc/crontab</filename>.</para>
</sect2>
</sect1>
</chapter>

View file

@ -0,0 +1,15 @@
#
# Build the Handbook with just the content from this chapter.
#
# $FreeBSD$
#
CHAPTERS= basics/chapter.sgml
VPATH= ..
MASTERDOC= ${.CURDIR}/../${DOC}.${DOCBOOKSUFFIX}
DOC_PREFIX?= ${.CURDIR}/../../../..
.include "../Makefile"

File diff suppressed because it is too large Load diff

View file

@ -0,0 +1,7 @@
// $FreeBSD$
digraph directory {
root [label="Root\n/"];
root -> "A1/";
root -> "A2/";
}

View file

@ -0,0 +1,8 @@
// $FreeBSD$
digraph directory {
root [label="Root\n/"];
root -> "A1/" -> "B1/";
"A1/" -> "B2/";
root -> "A2/";
}

View file

@ -0,0 +1,8 @@
// $FreeBSD$
digraph directory {
root [label="Root\n/"];
root -> "A1/";
root -> "A2/" -> "B1/";
"A2/" -> "B2/";
}

View file

@ -0,0 +1,9 @@
// $FreeBSD$
digraph directory {
root [label="Root\n/"];
root -> "A1/";
root -> "A2/" -> "B1/" -> "C1/";
"B1/" -> "C2/";
"A2/" -> "B2/";
}

View file

@ -0,0 +1,9 @@
// $FreeBSD$
digraph directory {
root [label="Root\n/"];
root -> "A1/" -> "C1/";
"A1/" -> "C2/";
root -> "A2/" -> "B1/";
"A2/" -> "B2/";
}

View file

@ -0,0 +1,15 @@
#
# Build the Handbook with just the content from this chapter.
#
# $FreeBSD$
#
CHAPTERS= bibliography/chapter.sgml
VPATH= ..
MASTERDOC= ${.CURDIR}/../${DOC}.${DOCBOOKSUFFIX}
DOC_PREFIX?= ${.CURDIR}/../../../..
.include "../Makefile"

View file

@ -0,0 +1,646 @@
<!--
The FreeBSD Documentation Project
$FreeBSD$
-->
<appendix id="bibliography">
<title>Bibliography</title>
<para>While the manual pages provide the definitive reference for individual
pieces of the FreeBSD operating system, they are notorious for not
illustrating how to put the pieces together to make the whole operating
system run smoothly. For this, there is no substitute for a good book on
&unix; system administration and a good users' manual.</para>
<sect1 id="bibliography-freebsd">
<title>Books &amp; Magazines Specific to FreeBSD</title>
<para><emphasis>International books &amp;
Magazines:</emphasis></para>
<itemizedlist>
<listitem>
<para><ulink
url="http://jdli.tw.FreeBSD.org/publication/book/freebsd2/index.htm">Using FreeBSD</ulink> (in Chinese).</para>
</listitem>
<listitem>
<para>FreeBSD Unleashed (Chinese translation), published by
<ulink url="http://www.hzbook.com/">China Machine
Press</ulink>. ISBN 7-111-10201-0.
</para>
</listitem>
<listitem>
<para>FreeBSD From Scratch First Edition (in Chinese),
published by China Machine Press. ISBN 7-111-07482-3.
</para>
</listitem>
<listitem>
<para>FreeBSD From Scratch Second Edition (in Chinese),
published by China Machine Press. ISBN 7-111-10286-X.
</para>
</listitem>
<listitem>
<para>FreeBSD Handbook (Chinese translation), published by
<ulink url="http://www.ptpress.com.cn/">Posts &amp; Telecom
Press</ulink>. ISBN 7-115-10541-3.
</para>
</listitem>
<listitem>
<para>FreeBSD 3.x Internet (in Chinese), published by
<ulink url="http://www.tup.tsinghua.edu.cn/">Tsinghua
University Press</ulink>. ISBN 7-900625-66-6.</para>
</listitem>
<listitem>
<para>FreeBSD &amp; Windows (in Chinese), ISBN 7-113-03845-X</para>
</listitem>
<listitem>
<para>FreeBSD Internet Services HOWTO (in Chinese), ISBN 7-113-03423-3</para>
</listitem>
<listitem>
<para>FreeBSD for PC 98'ers (in Japanese), published by SHUWA System
Co, LTD. ISBN 4-87966-468-5 C3055 P2900E.</para>
</listitem>
<listitem>
<para>FreeBSD (in Japanese), published by CUTT. ISBN 4-906391-22-2
C3055 P2400E.</para>
</listitem>
<listitem>
<para><ulink
url="http://www.shoeisha.com/book/Detail.asp?bid=650">Complete Introduction to FreeBSD</ulink> (in Japanese), published by <ulink url="http://www.shoeisha.co.jp/">Shoeisha Co., Ltd</ulink>. ISBN 4-88135-473-6 P3600E.</para>
</listitem>
<listitem>
<para><ulink
url="http://www.ascii.co.jp/pb/book1/shinkan/detail/1322785.html">Personal UNIX Starter Kit FreeBSD</ulink> (in Japanese), published by <ulink url="http://www.ascii.co.jp/">ASCII</ulink>. ISBN 4-7561-1733-3 P3000E.</para>
</listitem>
<listitem>
<para>FreeBSD Handbook (Japanese translation), published by <ulink
url="http://www.ascii.co.jp/">ASCII</ulink>. ISBN 4-7561-1580-2
P3800E.</para>
</listitem>
<listitem>
<para>FreeBSD mit Methode (in German), published by <ulink url="http://www.cul.de">Computer und
Literatur Verlag</ulink>/Vertrieb Hanser, 1998. ISBN 3-932311-31-0.</para>
</listitem>
<listitem>
<para><ulink
url="http://www.cul.de/freebsd.html">FreeBSD 4 - Installieren, Konfigurieren, Administrieren</ulink>
(in German), published by <ulink url="http://www.cul.de">Computer und Literatur Verlag</ulink>, 2001.
ISBN 3-932311-88-4.</para>
</listitem>
<listitem>
<para><ulink
url="http://www.cul.de/freebsd.html">FreeBSD 5 - Installieren, Konfigurieren, Administrieren</ulink>
(in German), published by <ulink url="http://www.cul.de">Computer und Literatur Verlag</ulink>, 2003.
ISBN 3-936546-06-1.</para>
</listitem>
<listitem>
<para><ulink url="http://www.mitp.de/vmi/mitp/detail/pWert/1343/">
FreeBSD de Luxe</ulink> (in German), published by
<ulink url="http://www.mitp.de">Verlag Modere Industrie</ulink>,
2003. ISBN 3-8266-1343-0.
</para>
</listitem>
<listitem>
<para><ulink
url="http://www.pc.mycom.co.jp/FreeBSD/install-manual.html">FreeBSD Install and Utilization Manual</ulink> (in Japanese), published by <ulink url="http://www.pc.mycom.co.jp/">Mainichi Communications Inc.</ulink>.</para>
</listitem>
<listitem>
<para>Onno W Purbo, Dodi Maryanto, Syahrial Hubbany, Widjil Widodo
<emphasis><ulink url="http://maxwell.itb.ac.id/">
Building Internet Server with
FreeBSD</ulink></emphasis> (in Indonesia Language), published
by <ulink url="http://www.elexmedia.co.id/">Elex Media Komputindo</ulink>.</para>
</listitem>
</itemizedlist>
<para><emphasis>English language books &amp; Magazines:</emphasis></para>
<itemizedlist>
<listitem>
<para><ulink url="http://www.AbsoluteBSD.com/">Absolute
BSD: The Ultimate Guide to FreeBSD</ulink>, published by
<ulink url="http://www.nostarch.com/">No Starch Press</ulink>, 2002.
ISBN: 1886411743</para>
</listitem>
<listitem>
<para><ulink
url="http://www.freebsdmall.com/cgi-bin/fm/bsdcomp">
The Complete FreeBSD</ulink>, published by
<ulink url="http://www.oreilly.com/">O'Reilly</ulink>, 2003.
ISBN: 0596005164</para>
</listitem>
<listitem>
<para><ulink url="http://www.freebsd-corp-net-guide.com/">The
FreeBSD Corporate Networker's Guide</ulink>, published by
<ulink url="http://www.awl.com/aw/">Addison-Wesley</ulink>, 2000.
ISBN: 0201704811</para>
</listitem>
<listitem>
<para><ulink url="http://andrsn.stanford.edu/FreeBSD/introbook/">
FreeBSD: An Open-Source Operating System for Your Personal
Computer</ulink>, published by The Bit Tree Press, 2001.
ISBN: 0971204500</para>
</listitem>
<listitem>
<para>Teach Yourself FreeBSD in 24 Hours, published by
<ulink url="http://www.samspublishing.com/">Sams</ulink>, 2002.
ISBN: 0672324245</para>
</listitem>
<listitem>
<para>FreeBSD unleashed, published by
<ulink url="http://www.samspublishing.com/">Sams</ulink>, 2002.
ISBN: 0672324563</para>
</listitem>
<listitem>
<para>FreeBSD: The Complete Reference, published by
<ulink url="http://books.mcgraw-hill.com">McGrawHill</ulink>, 2003.
ISBN: 0072224096 </para>
</listitem>
</itemizedlist>
</sect1>
<sect1 id="bibliography-userguides">
<title>Users' Guides</title>
<itemizedlist>
<listitem>
<para>Computer Systems Research Group, UC Berkeley. <emphasis>4.4BSD
User's Reference Manual</emphasis>. O'Reilly &amp; Associates,
Inc., 1994. ISBN 1-56592-075-9</para>
</listitem>
<listitem>
<para>Computer Systems Research Group, UC Berkeley. <emphasis>4.4BSD
User's Supplementary Documents</emphasis>. O'Reilly &amp;
Associates, Inc., 1994. ISBN 1-56592-076-7</para>
</listitem>
<listitem>
<para><emphasis>UNIX in a Nutshell</emphasis>. O'Reilly &amp;
Associates, Inc., 1990. ISBN 093717520X</para>
</listitem>
<listitem>
<para>Mui, Linda. <emphasis>What You Need To Know When You Can't Find
Your UNIX System Administrator</emphasis>. O'Reilly &amp;
Associates, Inc., 1995. ISBN 1-56592-104-6</para>
</listitem>
<listitem>
<para><ulink url="http://www-wks.acs.ohio-state.edu/">Ohio State
University</ulink> has written a <ulink
url="http://www-wks.acs.ohio-state.edu/unix_course/unix.html">UNIX
Introductory Course</ulink> which is available online in HTML and
PostScript format.</para>
<para>An Italian <ulink
url="&url.doc.base;/it_IT.ISO8859-15/books/unix-introduction/index.html">translation</ulink>
of this document is available as part of the FreeBSD Italian
Documentation Project.</para>
</listitem>
<listitem>
<para><ulink url="http://www.jp.FreeBSD.org/">Jpman Project, Japan
FreeBSD Users Group</ulink>. <ulink
url="http://www.pc.mycom.co.jp/FreeBSD/urm.html">FreeBSD User's
Reference Manual</ulink> (Japanese translation). <ulink
url="http://www.pc.mycom.co.jp/">Mainichi Communications
Inc.</ulink>, 1998. ISBN4-8399-0088-4 P3800E.</para>
</listitem>
<listitem>
<para><ulink url="http://www.ed.ac.uk/">Edinburgh
University</ulink> has written an <ulink
url="http://unixhelp.ed.ac.uk/">Online Guide</ulink> for
newcomers to the UNIX environment.</para>
</listitem>
</itemizedlist>
</sect1>
<sect1 id="bibliography-adminguides">
<title>Administrators' Guides</title>
<itemizedlist>
<listitem>
<para>Albitz, Paul and Liu, Cricket. <emphasis>DNS and
BIND</emphasis>, 4th Ed. O'Reilly &amp; Associates, Inc., 2001.
ISBN 1-59600-158-4</para>
</listitem>
<listitem>
<para>Computer Systems Research Group, UC Berkeley. <emphasis>4.4BSD
System Manager's Manual</emphasis>. O'Reilly &amp; Associates,
Inc., 1994. ISBN 1-56592-080-5</para>
</listitem>
<listitem>
<para>Costales, Brian, et al. <emphasis>Sendmail</emphasis>, 2nd Ed.
O'Reilly &amp; Associates, Inc., 1997. ISBN 1-56592-222-0</para>
</listitem>
<listitem>
<para>Frisch, &AElig;leen. <emphasis>Essential System
Administration</emphasis>, 2nd Ed. O'Reilly &amp; Associates,
Inc., 1995. ISBN 1-56592-127-5</para>
</listitem>
<listitem>
<para>Hunt, Craig. <emphasis>TCP/IP Network
Administration</emphasis>, 2nd Ed. O'Reilly &amp; Associates, Inc., 1997.
ISBN 1-56592-322-7</para>
</listitem>
<listitem>
<para>Nemeth, Evi. <emphasis>UNIX System Administration
Handbook</emphasis>. 3rd Ed. Prentice Hall, 2000. ISBN
0-13-020601-6</para>
</listitem>
<listitem>
<para>Stern, Hal <emphasis>Managing NFS and NIS</emphasis> O'Reilly
&amp; Associates, Inc., 1991. ISBN 0-937175-75-7</para>
</listitem>
<listitem>
<para><ulink url="http://www.jp.FreeBSD.org/">Jpman Project, Japan
FreeBSD Users Group</ulink>. <ulink
url="http://www.pc.mycom.co.jp/FreeBSD/sam.html">FreeBSD System
Administrator's Manual</ulink> (Japanese translation). <ulink
url="http://www.pc.mycom.co.jp/">Mainichi Communications
Inc.</ulink>, 1998. ISBN4-8399-0109-0 P3300E.</para>
</listitem>
<listitem>
<para>Dreyfus, Emmanuel. <ulink
url="http://www.eyrolles.com/Informatique/Livre/9782212114638/">Cahiers
de l'Admin: BSD</ulink> 2nd Ed. (in French), Eyrolles, 2004.
ISBN 2-212-11463-X</para>
</listitem>
</itemizedlist>
</sect1>
<sect1 id="bibliography-programmers">
<title>Programmers' Guides</title>
<itemizedlist>
<listitem>
<para>Asente, Paul, Converse, Diana, and Swick, Ralph.
<emphasis>X Window System Toolkit</emphasis>. Digital Press,
1998. ISBN 1-55558-178-1</para>
</listitem>
<listitem>
<para>Computer Systems Research Group, UC Berkeley. <emphasis>4.4BSD
Programmer's Reference Manual</emphasis>. O'Reilly &amp;
Associates, Inc., 1994. ISBN 1-56592-078-3</para>
</listitem>
<listitem>
<para>Computer Systems Research Group, UC Berkeley. <emphasis>4.4BSD
Programmer's Supplementary Documents</emphasis>. O'Reilly &amp;
Associates, Inc., 1994. ISBN 1-56592-079-1</para>
</listitem>
<listitem>
<para>Harbison, Samuel P. and Steele, Guy L. Jr. <emphasis>C: A
Reference Manual</emphasis>. 4th ed. Prentice Hall, 1995.
ISBN 0-13-326224-3</para>
</listitem>
<listitem>
<para>Kernighan, Brian and Dennis M. Ritchie. <emphasis>The C
Programming Language</emphasis>. 2nd Ed. PTR Prentice Hall, 1988.
ISBN 0-13-110362-8</para>
</listitem>
<listitem>
<para>Lehey, Greg. <emphasis>Porting UNIX Software</emphasis>.
O'Reilly &amp; Associates, Inc., 1995. ISBN 1-56592-126-7</para>
</listitem>
<listitem>
<para>Plauger, P. J. <emphasis>The Standard C Library</emphasis>.
Prentice Hall, 1992. ISBN 0-13-131509-9</para>
</listitem>
<listitem>
<para>Spinellis, Diomidis. <ulink
url="http://www.spinellis.gr/codereading/"><emphasis>Code
Reading: The Open Source Perspective</emphasis></ulink>.
Addison-Wesley, 2003. ISBN 0-201-79940-5</para>
</listitem>
<listitem>
<para>Stevens, W. Richard. <emphasis>Advanced Programming in the UNIX
Environment</emphasis>. Reading, Mass. : Addison-Wesley, 1992.
ISBN 0-201-56317-7</para>
</listitem>
<listitem>
<para>Stevens, W. Richard. <emphasis>UNIX Network
Programming</emphasis>. 2nd Ed, PTR Prentice Hall, 1998. ISBN
0-13-490012-X</para>
</listitem>
<listitem>
<para>Wells, Bill. <quote>Writing Serial Drivers for UNIX</quote>.
<emphasis>Dr. Dobb's Journal</emphasis>. 19(15), December 1994.
pp68-71, 97-99.</para>
</listitem>
</itemizedlist>
</sect1>
<sect1 id="bibliography-osinternals">
<title>Operating System Internals</title>
<itemizedlist>
<listitem>
<para>Andleigh, Prabhat K. <emphasis>UNIX System
Architecture</emphasis>. Prentice-Hall, Inc., 1990. ISBN
0-13-949843-5</para>
</listitem>
<listitem>
<para>Jolitz, William. <quote>Porting UNIX to the 386</quote>.
<emphasis>Dr. Dobb's Journal</emphasis>. January 1991-July
1992.</para>
</listitem>
<listitem>
<para>Leffler, Samuel J., Marshall Kirk McKusick, Michael J Karels and
John Quarterman <emphasis>The Design and Implementation of the
4.3BSD UNIX Operating System</emphasis>. Reading, Mass. :
Addison-Wesley, 1989. ISBN 0-201-06196-1</para>
</listitem>
<listitem>
<para>Leffler, Samuel J., Marshall Kirk McKusick, <emphasis>The Design
and Implementation of the 4.3BSD UNIX Operating System: Answer
Book</emphasis>. Reading, Mass. : Addison-Wesley, 1991. ISBN
0-201-54629-9</para>
</listitem>
<listitem>
<para>McKusick, Marshall Kirk, Keith Bostic, Michael J Karels, and
John Quarterman. <emphasis>The Design and Implementation of the
4.4BSD Operating System</emphasis>. Reading, Mass. :
Addison-Wesley, 1996. ISBN 0-201-54979-4</para>
<para>(Chapter 2 of this book is available <ulink
url="&url.books.design-44bsd;/book.html">online</ulink> as part of
the FreeBSD Documentation Project, and chapter 9 <ulink
url="http://www.netapp.com/tech_library/nfsbook.html">
here</ulink>.)</para>
</listitem>
<listitem>
<para>Marshall Kirk McKusick, George V. Neville-Neil <emphasis>The Design
and Implementation of the FreeBSD Operating System</emphasis>.
Boston, Mass. : Addison-Wesley, 2004. ISBN 0-201-70245-2</para>
</listitem>
<listitem>
<para>Stevens, W. Richard. <emphasis>TCP/IP Illustrated, Volume 1:
The Protocols</emphasis>. Reading, Mass. : Addison-Wesley,
1996. ISBN 0-201-63346-9</para>
</listitem>
<listitem>
<para>Schimmel, Curt. <emphasis>Unix Systems for Modern
Architectures</emphasis>. Reading, Mass. : Addison-Wesley, 1994.
ISBN 0-201-63338-8</para>
</listitem>
<listitem>
<para>Stevens, W. Richard. <emphasis>TCP/IP Illustrated, Volume 3:
TCP for Transactions, HTTP, NNTP and the UNIX Domain
Protocols</emphasis>. Reading, Mass. : Addison-Wesley, 1996.
ISBN 0-201-63495-3</para>
</listitem>
<listitem>
<para>Vahalia, Uresh. <emphasis>UNIX Internals -- The New
Frontiers</emphasis>. Prentice Hall, 1996. ISBN
0-13-101908-2</para>
</listitem>
<listitem>
<para>Wright, Gary R. and W. Richard Stevens. <emphasis>TCP/IP
Illustrated, Volume 2: The Implementation</emphasis>. Reading,
Mass. : Addison-Wesley, 1995. ISBN 0-201-63354-X</para>
</listitem>
</itemizedlist>
</sect1>
<sect1 id="bibliography-security">
<title>Security Reference</title>
<itemizedlist>
<listitem>
<para>Cheswick, William R. and Steven M. Bellovin. <emphasis>Firewalls
and Internet Security: Repelling the Wily Hacker</emphasis>.
Reading, Mass. : Addison-Wesley, 1995. ISBN
0-201-63357-4</para>
</listitem>
<listitem>
<para>Garfinkel, Simson and Gene Spafford.
<emphasis>Practical UNIX &amp; Internet Security</emphasis>.
2nd Ed. O'Reilly &amp; Associates, Inc., 1996. ISBN
1-56592-148-8</para>
</listitem>
<listitem>
<para>Garfinkel, Simson. <emphasis>PGP Pretty Good
Privacy</emphasis> O'Reilly &amp; Associates, Inc., 1995. ISBN
1-56592-098-8</para>
</listitem>
</itemizedlist>
</sect1>
<sect1 id="bibliography-hardware">
<title>Hardware Reference</title>
<itemizedlist>
<listitem>
<para>Anderson, Don and Tom Shanley. <emphasis>Pentium Processor
System Architecture</emphasis>. 2nd Ed. Reading, Mass. :
Addison-Wesley, 1995. ISBN 0-201-40992-5</para>
</listitem>
<listitem>
<para>Ferraro, Richard F. <emphasis>Programmer's Guide to the EGA,
VGA, and Super VGA Cards</emphasis>. 3rd ed. Reading, Mass. :
Addison-Wesley, 1995. ISBN 0-201-62490-7</para>
</listitem>
<listitem>
<para>Intel Corporation publishes documentation on their CPUs,
chipsets and standards on their <ulink
url="http://developer.intel.com/">developer web site</ulink>,
usually as PDF files.</para>
</listitem>
<listitem>
<para>Shanley, Tom. <emphasis>80486 System Architecture</emphasis>.
3rd ed. Reading, Mass. : Addison-Wesley, 1995. ISBN
0-201-40994-1</para>
</listitem>
<listitem>
<para>Shanley, Tom. <emphasis>ISA System Architecture</emphasis>.
3rd ed. Reading, Mass. : Addison-Wesley, 1995. ISBN
0-201-40996-8</para>
</listitem>
<listitem>
<para>Shanley, Tom. <emphasis>PCI System Architecture</emphasis>.
4th ed. Reading, Mass. : Addison-Wesley, 1999. ISBN
0-201-30974-2</para>
</listitem>
<listitem>
<para>Van Gilluwe, Frank. <emphasis>The Undocumented PC</emphasis>, 2nd Ed.
Reading, Mass: Addison-Wesley Pub. Co., 1996. ISBN
0-201-47950-8</para>
</listitem>
<listitem>
<para>Messmer, Hans-Peter. <emphasis>The Indispensable PC Hardware Book</emphasis>, 4th Ed.
Reading, Mass: Addison-Wesley Pub. Co., 2002. ISBN
0-201-59616-4</para>
</listitem>
</itemizedlist>
</sect1>
<sect1 id="bibliography-history">
<title>&unix; History</title>
<itemizedlist>
<listitem>
<para>Lion, John <emphasis>Lion's Commentary on UNIX, 6th Ed. With
Source Code</emphasis>. ITP Media Group, 1996. ISBN
1573980137</para>
</listitem>
<listitem>
<para>Raymond, Eric S. <emphasis>The New Hacker's Dictionary, 3rd
edition</emphasis>. MIT Press, 1996. ISBN
0-262-68092-0. Also known as the <ulink
url="http://www.catb.org/~esr/jargon/html/index.html">Jargon
File</ulink></para>
</listitem>
<listitem>
<para>Salus, Peter H. <emphasis>A quarter century of UNIX</emphasis>.
Addison-Wesley Publishing Company, Inc., 1994. ISBN
0-201-54777-5</para>
</listitem>
<listitem>
<para>Simon Garfinkel, Daniel Weise, Steven Strassmann. <emphasis>The
UNIX-HATERS Handbook</emphasis>. IDG Books Worldwide, Inc.,
1994. ISBN 1-56884-203-1. Out of print, but available <ulink
url="http://research.microsoft.com/~daniel/unix-haters.html">
online</ulink>.</para>
</listitem>
<listitem>
<para>Don Libes, Sandy Ressler <emphasis>Life with UNIX</emphasis>
&mdash; special edition. Prentice-Hall, Inc., 1989. ISBN
0-13-536657-7</para>
</listitem>
<listitem>
<para><emphasis>The BSD family tree</emphasis>.
<ulink url="http://www.FreeBSD.org/cgi/cvsweb.cgi/src/share/misc/bsd-family-tree"></ulink>
or <ulink type="html" url="file://localhost/usr/share/misc/bsd-family-tree"><filename>/usr/share/misc/bsd-family-tree</filename></ulink>
on a FreeBSD machine.</para>
</listitem>
<listitem>
<para><emphasis>The BSD Release Announcements collection</emphasis>.
1997. <ulink url="http://www.de.FreeBSD.org/de/ftp/releases/"></ulink></para>
</listitem>
<listitem>
<para><emphasis>Networked Computer Science Technical Reports
Library</emphasis>. <ulink url="http://www.ncstrl.org/"></ulink></para>
</listitem>
<listitem>
<para><emphasis>Old BSD releases from the Computer Systems Research
group (CSRG)</emphasis>.
<ulink url="http://www.mckusick.com/csrg/"></ulink>:
The 4CD set covers all BSD versions from 1BSD to 4.4BSD and
4.4BSD-Lite2 (but not 2.11BSD, unfortunately). The last
disk also holds the final sources plus the SCCS files.</para>
</listitem>
</itemizedlist>
</sect1>
<sect1 id="bibliography-journals">
<title>Magazines and Journals</title>
<itemizedlist>
<listitem>
<para><emphasis>The C/C++ Users Journal</emphasis>. R&amp;D
Publications Inc. ISSN 1075-2838</para>
</listitem>
<listitem>
<para><emphasis>Sys Admin &mdash; The Journal for UNIX System
Administrators</emphasis> Miller Freeman, Inc., ISSN
1061-2688</para>
</listitem>
<listitem>
<para><emphasis>freeX &mdash; Das Magazin f&uuml;r Linux - BSD - UNIX</emphasis>
(in German) Computer- und Literaturverlag GmbH, ISSN 1436-7033</para>
</listitem>
</itemizedlist>
</sect1>
</appendix>
<!--
Local Variables:
mode: sgml
sgml-declaration: "../appendix.decl"
sgml-indent-data: t
sgml-omittag: nil
sgml-always-quote-attributes: t
sgml-parent-document: ("../book.sgml" "part" "appendix")
End:
-->

View file

@ -0,0 +1,315 @@
<!--
The FreeBSD Documentation Project
$FreeBSD$
-->
<!DOCTYPE BOOK PUBLIC "-//FreeBSD//DTD DocBook V4.1-Based Extension//EN" [
<!ENTITY % books.ent PUBLIC "-//FreeBSD//ENTITIES DocBook FreeBSD Books Entity Set//EN">
%books.ent;
<!ENTITY % chapters SYSTEM "chapters.ent">
%chapters;
<!ENTITY % txtfiles SYSTEM "txtfiles.ent">
%txtfiles;
<!ENTITY % not.published "INCLUDE">
<!ENTITY % chap.introduction "IGNORE">
<!ENTITY % chap.install "IGNORE">
<!ENTITY % chap.basics "IGNORE">
<!ENTITY % chap.ports "IGNORE">
<!ENTITY % chap.config "IGNORE">
<!ENTITY % chap.boot "IGNORE">
<!ENTITY % chap.users "IGNORE">
<!ENTITY % chap.kernelconfig "IGNORE">
<!ENTITY % chap.security "IGNORE">
<!ENTITY % chap.printing "IGNORE">
<!ENTITY % chap.disks "IGNORE">
<!ENTITY % chap.geom "IGNORE">
<!ENTITY % chap.vinum "IGNORE">
<!ENTITY % chap.x11 "IGNORE">
<!ENTITY % chap.l10n "IGNORE">
<!ENTITY % chap.multimedia "IGNORE">
<!ENTITY % chap.desktop "IGNORE">
<!ENTITY % chap.serialcomms "IGNORE">
<!ENTITY % chap.ppp-and-slip "IGNORE">
<!ENTITY % chap.advanced-networking "IGNORE">
<!ENTITY % chap.firewalls "IGNORE">
<!ENTITY % chap.network-servers "IGNORE">
<!ENTITY % chap.mail "IGNORE">
<!ENTITY % chap.cutting-edge "IGNORE">
<!ENTITY % chap.linuxemu "IGNORE">
<!ENTITY % chap.mirrors "IGNORE">
<!ENTITY % chap.bibliography "IGNORE">
<!ENTITY % chap.eresources "IGNORE">
<!ENTITY % chap.pgpkeys "IGNORE">
<!ENTITY % chap.index "IGNORE">
<!ENTITY % chap.freebsd-glossary "IGNORE">
<!ENTITY % chap.mac "IGNORE">
<!ENTITY % pgpkeys SYSTEM "../../../share/pgpkeys/pgpkeys.ent"> %pgpkeys;
]>
<book>
<bookinfo>
<title>FreeBSD 使用手冊</title>
<corpauthor>FreeBSD 文件計畫</corpauthor>
<pubdate>February 1999</pubdate>
<copyright>
<year>1995</year>
<year>1996</year>
<year>1997</year>
<year>1998</year>
<year>1999</year>
<year>2000</year>
<year>2001</year>
<year>2002</year>
<year>2003</year>
<year>2004</year>
<year>2005</year>
<holder>FreeBSD 文件計畫</holder>
</copyright>
&bookinfo.legalnotice;
<legalnotice id="trademarks" role="trademarks">
&tm-attrib.freebsd;
&tm-attrib.3com;
&tm-attrib.3ware;
&tm-attrib.arm;
&tm-attrib.adaptec;
&tm-attrib.adobe;
&tm-attrib.apple;
&tm-attrib.corel;
&tm-attrib.creative;
&tm-attrib.cvsup;
&tm-attrib.heidelberger;
&tm-attrib.ibm;
&tm-attrib.ieee;
&tm-attrib.intel;
&tm-attrib.intuit;
&tm-attrib.linux;
&tm-attrib.lsilogic;
&tm-attrib.m-systems;
&tm-attrib.macromedia;
&tm-attrib.microsoft;
&tm-attrib.netscape;
&tm-attrib.nexthop;
&tm-attrib.opengroup;
&tm-attrib.oracle;
&tm-attrib.powerquest;
&tm-attrib.realnetworks;
&tm-attrib.redhat;
&tm-attrib.sap;
&tm-attrib.sun;
&tm-attrib.symantec;
&tm-attrib.themathworks;
&tm-attrib.thomson;
&tm-attrib.usrobotics;
&tm-attrib.vmware;
&tm-attrib.waterloomaple;
&tm-attrib.wolframresearch;
&tm-attrib.xfree86;
&tm-attrib.xiph;
&tm-attrib.general;
</legalnotice>
<abstract>
<para>歡迎使用FreeBSD 本使用手冊涵蓋範圍包括了
<emphasis>FreeBSD &rel2.current;-RELEASE</emphasis> 和
<emphasis>FreeBSD &rel.current;-RELEASE</emphasis> 的安裝和日常使用。
這份使用手冊是很多人的集體創作,而且仍然『持續不斷』的進行中。
許多章節仍未完成,已完成的部份也有些需要更新。
如果您對協助本計畫的進行有興趣的話,請寄 e-mail 到 &a.doc;。
在 <ulink url="http://www.FreeBSD.org/">FreeBSD 網站</ulink>
可以找到這份文件的最新版本(舊版文件可從 <ulink
url="http://docs.FreeBSD.org/doc/"></ulink> 取得),也可以從 <ulink
url="ftp://ftp.FreeBSD.org/pub/FreeBSD/doc/">FreeBSD FTP 伺服器</ulink>
或是眾多 <link linkend="mirrors-ftp">mirror 站臺</link>
下載不同格式及不同壓縮選項的資料。
如果比較偏好擁有實體書面資料,那可以在
<ulink url="http://www.freebsdmall.com/">FreeBSD Mall</ulink> 購買。
此外,也可以在 <ulink url="&url.base;/search/index.html">使用手冊</ulink>
中搜尋資料。
</para>
</abstract>
</bookinfo>
&chap.preface;
<part id="getting-started">
<title>開始使用 FreeBSD </title>
<partintro>
<para>這部份是提供給初次使用 FreeBSD 的使用者和系統管理者。
這些章節包括:</para>
<itemizedlist>
<listitem>
<para>介紹 FreeBSD 給您。 </para>
</listitem>
<listitem>
<para>在安裝過程給您指引。 </para>
</listitem>
<listitem>
<para>教您 &unix; 的基礎及原理。 </para>
</listitem>
<listitem>
<para>展示給您看如何安裝豐富的 FreeBSD 的應用軟體</para>
</listitem>
<listitem>
<para>向您介紹 X &unix; 的視窗系統以及詳細的桌面環境設定,讓您更有生產力。
</para>
</listitem>
</itemizedlist>
<para>我們試著儘可能的讓這段文字的參考連結數目降到最低,讓您在讀使用手冊的這部份時可以不太需要常常前後翻頁。
</para>
</partintro>
<![ %chap.introduction; [ &chap.introduction; ]]>
<![ %chap.install; [ &chap.install; ]]>
<![ %chap.basics; [ &chap.basics; ]]>
<![ %chap.ports; [ &chap.ports; ]]>
<![ %chap.x11; [ &chap.x11; ]]>
</part>
<part id="common-tasks">
<title>一般性工作</title>
<partintro>
<para>既然基礎的部分已經提過了,接下來的這個部分將會討論一些常會用到的 FreeBSD
的特色,這些章節包括:</para>
<itemizedlist>
<listitem>
<para>介紹給您常見且實用的桌面應用軟體:網頁瀏覽器、生產力工具、文件檢視程式等。</para>
</listitem>
<listitem>
<para>介紹給您眾多 FreeBSD 上可用的多媒體工具。</para>
</listitem>
<listitem>
<para>解釋如何編譯自訂 FreeBSD 核心以增加額外系統功能的流程。</para>
</listitem>
<listitem>
<para>詳細描述列印系統,包含桌上型印表機及網路印表機的設定。</para>
</listitem>
<listitem>
<para>展示給您看如何在您的 FreeBSD 系統中執行 Linux 應用軟體。</para>
</listitem>
</itemizedlist>
<para>這些章節中有些需要您預先閱讀些相關文件,在各章節開頭的概要內會提及。</para>
</partintro>
<![ %chap.desktop; [ &chap.desktop; ]]>
<![ %chap.multimedia; [ &chap.multimedia; ]]>
<![ %chap.kernelconfig; [ &chap.kernelconfig; ]]>
<![ %chap.printing; [ &chap.printing; ]]>
<![ %chap.linuxemu; [ &chap.linuxemu; ]]>
</part>
<part id="system-administration">
<title>系統管理</title>
<partintro>
<para>FreeBSD 使用手冊剩下的這些章節涵蓋了全方位的 FreeBSD 系統管理。
每個章節的開頭會先描述在該您讀完該章節後您會學到什麼,也會詳述在您在看這些資料時應該要有的一些背景知識。
</para>
<para>這些章節是讓您在需要查資料的時候翻閱用的。
您不需要依照特定的順序來讀,也不需要將這些章節全部過讀之後才開始用 FreeBSD。
</para>
</partintro>
<![ %chap.config; [ &chap.config; ]]>
<![ %chap.boot; [ &chap.boot; ]]>
<![ %chap.users; [ &chap.users; ]]>
<![ %chap.security; [ &chap.security; ]]>
<![ %chap.mac; [ &chap.mac; ]]>
<![ %chap.disks; [ &chap.disks; ]]>
<![ %chap.geom; [ &chap.geom; ]]>
<![ %chap.vinum; [ &chap.vinum; ]]>
<![ %chap.l10n; [ &chap.l10n; ]]>
<![ %chap.cutting-edge; [ &chap.cutting-edge; ]]>
</part>
<part id="network-communication">
<title>網路通訊</title>
<partintro>
<para>FreeBSD 是一種廣泛的被使用在高效能的網路伺服器中的作業系統,這些章節包含了:</para>
<itemizedlist>
<listitem>
<para>序列埠通訊</para>
</listitem>
<listitem>
<para>PPP 和 PPPoE</para>
</listitem>
<listitem>
<para>電子郵件</para>
</listitem>
<listitem>
<para>執行網路伺服程式</para>
</listitem>
<listitem>
<para>防火牆</para>
</listitem>
<listitem>
<para>其他的進階網路主題</para>
</listitem>
</itemizedlist>
<para>這些章節是讓您在需要查資料的時候翻閱用的。
您不需要依照特定的順序來讀,也不需要將這些章節全部讀過之後才將 FreeBSD 用在網路環境下。</para>
</partintro>
<![ %chap.serialcomms; [ &chap.serialcomms; ]]>
<![ %chap.ppp-and-slip; [ &chap.ppp-and-slip; ]]>
<![ %chap.mail; [ &chap.mail; ]]>
<![ %chap.network-servers; [ &chap.network-servers; ]]>
<![ %chap.firewalls; [ &chap.firewalls; ]]>
<![ %chap.advanced-networking; [ &chap.advanced-networking; ]]>
</part>
<part id="appendices">
<title>附錄</title>
<![ %chap.mirrors; [ &chap.mirrors; ]]>
<![ %chap.bibliography; [ &chap.bibliography; ]]>
<![ %chap.eresources; [ &chap.eresources; ]]>
<![ %chap.pgpkeys; [ &chap.pgpkeys; ]]>
</part>
<![ %chap.freebsd-glossary; [ &bookinfo.freebsd-glossary; ]]>
<![ %chap.index; [ &chap.index; ]]>
&chap.colophon;
</book>
<!--
Local Variables:
mode: sgml
sgml-indent-data: t
sgml-omittag: nil
sgml-always-quote-attributes: t
End:
-->

View file

@ -0,0 +1,15 @@
#
# Build the Handbook with just the content from this chapter.
#
# $FreeBSD$
#
CHAPTERS= boot/chapter.sgml
VPATH= ..
MASTERDOC= ${.CURDIR}/../${DOC}.${DOCBOOKSUFFIX}
DOC_PREFIX?= ${.CURDIR}/../../../..
.include "../Makefile"

View file

@ -0,0 +1,821 @@
<!--
The FreeBSD Documentation Project
$FreeBSD$
-->
<chapter id="boot">
<title>The FreeBSD Booting Process</title>
<sect1 id="boot-synopsis">
<title>Synopsis</title>
<indexterm><primary>booting</primary></indexterm>
<indexterm><primary>bootstrap</primary></indexterm>
<para>The process of starting a computer and loading the operating system
is referred to as <quote>the bootstrap process</quote>, or simply
<quote>booting</quote>. FreeBSD's boot process provides a great deal of
flexibility in customizing what happens when you start the system,
allowing you to select from different operating systems installed on the
same computer, or even different versions of the same operating system
or installed kernel.</para>
<para>This chapter details the configuration options you can set and how
to customize the FreeBSD boot process. This includes everything that
happens until the FreeBSD kernel has started, probed for devices, and
started &man.init.8;. If you are not quite sure when this happens, it
occurs when the text color changes from bright white to grey.</para>
<para>After reading this chapter, you will know:</para>
<itemizedlist>
<listitem>
<para>What the components of the FreeBSD bootstrap system are, and how
they interact.</para>
</listitem>
<listitem>
<para>The options you can give to the components in the FreeBSD
bootstrap to control the boot process.</para>
</listitem>
<listitem>
<para>The basics of &man.device.hints.5;.</para>
</listitem>
</itemizedlist>
<note>
<title>x86 Only</title>
<para>This chapter only describes the boot process for FreeBSD running
on Intel x86 systems.</para>
</note>
</sect1>
<sect1 id="boot-introduction">
<title>The Booting Problem</title>
<para>Turning on a computer and starting the operating system poses an
interesting dilemma. By definition, the computer does not know how to
do anything until the operating system is started. This includes
running programs from the disk. So if the computer can not run a
program from the disk without the operating system, and the operating
system programs are on the disk, how is the operating system
started?</para>
<para>This problem parallels one in the book <citetitle>The Adventures of
Baron Munchausen</citetitle>. A character had fallen part way down a
manhole, and pulled himself out by grabbing his bootstraps, and
lifting. In the early days of computing the term
<firstterm>bootstrap</firstterm> was applied to the mechanism used to
load the operating system, which has become shortened to
<quote>booting</quote>.</para>
<indexterm><primary>BIOS</primary></indexterm>
<indexterm><primary>Basic Input/Output System</primary><see>BIOS</see></indexterm>
<para>On x86 hardware the Basic Input/Output System (BIOS) is responsible
for loading the operating system. To do this, the BIOS looks on the
hard disk for the Master Boot Record (MBR), which must be located on a
specific place on the disk. The BIOS has enough knowledge to load and
run the MBR, and assumes that the MBR can then carry out the rest of the
tasks involved in loading the operating system,
possibly with the help of the BIOS.</para>
<indexterm><primary>Master Boot Record (MBR)</primary></indexterm>
<indexterm><primary>Boot Manager</primary></indexterm>
<indexterm><primary>Boot Loader</primary></indexterm>
<para>The code within the MBR is usually referred to as a <emphasis>boot
manager</emphasis>, especially when it interacts with the user. In this case
the boot manager usually has more code in the first
<emphasis>track</emphasis> of the disk or within some OS's file system. (A
boot manager is sometimes also called a <emphasis>boot loader</emphasis>,
but FreeBSD uses that term for a later stage of booting.) Popular boot
managers include <application>boot0</application> (a.k.a. <application>Boot
Easy</application>, the standard &os; boot manager),
<application>Grub</application>, <application>GAG</application>, and
<application>LILO</application>.
(Only <application>boot0</application> fits within the MBR.)</para>
<para>If you have only one operating system installed on your disks then
a standard PC MBR will suffice. This MBR searches for the first bootable
(a.k.a. active) slice on the disk, and then runs the code on that slice to
load the remainder of the operating system. The MBR installed by
&man.fdisk.8;, by default, is such an MBR. It is based on
<filename>/boot/mbr</filename>.</para>
<para>If you have installed multiple operating systems on your disks then
you can install a different boot manager, one that can display a list of
different operating systems, and allows you to choose the one to boot
from. Two of these are discussed in the next subsection.</para>
<para>The remainder of the FreeBSD bootstrap system is divided into three
stages. The first stage is run by the MBR, which knows just enough to
get the computer into a specific state and run the second stage. The
second stage can do a little bit more, before running the third stage.
The third stage finishes the task of loading the operating system. The
work is split into these three stages because the PC standards put
limits on the size of the programs that can be run at stages one and
two. Chaining the tasks together allows FreeBSD to provide a more
flexible loader.</para>
<indexterm><primary>kernel</primary></indexterm>
<indexterm><primary><command>init</command></primary></indexterm>
<para>The kernel is then started and it begins to probe for devices
and initialize them for use. Once the kernel boot
process is finished, the kernel passes control to the user process
&man.init.8;, which then makes sure the disks are in a usable state.
&man.init.8; then starts the user-level resource configuration which
mounts file systems, sets up network cards to communicate on the
network, and generally starts all the processes that usually
are run on a FreeBSD system at startup.</para>
</sect1>
<sect1 id="boot-blocks">
<title>The Boot Manager and Boot Stages</title>
<indexterm><primary>Boot Manager</primary></indexterm>
<sect2 id="boot-boot0">
<title>The Boot Manager</title>
<indexterm><primary>Master Boot Record (MBR)</primary></indexterm>
<para>The code in the MBR or boot manager is sometimes referred to as
<emphasis>stage zero</emphasis> of the boot process. This subsection
discusses two of the boot managers previously mentioned:
<application>boot0</application> and <application>LILO</application>.</para>
<formalpara><title>The <application>boot0</application> Boot Manager:</title>
<para>The MBR installed by FreeBSD's installer or &man.boot0cfg.8;, by
default, is based on <filename>/boot/boot0</filename>.
(The <application>boot0</application> program is very simple, since the
program in the <abbrev>MBR</abbrev> can only be 446 bytes long because of the slice
table and 0x55AA identifier at the end of the MBR.)
If you have installed <application>boot0</application> and
multiple operating systems on your hard disks, then you will see a
display similar to this one at boot time:</para></formalpara>
<example id="boot-boot0-example">
<title><filename>boot0</filename> Screenshot</title>
<screen>F1 DOS
F2 FreeBSD
F3 Linux
F4 ??
F5 Drive 1
Default: F2</screen>
</example>
<para>Other operating systems, in particular &windows;, have been known
to overwrite an existing MBR with their own. If this happens to you,
or you want to replace your existing MBR with the FreeBSD MBR then use
the following command:</para>
<screen>&prompt.root; <userinput>fdisk -B -b /boot/boot0 <replaceable>device</replaceable></userinput></screen>
<para>where <replaceable>device</replaceable> is the device that you
boot from, such as <devicename>ad0</devicename> for the first IDE
disk, <devicename>ad2</devicename> for the first IDE disk on a second
IDE controller, <devicename>da0</devicename> for the first SCSI disk,
and so on. Or, if you want a custom configuration of the MBR,
use &man.boot0cfg.8;.</para>
<formalpara><title>The LILO Boot Manager:</title>
<para>To install this boot manager so it will also boot FreeBSD, first
start Linux and add the following to your existing
<filename>/etc/lilo.conf</filename> configuration file:</para></formalpara>
<programlisting>other=/dev/hdXY
table=/dev/hdX
loader=/boot/chain.b
label=FreeBSD</programlisting>
<para>In the above, specify FreeBSD's primary partition and drive using
Linux specifiers, replacing <replaceable>X</replaceable> with the Linux
drive letter and <replaceable>Y</replaceable> with the Linux primary
partition number. If you are using a <acronym>SCSI</acronym> drive, you
will need to change <replaceable>/dev/hd</replaceable> to read something
similar to <replaceable>/dev/sd</replaceable>. The
<option>loader=/boot/chain.b</option> line can be omitted if you have
both operating systems on the same drive. Now run
<command>/sbin/lilo&nbsp;-v</command> to commit your new changes to the
system; this should be verified by checking its screen messages.</para>
</sect2>
<sect2 id="boot-boot1">
<title>Stage One, <filename>/boot/boot1</filename>, and Stage Two,
<filename>/boot/boot2</filename></title>
<para>Conceptually the first and second stages are part of the same
program, on the same area of the disk. Because of space constraints
they have been split into two, but you would always install them
together. They are copied from the combined file
<filename>/boot/boot</filename> by the installer or
<application>disklabel</application> (see below).</para>
<para>They are located outside file systems, in the first track of
the boot slice, starting with the first sector. This is where <link
linkend="boot-boot0">boot0</link>, or any other boot manager,
expects to find a program to run which will
continue the boot process. The number of sectors used is easily
determined from the size of <filename>/boot/boot</filename>.</para>
<para><filename>boot1</filename> is very simple, since it
can only be 512 bytes
in size, and knows just enough about the FreeBSD
<firstterm>disklabel</firstterm>, which stores information
about the slice, to find and execute <filename>boot2</filename>.</para>
<para><filename>boot2</filename> is slightly more sophisticated, and understands
the FreeBSD file system enough to find files on it, and can
provide a simple interface to choose the kernel or loader to
run.</para>
<para>Since the <link linkend="boot-loader">loader</link> is
much more sophisticated, and provides a nice easy-to-use
boot configuration, <filename>boot2</filename> usually runs
it, but previously it
was tasked to run the kernel directly.</para>
<example id="boot-boot2-example">
<title><filename>boot2</filename> Screenshot</title>
<screen>&gt;&gt; FreeBSD/i386 BOOT
Default: 0:ad(0,a)/kernel
boot:</screen>
</example>
<para>If you ever need to replace the installed
<filename>boot1</filename> and <filename>boot2</filename> use
&man.disklabel.8;:</para>
<screen>&prompt.root; <userinput>disklabel -B <replaceable>diskslice</replaceable></userinput></screen>
<para>where <replaceable>diskslice</replaceable> is the disk and slice
you boot from, such as <devicename>ad0s1</devicename> for the first
slice on the first IDE disk.</para>
<warning>
<title>Dangerously Dedicated Mode</title>
<para>If you use just the disk name, such as
<devicename>ad0</devicename>, in the &man.disklabel.8; command you
will create a dangerously dedicated disk, without slices. This is
almost certainly not what you want to do, so make sure you double
check the &man.disklabel.8; command before you press
<keycap>Return</keycap>.</para>
</warning>
</sect2>
<sect2 id="boot-loader">
<title>Stage Three, <filename>/boot/loader</filename></title>
<indexterm><primary>boot-loader</primary></indexterm>
<para>The loader is the final stage of the three-stage
bootstrap, and is located on the file system, usually as
<filename>/boot/loader</filename>.</para>
<para>The loader is intended as a user-friendly method for
configuration, using an easy-to-use built-in command set,
backed up by a more powerful interpreter, with a more complex
command set.</para>
<sect3 id="boot-loader-flow">
<title>Loader Program Flow</title>
<para>During initialization, the loader will probe for a
console and for disks, and figure out what disk it is
booting from. It will set variables accordingly, and an
interpreter is started where user commands can be passed from
a script or interactively.</para>
<indexterm><primary>loader</primary></indexterm>
<indexterm><primary>loader configuration</primary></indexterm>
<para>The loader will then read
<filename>/boot/loader.rc</filename>, which by default reads
in <filename>/boot/defaults/loader.conf</filename> which
sets reasonable defaults for variables and reads
<filename>/boot/loader.conf</filename> for local changes to
those variables. <filename>loader.rc</filename> then acts
on these variables, loading whichever modules and kernel are
selected.</para>
<para>Finally, by default, the loader issues a 10 second wait
for key presses, and boots the kernel if it is not interrupted.
If interrupted, the user is presented with a prompt which
understands the easy-to-use command set, where the user may
adjust variables, unload all modules, load modules, and then
finally boot or reboot.</para>
</sect3>
<sect3 id="boot-loader-commands">
<title>Loader Built-In Commands</title>
<para>These are the most commonly used loader commands. For a
complete discussion of all available commands, please see
&man.loader.8;.</para>
<variablelist>
<varlistentry>
<term>autoboot <replaceable>seconds</replaceable></term>
<listitem>
<para>Proceeds to boot the kernel if not interrupted
within the time span given, in seconds. It displays a
countdown, and the default time span is 10
seconds.</para>
</listitem>
</varlistentry>
<varlistentry>
<term>boot
<optional><replaceable>-options</replaceable></optional>
<optional><replaceable>kernelname</replaceable></optional></term>
<listitem>
<para>Immediately proceeds to boot the kernel, with the
given options, if any, and with the kernel name given,
if it is.</para>
</listitem>
</varlistentry>
<varlistentry>
<term>boot-conf</term>
<listitem>
<para>Goes through the same automatic configuration of
modules based on variables as what happens at boot.
This only makes sense if you use
<command>unload</command> first, and change some
variables, most commonly <envar>kernel</envar>.</para>
</listitem>
</varlistentry>
<varlistentry>
<term>help
<optional><replaceable>topic</replaceable></optional></term>
<listitem>
<para>Shows help messages read from
<filename>/boot/loader.help</filename>. If the topic
given is <literal>index</literal>, then the list of
available topics is given.</para>
</listitem>
</varlistentry>
<varlistentry>
<term>include <replaceable>filename</replaceable>
&hellip;</term>
<listitem>
<para>Processes the file with the given filename. The
file is read in, and interpreted line by line. An
error immediately stops the include command.</para>
</listitem>
</varlistentry>
<varlistentry>
<term>load <optional><option>-t</option>
<replaceable>type</replaceable></optional>
<replaceable>filename</replaceable></term>
<listitem>
<para>Loads the kernel, kernel module, or file of the
type given, with the filename given. Any arguments
after filename are passed to the file.</para>
</listitem>
</varlistentry>
<varlistentry>
<term>ls <optional><option>-l</option></optional>
<optional><replaceable>path</replaceable></optional></term>
<listitem>
<para>Displays a listing of files in the given path, or
the root directory, if the path is not specified. If
<option>-l</option> is specified, file sizes will be
shown too.</para>
</listitem>
</varlistentry>
<varlistentry>
<term>lsdev <optional><option>-v</option></optional></term>
<listitem>
<para>Lists all of the devices from which it may be
possible to load modules. If <option>-v</option> is
specified, more details are printed.</para>
</listitem>
</varlistentry>
<varlistentry>
<term>lsmod <optional><option>-v</option></optional></term>
<listitem>
<para>Displays loaded modules. If <option>-v</option> is
specified, more details are shown.</para>
</listitem>
</varlistentry>
<varlistentry>
<term>more <replaceable>filename</replaceable></term>
<listitem>
<para>Displays the files specified, with a pause at each
<varname>LINES</varname> displayed.</para>
</listitem>
</varlistentry>
<varlistentry>
<term>reboot</term>
<listitem>
<para>Immediately reboots the system.</para>
</listitem>
</varlistentry>
<varlistentry>
<term>set <replaceable>variable</replaceable></term>
<term>set
<replaceable>variable</replaceable>=<replaceable>value</replaceable></term>
<listitem>
<para>Sets the loader's environment variables.</para>
</listitem>
</varlistentry>
<varlistentry>
<term>unload</term>
<listitem>
<para>Removes all loaded modules.</para>
</listitem>
</varlistentry>
</variablelist>
</sect3>
<sect3 id="boot-loader-examples">
<title>Loader Examples</title>
<para>Here are some practical examples of loader usage:</para>
<itemizedlist>
<indexterm><primary>single-user mode</primary></indexterm>
<listitem>
<para>To simply boot your usual kernel, but in single-user
mode:</para>
<screen><userinput>boot -s</userinput></screen>
</listitem>
<listitem>
<para>To unload your usual kernel and modules, and then
load just your old (or another) kernel:</para>
<indexterm>
<primary><filename>kernel.old</filename></primary>
</indexterm>
<screen><userinput>unload</userinput>
<userinput>load <replaceable>kernel.old</replaceable></userinput></screen>
<para>You can use <filename>kernel.GENERIC</filename> to
refer to the generic kernel that comes on the install
disk, or <filename>kernel.old</filename> to refer to
your previously installed kernel (when you have upgraded
or configured your own kernel, for example).</para>
<note>
<para>Use the following to load your usual modules with
another kernel:</para>
<screen><userinput>unload</userinput>
<userinput>set kernel="<replaceable>kernel.old</replaceable>"</userinput>
<userinput>boot-conf</userinput></screen></note>
</listitem>
<listitem>
<para>To load a kernel configuration script (an automated
script which does the things you would normally do in the
kernel boot-time configurator):</para>
<screen><userinput>load -t userconfig_script <replaceable>/boot/kernel.conf</replaceable></userinput></screen>
</listitem>
</itemizedlist>
</sect3>
</sect2>
</sect1>
<sect1 id="boot-kernel">
<title>Kernel Interaction During Boot</title>
<indexterm>
<primary>kernel</primary>
<secondary>boot interaction</secondary>
</indexterm>
<para>Once the kernel is loaded by either <link
linkend="boot-loader">loader</link> (as usual) or <link
linkend="boot-boot1">boot2</link> (bypassing the loader), it
examines its boot flags, if any, and adjusts its behavior as
necessary.</para>
<sect2 id="boot-kernel-bootflags">
<indexterm>
<primary>kernel</primary>
<secondary>bootflags</secondary>
</indexterm>
<title>Kernel Boot Flags</title>
<para>Here are the more common boot flags:</para>
<variablelist id="boot-kernel-bootflags-list">
<varlistentry>
<term><option>-a</option></term>
<listitem>
<para>during kernel initialization, ask for the device
to mount as the root file system.</para>
</listitem>
</varlistentry>
<varlistentry>
<term><option>-C</option></term>
<listitem>
<para>boot from CDROM.</para>
</listitem>
</varlistentry>
<varlistentry>
<term><option>-c</option></term>
<listitem>
<para>run UserConfig, the boot-time kernel
configurator</para>
</listitem>
</varlistentry>
<varlistentry>
<term><option>-s</option></term>
<listitem>
<para>boot into single-user mode</para>
</listitem>
</varlistentry>
<varlistentry>
<term><option>-v</option></term>
<listitem>
<para>be more verbose during kernel startup</para>
</listitem>
</varlistentry>
</variablelist>
<note>
<para>There are other boot flags, read &man.boot.8; for more
information on them.</para></note>
</sect2>
<!-- <sect2 id="boot-kernel-userconfig">
<title>UserConfig: the Boot-time Kernel Configurator</title>
<para> </para>
</sect2> -->
</sect1>
<sect1 id="device-hints">
<sect1info>
<authorgroup>
<author>
<firstname>Tom</firstname>
<surname>Rhodes</surname>
<contrib>Contributed by </contrib>
</author>
</authorgroup>
<!-- 18 OCT 2002 -->
</sect1info>
<indexterm>
<primary>device.hints</primary>
</indexterm>
<title>Device Hints</title>
<note><para>This is a FreeBSD&nbsp;5.0 and later feature which does not
exist in earlier versions.</para></note>
<para>During initial system startup, the boot &man.loader.8; will read the
&man.device.hints.5; file. This file stores kernel boot information
known as variables, sometimes referred to as <quote>device hints</quote>.
These <quote>device hints</quote> are used by device drivers for device
configuration.</para>
<para>Device hints may also be specified at the <link linkend="boot-loader">
Stage 3 boot loader</link> prompt. Variables can be added using
<command>set</command>, removed with <command>unset</command>, and viewed
with the <command>show</command> commands. Variables set in the
<filename>/boot/device.hints</filename> file can be overridden here also. Device hints entered at
the boot loader are not permanent and will be forgotten on the next
reboot.</para>
<para>Once the system is booted, the &man.kenv.1; command can be used to
dump all of the variables.</para>
<para>The syntax for the <filename>/boot/device.hints</filename> file is one variable per line, using
the standard hash <quote>#</quote> as comment markers. Lines are
constructed as follows:</para>
<screen><userinput>hint.driver.unit.keyword="<replaceable>value</replaceable>"</userinput></screen>
<para>The syntax for the Stage 3 boot loader is:</para>
<screen><userinput>set hint.driver.unit.keyword=<replaceable>value</replaceable></userinput></screen>
<para><literal>driver</literal> is the device driver name, <literal>unit</literal>
is the device driver unit number, and <literal>keyword</literal> is the hint
keyword. The keyword may consist of the following options:</para>
<itemizedlist>
<listitem>
<para><literal>at</literal>: specifies the bus which the device is attached to.</para>
</listitem>
<listitem>
<para><literal>port</literal>: specifies the start address of the <acronym>I/O</acronym>
to be used.</para>
</listitem>
<listitem>
<para><literal>irq</literal>: specifies the interrupt request number to be used.</para>
</listitem>
<listitem>
<para><literal>drq</literal>: specifies the DMA channel number.</para>
</listitem>
<listitem>
<para><literal>maddr</literal>: specifies the physical memory address occupied by the
device.</para>
</listitem>
<listitem>
<para><literal>flags</literal>: sets various flag bits for the device.</para>
</listitem>
<listitem>
<para><literal>disabled</literal>: if set to <literal>1</literal> the device is disabled.</para>
</listitem>
</itemizedlist>
<para>Device drivers may accept (or require) more hints not listed here, viewing
their manual page is recommended. For more information, consult the
&man.device.hints.5;, &man.kenv.1;, &man.loader.conf.5;, and &man.loader.8;
manual pages.</para>
</sect1>
<sect1 id="boot-init">
<indexterm>
<primary><command>init</command></primary>
</indexterm>
<title>Init: Process Control Initialization</title>
<para>Once the kernel has finished booting, it passes control to
the user process &man.init.8;, which is located at
<filename>/sbin/init</filename>, or the program path specified
in the <envar>init_path</envar> variable in
<command>loader</command>.</para>
<sect2 id="boot-autoreboot">
<title>Automatic Reboot Sequence</title>
<para>The automatic reboot sequence makes sure that the
file systems available on the system are consistent. If they
are not, and &man.fsck.8; cannot fix the
inconsistencies, &man.init.8; drops the system
into <link linkend="boot-singleuser">single-user mode</link>
for the system administrator to take care of the problems
directly.</para>
</sect2>
<sect2 id="boot-singleuser">
<title>Single-User Mode</title>
<indexterm><primary>single-user mode</primary></indexterm>
<indexterm><primary>console</primary></indexterm>
<para>This mode can be reached through the <link
linkend="boot-autoreboot">automatic reboot
sequence</link>, or by the user booting with the
<option>-s</option> option or setting the
<envar>boot_single</envar> variable in
<command>loader</command>.</para>
<para>It can also be reached by calling
&man.shutdown.8; without the reboot
(<option>-r</option>) or halt (<option>-h</option>) options,
from <link linkend="boot-multiuser">multi-user
mode</link>.</para>
<para>If the system <literal>console</literal> is set
to <literal>insecure</literal> in <filename>/etc/ttys</filename>,
then the system prompts for the <username>root</username> password
before initiating single-user mode.</para>
<example id="boot-insecure-console">
<title>An Insecure Console in <filename>/etc/ttys</filename></title>
<programlisting># name getty type status comments
#
# If console is marked "insecure", then init will ask for the root password
# when going to single-user mode.
console none unknown off insecure</programlisting>
</example>
<note>
<para>An <literal>insecure</literal> console means that you
consider your physical security to the console to be
insecure, and want to make sure only someone who knows the
<username>root</username> password may use single-user mode, and it
does not mean that you want to run your console insecurely. Thus,
if you want security, choose <literal>insecure</literal>,
not <literal>secure</literal>.</para>
</note>
</sect2>
<sect2 id="boot-multiuser">
<title>Multi-User Mode</title>
<indexterm><primary>multi-user mode</primary></indexterm>
<para>If &man.init.8; finds your file systems to be
in order, or once the user has finished in <link
linkend="boot-singleuser">single-user mode</link>, the
system enters multi-user mode, in which it starts the
resource configuration of the system.</para>
<sect3 id="boot-rc">
<indexterm><primary>rc files</primary></indexterm>
<title>Resource Configuration (rc)</title>
<para>The resource configuration system reads in
configuration defaults from
<filename>/etc/defaults/rc.conf</filename>, and
system-specific details from
<filename>/etc/rc.conf</filename>, and then proceeds to
mount the system file systems mentioned in
<filename>/etc/fstab</filename>, start up networking
services, start up miscellaneous system daemons, and
finally runs the startup scripts of locally installed
packages.</para>
<para>The &man.rc.8; manual page is a good reference to the resource
configuration system, as is examining the scripts
themselves.</para>
</sect3>
</sect2>
</sect1>
<sect1 id="boot-shutdown">
<title>Shutdown Sequence</title>
<indexterm>
<primary><command>shutdown</command></primary>
</indexterm>
<para>Upon controlled shutdown, via &man.shutdown.8;,
&man.init.8; will attempt to run the script
<filename>/etc/rc.shutdown</filename>, and then proceed to send
all processes the <literal>TERM</literal> signal, and subsequently
the <literal>KILL</literal> signal to any that do not terminate
timely.</para>
<para>To power down a FreeBSD machine on architectures and systems
that support power management, simply use the command
<command>shutdown -p now</command> to turn the power off
immediately. To just reboot a FreeBSD system, just use
<command>shutdown -r now</command>. You need to be
<username>root</username> or a member of
<groupname>operator</groupname> group to run &man.shutdown.8;.
The &man.halt.8; and &man.reboot.8; commands can also be used,
please refer to their manual pages and to &man.shutdown.8;'s one
for more information.</para>
<note>
<para>Power management requires &man.acpi.4; support in the kernel
or loaded as module for FreeBSD&nbsp;5.X and &man.apm.4;
support for FreeBSD&nbsp;4.X.</para>
</note>
</sect1>
</chapter>
<!--
Local Variables:
mode: sgml
sgml-declaration: "../chapter.decl"
sgml-indent-data: t
sgml-omittag: nil
sgml-always-quote-attributes: t
sgml-parent-document: ("../book.sgml" "part" "chapter")
End:
-->

View file

@ -0,0 +1,2 @@
<!-- $FreeBSD$ -->
<!DOCTYPE chapter PUBLIC "-//FreeBSD//DTD DocBook V4.1-Based Extension//EN">

View file

@ -0,0 +1,58 @@
<!--
Creates entities for each chapter in the FreeBSD Handbook. Each entity
is named chap.foo, where foo is the value of the id attribute on that
chapter, and corresponds to the name of the directory in which that
chapter's .sgml file is stored.
Chapters should be listed in the order in which they are referenced.
$FreeBSD$
-->
<!ENTITY chap.preface SYSTEM "preface/preface.sgml">
<!-- Part one -->
<!ENTITY chap.introduction SYSTEM "introduction/chapter.sgml">
<!ENTITY chap.install SYSTEM "install/chapter.sgml">
<!ENTITY chap.basics SYSTEM "basics/chapter.sgml">
<!ENTITY chap.ports SYSTEM "ports/chapter.sgml">
<!ENTITY chap.x11 SYSTEM "x11/chapter.sgml">
<!-- Part two -->
<!ENTITY chap.desktop SYSTEM "desktop/chapter.sgml">
<!ENTITY chap.multimedia SYSTEM "multimedia/chapter.sgml">
<!ENTITY chap.kernelconfig SYSTEM "kernelconfig/chapter.sgml">
<!ENTITY chap.printing SYSTEM "printing/chapter.sgml">
<!ENTITY chap.linuxemu SYSTEM "linuxemu/chapter.sgml">
<!-- Part three -->
<!ENTITY chap.config SYSTEM "config/chapter.sgml">
<!ENTITY chap.boot SYSTEM "boot/chapter.sgml">
<!ENTITY chap.users SYSTEM "users/chapter.sgml">
<!ENTITY chap.security SYSTEM "security/chapter.sgml">
<!ENTITY chap.mac SYSTEM "mac/chapter.sgml">
<!ENTITY chap.disks SYSTEM "disks/chapter.sgml">
<!ENTITY chap.geom SYSTEM "geom/chapter.sgml">
<!ENTITY chap.vinum SYSTEM "vinum/chapter.sgml">
<!ENTITY chap.l10n SYSTEM "l10n/chapter.sgml">
<!ENTITY chap.cutting-edge SYSTEM "cutting-edge/chapter.sgml">
<!-- Part four -->
<!ENTITY chap.serialcomms SYSTEM "serialcomms/chapter.sgml">
<!ENTITY chap.ppp-and-slip SYSTEM "ppp-and-slip/chapter.sgml">
<!ENTITY chap.mail SYSTEM "mail/chapter.sgml">
<!ENTITY chap.network-servers SYSTEM "network-servers/chapter.sgml">
<!ENTITY chap.firewalls SYSTEM "firewalls/chapter.sgml">
<!ENTITY chap.advanced-networking SYSTEM "advanced-networking/chapter.sgml">
<!-- Part five (appendices) -->
<!ENTITY chap.mirrors SYSTEM "mirrors/chapter.sgml">
<!ENTITY chap.mirrors.ftp.inc SYSTEM "mirrors.sgml.ftp.inc">
<!ENTITY chap.mirrors.cvsup.inc SYSTEM "mirrors.sgml.cvsup.inc">
<!ENTITY chap.bibliography SYSTEM "bibliography/chapter.sgml">
<!ENTITY chap.eresources SYSTEM "eresources/chapter.sgml">
<!ENTITY chap.eresources.www.inc SYSTEM "eresources.sgml.www.inc">
<!ENTITY chap.pgpkeys SYSTEM "pgpkeys/chapter.sgml">
<!ENTITY chap.index SYSTEM "index.sgml">
<!ENTITY chap.colophon SYSTEM "colophon.sgml">

View file

@ -0,0 +1,32 @@
<!--
The FreeBSD Documentation Project
$FreeBSD$
-->
<colophon id='colophon'>
<para>This book is the combined work of hundreds of contributors to
<quote>The FreeBSD Documentation Project</quote>. The text is
authored in SGML
according to the DocBook DTD and is formatted from SGML into many
different presentation formats using <application>Jade</application>,
an open source DSSSL
engine. Norm Walsh's DSSSL stylesheets were used with an
additional customization layer to provide the presentation
instructions for <application>Jade</application>. The printed
version of this document would not be possible without Donald
Knuth's <application>&tex;</application> typesetting language,
Leslie Lamport's <application>LaTeX</application>, or Sebastian
Rahtz's <application>JadeTeX</application> macro package.</para>
</colophon>
<!--
Local Variables:
mode: sgml
sgml-declaration: "chapter.decl"
sgml-indent-data: t
sgml-omittag: nil
sgml-always-quote-attributes: t
sgml-parent-document: ("book.sgml" "part" "chapter")
End:
-->

View file

@ -0,0 +1,15 @@
#
# Build the Handbook with just the content from this chapter.
#
# $FreeBSD$
#
CHAPTERS= config/chapter.sgml
VPATH= ..
MASTERDOC= ${.CURDIR}/../${DOC}.${DOCBOOKSUFFIX}
DOC_PREFIX?= ${.CURDIR}/../../../..
.include "../Makefile"

File diff suppressed because it is too large Load diff

View file

@ -0,0 +1,15 @@
#
# Build the Handbook with just the content from this chapter.
#
# $FreeBSD$
#
CHAPTERS= cutting-edge/chapter.sgml
VPATH= ..
MASTERDOC= ${.CURDIR}/../${DOC}.${DOCBOOKSUFFIX}
DOC_PREFIX?= ${.CURDIR}/../../../..
.include "../Makefile"

File diff suppressed because it is too large Load diff

View file

@ -0,0 +1,15 @@
#
# Build the Handbook with just the content from this chapter.
#
# $FreeBSD$
#
CHAPTERS= desktop/chapter.sgml
VPATH= ..
MASTERDOC= ${.CURDIR}/../${DOC}.${DOCBOOKSUFFIX}
DOC_PREFIX?= ${.CURDIR}/../../../..
.include "../Makefile"

File diff suppressed because it is too large Load diff

View file

@ -0,0 +1,15 @@
#
# Build the Handbook with just the content from this chapter.
#
# $FreeBSD$
#
CHAPTERS= disks/chapter.sgml
VPATH= ..
MASTERDOC= ${.CURDIR}/../${DOC}.${DOCBOOKSUFFIX}
DOC_PREFIX?= ${.CURDIR}/../../../..
.include "../Makefile"

File diff suppressed because it is too large Load diff

View file

@ -0,0 +1,15 @@
#
# Build the Handbook with just the content from this chapter.
#
# $FreeBSD$
#
CHAPTERS= eresources/chapter.sgml
VPATH= ..
MASTERDOC= ${.CURDIR}/../${DOC}.${DOCBOOKSUFFIX}
DOC_PREFIX?= ${.CURDIR}/../../../..
.include "../Makefile"

File diff suppressed because it is too large Load diff

View file

@ -0,0 +1,15 @@
#
# Build the Handbook with just the content from this chapter.
#
# $FreeBSD$
#
CHAPTERS= firewalls/chapter.sgml
VPATH= ..
MASTERDOC= ${.CURDIR}/../${DOC}.${DOCBOOKSUFFIX}
DOC_PREFIX?= ${.CURDIR}/../../../..
.include "../Makefile"

File diff suppressed because it is too large Load diff

View file

@ -0,0 +1,15 @@
#
# Build the Handbook with just the content from this chapter.
#
# $FreeBSD$
#
CHAPTERS= geom/chapter.sgml
VPATH= ..
MASTERDOC= ${.CURDIR}/../${DOC}.${DOCBOOKSUFFIX}
DOC_PREFIX?= ${.CURDIR}/../../../..
.include "../Makefile"

View file

@ -0,0 +1,402 @@
<!--
The FreeBSD Documentation Project
$FreeBSD$
-->
<chapter id="GEOM">
<chapterinfo>
<authorgroup>
<author>
<firstname>Tom</firstname>
<surname>Rhodes</surname>
<contrib>Written by </contrib>
</author>
</authorgroup>
</chapterinfo>
<title>GEOM: Modular Disk Transformation Framework</title>
<sect1 id="GEOM-synopsis">
<title>Synopsis</title>
<indexterm>
<primary>GEOM</primary>
</indexterm>
<indexterm>
<primary>GEOM Disk Framework</primary>
<see>GEOM</see>
</indexterm>
<para>本章涵蓋如何在 &os; 的 GEOM 架構下使用磁碟,
包含用來設定幾種常用的 <acronym
role="Redundant Array of Inexpensive Disks磁碟陣列系統">RAID</acronym>
的控制工具。本章不會深入探討 GEOM 如何處理底層的 I/O這類資訊請參考
&man.geom.4; 及相關的 SEE ALSO 部份。本章也非 <acronym>RAID</acronym>
設定指南,在這裡只會討論目前 GEOM 支援的 <acronym>RAID</acronym> 模式。
</para>
<para>閱讀本章後,您會知道這些資訊:</para>
<itemizedlist>
<listitem>
<para>透過 GEOM 可支援哪些模式的 <acronym>RAID</acronym>。</para>
</listitem>
<listitem>
<para>如何使用基本工具來配置、操作、維護不同模式的
<acronym>RAID</acronym>。</para>
</listitem>
<listitem>
<para>如何透過 GEOM 來完成鏡射 (mirror)、分散連結 (stripe)、加密 (encryp)
、遠端連接磁碟等。</para>
</listitem>
<listitem>
<para>當 GEOM 架構下的磁碟發生問題,如何排除。</para>
</listitem>
</itemizedlist>
<para>Before reading this chapter, you should:</para>
<para>在開始之前,請您確任下列背景知識:</para>
<itemizedlist>
<listitem>
<para>了解 &os; 如何看待磁碟 (<xref linkend="disks">) 。</para>
</listitem>
<listitem>
<para>知道如何設定、安裝新的 &os; 核心
(<xref linkend="kernelconfig">) 。</para>
</listitem>
</itemizedlist>
</sect1>
<sect1 id="GEOM-intro">
<title>GEOM 導論</title>
<para>GEOM 透過 privoder (即 <dilename role="directory">/dev/</filename>
下的特殊裝置檔案) 來操控 classes (如 Master Boot Records、
<acronym>BSD</acronym> labels 等) 。GEOM 支援多種軟體
<acronym>RAID</acronym> 配置,透過 GEOM 存取時,
作業系統和應用程式不會意識到 GEOM 存在。</para>
</sect1>
<sect1 id="GEOM-striping">
<sect1info>
<authorgroup>
<author>
<firstname>Tom</firstname>
<surname>Rhodes</surname>
<contrib>Written by </contrib>
</author>
<author>
<firstname>Murray</firstname>
<surname>Stokely</surname>
</author>
</authorgroup>
</sect1info>
<title>RAID0 - 分散連結 (striping)</title>
<indexterm>
<primary>GEOM</primary>
</indexterm>
<indexterm>
<primary>分散連結 (Striping)</primary>
</indexterm>
<para>分散連結 (striping) 可用來連結多個磁碟成為一大塊空間。
很多時候硬體控制器可以完成這件事,不過 GEOM 也提供了軟體版本的
<acronym>RAID</acronym>0也就是分散連結 (striping)。</para>
<para>在 <acronym>RAID</acronym>0 裡,資料會被切分成很多塊,
再分散寫入全部的磁碟。例如要寫入 256k 的資料到單一磁碟,在
四個磁碟的 <acronym>RAID</acronym>0 中可同時寫入 64k 到四個磁碟裡,
因此可大幅提升 I/O 效能。如果使用更多的磁碟控制器,
I/O 效能可再提升。</para>
<para>由於讀或寫時會同步交錯對許多磁碟進行 I/O 處理,因此
<acronym>RAID</acronym>0 的每個磁碟必需大小一樣。
<mediaobject>
<imageobject>
<imagedata fileref="geom/striping" align="center">
</imageobject>
<textobject>
<phrase>Disk Striping Illustration</phrase>
</textobject>
</mediaobject>
<procedure>
<title>用未格式化的 ATA 磁碟來建立分散連結</title>
<step><para>載入 <filename>geom_stripe</filename>
核心模組:</para>
<screen>&prompt.root; <userinput>kldload geom_stripe.ko</userinput></screen>
</step>
<step><para>確定掛載點 (mount point) 存在。
如果想用分散連結的空間做為根目錄 (root partition即 /)
則先用個暫時的掛載點,如
<filename role="directory">/mnt</filename></para>
<screen>&prompt.root; <userinput>mkdir /mnt</userinput></screen>
</step>
<step><para>確認要用來分散連結的裝置名稱,接著建新新的分散連結裝置。
例如下面的指令會分散連結兩個未使用、尚未分區的 <acronym>ATA</acronym>
磁碟 (<filename>/dev/ad2</filename> 和
<filename>/dev/ad3</filename>) </para>
<screen>&prompt.root; <userinput>
gstripe label -v st0 /dev/ad2 /dev/ad3</userinput></screen>
<screen>&prompt.root; <userinput>gstripe label -v st0 /dev/ad2 /dev/ad3</userinput></screen>
<!--
<para>A message should be returned explaining that meta data has
been stored on the devices.
XXX: What message? Put it inside the screen output above.
-->
</step>
<step><para>用下面的指令來建立分區表 (partition table)</para>
<screen>&prompt.root; <userinput>bsdlabel -wB /dev/stripe/st0</userinput></screen>
</step>
<step><para>除了先前建立的 <devicename>st0</devices> ,這個步驟還會在
<filename role="directory">/dev/stripe</filename> 下新增兩個裝置:
<devicename>st0a</devicename> 和 <devicename>st0c</devicename>。
利用 <command>newfs</command> 指令可以在
<devicename>st0a</devicename> 建立檔案系統:
<screen>&prompt.root; <userinput>newfs -U /dev/stripe/st0a</userinput></screen>
<para>螢幕上會有一堆數字傾瀉而過,幾秒鐘後就會完成。此時空間已建立,
可用來掛載使用了。</para>
</step>
</procedure>
<para>下面指令可用來手動掛載分散連結空間:</para>
<screen>&prompt.root; <userinput>mount /dev/stripe/st0a /mnt</userinput></screen>
<para>如果要在開機時自動掛載,在 <filename>/etc/fstab</filename>
加入這塊空間的資訊:</para>
<screen>&prompt.root; <userinput>echo "/dev/stripe/st0a /mnt ufs rw 2 2" \</userinput>
<userinput>&gt;&gt; /etc/fstab</userinput></screen>
<para>而 <filename>geom</filename> 核心模組必需在系統初始化時自動載入,
因此在 </filename>/boot/lodaer.conf</filename> 加入一行:</para>
<screen>&prompt.root; <userinput>echo 'geom_stripe_load="YES"' &gt;&gt; /boot/loader.conf</userinput></screen>
</sect1>
<sect1 id="GEOM-mirror">
<title>RAID1 - Mirroring</title>
<indexterm>
<primary>GEOM</primary>
</indexterm>
<indexterm>
<primary>Disk Mirroring</primary>
</indexterm>
<para>Mirroring is a technology used by many corporations and home
users to back up data without interruption. When a mirror exists,
it simply means that diskB replicates diskA. Or, perhaps diskC+D
replicates diskA+B. Regardless of the disk configuration, the
important aspect is that information on one disk or partition is
being replicated. Later, that information could be more easily
restored, backed up without causing service or access
interruption, and even be physically stored in a data
safe.</para>
<para>To begin, ensure the system has two disk drives of equal size,
this exercise assumes they are direct access (&man.da.4;)
<acronym>SCSI</acronym> disks.</para>
<para>Begin by installing &os; on the first disk with only two
partitions. One should be a swap partition, double the
<acronym>RAM</acronym> size and all remaining space devoted to
the root (<filename role="directory">/</filename>) file system.
It is possible to have separate partitions for other mount points;
however, this will increase the difficulty level ten fold due to
manual alteration of the &man.bsdlabel.8; and &man.fdisk.8;
settings.</para>
<para>Reboot and wait for the system to fully initialize. Once this
process has completed, log in as the <username>root</username>
user.</para>
<para>Create the <filename>/dev/mirror/gm</filename> device and link
it with <filename>/dev/da1</filename>:</para>
<screen>&prompt.root; <userinput>gmirror label -vnb round-robin gm0 /dev/da1</userinput></screen>
<para>The system should respond with:</para>
<screen>
Metadata value stored on /dev/da1.
Done.</screen>
<para>Initialize GEOM, this will load the
<filename>/boot/kernel/geom_mirror.ko</filename> kernel
module:</para>
<screen>&prompt.root; <userinput>gmirror load</userinput></screen>
<note>
<para>This command should have created the
<devicename>gm0</devicename>, device node under the
<filename role="directory">/dev/mirror</filename>
directory.</para>
</note>
<para>Install a generic <command>fdisk</command> label and boot code
to newly created <devicename>gm0</devicename> device:</para>
<screen>&prompt.root; <userinput>fdisk -vBI /dev/mirror/gm0</userinput></screen>
<para>Now install generic <command>bsdlabel</command>
information:</para>
<screen>&prompt.root; <userinput>bsdlabel -wB /dev/mirror/gm0s1</userinput></screen>
<note>
<para>If multiple slices and partitions exist, the flags for the
previous two commands will require alteration. They must match
the slice and partition size of the other disk.</para>
</note>
<para>Use the &man.newfs.8; utility to create a default file
system on the <devicename>gm0s1a</devicename> device node:</para>
<screen>&prompt.root; <userinput>newfs -U /dev/mirror/gm0s1a</userinput></screen>
<para>This should have caused the system to spit out some
information and a bunch of numbers. This is good. Examine the
screen for any error messages and mount the device to the
<filename role="directory">/mnt</filename> mount point:</para>
<screen>&prompt.root; <userinput>mount /dev/mirror/gm0s1a /mnt</userinput></screen>
<para>Now move all data from the boot disk over to this new file
system. This example uses the &man.dump.8; and &man.restore.8;
commands; however, &man.dd.1; would also work with this
scenario.</para>
<screen>&prompt.root; <userinput>dump -L -0 -f- / |(cd /mnt && restore -r -v -f-)</userinput></screen>
<para>This must be done for each file system. Simply place the
appropriate file system in the correct location when running the
aforementioned command.</para>
<para>Now edit the replicated <filename>/mnt/etc/fstab</filename>
file and remove or comment out the swap file
<footnote>
<para>It should be noted that commenting out the swap file entry
in <filename>fstab</filename> will most likely require you to
re-establish a different way of enabling swap space. Please
refer to <xref linkend="adding-swap-space"> for more
information.</para>
</footnote>. Change the other file system information to use the
new disk. See the following example:</para>
<programlisting># Device Mountpoint FStype Options Dump Pass#
#/dev/da0s2b none swap sw 0 0
/dev/mirror/gm0s1a / ufs rw 1 1</programlisting>
<para>Now create a <filename>boot.conf</filename> file on both the
current and new root partitions. This file will
<quote>help</quote> the system <acronym>BIOS</acronym>
boot the correct drive:</para>
<screen>&prompt.root; <userinput>echo "1:da(1,a)/boot/loader" &gt; /boot.config</userinput></screen>
<screen>&prompt.root; <userinput>echo "1:da(1,a)/boot/loader" &gt; /mnt/boot.config</userinput></screen>
<note>
<para>We have placed it on both root partitions to ensure proper
boot up. If for some reason the system cannot read from the
new root partition, a failsafe is available.</para>
</note>
<para>Now add the following line to the new
<filename>/boot/loader.conf</filename>:</para>
<screen>&prompt.root; <userinput>echo 'geom_mirror_load="YES"' &gt;&gt; /mnt/boot/loader.conf</userinput></screen>
<para>This will instruct &man.loader.8; utility to load the
<filename>geom_mirror.ko</filename> module during system
initialization.</para>
<para>Reboot the system:</para>
<screen>&prompt.root; <userinput>shutdown -r now</userinput></screen>
<para>If all has gone well, the system should have booted from the
<devicename>gm0s1a</devicename> device and a <command>login</command>
prompt should be waiting. If something went wrong, see review
the forthcoming troubleshooting section. Now add the
<devicename>da0</devicename> disk to <devicename>gm0</devicename>
device:</para>
<screen>&prompt.root; <userinput>gmirror configure -a gm0</userinput>
&prompt.root; <userinput>gmirror insert gm0 /dev/da0</userinput></screen>
<para>The <option>-a</option> flag tells &man.gmirror.8; to use
automatic synchronization; i.e., mirror the disk writes
automatically. The manual page explains how to rebuild and
replace disks, although it uses <devicename>data</devicename>
in place of <devicename>gm0</devicename>.</para>
<sect2>
<title>Troubleshooting</title>
<sect3>
<title>System refuses to boot</title>
<para>If the system boots up to a prompt similar to:</para>
<programlisting>ffs_mountroot: can't find rootvp
Root mount failed: 6
mountroot></programlisting>
<para>Reboot the machine using the power or reset button. At
the boot menu, select option six (6). This will drop the
system to a &man.loader.8; prompt. Load the kernel module
manually:</para>
<screen>OK? <userinput>load geom_mirror.ko</userinput>
OK? <userinput>boot</userinput></screen>
<para>If this works then for whatever reason the module was not
being loaded properly. Place:</para>
<programlisting>options GEOM_MIRROR</programlisting>
<para>in the kernel configuration file, rebuild and reinstall.
That should remedy this issue.</para>
</sect3>
</sect2>
</sect1>
</chapter>
<!--
Local Variables:
mode: sgml
sgml-declaration: "../chapter.decl"
sgml-indent-data: t
sgml-omittag: nil
sgml-always-quote-attributes: t
sgml-parent-document: ("../book.sgml" "part" "chapter")
End:
-->

View file

@ -0,0 +1,15 @@
#
# Build the Handbook with just the content from this chapter.
#
# $FreeBSD$
#
CHAPTERS= install/chapter.sgml
VPATH= ..
MASTERDOC= ${.CURDIR}/../${DOC}.${DOCBOOKSUFFIX}
DOC_PREFIX?= ${.CURDIR}/../../../..
.include "../Makefile"

File diff suppressed because it is too large Load diff

View file

@ -0,0 +1,7 @@
// $FreeBSD$
digraph directory {
root [label="Root\n/"];
root -> "A1/";
root -> "A2/";
}

View file

@ -0,0 +1,8 @@
// $FreeBSD$
digraph directory {
root [label="Root\n/"];
root -> "A1/" -> "B1/";
"A1/" -> "B2/";
root -> "A2/";
}

View file

@ -0,0 +1,8 @@
// $FreeBSD$
digraph directory {
root [label="Root\n/"];
root -> "A1/";
root -> "A2/" -> "B1/";
"A2/" -> "B2/";
}

View file

@ -0,0 +1,9 @@
// $FreeBSD$
digraph directory {
root [label="Root\n/"];
root -> "A1/";
root -> "A2/" -> "B1/" -> "C1/";
"B1/" -> "C2/";
"A2/" -> "B2/";
}

View file

@ -0,0 +1,9 @@
// $FreeBSD$
digraph directory {
root [label="Root\n/"];
root -> "A1/" -> "C1/";
"A1/" -> "C2/";
root -> "A2/" -> "B1/";
"A2/" -> "B2/";
}

View file

@ -0,0 +1,15 @@
#
# Build the Handbook with just the content from this chapter.
#
# $FreeBSD$
#
CHAPTERS= introduction/chapter.sgml
VPATH= ..
MASTERDOC= ${.CURDIR}/../${DOC}.${DOCBOOKSUFFIX}
DOC_PREFIX?= ${.CURDIR}/../../../..
.include "../Makefile"

View file

@ -0,0 +1,951 @@
<!--
The FreeBSD Documentation Project
$FreeBSD$
-->
<chapter id="introduction">
<chapterinfo>
<authorgroup>
<author>
<firstname>Jim</firstname>
<surname>Mock</surname>
<contrib>Restructured, reorganized, and parts
rewritten by </contrib>
</author>
</authorgroup>
</chapterinfo>
<title>簡介</title>
<sect1 id="introduction-synopsis">
<title>概述</title>
<para>非常感謝您對 FreeBSD 感興趣!以下章節涵蓋 FreeBSD
計畫的各方面:比如它的歷史、目標、開發模式等等。</para>
<para>讀完這章,可以瞭解:</para>
<itemizedlist>
<listitem>
<para>FreeBSD 與其他 OS 之間的關係;</para>
</listitem>
<listitem>
<para>FreeBSD 計畫的歷史淵源;</para>
</listitem>
<listitem>
<para>FreeBSD 計畫的目標;</para>
</listitem>
<listitem>
<para>FreeBSD open-source 開發模式的基礎概念;</para>
</listitem>
<listitem>
<para>當然囉,還有 <quote>FreeBSD</quote> 這名字的緣故。</para>
</listitem>
</itemizedlist>
</sect1>
<sect1 id="nutshell">
<title>Welcome to FreeBSD!</title>
<indexterm><primary>4.4BSD-Lite</primary></indexterm>
<para>FreeBSD 是一個從 4.4BSD-Lite 衍生出而能在以 Intel (x86 and &itanium;),
AMD64, <trademark>Alpha</trademark>, Sun &ultrasparc;
為基礎的電腦上執行的作業系統。同時,移植到其他平台的工作也在進行中。
對於本計劃歷史的介紹,請看 <link linkend="history">FreeBSD 的簡短歷史</link>
對於 FreeBSD 的最新版本介紹,請看 <link linkend="relnotes"> current release
</link>
is a 4.4BSD-Lite based operating system for
Intel (x86 and &itanium;), AMD64, <trademark>Alpha</trademark>, Sun
&ultrasparc; computers. Ports to other
architectures are also underway.
You can also
read about <link linkend="history">the history of FreeBSD</link>,
or the <link linkend="relnotes">current release</link>. If you
are interested in contributing something to the Project (code,
hardware, unmarked bills), see the <ulink
url="&url.articles.contributing;/index.html">Contributing to FreeBSD</ulink> article.</para>
<sect2 id="os-overview">
<title>What Can FreeBSD Do?</title>
<para>FreeBSD has many noteworthy features. Some of these
are:</para>
<itemizedlist>
<indexterm><primary>preemptive multitasking</primary></indexterm>
<listitem>
<para><emphasis>Preemptive multitasking</emphasis> with
dynamic priority adjustment to ensure smooth and fair
sharing of the computer between applications and users, even
under the heaviest of loads.</para>
</listitem>
<indexterm><primary>multi-user facilities</primary></indexterm>
<listitem>
<para><emphasis>Multi-user facilities</emphasis> which allow many
people to use a FreeBSD system simultaneously for a variety
of things. This means, for example, that system peripherals
such as printers and tape drives are properly shared between
all users on the system or the network and that individual
resource limits can be placed on users or groups of users,
protecting critical system resources from over-use.</para>
</listitem>
<indexterm><primary>TCP/IP networking</primary></indexterm>
<listitem>
<para>Strong <emphasis>TCP/IP networking</emphasis> with
support for industry standards such as SLIP, PPP, NFS, DHCP,
and NIS. This means that your FreeBSD machine can
interoperate easily with other systems as well as act as an
enterprise server, providing vital functions such as NFS
(remote file access) and email services or putting your
organization on the Internet with WWW, FTP, routing and
firewall (security) services.</para>
</listitem>
<indexterm><primary>memory protection</primary></indexterm>
<listitem>
<para><emphasis>Memory protection</emphasis> ensures that
applications (or users) cannot interfere with each other. One
application crashing will not affect others in any way.</para>
</listitem>
<listitem>
<para>FreeBSD is a <emphasis>32-bit</emphasis> operating
system (<emphasis>64-bit</emphasis> on the Alpha, &itanium;, AMD64, and &ultrasparc;) and was
designed as such from the ground up.</para>
</listitem>
<indexterm>
<primary>X Window System</primary>
<seealso>XFree86</seealso>
</indexterm>
<listitem>
<para>The industry standard <emphasis>X Window System</emphasis>
(X11R6) provides a graphical user interface (GUI) for the cost
of a common VGA card and monitor and comes with full
sources.</para>
</listitem>
<indexterm>
<primary>binary compatibility</primary>
<secondary>Linux</secondary>
</indexterm>
<indexterm>
<primary>binary compatibility</primary>
<secondary>SCO</secondary>
</indexterm>
<indexterm>
<primary>binary compatibility</primary>
<secondary>SVR4</secondary>
</indexterm>
<indexterm>
<primary>binary compatibility</primary>
<secondary>BSD/OS</secondary>
</indexterm>
<indexterm>
<primary>binary compatibility</primary>
<secondary>NetBSD</secondary>
</indexterm>
<listitem>
<para><emphasis>Binary compatibility</emphasis> with many
programs built for Linux, SCO, SVR4, BSDI and NetBSD.</para>
</listitem>
<listitem>
<para>Thousands of <emphasis>ready-to-run</emphasis>
applications are available from the FreeBSD
<emphasis>ports</emphasis> and <emphasis>packages</emphasis>
collection. Why search the net when you can find it all right
here?</para>
</listitem>
<listitem>
<para>Thousands of additional and
<emphasis>easy-to-port</emphasis> applications are available
on the Internet. FreeBSD is source code compatible with most
popular commercial &unix; systems and thus most applications
require few, if any, changes to compile.</para>
</listitem>
<indexterm><primary>virtual memory</primary></indexterm>
<listitem>
<para>Demand paged <emphasis>virtual memory</emphasis> and
<quote>merged VM/buffer cache</quote> design efficiently
satisfies applications with large appetites for memory while
still maintaining interactive response to other users.</para>
</listitem>
<indexterm>
<primary>Symmetric Multi-Processing (SMP)</primary>
</indexterm>
<listitem>
<para><emphasis>SMP</emphasis> support for machines with
multiple CPUs.</para>
</listitem>
<indexterm>
<primary>compilers</primary>
<secondary>C</secondary>
</indexterm>
<indexterm>
<primary>compilers</primary>
<secondary>C++</secondary>
</indexterm>
<indexterm>
<primary>compilers</primary>
<secondary>FORTRAN</secondary>
</indexterm>
<listitem>
<para>A full complement of <emphasis>C</emphasis>,
<emphasis>C++</emphasis>, <emphasis>Fortran</emphasis>, and
<emphasis>Perl</emphasis> development tools.
Many additional languages for advanced research
and development are also available in the ports and packages
collection.</para>
</listitem>
<indexterm><primary>source code</primary></indexterm>
<listitem>
<para><emphasis>Source code</emphasis> for the entire system
means you have the greatest degree of control over your
environment. Why be locked into a proprietary solution
at the mercy of your vendor when you can have a truly open
system?</para>
</listitem>
<listitem>
<para>Extensive <emphasis>online
documentation</emphasis>.</para>
</listitem>
<listitem>
<para><emphasis>And many more!</emphasis></para>
</listitem>
</itemizedlist>
<indexterm><primary>4.4BSD-Lite</primary></indexterm>
<indexterm>
<primary>Computer Systems Research Group (CSRG)</primary>
</indexterm>
<indexterm><primary>U.C. Berkeley</primary></indexterm>
<para>FreeBSD is based on the 4.4BSD-Lite release from Computer
Systems Research Group (CSRG) at the University of California at
Berkeley, and carries on the distinguished tradition of BSD
systems development. In addition to the fine work provided by
CSRG, the FreeBSD Project has put in many thousands of hours in
fine tuning the system for maximum performance and reliability in
real-life load situations. As many of the commercial giants
struggle to field PC operating systems with such features,
performance and reliability, FreeBSD can offer them
<emphasis>now</emphasis>!</para>
<para>The applications to which FreeBSD can be put are truly
limited only by your own imagination. From software development
to factory automation, inventory control to azimuth correction of
remote satellite antennae; if it can be done with a commercial
&unix; product then it is more than likely that you can do it with
FreeBSD too! FreeBSD also benefits significantly from
literally thousands of high quality applications developed by
research centers and universities around the world, often
available at little to no cost. Commercial applications are also
available and appearing in greater numbers every day.</para>
<para>Because the source code for FreeBSD itself is generally
available, the system can also be customized to an almost unheard
of degree for special applications or projects, and in ways not
generally possible with operating systems from most major
commercial vendors. Here is just a sampling of some of the
applications in which people are currently using FreeBSD:</para>
<itemizedlist>
<listitem>
<para><emphasis>Internet Services:</emphasis> The robust TCP/IP
networking built into FreeBSD makes it an ideal platform for a
variety of Internet services such as:</para>
<itemizedlist>
<indexterm><primary>FTP servers</primary></indexterm>
<listitem>
<para>FTP servers</para>
</listitem>
<indexterm><primary>web servers</primary></indexterm>
<listitem>
<para>World Wide Web servers (standard or secure
[SSL])</para>
</listitem>
<indexterm><primary>firewall</primary></indexterm>
<indexterm><primary>NAT</primary></indexterm>
<listitem>
<para>Firewalls and NAT (<quote>IP masquerading</quote>)
gateways</para>
</listitem>
<indexterm>
<primary>electronic mail</primary>
<see>email</see>
</indexterm>
<indexterm>
<primary>email</primary>
</indexterm>
<listitem>
<para>Electronic Mail servers</para>
</listitem>
<indexterm><primary>USENET</primary></indexterm>
<listitem>
<para>USENET News or Bulletin Board Systems</para>
</listitem>
<listitem>
<para>And more...</para>
</listitem>
</itemizedlist>
<para>With FreeBSD, you can easily start out small with an
inexpensive 386 class PC and upgrade all the way up to a
quad-processor Xeon with RAID storage as your enterprise
grows.</para>
</listitem>
<listitem>
<para><emphasis>Education:</emphasis> Are you a student of
computer science or a related engineering field? There is no
better way of learning about operating systems, computer
architecture and networking than the hands on, under the hood
experience that FreeBSD can provide. A number of freely
available CAD, mathematical and graphic design packages also
make it highly useful to those whose primary interest in a
computer is to get <emphasis>other</emphasis> work
done!</para>
</listitem>
<listitem>
<para><emphasis>Research:</emphasis> With source code for the
entire system available, FreeBSD is an excellent platform for
research in operating systems as well as other branches of
computer science. FreeBSD's freely available nature also makes
it possible for remote groups to collaborate on ideas or
shared development without having to worry about special
licensing agreements or limitations on what may be discussed
in open forums.</para>
</listitem>
<indexterm><primary>router</primary></indexterm>
<indexterm><primary>DNS Server</primary></indexterm>
<listitem>
<para><emphasis>Networking:</emphasis> Need a new router? A
name server (DNS)? A firewall to keep people out of your
internal network? FreeBSD can easily turn that unused 386 or
486 PC sitting in the corner into an advanced router with
sophisticated packet-filtering capabilities.</para>
</listitem>
<indexterm>
<primary>X Window System</primary>
<secondary>XFree86</secondary>
</indexterm>
<indexterm>
<primary>X Window System</primary>
<secondary>Accelerated-X</secondary>
</indexterm>
<listitem>
<para><emphasis>X Window workstation:</emphasis> FreeBSD is a
fine choice for an inexpensive X terminal solution, either
using the freely available X11 server or one of the
excellent commercial servers provided by <ulink
url="http://www.xig.com">Xi Graphics</ulink>. Unlike an
X terminal, FreeBSD allows many applications to be run
locally if desired, thus relieving the burden on a central
server. FreeBSD can even boot <quote>diskless</quote>, making
individual workstations even cheaper and easier to
administer.</para>
</listitem>
<indexterm><primary>GNU Compiler Collection</primary></indexterm>
<listitem>
<para><emphasis>Software Development:</emphasis> The basic
FreeBSD system comes with a full complement of development
tools including the renowned GNU C/C++ compiler and
debugger.</para>
</listitem>
</itemizedlist>
<para>FreeBSD is available in both source and binary form on CDROM,
DVD,
and via anonymous FTP. Please see <xref linkend="mirrors">
for more information about obtaining FreeBSD.</para>
</sect2>
<sect2>
<title>Who Uses FreeBSD?</title>
<indexterm>
<primary>users</primary>
<secondary>large sites running FreeBSD</secondary>
</indexterm>
<para>FreeBSD is used to power some of the biggest sites on the
Internet, including:</para>
<itemizedlist>
<indexterm><primary>Yahoo!</primary></indexterm>
<listitem>
<para><ulink url="http://www.yahoo.com/">Yahoo!</ulink></para>
</listitem>
<indexterm><primary>Apache</primary></indexterm>
<listitem>
<para><ulink url="http://www.apache.org/">Apache</ulink></para>
</listitem>
<indexterm><primary>Blue Mountain Arts</primary></indexterm>
<listitem>
<para><ulink url="http://www.bluemountain.com/">Blue Mountain
Arts</ulink></para>
</listitem>
<indexterm><primary>Pair Networks</primary></indexterm>
<listitem>
<para><ulink url="http://www.pair.com/">Pair
Networks</ulink></para>
</listitem>
<indexterm><primary>Sony Japan</primary></indexterm>
<listitem>
<para><ulink url="http://www.sony.co.jp/">Sony
Japan</ulink></para>
</listitem>
<indexterm><primary>Netcraft</primary></indexterm>
<listitem>
<para><ulink url="http://www.netcraft.com/">Netcraft</ulink>
</para>
</listitem>
<indexterm><primary>Weathernews</primary></indexterm>
<listitem>
<para><ulink url="http://www.wni.com/">Weathernews</ulink>
</para></listitem>
<indexterm><primary>Supervalu</primary></indexterm>
<listitem>
<para><ulink
url="http://www.supervalu.com/">Supervalu</ulink></para>
</listitem>
<indexterm><primary>TELEHOUSE America</primary></indexterm>
<listitem>
<para><ulink url="http://www.telehouse.com/">TELEHOUSE
America</ulink></para>
</listitem>
<indexterm><primary>Sophos Anti-Virus</primary></indexterm>
<listitem>
<para><ulink url="http://www.sophos.com/">Sophos
Anti-Virus</ulink></para>
</listitem>
<indexterm><primary>JMA Wired</primary></indexterm>
<listitem>
<para><ulink
url="http://www.jmawired.com/">JMA Wired</ulink></para>
</listitem>
</itemizedlist>
<para>and many more.</para>
</sect2>
</sect1>
<sect1 id="history">
<title>About the FreeBSD Project</title>
<para>The following section provides some background information on
the project, including a brief history, project goals, and the
development model of the project.</para>
<sect2 id="intro-history">
<sect2info role="firstperson">
<authorgroup>
<author>
<firstname>Jordan</firstname>
<surname>Hubbard</surname>
<contrib>Contributed by </contrib>
</author>
</authorgroup>
</sect2info>
<title>A Brief History of FreeBSD</title>
<indexterm><primary>386BSD Patchkit</primary></indexterm>
<indexterm><primary>Hubbard, Jordan</primary></indexterm>
<indexterm><primary>Williams, Nate</primary></indexterm>
<indexterm><primary>Grimes, Rod</primary></indexterm>
<indexterm>
<primary>FreeBSD Project</primary>
<secondary>history</secondary>
</indexterm>
<para>The FreeBSD project had its genesis in the early part of 1993,
partially as an outgrowth of the <quote>Unofficial 386BSD
Patchkit</quote> by the patchkit's last 3 coordinators: Nate
Williams, Rod Grimes and myself.</para>
<indexterm><primary>386BSD</primary></indexterm>
<para>Our original goal was to produce an intermediate snapshot of
386BSD in order to fix a number of problems with it that the
patchkit mechanism just was not capable of solving. Some of you
may remember the early working title for the project being
<quote>386BSD 0.5</quote> or <quote>386BSD Interim</quote> in
reference to that fact.</para>
<indexterm><primary>Jolitz, Bill</primary></indexterm>
<para>386BSD was Bill Jolitz's operating system, which had been up
to that point suffering rather severely from almost a year's worth
of neglect. As the patchkit swelled ever more uncomfortably with
each passing day, we were in unanimous agreement that something
had to be done and decided to assist Bill by providing
this interim <quote>cleanup</quote> snapshot. Those plans came to
a rude halt when Bill Jolitz suddenly decided to withdraw his
sanction from the project without any clear indication of what
would be done instead.</para>
<indexterm><primary>Greenman, David</primary></indexterm>
<indexterm><primary>Walnut Creek CDROM</primary></indexterm>
<para>It did not take us long to decide that the goal remained
worthwhile, even without Bill's support, and so we adopted the
name <quote>FreeBSD</quote>, coined by David Greenman. Our initial
objectives were set after consulting with the system's current
users and, once it became clear that the project was on the road
to perhaps even becoming a reality, I contacted Walnut Creek CDROM
with an eye toward improving FreeBSD's distribution channels for
those many unfortunates without easy access to the Internet.
Walnut Creek CDROM not only supported the idea of distributing
FreeBSD on CD but also went so far as to provide the project with a
machine to work on and a fast Internet connection. Without Walnut
Creek CDROM's almost unprecedented degree of faith in what was, at
the time, a completely unknown project, it is quite unlikely that
FreeBSD would have gotten as far, as fast, as it has today.</para>
<indexterm><primary>4.3BSD-Lite</primary></indexterm>
<indexterm><primary>Net/2</primary></indexterm>
<indexterm><primary>U.C. Berkeley</primary></indexterm>
<indexterm><primary>386BSD</primary></indexterm>
<indexterm><primary>Free Software Foundation</primary></indexterm>
<para>The first CDROM (and general net-wide) distribution was
FreeBSD&nbsp;1.0, released in December of 1993. This was based on the
4.3BSD-Lite (<quote>Net/2</quote>) tape from U.C. Berkeley, with
many components also provided by 386BSD and the Free Software
Foundation. It was a fairly reasonable success for a first
offering, and we followed it with the highly successful FreeBSD
1.1 release in May of 1994.</para>
<indexterm><primary>Novell</primary></indexterm>
<indexterm><primary>U.C. Berkeley</primary></indexterm>
<indexterm><primary>Net/2</primary></indexterm>
<indexterm><primary>AT&amp;T</primary></indexterm>
<para>Around this time, some rather unexpected storm clouds formed
on the horizon as Novell and U.C. Berkeley settled their
long-running lawsuit over the legal status of the Berkeley Net/2
tape. A condition of that settlement was U.C. Berkeley's
concession that large parts of Net/2 were <quote>encumbered</quote>
code and the property of Novell, who had in turn acquired it from
AT&amp;T some time previously. What Berkeley got in return was
Novell's <quote>blessing</quote> that the 4.4BSD-Lite release, when
it was finally released, would be declared unencumbered and all
existing Net/2 users would be strongly encouraged to switch. This
included FreeBSD, and the project was given until the end of July
1994 to stop shipping its own Net/2 based product. Under the
terms of that agreement, the project was allowed one last release
before the deadline, that release being FreeBSD&nbsp;1.1.5.1.</para>
<para>FreeBSD then set about the arduous task of literally
re-inventing itself from a completely new and rather incomplete
set of 4.4BSD-Lite bits. The <quote>Lite</quote> releases were
light in part because Berkeley's CSRG had removed large chunks of
code required for actually constructing a bootable running system
(due to various legal requirements) and the fact that the Intel
port of 4.4 was highly incomplete. It took the project until
November of 1994 to make this transition, at which point it
released FreeBSD&nbsp;2.0 to the net and on CDROM (in late December).
Despite being still more than a little rough around the edges,
the release was a significant success and was followed by the
more robust and easier to install FreeBSD&nbsp;2.0.5 release in June of
1995.</para>
<para>We released FreeBSD&nbsp;2.1.5 in August of 1996, and it appeared
to be popular enough among the ISP and commercial communities that
another release along the 2.1-STABLE branch was merited. This was
FreeBSD&nbsp;2.1.7.1, released in February 1997 and capping the end of
mainstream development on 2.1-STABLE. Now in maintenance mode,
only security enhancements and other critical bug fixes will be
done on this branch (RELENG_2_1_0).</para>
<para>FreeBSD&nbsp;2.2 was branched from the development mainline
(<quote>-CURRENT</quote>) in November 1996 as the RELENG_2_2
branch, and the first full release (2.2.1) was released in April
1997. Further releases along the 2.2 branch were done in the
summer and fall of '97, the last of which (2.2.8) appeared in
November 1998. The first official 3.0 release appeared in
October 1998 and spelled the beginning of the end for the 2.2
branch.</para>
<para>The tree branched again on Jan 20, 1999, leading to the
4.0-CURRENT and 3.X-STABLE branches. From 3.X-STABLE, 3.1 was
released on February 15, 1999, 3.2 on May 15, 1999, 3.3 on
September 16, 1999, 3.4 on December 20, 1999, and 3.5 on
June 24, 2000, which was followed a few days later by a minor
point release update to 3.5.1, to incorporate some last-minute
security fixes to Kerberos. This will be the final release in the
3.X branch.</para>
<para>There was another branch on March 13, 2000, which saw the
emergence of the 4.X-STABLE branch. There have been several releases
from it so far: 4.0-RELEASE was introduced in March 2000, and
the last &rel2.current;-RELEASE came out in
&rel2.current.date;.</para>
<para>The long-awaited 5.0-RELEASE was announced on January 19,
2003. The culmination of nearly three years of work, this
release started FreeBSD on the path of advanced multiprocessor
and application thread support and introduced support for the
&ultrasparc; and <literal>ia64</literal> platforms. This release
was followed by 5.1 in June of 2003. The last 5.X release from
-CURRENT branch was 5.2.1-RELEASE, introduced in February 2004.</para>
<para>RELENG_5 branch created in August 2004, followed by 5.3-RELEASE,
that marks beginning of the 5-STABLE branch releases. The most
recent &rel.current;-RELEASE came out in &rel.current.date;.
There will be additional releases from the RELENG_5 branch.</para>
<para>For now, long-term development projects continue to take place in the
6.X-CURRENT (trunk) branch, and SNAPshot releases of 6.X on
CDROM (and, of course, on the net) are continually made available
from <ulink url="ftp://current.FreeBSD.org/pub/FreeBSD/snapshots/">
the snapshot server</ulink> as work progresses.</para>
</sect2>
<sect2 id="goals">
<sect2info>
<authorgroup>
<author>
<firstname>Jordan</firstname>
<surname>Hubbard</surname>
<contrib>Contributed by </contrib>
</author>
</authorgroup>
</sect2info>
<title>FreeBSD Project Goals</title>
<indexterm>
<primary>FreeBSD Project</primary>
<secondary>goals</secondary>
</indexterm>
<para>The goals of the FreeBSD Project are to provide software that
may be used for any purpose and without strings attached. Many of
us have a significant investment in the code (and project) and
would certainly not mind a little financial compensation now and
then, but we are definitely not prepared to insist on it. We
believe that our first and foremost <quote>mission</quote> is to
provide code to any and all comers, and for whatever purpose, so
that the code gets the widest possible use and provides the widest
possible benefit. This is, I believe, one of the most fundamental
goals of Free Software and one that we enthusiastically
support.</para>
<indexterm>
<primary>GNU General Public License (GPL)</primary>
</indexterm>
<indexterm>
<primary>GNU Lesser General Public License (LGPL)</primary>
</indexterm>
<indexterm><primary>BSD Copyright</primary></indexterm>
<para>That code in our source tree which falls under the GNU
General Public License (GPL) or Library General Public License
(LGPL) comes with slightly more strings attached, though at
least on the side of enforced access rather than the usual
opposite. Due to the additional complexities that can evolve
in the commercial use of GPL software we do, however, prefer
software submitted under the more relaxed BSD copyright when
it is a reasonable option to do so.</para>
</sect2>
<sect2 id="development">
<sect2info>
<authorgroup>
<author>
<firstname>Satoshi</firstname>
<surname>Asami</surname>
<contrib>Contributed by </contrib>
</author>
</authorgroup>
</sect2info>
<title>The FreeBSD Development Model</title>
<indexterm>
<primary>FreeBSD Project</primary>
<secondary>development model</secondary>
</indexterm>
<para>The development of FreeBSD is a very open and flexible
process, being literally built from the contributions
of hundreds of people around the world, as can be seen from
our <ulink
url="&url.articles.contributors;/article.html">list of
contributors</ulink>. FreeBSD's development infrastructure allow
these hundreds of developers to collaborate over the Internet.
We are constantly on the lookout for
new developers and ideas, and those interested in becoming
more closely involved with the project need simply contact us
at the &a.hackers;. The &a.announce; is also available to
those wishing to make other FreeBSD users aware of major areas
of work.</para>
<para>Useful things to know about the FreeBSD project and its
development process, whether working independently or in close
cooperation:</para>
<variablelist>
<varlistentry>
<term>The CVS repository<anchor
id="development-cvs-repository"></term>
<indexterm>
<primary>CVS</primary>
<secondary>repository</secondary>
</indexterm>
<indexterm>
<primary>Concurrent Versions System</primary>
<see>CVS</see>
</indexterm>
<listitem>
<para>The central source tree for FreeBSD is maintained by
<ulink url="http://www.cvshome.org/">CVS</ulink>
(Concurrent Versions System), a freely available source code
control tool that comes bundled with FreeBSD. The primary
<ulink url="http://www.FreeBSD.org/cgi/cvsweb.cgi">CVS
repository</ulink> resides on a machine in Santa Clara CA, USA
from where it is replicated to numerous mirror machines
throughout the world. The CVS tree, which contains the <link
linkend="current">-CURRENT</link> and <link
linkend="stable">-STABLE</link> trees,
can all be easily replicated to your own machine as well.
Please refer to the <link linkend="synching">Synchronizing
your source tree</link> section for more information on
doing this.</para>
</listitem>
</varlistentry>
<varlistentry>
<term>The committers list<anchor
id="development-committers"></term>
<indexterm><primary>committers</primary></indexterm>
<listitem>
<para>The <firstterm>committers</firstterm>
are the people who have <emphasis>write</emphasis> access to
the CVS tree, and are authorized to make modifications
to the FreeBSD source (the term <quote>committer</quote>
comes from the &man.cvs.1; <command>commit</command>
command, which is used to bring new changes into the CVS
repository). The best way of making submissions for review
by the committers list is to use the &man.send-pr.1;
command. If something appears to be jammed in the
system, then you may also reach them by sending mail to
the &a.committers;.</para>
</listitem>
</varlistentry>
<varlistentry>
<term>The FreeBSD core team<anchor id="development-core"></term>
<indexterm><primary>core team</primary></indexterm>
<listitem>
<para>The <firstterm>FreeBSD core team</firstterm>
would be equivalent to the board of directors if the FreeBSD
Project were a company. The primary task of the core team
is to make sure the project, as a whole, is in good shape
and is heading in the right directions. Inviting dedicated
and responsible developers to join our group of committers
is one of the functions of the core team, as is the
recruitment of new core team members as others move on.
The current core team was elected from a pool of committer
candidates in July 2004. Elections are held every 2 years.
</para>
<para>Some core team members also have specific areas of
responsibility, meaning that they are committed to
ensuring that some large portion of the system works as
advertised. For a complete list of FreeBSD developers
and their areas of responsibility, please see the <ulink
url="&url.articles.contributors;/article.html">Contributors
List</ulink></para>
<note>
<para>Most members of the core team are volunteers when it
comes to FreeBSD development and do not benefit from the
project financially, so <quote>commitment</quote> should
also not be misconstrued as meaning <quote>guaranteed
support.</quote> The <quote>board of directors</quote>
analogy above is not very accurate, and it may be
more suitable to say that these are the people who gave up
their lives in favor of FreeBSD against their better
judgment!</para>
</note>
</listitem>
</varlistentry>
<varlistentry>
<term>Outside contributors</term>
<indexterm><primary>contributors</primary></indexterm>
<listitem>
<para>Last, but definitely not least, the largest group of
developers are the users themselves who provide feedback and
bug fixes to us on an almost constant basis. The primary
way of keeping in touch with FreeBSD's more non-centralized
development is to subscribe to the &a.hackers; where such
things are discussed. See <xref
linkend="eresources"> for more information about
the various FreeBSD mailing lists.</para>
<para><citetitle><ulink
url="&url.articles.contributors;/article.html">The
FreeBSD Contributors List</ulink></citetitle> is a long
and growing one, so why not join it by contributing
something back to FreeBSD today?</para>
<para>Providing code is not the only way of contributing to
the project; for a more complete list of things that need
doing, please refer to the <ulink
url="&url.base;/index.html">FreeBSD Project web
site</ulink>.</para>
</listitem>
</varlistentry>
</variablelist>
<para>In summary, our development model is organized as a loose set
of concentric circles. The centralized model is designed for the
convenience of the <emphasis>users</emphasis> of FreeBSD, who are
provided with an easy way of tracking one central code
base, not to keep potential contributors out! Our desire is to
present a stable operating system with a large set of coherent
<link linkend="ports">application programs</link> that the users
can easily install and use &mdash; this model works very well in
accomplishing that.</para>
<para>All we ask of those who would join us as FreeBSD developers is
some of the same dedication its current people have to its
continued success!</para>
</sect2>
<sect2 id="relnotes">
<title>The Current FreeBSD Release</title>
<indexterm><primary>NetBSD</primary></indexterm>
<indexterm><primary>OpenBSD</primary></indexterm>
<indexterm><primary>386BSD</primary></indexterm>
<indexterm><primary>Free Software Foundation</primary></indexterm>
<indexterm><primary>U.C. Berkeley</primary></indexterm>
<indexterm>
<primary>Computer Systems Research Group (CSRG)</primary>
</indexterm>
<para>FreeBSD is a freely available, full source 4.4BSD-Lite based
release for Intel &i386;, &i486;, &pentium;,
&pentium;&nbsp;Pro,
&celeron;,
&pentium;&nbsp;II,
&pentium;&nbsp;III,
&pentium;&nbsp;4 (or compatible),
&xeon;, DEC <trademark>Alpha</trademark>
and Sun &ultrasparc; based computer
systems. It is based primarily on software from U.C. Berkeley's
CSRG group, with some enhancements from NetBSD, OpenBSD, 386BSD, and
the Free Software Foundation.</para>
<para>Since our release of FreeBSD&nbsp;2.0 in late 94, the performance,
feature set, and stability of FreeBSD has improved dramatically.
<!-- XXX is the rest of this paragraph still true ? -->
The largest change is a revamped virtual memory system with a merged
VM/file buffer cache that not only increases performance, but also
reduces FreeBSD's memory footprint, making a 5&nbsp;MB configuration a
more acceptable minimum. Other enhancements include full NIS client
and server support, transaction TCP support, dial-on-demand PPP,
integrated DHCP support, an improved SCSI subsystem, ISDN support,
support for ATM, FDDI, Fast and Gigabit Ethernet (1000&nbsp;Mbit)
adapters, improved support for the latest Adaptec controllers, and
many thousands of bug fixes.</para>
<para>In addition to the base distributions, FreeBSD offers a
ported software collection with thousands of commonly
sought-after programs. At the time of this printing, there
were over &os.numports; ports! The list of ports ranges from
http (WWW) servers, to games, languages, editors, and almost
everything in between. The entire Ports Collection requires
approximately &ports.size; of storage, all ports being expressed as
<quote>deltas</quote> to their original sources. This makes
it much easier for us to update ports, and greatly reduces the
disk space demands made by the older 1.0 Ports Collection. To
compile a port, you simply change to the directory of the
program you wish to install, type <command>make
install</command>, and let the system do the rest. The full
original distribution for each port you build is retrieved
dynamically off the CDROM or a local FTP site, so you need
only enough disk space to build the ports you want. Almost
every port is also provided as a pre-compiled
<quote>package</quote>, which can be installed with a simple
command (<command>pkg_add</command>) by those who do not wish
to compile their own ports from source. More information on
packages and ports can be found in <xref linkend="ports">.</para>
<para>A number of additional documents which you may find very helpful
in the process of installing and using FreeBSD may now also be found
in the <filename>/usr/share/doc</filename> directory on any recent
FreeBSD machine. You may view the locally installed
manuals with any HTML capable browser using the following
URLs:</para>
<variablelist>
<varlistentry>
<term>The FreeBSD Handbook</term>
<listitem>
<para><ulink type="html"
url="file://localhost/usr/share/doc/handbook/index.html"><filename>/usr/share/doc/handbook/index.html</filename></ulink></para>
</listitem>
</varlistentry>
<varlistentry>
<term>The FreeBSD FAQ</term>
<listitem>
<para><ulink type="html"
url="file://localhost/usr/share/doc/faq/index.html"><filename>/usr/share/doc/faq/index.html</filename></ulink></para>
</listitem>
</varlistentry>
</variablelist>
<para>You can also view the master (and most frequently updated)
copies at <ulink
url="http://www.FreeBSD.org/"></ulink>.</para>
</sect2>
</sect1>
</chapter>
<!--
Local Variables:
mode: sgml
sgml-declaration: "../chapter.decl"
sgml-indent-data: t
sgml-omittag: nil
sgml-always-quote-attributes: t
sgml-parent-document: ("../book.sgml" "part" "chapter")
End:
-->

View file

@ -0,0 +1,15 @@
#
# Build the Handbook with just the content from this chapter.
#
# $FreeBSD$
#
CHAPTERS= kernelconfig/chapter.sgml
VPATH= ..
MASTERDOC= ${.CURDIR}/../${DOC}.${DOCBOOKSUFFIX}
DOC_PREFIX?= ${.CURDIR}/../../../..
.include "../Makefile"

File diff suppressed because it is too large Load diff

View file

@ -0,0 +1,15 @@
#
# Build the Handbook with just the content from this chapter.
#
# $FreeBSD$
#
CHAPTERS= l10n/chapter.sgml
VPATH= ..
MASTERDOC= ${.CURDIR}/../${DOC}.${DOCBOOKSUFFIX}
DOC_PREFIX?= ${.CURDIR}/../../../..
.include "../Makefile"

View file

@ -0,0 +1,971 @@
<!--
The FreeBSD Documentation Project
$FreeBSD$
-->
<chapter id="l10n">
<chapterinfo>
<authorgroup>
<author>
<firstname>Andrey</firstname>
<surname>Chernov</surname>
<contrib>Contributed by </contrib>
</author>
</authorgroup>
<authorgroup>
<author>
<firstname>Michael C.</firstname>
<surname>Wu</surname>
<contrib>Rewritten by </contrib>
</author>
<!-- 30 Nv 2000 -->
</authorgroup>
</chapterinfo>
<title>Localization - I18N/L10N Usage and Setup</title>
<sect1 id="l10n-synopsis">
<title>Synopsis</title>
<para>FreeBSD is a very distributed project with users and
contributors located all over the world. This chapter discusses
the internationalization and localization features of FreeBSD
that allow non-English speaking users to get real work done.
There are many aspects of the i18n implementation in both the system
and application levels, so where applicable we refer the reader
to more specific sources of documentation.</para>
<para>After reading this chapter, you will know:</para>
<itemizedlist>
<listitem><para>How different languages and locales are encoded
on modern operating systems.</para></listitem>
<listitem><para>How to set the locale for your login
shell.</para></listitem>
<listitem><para>How to configure your console for non-English
languages.</para></listitem>
<listitem><para>How to use X Window System effectively with different
languages.</para></listitem>
<listitem><para>Where to find more information about writing
i18n-compliant applications.</para></listitem>
</itemizedlist>
<para>Before reading this chapter, you should:</para>
<itemizedlist>
<listitem><para>Know how to install additional third-party
applications (<xref linkend="ports">).</para></listitem>
</itemizedlist>
</sect1>
<sect1 id="l10n-basics">
<title>The Basics</title>
<sect2>
<title>What Is I18N/L10N?</title>
<indexterm>
<primary>internationalization</primary>
<see>localization</see>
</indexterm>
<indexterm><primary>localization</primary></indexterm>
<para>Developers shortened internationalization into the term I18N,
counting the number of letters between the first and the last
letters of internationalization. L10N uses the same naming
scheme, coming from <quote>localization</quote>. Combined
together, I18N/L10N methods, protocols, and applications allow
users to use languages of their choice.</para>
<para>I18N applications are programmed using I18N kits under
libraries. It allows for developers to write a simple file and
translate displayed menus and texts to each language. We strongly
encourage programmers to follow this convention.</para>
</sect2>
<sect2>
<title>Why Should I Use I18N/L10N?</title>
<para>I18N/L10N is used whenever you wish to either view, input, or
process data in non-English languages.</para>
</sect2>
<sect2>
<title>What Languages Are Supported in the I18N Effort?</title>
<para>I18N and L10N are not FreeBSD specific. Currently, one can
choose from most of the major languages of the World, including
but not limited to: Chinese, German, Japanese, Korean, French,
Russian, Vietnamese and others.</para>
</sect2>
</sect1>
<sect1 id="using-localization">
<title>Using Localization</title>
<para>In all its splendor, I18N is not FreeBSD-specific and is a
convention. We encourage you to help FreeBSD in following this
convention.</para>
<indexterm><primary>locale</primary></indexterm>
<para>Localization settings are based on three main terms:
Language Code, Country Code, and Encoding. Locale names are
constructed from these parts as follows:</para>
<programlisting><replaceable>LanguageCode</replaceable>_<replaceable>CountryCode</replaceable>.<replaceable>Encoding</replaceable></programlisting>
<sect2>
<title>Language and Country Codes</title>
<indexterm><primary>language codes</primary></indexterm>
<indexterm><primary>country codes</primary></indexterm>
<para>In order to localize a FreeBSD system to a specific language
(or any other I18N-supporting &unix; like systems), the user needs to find out
the codes for the specify country and language (country
codes tell applications what variation of given
language to use). In addition, web
browsers, SMTP/POP servers, web servers, etc. make decisions based on
them. The following are examples of language/country codes:</para>
<informaltable frame="none" pgwide="1">
<tgroup cols="2">
<thead>
<row>
<entry>Language/Country Code</entry>
<entry>Description</entry>
</row>
</thead>
<tbody>
<row>
<entry>en_US</entry>
<entry>English - United States</entry>
</row>
<row>
<entry>ru_RU</entry>
<entry>Russian for Russia</entry>
</row>
<row>
<entry>zh_TW</entry>
<entry>Traditional Chinese for Taiwan</entry>
</row>
</tbody>
</tgroup>
</informaltable>
</sect2>
<sect2>
<title>Encodings</title>
<indexterm><primary>encodings</primary></indexterm>
<indexterm><primary>ASCII</primary></indexterm>
<para>Some languages use non-ASCII encodings that are 8-bit, wide
or multibyte characters, see &man.multibyte.3; for more
details. Older applications do not recognize them
and mistake them for control characters. Newer applications
usually do recognize 8-bit characters. Depending on the
implementation, users may be required to compile an application
with wide or multibyte characters support, or configure it correctly.
To be able to input and process wide or multibyte characters, the <ulink
url="&url.base;/ports/index.html">FreeBSD Ports Collection</ulink> has provided
each language with different programs. Refer to the I18N
documentation in the respective FreeBSD Port.</para>
<para>Specifically, the user needs to look at the application
documentation to decide on how to configure it correctly or to
pass correct values into the configure/Makefile/compiler.</para>
<para>Some things to keep in mind are:</para>
<itemizedlist>
<listitem>
<para>Language specific single C chars character sets
(see &man.multibyte.3;), e.g.
ISO-8859-1, ISO-8859-15, KOI8-R, CP437.</para>
</listitem>
<listitem>
<para>Wide or multibyte encodings, e.g. EUC, Big5.</para>
</listitem>
</itemizedlist>
<para>You can check the active list of character sets at the
<ulink
url="http://www.iana.org/assignments/character-sets">IANA Registry</ulink>.</para>
<note>
<para>FreeBSD versions 4.5 and up use X11-compatible locale
encodings instead.</para>
</note>
</sect2>
<sect2>
<title>I18N Applications</title>
<para>In the FreeBSD Ports and Package system, I18N applications
have been named with <literal>I18N</literal> in their names for
easy identification. However, they do not always support the
language needed.</para>
</sect2>
<sect2 id="setting-locale">
<title>Setting Locale</title>
<para>Usually it is sufficient to export the value of the locale name
as <envar>LANG</envar> in the login shell. This could be done in
the user's <filename>~/.login_conf</filename> file or in the
startup file of the user's shell (<filename>~/.profile</filename>,
<filename>~/.bashrc</filename>, <filename>~/.cshrc</filename>).
There is no need to set the locale subsets such as
<envar>LC_CTYPE</envar>, <envar>LC_CTIME</envar>. Please
refer to language-specific FreeBSD documentation for more
information.</para>
<para>You should set the following two environment variables in your configuration
files:</para>
<itemizedlist>
<indexterm><primary>POSIX</primary></indexterm>
<listitem>
<para><envar>LANG</envar> for &posix; &man.setlocale.3; family
functions</para>
</listitem>
<indexterm><primary>MIME</primary></indexterm>
<listitem>
<para><envar>MM_CHARSET</envar> for applications' MIME character
set</para>
</listitem>
</itemizedlist>
<para>This includes the user shell configuration, the specific application
configuration, and the X11 configuration.</para>
<sect3>
<title>Setting Locale Methods</title>
<indexterm><primary>locale</primary></indexterm>
<indexterm><primary>login class</primary></indexterm>
<para>There are two methods for setting locale, and both are
described below. The first (recommended one) is by assigning
the environment variables in <link linkend="login-class">login
class</link>, and the second is by adding the environment
variable assignments to the system's shell <link
linkend="startup-file">startup file</link>.</para>
<sect4 id="login-class">
<title>Login Classes Method</title>
<para>This method allows environment variables needed for locale
name and MIME character sets to be assigned once for every
possible shell instead of adding specific shell assignments to
each shell's startup file. <link linkend="usr-setup">User
Level Setup</link> can be done by an user himself and <link
linkend="adm-setup">Administrator Level Setup</link> require
superuser privileges.</para>
<sect5 id="usr-setup">
<title>User Level Setup</title>
<para>Here is a minimal example of a
<filename>.login_conf</filename> file in user's home
directory which has both variables set for Latin-1
encoding:</para>
<programlisting>me:\
:charset=ISO-8859-1:\
:lang=de_DE.ISO8859-1:</programlisting>
<indexterm><primary>Traditional Chinese</primary><secondary>BIG-5 encoding</secondary></indexterm>
<para>Here is an example of a
<filename>.login_conf</filename> that sets the variables
for Traditional Chinese in BIG-5 encoding. Notice the many
more variables set because some software does not respect
locale variables correctly for Chinese, Japanese, and Korean.</para>
<programlisting>#Users who do not wish to use monetary units or time formats
#of Taiwan can manually change each variable
me:\
:lang=zh_TW.Big5:\
:lc_all=zh_TW.Big:\
:lc_collate=zh_TW.Big5:\
:lc_ctype=zh_TW.Big5:\
:lc_messages=zh_TW.Big5:\
:lc_monetary=zh_TW.Big5:\
:lc_numeric=zh_TW.Big5:\
:lc_time=zh_TW.Big5:\
:charset=big5:\
:xmodifiers="@im=xcin": #Setting the XIM Input Server</programlisting>
<para>See <link linkend="adm-setup">Administrator Level
Setup</link> and &man.login.conf.5; for more details.</para>
</sect5>
<sect5 id="adm-setup">
<title>Administrator Level Setup</title>
<para>Verify that the user's login class in
<filename>/etc/login.conf</filename> sets the correct
language. Make sure these settings
appear in <filename>/etc/login.conf</filename>:</para>
<programlisting><replaceable>language_name</replaceable>:<replaceable>accounts_title</replaceable>:\
:charset=<replaceable>MIME_charset</replaceable>:\
:lang=<replaceable>locale_name</replaceable>:\
:tc=default:</programlisting>
<para>So sticking with our previous example using Latin-1, it
would look like this:</para>
<programlisting>german:German Users Accounts:\
:charset=ISO-8859-1:\
:lang=de_DE.ISO8859-1:\
:tc=default:</programlisting>
<bridgehead renderas=sect4>Changing Login Classes with &man.vipw.8;</bridgehead>
<indexterm>
<primary><command>vipw</command></primary>
</indexterm>
<para>Use <command>vipw</command> to add new users, and make
the entry look like this:</para>
<programlisting>user:password:1111:11:<replaceable>language</replaceable>:0:0:User Name:/home/user:/bin/sh</programlisting>
<bridgehead renderas=sect4>Changing Login Classes with &man.adduser.8;</bridgehead>
<indexterm>
<primary><command>adduser</command></primary>
</indexterm>
<indexterm><primary>login class</primary></indexterm>
<para>Use <command>adduser</command> to add new users, and do
the following:</para>
<itemizedlist>
<listitem>
<para>Set <literal>defaultclass =
<replaceable>language</replaceable></literal> in
<filename>/etc/adduser.conf</filename>. Keep in mind
you must enter a <literal>default</literal> class for
all users of other languages in this case.</para>
</listitem>
<listitem>
<para>An alternative variant is answering the specified
language each time that
<screen><prompt>Enter login class: default []: </prompt></screen>
appears from &man.adduser.8;.</para>
</listitem>
<listitem>
<para>Another alternative is to use the following for each
user of a different language that you wish to
add:</para>
<screen>&prompt.root; <userinput>adduser -class <replaceable>language</replaceable></userinput></screen>
</listitem>
</itemizedlist>
<bridgehead renderas=sect4>Changing Login Classes with &man.pw.8;</bridgehead>
<indexterm>
<primary><command>pw</command></primary>
</indexterm>
<para>If you use &man.pw.8; for adding new users, call it in
this form:</para>
<screen>&prompt.root; <userinput>pw useradd <replaceable>user_name</replaceable> -L <replaceable>language</replaceable></userinput></screen>
</sect5>
</sect4>
<sect4 id="startup-file">
<title>Shell Startup File Method</title>
<note>
<para>This method is not recommended because it requires a
different setup for each possible shell program chosen. Use
the <link linkend="login-class">Login Class Method</link>
instead.</para>
</note>
<indexterm><primary>MIME</primary></indexterm>
<indexterm><primary>locale</primary></indexterm>
<para>To add the locale name and MIME character set, just set
the two environment variables shown below in the
<filename>/etc/profile</filename> and/or
<filename>/etc/csh.login</filename> shell startup files. We
will use the German language as an example below:</para>
<para>In <filename>/etc/profile</filename>:</para>
<programlisting><envar>LANG=de_DE.ISO8859-1; export LANG</envar>
<envar>MM_CHARSET=ISO-8859-1; export MM_CHARSET</envar></programlisting>
<para>Or in <filename>/etc/csh.login</filename>:</para>
<programlisting><envar>setenv LANG de_DE.ISO8859-1</envar>
<envar>setenv MM_CHARSET ISO-8859-1</envar></programlisting>
<para>Alternatively, you can add the above instructions to
<filename>/usr/share/skel/dot.profile</filename> (similar to
what was used in <filename>/etc/profile</filename> above), or
<filename>/usr/share/skel/dot.login</filename> (similar to
what was used in <filename>/etc/csh.login</filename>
above).</para>
<para>For X11:</para>
<para>In <filename>$HOME/.xinitrc</filename>:</para>
<programlisting><envar>LANG=de_DE.ISO8859-1; export LANG</envar></programlisting>
<para>Or:</para>
<programlisting><envar>setenv LANG de_DE.ISO8859-1</envar></programlisting>
<para>Depending on your shell (see above).</para>
</sect4>
</sect3>
</sect2>
<sect2 id="setting-console">
<title>Console Setup</title>
<para>For all single C chars character sets, set the correct
console fonts in <filename>/etc/rc.conf</filename> for the
language in question with:</para>
<programlisting>font8x16=<replaceable>font_name</replaceable>
font8x14=<replaceable>font_name</replaceable>
font8x8=<replaceable>font_name</replaceable></programlisting>
<para>The <replaceable>font_name</replaceable> here is taken from
the <filename>/usr/share/syscons/fonts</filename> directory,
without the <filename>.fnt</filename> suffix.</para>
<indexterm>
<primary><application>sysinstall</application></primary>
</indexterm>
<indexterm><primary>keymap</primary></indexterm>
<indexterm><primary>screenmap</primary></indexterm>
<para>Also be sure to set the correct keymap and screenmap for your
single C chars character set through
<command>sysinstall</command> (<command>/stand/sysinstall</command>
in &os; versions older than 5.2).
Once inside <application>sysinstall</application>, choose <guimenuitem>Configure</guimenuitem>, then
<guimenuitem>Console</guimenuitem>. Alternatively, you can add the
following to <filename>/etc/rc.conf</filename>:</para>
<programlisting>scrnmap=<replaceable>screenmap_name</replaceable>
keymap=<replaceable>keymap_name</replaceable>
keychange="<replaceable>fkey_number sequence</replaceable>"</programlisting>
<para>The <replaceable>screenmap_name</replaceable> here is taken
from the <filename>/usr/share/syscons/scrnmaps</filename>
directory, without the <filename>.scm</filename> suffix. A
screenmap with a corresponding mapped font is usually needed as a
workaround for expanding bit 8 to bit 9 on a VGA adapter's font
character matrix in pseudographics area, i.e., to move letters out
of that area if screen font uses a bit 8 column.</para>
<para>If you have the <application>moused</application> daemon
enabled by setting the following
in your <filename>/etc/rc.conf</filename>:</para>
<programlisting>moused_enable="YES"</programlisting>
<para>then examine the mouse cursor information in the next
paragraph.</para>
<indexterm>
<primary><application>moused</application></primary>
</indexterm>
<para>By default the mouse cursor of the &man.syscons.4; driver occupies the
0xd0-0xd3 range in the character set. If your language uses this
range, you need to move the cursor's range outside of it. To enable
the workaround for FreeBSD versions before 5.0, insert the following
line into your kernel configuration:</para>
<programlisting>options SC_MOUSE_CHAR=0x03</programlisting>
<para>For FreeBSD versions 4.4 and up insert the following line
into <filename>/etc/rc.conf</filename>:</para>
<programlisting>mousechar_start=3</programlisting>
<para>The <replaceable>keymap_name</replaceable> here is taken from
the <filename>/usr/share/syscons/keymaps</filename> directory,
without the <filename>.kbd</filename> suffix. If you are
uncertain which keymap to use, you use can &man.kbdmap.1; to test
keymaps without rebooting.</para>
<para>The <literal>keychange</literal> is usually needed to program
function keys to match the selected terminal type because
function key sequences cannot be defined in the key map.</para>
<para>Also be sure to set the correct console terminal type in
<filename>/etc/ttys</filename> for all <literal>ttyv*</literal>
entries. Current pre-defined correspondences are:</para>
<informaltable frame="none" pgwide="1">
<tgroup cols="2">
<thead>
<row>
<entry>Character Set</entry>
<entry>Terminal Type</entry>
</row>
</thead>
<tbody>
<row>
<entry>ISO-8859-1 or ISO-8859-15</entry>
<entry><literal>cons25l1</literal></entry>
</row>
<row>
<entry>ISO-8859-2</entry>
<entry><literal>cons25l2</literal></entry>
</row>
<row>
<entry>ISO-8859-7</entry>
<entry><literal>cons25l7</literal></entry>
</row>
<row>
<entry>KOI8-R</entry>
<entry><literal>cons25r</literal></entry>
</row>
<row>
<entry>KOI8-U</entry>
<entry><literal>cons25u</literal></entry>
</row>
<row>
<entry>CP437 (VGA default)</entry>
<entry><literal>cons25</literal></entry>
</row>
<row>
<entry>US-ASCII</entry>
<entry><literal>cons25w</literal></entry>
</row>
</tbody>
</tgroup>
</informaltable>
<para>For wide or multibyte characters languages, use the correct
FreeBSD port in your
<filename>/usr/ports/<replaceable>language</replaceable></filename>
directory. Some ports appear as console while the system sees it
as serial vtty's, hence you must reserve enough vtty's for both
X11 and the pseudo-serial console. Here is a partial list of
applications for using other languages in console:</para>
<informaltable frame="none" pgwide="1">
<tgroup cols="2">
<thead>
<row>
<entry>Language</entry>
<entry>Location</entry>
</row>
</thead>
<tbody>
<row>
<entry>Traditional Chinese (BIG-5)</entry>
<entry><filename role="package">chinese/big5con</filename></entry>
</row>
<row>
<entry>Japanese</entry>
<entry><filename role="package">japanese/kon2-16dot</filename> or
<filename role="package">japanese/mule-freewnn</filename></entry>
</row>
<row>
<entry>Korean</entry>
<entry><filename role="package">korean/han</filename></entry>
</row>
</tbody>
</tgroup>
</informaltable>
</sect2>
<sect2>
<title>X11 Setup</title>
<para>Although X11 is not part of the FreeBSD Project, we have
included some information here for FreeBSD users. For more
details, refer to the <ulink
url="http://www.x.org/">&xorg;
web site</ulink> or whichever X11 Server you use.</para>
<para>In <filename>~/.Xresources</filename>, you can additionally
tune application specific I18N settings (e.g., fonts, menus,
etc.).</para>
<sect3>
<title>Displaying Fonts</title>
<indexterm><primary>X11 True Type font server</primary></indexterm>
<para>Install <application>&xorg;</application> server
(<filename role="package">x11-servers/xorg-server</filename>)
or <application>&xfree86;</application> server
(<filename role="package">x11-servers/XFree86-4-Server</filename>),
then install the language &truetype; fonts. Setting the correct
locale should allow you to view your selected language in menus
and such.</para>
</sect3>
<sect3>
<title>Inputting Non-English Characters</title>
<indexterm><primary>X11 Input Method (XIM)</primary></indexterm>
<para>The X11 Input Method (XIM) Protocol is a new standard for
all X11 clients. All X11 applications should be written as XIM
clients that take input from XIM Input servers. There are
several XIM servers available for different languages.</para>
</sect3>
</sect2>
<sect2>
<title>Printer Setup</title>
<para>Some single C chars character sets are usually hardware
coded into printers. Wide or multibyte
character sets require special setup and we recommend using
<application>apsfilter</application>. You may also convert the
document to &postscript; or PDF formats using language specific
converters.</para>
</sect2>
<sect2>
<title>Kernel and File Systems</title>
<para>The FreeBSD fast filesystem (FFS) is 8-bit clean, so it can be used
with any single C chars character set (see &man.multibyte.3;),
but there is no character set
name stored in the filesystem; i.e., it is raw 8-bit and does not
know anything about encoding order. Officially, FFS does not
support any form of wide or multibyte character sets yet. However, some
wide or multibyte character sets have independent patches for FFS
enabling such support. They are only temporary unportable
solutions or hacks and we have decided to not include them in the
source tree. Refer to respective languages' web sites for more
information and the patch files.</para>
<indexterm><primary>DOS</primary></indexterm>
<indexterm><primary>Unicode</primary></indexterm>
<para>The FreeBSD &ms-dos; filesystem has the configurable ability to
convert between &ms-dos;, Unicode character sets and chosen
FreeBSD filesystem character sets. See &man.mount.msdos.8; for
details.</para>
</sect2>
</sect1>
<sect1 id="l10n-compiling">
<title>Compiling I18N Programs</title>
<para>Many FreeBSD Ports have been ported with I18N support. Some
of them are marked with -I18N in the port name. These and many
other programs have built in support for I18N and need no special
consideration.</para>
<indexterm>
<primary><application>MySQL</application></primary>
</indexterm>
<para>However, some applications such as
<application>MySQL</application> need to be have the
<filename>Makefile</filename> configured with the specific
charset. This is usually done in the
<filename>Makefile</filename> or done by passing a value to
<application>configure</application> in the source.</para>
</sect1>
<sect1 id="lang-setup">
<title>Localizing FreeBSD to Specific Languages</title>
<sect2 id="ru-localize">
<sect2info>
<authorgroup>
<author>
<firstname>Andrey</firstname>
<surname>Chernov</surname>
<contrib>Originally contributed by </contrib>
</author>
</authorgroup>
</sect2info>
<title>Russian Language (KOI8-R Encoding)</title>
<indexterm>
<primary>localization</primary>
<secondary>Russian</secondary>
</indexterm>
<para>For more information about KOI8-R encoding, see the <ulink
url="http://koi8.pp.ru/">KOI8-R References
(Russian Net Character Set)</ulink>.</para>
<sect3>
<title>Locale Setup</title>
<para>Put the following lines into your
<filename>~/.login_conf</filename> file:</para>
<programlisting>me:My Account:\
:charset=KOI8-R:\
:lang=ru_RU.KOI8-R:</programlisting>
<para>See earlier in this chapter for examples of setting up the
<link linkend="setting-locale">locale</link>.</para>
</sect3>
<sect3>
<title>Console Setup</title>
<itemizedlist>
<listitem>
<para>For the FreeBSD versions before 5.0 add the following line
to your kernel configuration file:</para>
<programlisting>options SC_MOUSE_CHAR=0x03</programlisting>
<para>For FreeBSD versions 4.4 and up insert the following
line into <filename>/etc/rc.conf</filename>:</para>
<programlisting>mousechar_start=3</programlisting>
</listitem>
<listitem>
<para>Use following settings in
<filename>/etc/rc.conf</filename>:</para>
<programlisting>keymap="ru.koi8-r"
scrnmap="koi8-r2cp866"
font8x16="cp866b-8x16"
font8x14="cp866-8x14"
font8x8="cp866-8x8"</programlisting>
</listitem>
<listitem>
<para>For each <literal>ttyv*</literal> entry in
<filename>/etc/ttys</filename>, use
<literal>cons25r</literal> as the terminal type.</para>
</listitem>
</itemizedlist>
<para>See earlier in this chapter for examples of setting up the
<link linkend="setting-console">console</link>.</para>
</sect3>
<sect3>
<title>Printer Setup</title>
<indexterm><primary>printers</primary></indexterm>
<para>Since most printers with Russian characters come with
hardware code page CP866, a special output filter is needed
to convert from KOI8-R to CP866. Such a filter is installed by
default as <filename>/usr/libexec/lpr/ru/koi2alt</filename>.
A Russian printer <filename>/etc/printcap</filename> entry
should look like:</para>
<programlisting>lp|Russian local line printer:\
:sh:of=/usr/libexec/lpr/ru/koi2alt:\
:lp=/dev/lpt0:sd=/var/spool/output/lpd:lf=/var/log/lpd-errs:</programlisting>
<para>See &man.printcap.5; for a detailed description.</para>
</sect3>
<sect3>
<title>&ms-dos; FS and Russian Filenames</title>
<para>The following example &man.fstab.5; entry enables support
for Russian filenames in mounted &ms-dos; filesystems:</para>
<programlisting>/dev/ad0s2 /dos/c msdos rw,-Wkoi2dos,-Lru_RU.KOI8-R 0 0</programlisting>
<para>The option <option>-L</option> selects the locale name
used, and <option>-W</option> sets the character conversion
table. To use the <option>-W</option> option, be sure to
mount <filename>/usr</filename> before the &ms-dos; partition
because the conversion tables are located in
<filename>/usr/libdata/msdosfs</filename>. For more
information, see the &man.mount.msdos.8; manual
page.</para>
</sect3>
<sect3>
<title>X11 Setup</title>
<orderedlist>
<listitem>
<para>Do <link linkend="setting-locale">non-X locale
setup</link> first as described.</para>
<note>
<para><anchor id="russian-note">The Russian KOI8-R locale
may not work with old <application>&xfree86;</application> releases (lower than 3.3).
<application>&xorg;</application> is now the default
version of the X Window System on FreeBSD.
This should not be an
issue unless you are using an old version of
FreeBSD.</para>
</note>
</listitem>
<listitem>
<para>If you use <application>&xorg;</application>,
install
<filename role="package">x11-fonts/xorg-fonts-cyrillic</filename>
package.</para>
<para>Check the <literal>"Files"</literal> section
in your <filename>/etc/X11/xorg.conf</filename> file.
The following
lines must be added <emphasis>before</emphasis> any other
<literal>FontPath</literal> entries:</para>
<programlisting>FontPath "/usr/X11R6/lib/X11/fonts/cyrillic/misc"
FontPath "/usr/X11R6/lib/X11/fonts/cyrillic/75dpi"
FontPath "/usr/X11R6/lib/X11/fonts/cyrillic/100dpi"</programlisting>
<para>If you use a high resolution video mode, swap the 75 dpi
and 100 dpi lines.</para>
</listitem>
<listitem>
<para>To activate a Russian keyboard, add the following to the
<literal>"Keyboard"</literal> section of your
<filename>XF86Config</filename> file.</para>
<para>For <application>&xfree86; 3.X</application>:</para>
<programlisting>XkbLayout "ru"
XkbOptions "grp:caps_toggle"</programlisting>
<para>For <application>&xorg;</application> (or
<application>&xfree86; 4.X</application>):</para>
<programlisting>Option "XkbLayout" "us,ru"
Option "XkbOptions" "grp:toggle"</programlisting>
<para>Also make sure that <literal>XkbDisable</literal> is
turned off (commented out) there.</para>
<para>For <literal>grp:caps_toggle</literal>
the RUS/LAT switch will be <keycap>CapsLock</keycap>.
The old <keycap>CapsLock</keycap> function is still
available via <keycombo action="simul"><keycap>Shift</keycap><keycap>CapsLock</keycap></keycombo> (in LAT mode
only). For <literal>grp:toggle</literal>
the RUS/LAT switch will be <keycap>Right Alt</keycap>.
<literal>grp:caps_toggle</literal> does not work in
<application>&xorg;</application> for unknown reason.</para>
<para>If you have <quote>&windows;</quote> keys on your keyboard,
and notice that some non-alphabetical keys are mapped
incorrectly in RUS mode, add the following line in your
<filename>XF86Config</filename> file.</para>
<para>For <application>&xfree86; 3.X</application>:</para>
<programlisting>XkbVariant "winkeys"</programlisting>
<para>For <application>&xorg;</application> (or
<application>&xfree86; 4.X</application>):</para>
<programlisting>Option "XkbVariant" ",winkeys"</programlisting>
<note>
<para>The Russian XKB keyboard may not work with old <application>&xfree86;</application>
versions, see the <link linkend="russian-note">above
note</link> for more information. The Russian XKB
keyboard may also not work with non-localized
applications as well.</para>
</note>
</listitem>
</orderedlist>
<note>
<para>Minimally localized applications
should call a <function>XtSetLanguageProc (NULL, NULL,
NULL);</function> function early in the program.</para>
<para>See <ulink
url="http://koi8.pp.ru/xwin.html">
KOI8-R for X Window</ulink> for more instructions on
localizing X11 applications.</para>
</note>
</sect3>
</sect2>
<sect2>
<title>Traditional Chinese Localization for Taiwan</title>
<indexterm>
<primary>localization</primary>
<secondary>Traditional Chinese</secondary>
</indexterm>
<para>The FreeBSD-Taiwan Project has an Chinese HOWTO for
FreeBSD at <ulink url="http://netlab.cse.yzu.edu.tw/~statue/freebsd/zh-tut/"></ulink>
using many Chinese ports.
Current editor for the <literal>FreeBSD Chinese HOWTO</literal> is
Shen Chuan-Hsing <email>statue@freebsd.sinica.edu.tw</email>.
</para>
<para>Chuan-Hsing Shen <email>statue@freebsd.sinica.edu.tw</email> has
created the <ulink url="http://netlab.cse.yzu.edu.tw/~statue/cfc/">
Chinese FreeBSD Collection (CFC)</ulink> using FreeBSD-Taiwan's
<literal>zh-L10N-tut</literal>. The packages and the script files
are available at <ulink url="ftp://freebsd.csie.nctu.edu.tw/pub/taiwan/CFC/"></ulink>.</para>
</sect2>
<sect2>
<title>German Language Localization (for All ISO 8859-1
Languages)</title>
<indexterm>
<primary>localization</primary>
<secondary>German</secondary>
</indexterm>
<para>Slaven Rezic <email>eserte@cs.tu-berlin.de</email> wrote a
tutorial how to use umlauts on a FreeBSD machine. The tutorial
is written in German and available at
<ulink url="http://www.de.FreeBSD.org/de/umlaute/"></ulink>.</para>
</sect2>
<sect2>
<title>Japanese and Korean Language Localization</title>
<indexterm>
<primary>localization</primary>
<secondary>Japanese</secondary>
</indexterm>
<indexterm>
<primary>localization</primary>
<secondary>Korean</secondary>
</indexterm>
<para>For Japanese, refer to
<ulink url="http://www.jp.FreeBSD.org/"></ulink>,
and for Korean, refer to
<ulink url="http://www.kr.FreeBSD.org/"></ulink>.</para>
</sect2>
<sect2>
<title>Non-English FreeBSD Documentation</title>
<para>Some FreeBSD contributors have translated parts of FreeBSD to
other languages. They are available through links on the <ulink
url="&url.base;/index.html">main site</ulink> or in
<filename>/usr/share/doc</filename>.</para>
</sect2>
</sect1>
</chapter>
<!--
Local Variables:
mode: sgml
sgml-declaration: "../chapter.decl"
sgml-indent-data: t
sgml-omittag: nil
sgml-always-quote-attributes: t
sgml-parent-document: ("../book.sgml" "part" "chapter")
End:
-->

View file

@ -0,0 +1,15 @@
#
# Build the Handbook with just the content from this chapter.
#
# $FreeBSD$
#
CHAPTERS= linuxemu/chapter.sgml
VPATH= ..
MASTERDOC= ${.CURDIR}/../${DOC}.${DOCBOOKSUFFIX}
DOC_PREFIX?= ${.CURDIR}/../../../..
.include "../Makefile"

File diff suppressed because it is too large Load diff

View file

@ -0,0 +1,15 @@
#
# Build the Handbook with just the content from this chapter.
#
# $FreeBSD$
#
CHAPTERS= mac/chapter.sgml
VPATH= ..
MASTERDOC= ${.CURDIR}/../${DOC}.${DOCBOOKSUFFIX}
DOC_PREFIX?= ${.CURDIR}/../../../..
.include "../Makefile"

File diff suppressed because it is too large Load diff

View file

@ -0,0 +1,15 @@
#
# Build the Handbook with just the content from this chapter.
#
# $FreeBSD$
#
CHAPTERS= mail/chapter.sgml
VPATH= ..
MASTERDOC= ${.CURDIR}/../${DOC}.${DOCBOOKSUFFIX}
DOC_PREFIX?= ${.CURDIR}/../../../..
.include "../Makefile"

File diff suppressed because it is too large Load diff

View file

@ -0,0 +1,15 @@
#
# Build the Handbook with just the content from this chapter.
#
# $FreeBSD$
#
CHAPTERS= mirrors/chapter.sgml
VPATH= ..
MASTERDOC= ${.CURDIR}/../${DOC}.${DOCBOOKSUFFIX}
DOC_PREFIX?= ${.CURDIR}/../../../..
.include "../Makefile"

File diff suppressed because it is too large Load diff

View file

@ -0,0 +1,15 @@
#
# Build the Handbook with just the content from this chapter.
#
# $FreeBSD$
#
CHAPTERS= multimedia/chapter.sgml
VPATH= ..
MASTERDOC= ${.CURDIR}/../${DOC}.${DOCBOOKSUFFIX}
DOC_PREFIX?= ${.CURDIR}/../../../..
.include "../Makefile"

File diff suppressed because it is too large Load diff

View file

@ -0,0 +1,15 @@
#
# Build the Handbook with just the content from this chapter.
#
# $FreeBSD$
#
CHAPTERS= network-servers/chapter.sgml
VPATH= ..
MASTERDOC= ${.CURDIR}/../${DOC}.${DOCBOOKSUFFIX}
DOC_PREFIX?= ${.CURDIR}/../../../..
.include "../Makefile"

File diff suppressed because it is too large Load diff

View file

@ -0,0 +1,19 @@
#
# Build the Handbook with just the content from this chapter.
#
# $FreeBSD$
#
CHAPTERS= pgpkeys/chapter.sgml
PGPKEYS!= perl -ne 'm/\"([\w-]+.key)\"/ && print "$$1\n"' \
${DOC_PREFIX}/share/pgpkeys/pgpkeys.ent
SRCS+= ${PGPKEYS}
VPATH= ..
MASTERDOC= ${.CURDIR}/../${DOC}.${DOCBOOKSUFFIX}
DOC_PREFIX?= ${.CURDIR}/../../../..
.include "../Makefile"

File diff suppressed because it is too large Load diff

View file

@ -0,0 +1,15 @@
#
# Build the Handbook with just the content from this chapter.
#
# $FreeBSD$
#
CHAPTERS= ports/chapter.sgml
VPATH= ..
MASTERDOC= ${.CURDIR}/../${DOC}.${DOCBOOKSUFFIX}
DOC_PREFIX?= ${.CURDIR}/../../../..
.include "../Makefile"

File diff suppressed because it is too large Load diff

View file

@ -0,0 +1,15 @@
#
# Build the Handbook with just the content from this chapter.
#
# $FreeBSD$
#
CHAPTERS= ppp-and-slip/chapter.sgml
VPATH= ..
MASTERDOC= ${.CURDIR}/../${DOC}.${DOCBOOKSUFFIX}
DOC_PREFIX?= ${.CURDIR}/../../../..
.include "../Makefile"

File diff suppressed because it is too large Load diff

View file

@ -0,0 +1,625 @@
<!--
$FreeBSD$
-->
<preface id="book-preface">
<title>Preface</title>
<bridgehead id="preface-audience" renderas=sect1>Intended
Audience</bridgehead>
<para>The FreeBSD newcomer will find that the first section of this
book guides the user through the FreeBSD installation process and
gently introduces the concepts and conventions that underpin &unix;.
Working through this section requires little more than the desire
to explore, and the ability to take on board new concepts as they
are introduced.</para>
<para>Once you have traveled this far, the second, far larger,
section of the Handbook is a comprehensive reference to all manner
of topics of interest to FreeBSD system administrators. Some of
these chapters may recommend that you do some prior reading, and
this is noted in the synopsis at the beginning of each
chapter.</para>
<para>For a list of additional sources of information, please see <xref
linkend="bibliography">.</para>
<bridgehead id="preface-changes-from2" renderas=sect1>Changes from the
Second Edition</bridgehead>
<para>This third edition is the culmination of over two years of
work by the dedicated members of the FreeBSD Documentation
Project. The following are the major changes in this new
edition:</para>
<itemizedlist>
<listitem>
<para><xref linkend="config-tuning">, Configuration and
Tuning, has been expanded with new information about the
ACPI power and resource management, the cron system utility,
and more kernel tuning options.</para>
</listitem>
<listitem>
<para><xref linkend="security">, Security, has been expanded with
new information about virtual private networks (VPNs), file
system access control lists (ACLs), and security
advisories.</para>
</listitem>
<listitem>
<para><xref linkend="mac">, Mandatory Access Control (MAC), is
a new chapter with this edition. It explains what MAC is
and how this mechanism can be used to secure a FreeBSD
system.</para>
</listitem>
<listitem>
<para><xref linkend="disks">, Storage, has been expanded with
new information about USB storage devices, file system
snapshots, file system quotas, file and network backed
filesystems, and encrypted disk partitions.</para>
</listitem>
<listitem>
<para><xref linkend="vinum-vinum">, Vinum, is a new chapter
with this edition. It describes how to use Vinum, a logical
volume manager which provides device-independent logical
disks, and software RAID-0, RAID-1 and RAID-5.</para>
</listitem>
<listitem>
<para>A troubleshooting section has been added to <xref
linkend="ppp-and-slip">, PPP and SLIP.</para>
</listitem>
<listitem>
<para><xref linkend="mail">, Electronic Mail, has been
expanded with new information about using alternative
transport agents, SMTP authentication, UUCP, fetchmail,
procmail, and other advanced topics.</para>
</listitem>
<listitem>
<para><xref linkend="network-servers">, Network Servers, is
all new with this edition. This chapter includes
information about setting up the Apache HTTP Server, FTPd,
and setting up a server for Microsoft Windows clients with
Samba. Some sections from <xref
linkend="advanced-networking">, Advanced Networking, were
moved here to improve the presentation.</para>
</listitem>
<listitem>
<para><xref linkend="advanced-networking">, Advanced
Networking, has been expanded with new information about
using Bluetooth devices with FreeBSD, setting up wireless
networks, and Asynchronous Transfer Mode (ATM)
networking.</para>
</listitem>
<listitem>
<para>A glossary has been added to provide a central location
for the definitions of technical terms used throughout the
book.</para>
</listitem>
<listitem>
<para>A number of aesthetic improvements have been made to the
tables and figures throughout the book.</para>
</listitem>
</itemizedlist>
<bridgehead id="preface-changes" renderas=sect1>Changes from the
First Edition</bridgehead>
<para>The second edition was the culmination of over two years of
work by the dedicated members of the FreeBSD Documentation
Project. The following were the major changes in this
edition:</para>
<!-- Talk a little about justification and other stylesheet changes? -->
<itemizedlist>
<listitem>
<para>A complete Index has been added.</para>
</listitem>
<listitem>
<para>All ASCII figures have been replaced by graphical diagrams.</para>
</listitem>
<listitem>
<para>A standard synopsis has been added to each chapter to
give a quick summary of what information the chapter contains,
and what the reader is expected to know.</para>
</listitem>
<listitem>
<para>The content has been logically reorganized into three
parts: <quote>Getting Started</quote>, <quote>System Administration</quote>, and
<quote>Appendices</quote>.</para>
</listitem>
<listitem>
<para><xref linkend="install"> (<quote>Installing FreeBSD</quote>) was completely
rewritten with many screenshots to make it much easier for new
users to grasp the text.</para>
</listitem>
<listitem>
<para><xref linkend="basics"> (<quote>&unix; Basics</quote>) has been expanded to contain
additional information about processes, daemons, and
signals.</para>
</listitem>
<listitem>
<para><xref linkend="ports"> (<quote>Installing Applications</quote>) has been expanded
to contain additional information about binary package
management.</para>
</listitem>
<listitem>
<para><xref linkend="x11"> (<quote>The X Window System</quote>) has been completely
rewritten with an emphasis on using modern desktop
technologies such as <application>KDE</application> and <application>GNOME</application> on &xfree86; 4.X.</para>
</listitem>
<listitem>
<para><xref linkend="boot"> (<quote>The FreeBSD Booting Process</quote>) has been
expanded.</para>
</listitem>
<listitem>
<para><xref linkend="disks"> (<quote>Storage</quote>) has been written from what used
to be two separate chapters on <quote>Disks</quote> and <quote>Backups</quote>. We feel
that the topics are easier to comprehend when presented as a
single chapter. A section on RAID (both hardware and
software) has also been added.</para>
</listitem>
<listitem>
<para><xref linkend="serialcomms"> (<quote>Serial Communications</quote>) has been completely
reorganized and updated for FreeBSD 4.X/5.X.</para>
</listitem>
<listitem>
<para><xref linkend="ppp-and-slip"> (<quote>PPP and SLIP</quote>) has been substantially
updated.</para>
</listitem>
<listitem>
<para>Many new sections have been added to <xref linkend="advanced-networking">
(<quote>Advanced Networking</quote>).</para>
</listitem>
<listitem>
<para><xref linkend="mail"> (<quote>Electronic Mail</quote>) has been expanded to
include more information about configuring
<application>sendmail</application>.</para>
</listitem>
<listitem>
<para><xref linkend="linuxemu"> (<quote>&linux; Compatibility</quote>) has been expanded to
include information about installing
<application>&oracle;</application> and
<application>&sap.r3;</application>.</para>
</listitem>
<listitem>
<para>The following new topics are covered in this second
edition:</para>
<itemizedlist>
<listitem>
<para>Configuration and Tuning (<xref linkend="config-tuning">).</para>
</listitem>
<listitem>
<para>Multimedia (<xref linkend="multimedia">)</para>
</listitem>
</itemizedlist>
</listitem>
</itemizedlist>
<bridgehead id="preface-overview" renderas=sect1>Organization of This
Book</bridgehead>
<para>This book is split into five logically distinct sections.
The first section, <emphasis>Getting Started</emphasis>, covers
the installation and basic usage of FreeBSD. It is expected that
the reader will follow these chapters in sequence, possibly
skipping chapters covering familiar topics. The second section,
<emphasis>Common Tasks</emphasis>, covers some frequently used
features of FreeBSD. This section, and all subsequent sections,
can be read out of order. Each chapter begins with a succinct
synopsis that
describes what the chapter covers and what the reader is expected
to already know. This is meant to allow the casual reader to skip
around to find chapters of interest. The third section,
<emphasis>System Administration</emphasis>, covers administration
topics. The fourth section, <emphasis>Network
Communication</emphasis>, covers networking and server topics.
The fifth section contains
appendices of reference information.</para>
<variablelist>
<!-- Part I - Introduction -->
<varlistentry>
<term><emphasis><xref linkend="introduction">, Introduction</emphasis></term>
<listitem>
<para>Introduces FreeBSD to a new user. It describes the
history of the FreeBSD Project, its goals and development model.</para>
</listitem>
</varlistentry>
<varlistentry>
<term><emphasis><xref linkend="install">, Installation</emphasis></term>
<listitem>
<para>Walks a user through the entire installation process.
Some advanced installation topics, such as installing through
a serial console, are also covered.</para>
</listitem>
</varlistentry>
<varlistentry>
<term><emphasis><xref linkend="basics">, &unix; Basics</emphasis></term>
<listitem>
<para>Covers the basic commands and functionality of the
FreeBSD operating system. If you are familiar with &linux; or
another flavor of &unix; then you can probably skip this
chapter.</para>
</listitem>
</varlistentry>
<varlistentry>
<term><emphasis><xref linkend="ports">, Installing Applications</emphasis></term>
<listitem>
<para>Covers the installation of third-party software with
both FreeBSD's innovative <quote>Ports Collection</quote> and standard
binary packages.</para>
</listitem>
</varlistentry>
<varlistentry>
<term><emphasis><xref linkend="x11">, The X Window System</emphasis></term>
<listitem>
<para>Describes the X Window System in general and using
X11 on FreeBSD in particular. Also describes common
desktop environments such as <application>KDE</application> and <application>GNOME</application>.</para>
</listitem>
</varlistentry>
<!-- Part II Common Tasks -->
<varlistentry>
<term><emphasis><xref linkend="desktop">, Desktop Applications</emphasis></term>
<listitem>
<para>Lists some common desktop applications, such as web browsers
and productivity suites, and describes how to install them on
FreeBSD.</para>
</listitem>
</varlistentry>
<varlistentry>
<term><emphasis><xref linkend="multimedia">, Multimedia</emphasis></term>
<listitem>
<para>Shows how to set up sound and video playback support for your
system. Also describes some sample audio and video applications.</para>
</listitem>
</varlistentry>
<varlistentry>
<term><emphasis><xref linkend="kernelconfig">, Configuring the FreeBSD
Kernel</emphasis></term>
<listitem>
<para>Explains why you might need to configure a new kernel
and provides detailed instructions for configuring, building,
and installing a custom kernel.</para>
</listitem>
</varlistentry>
<varlistentry>
<term><emphasis><xref linkend="printing">, Printing</emphasis></term>
<listitem>
<para>Describes managing printers on FreeBSD, including
information about banner pages, printer accounting, and
initial setup.</para>
</listitem>
</varlistentry>
<varlistentry>
<term><emphasis><xref linkend="linuxemu">, &linux; Binary Compatibility</emphasis></term>
<listitem>
<para>Describes the &linux; compatibility features of FreeBSD.
Also provides detailed installation instructions for many
popular &linux; applications such as <application>&oracle;</application>, <application>&sap.r3;</application>, and
<application>&mathematica;</application>.</para>
</listitem>
</varlistentry>
<!-- Part III - System Administration -->
<varlistentry>
<term><emphasis><xref linkend="config-tuning">, Configuration and Tuning</emphasis></term>
<listitem>
<para>Describes the parameters available for system
administrators to tune a FreeBSD system for optimum
performance. Also describes the various configuration files
used in FreeBSD and where to find them.</para>
</listitem>
</varlistentry>
<varlistentry>
<term><emphasis><xref linkend="boot">, Booting Process</emphasis></term>
<listitem>
<para>Describes the FreeBSD boot process and explains
how to control this process with configuration options.</para>
</listitem>
</varlistentry>
<varlistentry>
<term><emphasis><xref linkend="users">, Users and Basic Account
Management</emphasis></term>
<listitem>
<para>Describes the creation and manipulation of user
accounts. Also discusses resource limitations that can be
set on users and other account management tasks.</para>
</listitem>
</varlistentry>
<varlistentry>
<term><emphasis><xref linkend="security">, Security</emphasis></term>
<listitem>
<para>Describes many different tools available to help keep your
FreeBSD system secure, including Kerberos, IPsec and OpenSSH.</para>
</listitem>
</varlistentry>
<varlistentry>
<term><emphasis><xref linkend="mac">, Mandatory Access Control</emphasis></term>
<listitem>
<para>Explains what Mandatory Access Control (MAC) is and how this
mechanism can be used to secure a FreeBSD system.</para>
</listitem>
</varlistentry>
<varlistentry>
<term><emphasis><xref linkend="disks">, Storage</emphasis></term>
<listitem>
<para>Describes how to manage storage media and filesystems
with FreeBSD. This includes physical disks, RAID arrays,
optical and tape media, memory-backed disks, and network
filesystems.</para>
</listitem>
</varlistentry>
<varlistentry>
<term><emphasis><xref linkend="geom">, GEOM</emphasis></term>
<listitem>
<para>Describes what the GEOM framework in FreeBSD is and how
to configure various supported RAID levels.</para>
</listitem>
</varlistentry>
<varlistentry>
<term><emphasis><xref linkend="vinum-vinum">, Vinum</emphasis></term>
<listitem>
<para>Describes how to use Vinum, a logical volume manager
which provides device-independent logical disks, and
software RAID-0, RAID-1 and RAID-5.</para>
</listitem>
</varlistentry>
<varlistentry>
<term><emphasis><xref linkend="l10n">, Localization</emphasis></term>
<listitem>
<para>Describes how to use FreeBSD in languages other than
English. Covers both system and application level
localization.</para>
</listitem>
</varlistentry>
<varlistentry>
<term><emphasis><xref linkend="cutting-edge">, The Cutting Edge</emphasis></term>
<listitem>
<para>Explains the differences between FreeBSD-STABLE,
FreeBSD-CURRENT, and FreeBSD releases. Describes which users
would benefit from tracking a development system and outlines
that process.</para>
</listitem>
</varlistentry>
<!-- Part IV - Network Communications -->
<varlistentry>
<term><emphasis><xref linkend="serialcomms">, Serial Communications</emphasis></term>
<listitem>
<para>Explains how to connect terminals and modems to your
FreeBSD system for both dial in and dial out connections.</para>
</listitem>
</varlistentry>
<varlistentry>
<term><emphasis><xref linkend="ppp-and-slip">, PPP and SLIP</emphasis></term>
<listitem>
<para>Describes how to use PPP, SLIP, or PPP over Ethernet to
connect to remote systems with FreeBSD.</para>
</listitem>
</varlistentry>
<varlistentry>
<term><emphasis><xref linkend="mail">, Electronic Mail</emphasis></term>
<listitem>
<para>Explains the different components of an email server and
dives into simple configuration topics for the most popular
mail server software:
<application>sendmail</application>.</para>
</listitem>
</varlistentry>
<varlistentry>
<term><emphasis><xref linkend="network-servers">, Network Servers</emphasis></term>
<listitem>
<para>Provides detailed instructions and example configuration
files to set up your FreeBSD machine as a network filesystem
server, domain name server, network information system
server, or time synchronization server.</para>
</listitem>
</varlistentry>
<varlistentry>
<term><emphasis><xref linkend="firewalls">, Firewalls</emphasis></term>
<listitem>
<para>Explains the philosophy behind software-based firewalls and
provides detailed information about the configuration of the
different firewalls available for FreeBSD.</para>
</listitem>
</varlistentry>
<varlistentry>
<term><emphasis><xref linkend="advanced-networking">, Advanced Networking</emphasis></term>
<listitem>
<para>Describes many networking topics, including sharing an
Internet connection with other computers on your LAN, advanced
routing topics, wireless networking, bluetooth, ATM, IPv6, and
much more.</para>
</listitem>
</varlistentry>
<!-- Part V - Appendices -->
<varlistentry>
<term><emphasis><xref linkend="mirrors">, Obtaining FreeBSD </emphasis></term>
<listitem>
<para>Lists different sources for obtaining FreeBSD media on CDROM
or DVD as well as different sites on the Internet that allow
you to download and install FreeBSD.</para>
</listitem>
</varlistentry>
<varlistentry>
<term><emphasis><xref linkend="bibliography">, Bibliography </emphasis></term>
<listitem>
<para>This book touches on many different subjects that may
leave you hungry for a more detailed explanation. The
bibliography lists many excellent books that are referenced in
the text.</para>
</listitem>
</varlistentry>
<varlistentry>
<term><emphasis><xref linkend="eresources">, Resources on the Internet</emphasis></term>
<listitem>
<para>Describes the many forums available for FreeBSD users to
post questions and engage in technical conversations about
FreeBSD.</para>
</listitem>
</varlistentry>
<varlistentry>
<term><emphasis><xref linkend="pgpkeys">, PGP Keys</emphasis></term>
<listitem>
<para>Lists the PGP fingerprints of several FreeBSD Developers.</para>
</listitem>
</varlistentry>
</variablelist>
<bridgehead id="preface-conv" renderas=sect1>Conventions used
in this book</bridgehead>
<para>To provide a consistent and easy to read text, several
conventions are followed throughout the book.</para>
<bridgehead id="preface-conv-typographic" renderas=sect2>Typographic
Conventions</bridgehead>
<variablelist>
<varlistentry>
<term><emphasis>Italic</emphasis></term>
<listitem>
<para>An <emphasis>italic</emphasis> font is used for filenames, URLs,
emphasized text, and the first usage of technical terms.</para>
</listitem>
</varlistentry>
<varlistentry>
<term><literal>Monospace</literal></term>
<listitem>
<para>A <literal>monospaced</literal> font is
used for error messages, commands, environment variables,
names of ports, hostnames, user names, group names, device
names, variables, and code fragments.</para>
</listitem>
</varlistentry>
<varlistentry>
<term><application>Bold</application></term>
<listitem>
<para>A <application>bold</application> font is used for
applications, commands, and keys.</para>
</listitem>
</varlistentry>
</variablelist>
<!-- Var list -->
<bridgehead id="preface-conv-commands"
renderas=sect2>User Input</bridgehead>
<para>Keys are shown in <keycap>bold</keycap> to stand out from
other text. Key combinations that are meant to be typed
simultaneously are shown with `<literal>+</literal>' between
the keys, such as:</para>
<para>
<keycombo action="simul">
<keycap>Ctrl</keycap>
<keycap>Alt</keycap>
<keycap>Del</keycap>
</keycombo>
</para>
<para>Meaning the user should type the <keycap>Ctrl</keycap>,
<keycap>Alt</keycap>, and <keycap>Del</keycap> keys at the same
time.</para>
<para>Keys that are meant to be typed in sequence will be separated with
commas, for example:</para>
<para>
<keycombo action="simul">
<keycap>Ctrl</keycap>
<keycap>X</keycap>
</keycombo>,
<keycombo action="simul">
<keycap>Ctrl</keycap>
<keycap>S</keycap>
</keycombo>
</para>
<para>Would mean that the user is expected to type the
<keycap>Ctrl</keycap> and <keycap>X</keycap> keys simultaneously
and then to type the <keycap>Ctrl</keycap> and <keycap>S</keycap>
keys simultaneously.</para>
<!-- How to type in key stokes, etc.. -->
<bridgehead id="preface-conv-examples"
renderas=sect2>Examples</bridgehead>
<para>Examples starting with <devicename>E:\&gt;</devicename>
indicate a &ms-dos; command. Unless otherwise noted, these commands
may be executed from a <quote>Command Prompt</quote> window in a modern &microsoft.windows;
environment.</para>
<screen><prompt>E:\&gt;</prompt> <userinput>tools\fdimage floppies\kern.flp A:</userinput></screen>
<para>Examples starting with &prompt.root; indicate a command that
must be invoked as the superuser in FreeBSD. You can login as
<username>root</username> to type the command, or login as your
normal account and use &man.su.1; to gain
superuser privileges.</para>
<screen>&prompt.root; <userinput>dd if=kern.flp of=/dev/fd0</userinput></screen>
<para>Examples starting with &prompt.user; indicate a command that
should be invoked from a normal user account. Unless otherwise
noted, C-shell syntax is used for setting environment variables
and other shell commands.</para>
<screen>&prompt.user; <userinput>top</userinput></screen>
<bridgehead id="preface-acknowledgements"
renderas=sect1>Acknowledgments</bridgehead>
<para>The book you are holding represents the efforts of many hundreds of
people around the world. Whether they sent in fixes for typos, or
submitted complete chapters, all the contributions have been
useful.</para>
<para>Several companies have supported the development of this
document by paying authors to work on it full-time, paying for
publication, etc. In particular, BSDi (subsequently acquired by
<ulink url="http://www.windriver.com">Wind River Systems</ulink>)
paid members of the FreeBSD Documentation Project to work on
improving this book full time leading up to the publication of the
first printed edition in March 2000 (ISBN 1-57176-241-8). Wind
River Systems then paid several additional authors to make a
number of improvements to the print-output infrastructure and to add
additional chapters to the text. This work culminated in the
publication of the second printed edition in November 2001 (ISBN
1-57176-303-1). In 2003-2004, <ulink
url="http://www.freebsdmall.com">FreeBSD Mall, Inc</ulink>, paid
several contributors to improve the Handbook in preparation for
the third printed edition.</para>
</preface>
<!--
Local Variables:
mode: sgml
sgml-declaration: "../chapter.decl"
sgml-indent-data: t
sgml-omittag: nil
sgml-always-quote-attributes: t
sgml-parent-document: ("../book.sgml" "book" "preface")
End:
-->

View file

@ -0,0 +1,15 @@
#
# Build the Handbook with just the content from this chapter.
#
# $FreeBSD$
#
CHAPTERS= printing/chapter.sgml
VPATH= ..
MASTERDOC= ${.CURDIR}/../${DOC}.${DOCBOOKSUFFIX}
DOC_PREFIX?= ${.CURDIR}/../../../..
.include "../Makefile"

File diff suppressed because it is too large Load diff

View file

@ -0,0 +1,15 @@
#
# Build the Handbook with just the content from this chapter.
#
# $FreeBSD$
#
CHAPTERS= security/chapter.sgml
VPATH= ..
MASTERDOC= ${.CURDIR}/../${DOC}.${DOCBOOKSUFFIX}
DOC_PREFIX?= ${.CURDIR}/../../../..
.include "../Makefile"

File diff suppressed because it is too large Load diff

View file

@ -0,0 +1,15 @@
#
# Build the Handbook with just the content from this chapter.
#
# $FreeBSD$
#
CHAPTERS= serialcomms/chapter.sgml
VPATH= ..
MASTERDOC= ${.CURDIR}/../${DOC}.${DOCBOOKSUFFIX}
DOC_PREFIX?= ${.CURDIR}/../../../..
.include "../Makefile"

File diff suppressed because it is too large Load diff

View file

@ -0,0 +1,71 @@
<!--
Creates entities for each .txt screenshot that is included in the
Handbook.
Each entity is named txt.dir.foo, where dir is the directory in
which it is stored, and foo is its filename, without the '.txt'
extension.
Entities should be listed in alphabetical order.
$FreeBSD$
-->
<!ENTITY txt.install.adduser1 SYSTEM "install/adduser1.txt">
<!ENTITY txt.install.adduser2 SYSTEM "install/adduser2.txt">
<!ENTITY txt.install.adduser3 SYSTEM "install/adduser3.txt">
<!ENTITY txt.install.boot-mgr SYSTEM "install/boot-mgr.txt">
<!ENTITY txt.install.console-saver1 SYSTEM "install/console-saver1.txt">
<!ENTITY txt.install.console-saver2 SYSTEM "install/console-saver2.txt">
<!ENTITY txt.install.console-saver3 SYSTEM "install/console-saver3.txt">
<!ENTITY txt.install.console-saver4 SYSTEM "install/console-saver4.txt">
<!ENTITY txt.install.desktop SYSTEM "install/desktop.txt">
<!ENTITY txt.install.disklabel-auto SYSTEM "install/disklabel-auto.txt">
<!ENTITY txt.install.disklabel-ed1 SYSTEM "install/disklabel-ed1.txt">
<!ENTITY txt.install.disklabel-ed2 SYSTEM "install/disklabel-ed2.txt">
<!ENTITY txt.install.disklabel-fs SYSTEM "install/disklabel-fs.txt">
<!ENTITY txt.install.disklabel-root1 SYSTEM "install/disklabel-root1.txt">
<!ENTITY txt.install.disklabel-root2 SYSTEM "install/disklabel-root2.txt">
<!ENTITY txt.install.disklabel-root3 SYSTEM "install/disklabel-root3.txt">
<!ENTITY txt.install.dist-set SYSTEM "install/dist-set.txt">
<!ENTITY txt.install.dist-set2 SYSTEM "install/dist-set2.txt">
<!ENTITY txt.install.docmenu1 SYSTEM "install/docmenu1.txt">
<!ENTITY txt.install.ed0-conf SYSTEM "install/ed0-conf.txt">
<!ENTITY txt.install.ed0-conf2 SYSTEM "install/ed0-conf2.txt">
<!ENTITY txt.install.edit-inetd-conf SYSTEM "install/edit-inetd-conf.txt">
<!ENTITY txt.install.fdisk-drive1 SYSTEM "install/fdisk-drive1.txt">
<!ENTITY txt.install.fdisk-drive2 SYSTEM "install/fdisk-drive2.txt">
<!ENTITY txt.install.fdisk-edit1 SYSTEM "install/fdisk-edit1.txt">
<!ENTITY txt.install.fdisk-edit2 SYSTEM "install/fdisk-edit2.txt">
<!ENTITY txt.install.ftp-anon1 SYSTEM "install/ftp-anon1.txt">
<!ENTITY txt.install.ftp-anon2 SYSTEM "install/ftp-anon2.txt">
<!ENTITY txt.install.hdwrconf SYSTEM "install/hdwrconf.txt">
<!ENTITY txt.install.keymap SYSTEM "install/keymap.txt">
<!ENTITY txt.install.main-doc SYSTEM "install/main-doc.txt">
<!ENTITY txt.install.main-keymap SYSTEM "install/main-keymap.txt">
<!ENTITY txt.install.main-options SYSTEM "install/main-options.txt">
<!ENTITY txt.install.main-std SYSTEM "install/main-std.txt">
<!ENTITY txt.install.main1 SYSTEM "install/main1.txt">
<!ENTITY txt.install.mainexit SYSTEM "install/mainexit.txt">
<!ENTITY txt.install.media SYSTEM "install/media.txt">
<!ENTITY txt.install.mouse1 SYSTEM "install/mouse1.txt">
<!ENTITY txt.install.mouse2 SYSTEM "install/mouse2.txt">
<!ENTITY txt.install.mouse3 SYSTEM "install/mouse3.txt">
<!ENTITY txt.install.mouse4 SYSTEM "install/mouse4.txt">
<!ENTITY txt.install.mouse5 SYSTEM "install/mouse5.txt">
<!ENTITY txt.install.mouse6 SYSTEM "install/mouse6.txt">
<!ENTITY txt.install.nfs-server-edit SYSTEM "install/nfs-server-edit.txt">
<!ENTITY txt.install.options SYSTEM "install/options.txt">
<!ENTITY txt.install.pkg-cat SYSTEM "install/pkg-cat.txt">
<!ENTITY txt.install.pkg-confirm SYSTEM "install/pkg-confirm.txt">
<!ENTITY txt.install.pkg-install SYSTEM "install/pkg-install.txt">
<!ENTITY txt.install.pkg-sel SYSTEM "install/pkg-sel.txt">
<!ENTITY txt.install.probstart SYSTEM "install/probstart.txt">
<!ENTITY txt.install.security SYSTEM "install/security.txt">
<!ENTITY txt.install.sysinstall-exit SYSTEM "install/sysinstall-exit.txt">
<!ENTITY txt.install.timezone1 SYSTEM "install/timezone1.txt">
<!ENTITY txt.install.timezone2 SYSTEM "install/timezone2.txt">
<!ENTITY txt.install.timezone3 SYSTEM "install/timezone3.txt">
<!ENTITY txt.install.userconfig SYSTEM "../../../share/images/books/handbook/install/userconfig.txt">
<!ENTITY txt.install.userconfig2 SYSTEM "../../../share/images/books/handbook/install/userconfig2.txt">
<!ENTITY txt.install.xf86setup SYSTEM "install/xf86setup.txt">

View file

@ -0,0 +1,15 @@
#
# Build the Handbook with just the content from this chapter.
#
# $FreeBSD$
#
CHAPTERS= users/chapter.sgml
VPATH= ..
MASTERDOC= ${.CURDIR}/../${DOC}.${DOCBOOKSUFFIX}
DOC_PREFIX?= ${.CURDIR}/../../../..
.include "../Makefile"

File diff suppressed because it is too large Load diff

View file

@ -0,0 +1,15 @@
#
# Build the Handbook with just the content from this chapter.
#
# $FreeBSD$
#
CHAPTERS= vinum/chapter.sgml
VPATH= ..
MASTERDOC= ${.CURDIR}/../${DOC}.${DOCBOOKSUFFIX}
DOC_PREFIX?= ${.CURDIR}/../../../..
.include "../Makefile"

File diff suppressed because it is too large Load diff

View file

@ -0,0 +1,15 @@
#
# Build the Handbook with just the content from this chapter.
#
# $FreeBSD$
#
CHAPTERS= x11/chapter.sgml
VPATH= ..
MASTERDOC= ${.CURDIR}/../${DOC}.${DOCBOOKSUFFIX}
DOC_PREFIX?= ${.CURDIR}/../../../..
.include "../Makefile"

File diff suppressed because it is too large Load diff

View file

@ -0,0 +1,43 @@
#
# $FreeBSD$
#
# Build the FreeBSD Porter's Handbook.
#
MAINTAINER=doc@FreeBSD.org
DOC?= book
FORMATS?= html-split
INSTALL_COMPRESSED?= gz
INSTALL_ONLY_COMPRESSED?=
#
# SRCS lists the individual SGML files that make up the document. Changes
# to any of these files will force a rebuild
#
# SGML content
SRCS= book.sgml
# Use the local DSSSL file
DSLHTML?= ${.CURDIR}/freebsd.dsl
DSLPRINT?= ${.CURDIR}/freebsd.dsl
# Images from the cross-document image library
IMAGES_LIB+= callouts/1.png
IMAGES_LIB+= callouts/2.png
IMAGES_LIB+= callouts/3.png
IMAGES_LIB+= callouts/4.png
IMAGES_LIB+= callouts/5.png
IMAGES_LIB+= callouts/6.png
IMAGES_LIB+= callouts/7.png
IMAGES_LIB+= callouts/8.png
IMAGES_LIB+= callouts/9.png
IMAGES_LIB+= callouts/10.png
URL_RELPREFIX?= ../../../..
DOC_PREFIX?= ${.CURDIR}/../../..
.include "${DOC_PREFIX}/share/mk/doc.project.mk"

File diff suppressed because it is too large Load diff

View file

@ -0,0 +1,40 @@
<!-- $FreeBSD$ -->
<!-- Local DSSSL file for the Porter's Handbook. This is so we can include
a link to the -ports mailing list at the bottom of the HTML files,
rather than the -questions mailing list. -->
<!DOCTYPE style-sheet PUBLIC "-//James Clark//DTD DSSSL Style Sheet//EN" [
<!ENTITY freebsd.dsl SYSTEM "../../share/sgml/freebsd.dsl" CDATA DSSSL>
<!ENTITY % output.html "IGNORE">
]>
<style-sheet>
<style-specification use="docbook">
<style-specification-body>
<![ %output.html; [
(define ($email-footer$)
(make sequence
(literal "For questions about the FreeBSD ports system, e-mail <")
(create-link (list (list "HREF" "mailto:ports@FreeBSD.org"))
(literal "ports@FreeBSD.org"))
(literal ">.")
(make empty-element gi: "br")
(literal "For questions about this documentation, e-mail <")
(create-link (list (list "HREF" "mailto:doc@FreeBSD.org"))
(literal "doc@FreeBSD.org"))
(literal ">.")))
<!-- Convert " ... " to `` ... '' in the HTML output. -->
(element quote
(make sequence
(literal "``")
(process-children)
(literal "''")))
]]>
</style-specification-body>
</style-specification>
<external-specification id="docbook" document="freebsd.dsl">
</style-sheet>

View file

@ -0,0 +1,140 @@
#
# $FreeBSD$
#
# Build the FreeBSD Handbook.
#
MAINTAINER= statue@freebsd.sinica.edu.tw
DOC?= zh-tut
FORMATS?= html-split
INSTALL_COMPRESSED?= gz
INSTALL_ONLY_COMPRESSED?=
TIDYFLAGS= -raw
DSLHTML= freebsd.dsl
DSLPRINT= freebsd.dsl
#
# SRCS lists the individual SGML files that make up the document. Changes
# to any of these files will force a rebuild
#
# SGML content
SRCS= book.sgml
SRCS+= chapters/ack.sgml
SRCS+= chapters/compose.sgml
SRCS+= chapters/converter.sgml
SRCS+= chapters/charmap.sgml
SRCS+= chapters/devel.sgml
SRCS+= chapters/dict.sgml
SRCS+= chapters/difficult.sgml
SRCS+= chapters/faq.sgml
SRCS+= chapters/fonts.sgml
SRCS+= chapters/l10n.sgml
SRCS+= chapters/mailclient.sgml
SRCS+= chapters/message.sgml
SRCS+= chapters/multimedia.sgml
SRCS+= chapters/net.sgml
SRCS+= chapters/other.sgml
SRCS+= chapters/outta.sgml
SRCS+= chapters/preface.sgml
SRCS+= chapters/print.sgml
SRCS+= chapters/software.sgml
SRCS+= chapters/stepbystep.sgml
SRCS+= chapters/view.sgml
SRCS+= chapters/wm.sgml
SRCS+= chapters/xwin.sgml
# Entities
SRCS+= authors.ent
SRCS+= chapters.ent
IMAGES= images/20020527-2.png
IMAGES+= images/20020527.png
IMAGES+= images/Eterm.png
IMAGES+= images/IglooFTP.png
IMAGES+= images/abiword.png
IMAGES+= images/acroread.png
IMAGES+= images/applet.png
IMAGES+= images/arphicttf.png
IMAGES+= images/aterm.png
IMAGES+= images/bbsnet.png
IMAGES+= images/bg5pdf.png
IMAGES+= images/bg5ps.png
IMAGES+= images/big5con.png
IMAGES+= images/cccii.png
IMAGES+= images/cce.png
IMAGES+= images/cid-gv.png
IMAGES+= images/cjk.png
IMAGES+= images/cjk-lyx.png
IMAGES+= images/cwtexttf.png
IMAGES+= images/cxterm.png
IMAGES+= images/dict.png
IMAGES+= images/dvipdfmx.png
IMAGES+= images/edict-big5.png
IMAGES+= images/fzzdxfw.png
IMAGES+= images/fortunetw.png
IMAGES+= images/gaim.png
IMAGES+= images/gnuls.png
IMAGES+= images/hanzim.png
IMAGES+= images/hztty.png
IMAGES+= images/irssi.png
IMAGES+= images/joe.png
IMAGES+= images/kde-print.png
IMAGES+= images/kfont_3_1.png
IMAGES+= images/kmerlin.png
IMAGES+= images/konq_3_1.png
IMAGES+= images/konq_3_2.png
IMAGES+= images/konq_3_3.png
IMAGES+= images/konq_3_4.png
IMAGES+= images/konqueror.png
IMAGES+= images/konsole.png
IMAGES+= images/ldap.png
IMAGES+= images/lynx.png
IMAGES+= images/licq.png
IMAGES+= images/man.png
IMAGES+= images/mlterm.png
IMAGES+= images/mplayer.png
IMAGES+= images/moefonts-cid.png
IMAGES+= images/moettf.png
IMAGES+= images/mozilla.png
IMAGES+= images/mutt.png
IMAGES+= images/nautilus.png
IMAGES+= images/ncftp3.png
IMAGES+= images/ntfs.png
IMAGES+= images/ntuttf.png
IMAGES+= images/openoffice.png
IMAGES+= images/oxford.png
IMAGES+= images/php-imagettftext.png
IMAGES+= images/php-pdf.png
IMAGES+= images/pydict.png
IMAGES+= images/qe.png
IMAGES+= images/qkmj.png
IMAGES+= images/qterm.png
IMAGES+= images/rxvt.png
IMAGES+= images/showttf.png
IMAGES+= images/stardict.png
IMAGES+= images/stardict2.png
IMAGES+= images/swing.png
IMAGES+= images/sylpheed.png
IMAGES+= images/tcltk.png
IMAGES+= images/tcsh.png
IMAGES+= images/tin.png
IMAGES+= images/tintin++.png
IMAGES+= images/ttf2pt1.png
IMAGES+= images/ve.png
IMAGES+= images/vim.png
IMAGES+= images/vnc.png
IMAGES+= images/wangttf.png
IMAGES+= images/windowmaker.png
IMAGES+= images/xchat.png
IMAGES+= images/xcin25.png
IMAGES+= images/xmms.png
IMAGES+= images/xpdf.png
IMAGES+= images/zhcon.png
DOC_PREFIX?= ${.CURDIR}/../../..
.include "${DOC_PREFIX}/share/mk/doc.project.mk"

View file

@ -0,0 +1,39 @@
<!--
Names and email address of contributing authors and CVS committers.
Entity names for committers should be the same as their login names on
freefall.FreeBSD.org.
Use these entities when referencing people.
Please keep this list in alphabetical order by entity names.
Id: authors.ent,v 1.9 2003/10/12 12:14:19 statue Exp
$FreeBSD$
-->
<!ENTITY a.statue "Shen Chun-Hsing <email>statue@freebsd.sinica.edu.tw</email>">
<!ENTITY a.clive "Clive T. Lin<email>clive@FreeBSD.ORG</email>">
<!ENTITY a.cschin "Chen-Shan Chin <email>cschin@u.washington.edu</email>">
<!ENTITY a.cwhuang "cwhuang <email>cwhuang@phys.ntu.edu.tw</email>">
<!ENTITY a.cwweng "Chih-Wei Weng <email>cwweng@mail.ep.nctu.edu.tw</email>">
<!ENTITY a.edwardlee "Edward G.J. Lee <email>EdwardLee@bbs.ee.ntu.edu.tw</email>">
<!ENTITY a.foxfair "Foxfair Hu <email>foxfair@FreeBSD.ORG</email>">
<!ENTITY a.gslin "Gea-Suan Lin <email>gslin@ccca.nctu.edu.tw</email>">
<!ENTITY a.ijliao "Ying-chieh Liao <email>ijliao@FreeBSD.ORG</email>">
<!ENTITY a.jdli "jdli <email>jdli@csie.nctu.edu.tw</email>">
<!ENTITY a.jerry "jerry <email>jerry@mail.hantop.com.tw</email>">
<!ENTITY a.joelu "Joe Lu <email>JoeLu@freebsd.ee.ntu.edu.tw</email>">
<!ENTITY a.keichii "Michael C. Wu <email>keichii@FreeBSD.ORG</email>">
<!ENTITY a.keith "Jing-Tang Keith Jang <email>keith@FreeBSD.ORG</email>">
<!ENTITY a.kevlo "Kevin Lo <email>kevlo@FreeBSD.ORG</email>">
<!ENTITY a.kuang.c.w "Kuang-che Wu <email>b88062@csie.ntu.edu.tw</email>">
<!ENTITY a.leeym "Yen-Ming Lee <email>leeym@FreeBSD.ORG</email>">
<!ENTITY a.mhsin "mhsin <email>b7506043@csie.ntu.edu.tw</email>">
<!ENTITY a.platin "platin <email>platin@ms31.hinet.net</email>">
<!ENTITY a.srlee "§õªYèû <email>srlee@csie.nctu.edu.tw</email>">
<!ENTITY a.tung.c.k "Chung-Kie Tung <email>tung@turtle.ee.ncku.edu.tw</email>">
<!ENTITY a.thhsieh "thhsieh <email>thhsieh@linux.org.tw</email>">
<!ENTITY a.vanilla "Vanilla I. Shu <email>vanilla@FreeBSD.ORG</email>">
<!ENTITY a.weijr "weijr <email>weijr.bbs@bbs.ntu.edu.tw</email>">
<!ENTITY a.ycheng "Yuan-Chen Cheng <email>ycheng@sinica.edu.tw</email>">
<!ENTITY a.yinjieh "yinjieh <email>yinjieh@csie.nctu.edu.tw</email>">

View file

@ -0,0 +1,2 @@
<!-- $FreeBSD$ -->
<!DOCTYPE chapter PUBLIC "-//FreeBSD//DTD DocBook V3.1-Based Extension//EN">

View file

@ -0,0 +1,39 @@
<!--
Creates entities for each chapter in the FreeBSD Handbook. Each entity
is named chap.foo, where foo is the value of the id attribute on that
chapter, and corresponds to the name of the directory in which that
chapter's .sgml file is stored.
Chapters should be listed in the order in which they are referenced.
Id: chapters.ent,v 1.13 2003/09/10 19:57:19 statue Exp
$FreeBSD$
-->
<!-- Part one -->
<!ENTITY chap.preface SYSTEM "chapters/preface.sgml">
<!ENTITY chap.stepbystep SYSTEM "chapters/stepbystep.sgml">
<!ENTITY chap.dict SYSTEM "chapters/dict.sgml">
<!ENTITY chap.difficult SYSTEM "chapters/difficult.sgml">
<!ENTITY chap.environment SYSTEM "chapters/environment.sgml">
<!ENTITY chap.fetch SYSTEM "chapters/fetch.sgml">
<!ENTITY chap.xwin SYSTEM "chapters/xwin.sgml">
<!ENTITY chap.message SYSTEM "chapters/message.sgml">
<!ENTITY chap.fonts SYSTEM "chapters/fonts.sgml">
<!ENTITY chap.view SYSTEM "chapters/view.sgml">
<!ENTITY chap.wm SYSTEM "chapters/wm.sgml">
<!ENTITY chap.print SYSTEM "chapters/print.sgml">
<!ENTITY chap.compose SYSTEM "chapters/compose.sgml">
<!ENTITY chap.converter SYSTEM "chapters/converter.sgml">
<!ENTITY chap.mailclient SYSTEM "chapters/mailclient.sgml">
<!ENTITY chap.net SYSTEM "chapters/net.sgml">
<!ENTITY chap.irc SYSTEM "chapters/irc.sgml">
<!ENTITY chap.devel SYSTEM "chapters/devel.sgml">
<!ENTITY chap.multimedia SYSTEM "chapters/multimedia.sgml">
<!ENTITY chap.software SYSTEM "chapters/software.sgml">
<!ENTITY chap.outta SYSTEM "chapters/outta.sgml">
<!ENTITY chap.other SYSTEM "chapters/other.sgml">
<!ENTITY chap.l10n SYSTEM "chapters/l10n.sgml">
<!ENTITY chap.faq SYSTEM "chapters/faq.sgml">
<!ENTITY chap.charmap SYSTEM "chapters/charmap.sgml">
<!ENTITY chap.ack SYSTEM "chapters/ack.sgml">

View file

@ -0,0 +1,147 @@
<!--
The Chinese FreeBSD Documentation Project
Id: ack.sgml,v 1.16 2003/12/08 11:06:41 statue Exp
$FreeBSD$
-->
<chapter id="ack">
<title>感謝</title>
<para>本份文件的完成,要感謝以下的熱心人士 :-)。
更要感謝致力為 FreeBSD 中文化的許多人們。因為他們的努力,今日
我們在 FreeBSD 上才有舒適的中文環境能使用。
可以從 <ulink url="http://www.freebsd.org/cgi/cvsweb.cgi/CVSROOT-ports/access">CVSROOT-ports/access</ulink> 得到所有 ports committer 的加入時間。</para>
<itemizedlist>
<listitem>
<para>&a.statue; Weak initializer也是新手 ports maintainer。</para>
</listitem>
<listitem>
<para>&a.clive; 給予這份文件很多的指導,
FreeBSD 的 <ulink url="http://people.freebsd.org/~fenner/portsurvey/clive@freebsd.org.html">ports committer</ulink>
(06 Dec 2000),對於中文的貢獻不遺餘力。</para>
</listitem>
<listitem>
<para>&a.foxfair; FreeBSD 的 <ulink url="http://people.freebsd.org/~fenner/portsurvey/foxfair@freebsd.org.html">ports committer</ulink>
對於中文的貢獻不遺餘力。</para>
</listitem>
<listitem>
<para>&a.gslin; 提供 cvsup 的設定方式和步驟,國內使用 FreeBSD 的高級玩家。
</para>
</listitem>
<listitem>
<para>&a.ijliao; FreeBSD 的 <ulink url="http://people.freebsd.org/~fenner/portsurvey/ijliao@freebsd.org.html">ports committer</ulink>
(20 Jan 2001),對於中文的貢獻不遺餘力。 </para>
</listitem>
<listitem>
<para>&a.keichii; FreeBSD 的 <ulink url="http://people.freebsd.org/~fenner/portsurvey/keichii@freebsd.org.html">src committer</ulink>(07 Mar 2001),在列印的章節給予了很多的指導。</para>
</listitem>
<listitem>
<para>&a.keith; FreeBSD 的 <ulink url="http://people.freebsd.org/~fenner/portsurvey/keith@freebsd.org.html">ports committer</ulink>
(06 Nov 2000),對於中文的貢獻不遺餘力。 </para>
</listitem>
<listitem>
<para>&a.kevlo; FreeBSD 的 <ulink url="http://people.freebsd.org/~fenner/portsurvey/kevlo@freebsd.org.html">ports committer</ulink>
(28 May 1999),對於中文的貢獻不遺餘力。 </para>
</listitem>
<listitem>
<para>&a.leeym; FreeBSD 的 <ulink url="http://people.freebsd.org/~fenner/portsurvey/leeym@freebsd.org.html">ports committer</ulink>
(14 Aug 2002),對於中文的貢獻不遺餘力。 </para>
</listitem>
<listitem>
<para>&a.vanilla; FreeBSD 的 <ulink url="http://people.freebsd.org/~fenner/portsurvey/vanilla@freebsd.org.html">ports committer</ulink>
(25 Dec 1997),對於中文的貢獻不遺餘力。 </para>
</listitem>
<listitem>
<para>davidxu 是大陸的 committer專門做 KSE 方面。</para>
</listitem>
<listitem>
<para>hsu 是大陸的 committer。</para>
</listitem>
<listitem>
<para>bmah 是香港的 committer。</para>
</listitem>
</itemizedlist>
<para>以下是 FreeBSD ports maintainers。</para>
<programlisting>
find /usr/ports -name Makefile -print|xargs grep MAINTAINER|grep \\.tw|sort|uniq|less
cut -d\| -f6 /usr/ports/INDEX | grep \.tw\$ | sort | uniq -c</programlisting>
<itemizedlist>
<listitem>
<para><ulink url="http://people.freebsd.org/~fenner/portsurvey/avatar@mmlab.cse.yzu.edu.tw.html">avatar@mmlab.cse.yzu.edu.tw</ulink></para>
</listitem>
<listitem>
<para><ulink url="http://people.freebsd.org/~fenner/portsurvey/clsung@dragon2.net.html">clsung@dragon2.net</ulink></para>
</listitem>
<listitem>
<para><ulink url="http://people.freebsd.org/~fenner/portsurvey/edwardc@firebird.org.tw.html">edwardc@firebird.org.tw.html</ulink></para>
</listitem>
<listitem>
<para><ulink url="http://people.freebsd.org/~fenner/portsurvey/gslin@ccca.nctu.edu.tw.html">gslin@ccca.nctu.edu.tw.html</ulink></para>
</listitem>
<listitem>
<para><ulink url="http://people.freebsd.org/~fenner/portsurvey/horance@freedom.ie.cycu.edu.tw.html">horance@freedom.ie.cycu.edu.tw</ulink></para>
</listitem>
<listitem>
<para><ulink url="http://people.freebsd.org/~fenner/portsurvey/jdli@csie.nctu.edu.tw.html">jdli@csie.nctu.edu.tw</ulink></para>
</listitem>
<listitem>
<para><ulink url="http://people.freebsd.org/~fenner/portsurvey/jihuang@gate.sinica.edu.tw.html">jihuang@gate.sinica.edu.tw</ulink></para>
</listitem>
<listitem>
<para><ulink url="http://people.freebsd.org/~fenner/portsurvey/kcwu@ck.tp.edu.tw.html">kcwu@ck.tp.edu.tw</ulink></para>
</listitem>
<listitem>
<para><ulink url="http://people.freebsd.org/~fenner/portsurvey/sexbear@tmu.edu.tw.html">sexbear@tmu.edu.tw</ulink></para>
</listitem>
<listitem>
<para><ulink url="http://people.freebsd.org/~fenner/portsurvey/piaip@csie.ntu.edu.tw.html">piaip@csie.ntu.edu.tw</ulink></para>
</listitem>
<listitem>
<para><ulink url="http://people.freebsd.org/~fenner/portsurvey/tung@turtle.ee.ncku.edu.tw.html">tung@turtle.ee.ncku.edu.tw</ulink></para>
</listitem>
<listitem>
<para><ulink url="http://people.freebsd.org/~fenner/portsurvey/woju@freebsd.ntu.edu.tw.html">woju@freebsd.ntu.edu.tw</ulink></para>
</listitem>
<listitem>
<para><ulink url="http://people.freebsd.org/~fenner/portsurvey/ycheng@sinica.edu.tw.html">ycheng@sinica.edu.tw</ulink></para>
</listitem>
<listitem>
<para><ulink url="http://people.freebsd.org/~fenner/portsurvey/yinjieh@csie.nctu.edu.tw.html">yinjieh@csie.nctu.edu.tw</ulink></para>
</listitem>
<listitem>
<para><ulink url="http://people.freebsd.org/~fenner/portsurvey/yssu@ccca.nctu.edu.tw.html">yssu@CCCA.NCTU.edu.tw</ulink></para>
</listitem>
</itemizedlist>
<para>以下是 GNU/Linux 相關的貢獻者。</para>
<itemizedlist>
<listitem>
<para>&a.cwhuang; 這份文件的 GNU/Linux 版本,它是本文件的基礎。</para>
</listitem>
<listitem>
<para>&a.platin; 親手打造 GNU/Linux 中文環境原文。</para>
</listitem>
<listitem>
<para>&a.thhsieh; 親手打造 GNU/Linux 中文環境原文。</para>
</listitem>
</itemizedlist>
<para>另外感謝台灣 ftp[1-n].tw.freebsd.org 的 mirror 站維護者,
有了這些主機和頻寬讓我們能夠省許多到國外抓取檔案的時間,
使得 FreeBSD 能夠快速流通於台灣。
台灣也是全世界 mirror 站密度最高的。</para>
</chapter>
<!--
Local Variables:
mode: sgml
sgml-declaration: "../chapter.decl"
sgml-indent-data: t
sgml-omittag: nil
sgml-always-quote-attributes: t
sgml-parent-document: ("../zh-tut.sgml" "part" "chapter")
End:
-->

View file

@ -0,0 +1,79 @@
<!--
The Chinese FreeBSD Documentation Project
Id: charmap.sgml,v 1.18 2003/11/13 12:02:46 statue Exp
$FreeBSD$
-->
<chapter id="charmap">
<title>文字編碼</title>
<sect1 id="charmap-taiwan">
<title>中文編碼</title>
<para></para>
<sect2 id="big5tbl">
<title>Big5 文字內碼表</title>
<programlisting>
#!/usr/bin/perl
#
# create code table (Big5) [\0xa1-0xf9][\0x40-\0x7e\0xa1-\0xfe]
#
# 繁體中文 (Big5) 文字內碼表的產生
open (OUT, "&gt; big5tbl.txt"); select OUT;
# 文字內碼表的產生
for ($c1 = 0xA1; $c1 &lt;= 0xF9; $c1++) { # $c1 是第一個位元 [\0xa1-\0xf9]
# 開頭的表示
print "\ncode ";
print "+0 +1 +2 +3 +4 +5 +6 +7 +8 +9 +A +B +C +D +E +F\n";
$head = "";
$line = "";
$c = 1; # 1行文字數(16文字)
for ($c2 = 0x40; $c2 &lt;= 0xFF; $c2++) { # $c2 是第二個位元
# 開頭第一個字
if ("$head" eq "") {
$head = sprintf ("%02X%02X ", $c1, $c2);
}
# 文字的表示
$line .= " "; # 文字間的空白
if (($c2 == 0x7F) || ($c2 == 0xA0) || ($c2 == 0xFF)) {
$line .= ' ';
} else {
$line .= pack("CC", $c1, $c2);
}
if ($c == 16) { # 16文字表示一行
print "$head$line\n";
$head = "";
$line = "";
$c = 1;
if ($c2 == 0x7F) { $c2 = 0x9F; } # 跳過 [\0x80-0x9f]
} else {
$c++;
}
}
}
close(OUT);
exit; </programlisting>
</sect2>
</sect1>
</chapter>
<!--
Local Variables:
mode: sgml
sgml-declaration: "../chapter.decl"
sgml-indent-data: t
sgml-omittag: nil
sgml-always-quote-attributes: t
sgml-parent-document: ("../zh-tut.sgml" "part" "chapter")
End:
-->

File diff suppressed because it is too large Load diff

View file

@ -0,0 +1,362 @@
<!--
The Chinese FreeBSD Documentation Project
Id: converter.sgml,v 1.28 2003/12/08 11:06:41 statue Exp
$FreeBSD$
-->
<chapter id="converter">
<title>中文轉碼軟體</title>
<para></para>
<sect1 id="iconv">
<title>iconv</title>
<para>由於版權的問題FreeBSD 下的 iconv 2.0 大約是 2000 年的程式,
也就不能 GNU libiconv 所擁有的轉換表,
在使用上也是有許多缺點。</para>
<para>安裝 <filename role="package">converters/iconv</filename>。</para>
<para>基本的用法有:</para>
<screen>
&prompt.user; <userinput>iconv -f gb2312 -t big5 file.gb &gt; file.big5</userinput></screen>
<para>以下是寫 C 程式的小範例:</para>
<programlisting>
#include &lt;stdio.h&gt;
#include "iconv.h"
void
my_iconv(char *fromcode, char *tocode, char *inbuf, char *outbuf)
{
iconv_t cd;
size_t status;
char *inbufp, *outbufp;
size_t inbytesleft, outbytesleft;
inbytesleft = strlen(inbuf);
outbytesleft = inbytesleft * 5;
cd = iconv_open(tocode, fromcode);
if ((iconv_t) (-1) == cd) {
perror ("Error at iconv_open");
exit(1);
}
inbufp = inbuf;
outbufp = outbuf;
status = iconv (cd, &amp;inbufp, &amp;inbytesleft, &amp;outbufp, &amp;outbytesleft);
if (status == (size_t) -1)
{
perror ("Error at my_iconv");
}
status = iconv_close(cd);
if (status == (int) -1)
{
perror ("Error at iconv_close");
}
return;
}
int
main(int argc, char* argv[])
{
char *inbuf = "加上";
char *outbuf = (char *) malloc(sizeof (char) * strlen(inbuf)*5);
my_iconv("Big5", "GBK", inbuf, outbuf);
printf("%s -> %s\n", inbuf, outbuf);
free(outbuf);
}</programlisting>
<para>以下是編譯的方式:</para>
<programlisting>
gcc -I/usr/local/include -L/usr/local/lib -liconv -o my_iconv my_iconv.c</programlisting>
<para>
WWW: <ulink url="http://www.dante.net/staff/konstantin/FreeBSD/iconv/">
http://www.dante.net/staff/konstantin/FreeBSD/iconv/</ulink></para>
</sect1>
<sect1 id="cn2jp">
<title>cn2jp - 在中文和日文間的編碼轉移函式庫</title>
<para>
一個可以中文 {GB,Big5,HZ} 和日文 (EUC-Jis/Shift-Jis/Jis)
之間互相轉換的程式。</para>
<para>安裝 <filename role="package">converters/cn2jp</filename>。</para>
<para>基本的用法有:</para>
<screen>
&prompt.user; <userinput>b2j &lt; file.big5 &gt; file.jis</userinput>
&prompt.user; <userinput>g2j &lt; file.gb &gt; file.jis</userinput>
&prompt.user; <userinput>j2b &lt; file.jis &gt; file.big5</userinput>
&prompt.user; <userinput>g2b &lt; file.gb &gt; file.big5</userinput>
&prompt.user; <userinput>j2g &lt; file.jis &gt; file.gb</userinput>
&prompt.user; <userinput>b2g &lt; file.big5 &gt; file.gb</userinput></screen>
<para>另外還有幾個可以使用的 Library</para>
<programlisting>
char *lang_big5_to_eucjis(istr)
;translate Big5 in istr to EUC-Jis in allocated buffer
;the allocated buffer is returned and valid until next call
;refer to subdirectory big2jis
char *lang_gb_to_eucjis();
;translate GB in istr to EUC-Jis in allocated buffer
;the allocated buffer is returned and valid until next call
;refer to subdirectory gb2jis
char *lang_eucjis_to_big5(istr)
;translate EUC-Jis in istr to Big5 in allocated buffer
;the allocated buffer is returned and valid until next call
;refer to subdirectory jis2big
char *lang_gb_to_big5(istr)
;translate GB in istr to Big5 in allocated buffer
;the allocated buffer is returned and valid until next call
;refer to subdirectory gb2big
char *lang_eucjis_to_gb(istr)
;translate EUC-Jis in istr to GB in allocated buffer
;the allocated buffer is returned and valid until next call
;refer to subdirectory jis2gb
char *lang_big5_to_gb(istr)
;translate Big5 in istr to GB in allocated buffer
;the allocated buffer is returned and valid until next call
;refer to subdirectory big2gb
int lang_uzpj
;uses the uzpj system for unmappable words
int lang_debug
;turns on the debug info in translation</programlisting>
</sect1>
<sect1 id="autoconvert">
<title>autoconvert - 智慧的中文編碼轉換</title>
<para>
<application>autoconverter</application>
的特色是有自動判斷轉碼功能,適合用在
GB &lt;=&gt; Big5 &lt;=&gt; HZ 互轉。</para>
<para>安裝 <filename role="package">chinese/autoconvert</filename>。</para>
<para>
如果您使用 <application>procmail</application>,在
<filename>/usr/local/share/autoconvert/procmailrc.example</filename>
底下有一個將
<application>autoconvert</application> 當作
<application>procmail</application> 過濾器的範例。</para>
<para><application>autoconvert</application>使用方法:</para>
<screen>
&prompt.user; <userinput>autob5 -i utf8 -o big5 &lt; shed.utf8 &gt; shed.utf8.big5-ac</userinput>
</screen>
<para>
WWW: <ulink url="http://banyan.dlut.edu.cn/~ygh/">
http://banyan.dlut.edu.cn/~ygh/</ulink></para>
</sect1>
<sect1 id="c2t">
<title>c2t - 轉譯 GB/Big5 編碼成拼音</title>
<para>GB(大陸)/Big5(台灣)中文轉成拼音中文字轉成英文字母拼音。 </para>
<para>安裝 <filename role="package">chinese/c2t</filename>。</para>
<programlisting>
&prompt.user; <userinput>echo "您好" | b2g | c2t</userinput>
nin2 hao3</programlisting>
</sect1>
<sect1 id="hc">
<title>hc - 漢字轉換器,在 GB 和 Big5 編碼間轉換</title>
<para>
漢字轉換器,這是一個 BIG5 及 GB 編碼的轉換程式。 </para>
<para>GB 與 Big5 屬於兩個不同組織各自制定的標準,
對應漢字編碼的轉換都是通過表格來轉換,
它們之間不存在任何內在的邏輯關係或函數。</para>
<para>安裝 <filename role="package">chinese/hc</filename>。</para>
<para>GB 轉為 BIG5 用:</para>
<screen>
&prompt.user; <userinput>hc -m g2b -t /usr/local/share/chinese/hc.tab &lt; INPUT_FILE &gt; OUTPUT_FILE</userinput>
</screen>
<para>BIG5 轉為 GB 用:</para>
<screen>
&prompt.user; <userinput>hc -m b2g -t /usr/local/share/chinese/hc.tab &lt; INPUT_FILE &gt; OUTPUT_FILE</userinput>
</screen>
<para>
您可以自己寫一個 shell script 來簡化上面的指令。
或是直接使用已經寫好的 shell script
<command>g2b</command> 和 <command>b2g</command>。</para>
</sect1>
<sect1 id="gb2jis">
<title>gb2jis - GB漢字轉換JIS漢字</title>
<para>安裝 <filename role="package">chinese/gb2jis</filename>。</para>
<para>可輸入以下編碼:</para>
<programlisting>
GB2312-80 + GB8565-88
GB2312-80
中國語EUC (8-bit GuoBiao)
HZ-encoding</programlisting>
<para>可輸出以下編碼:</para>
<programlisting>
JISX0208-1983 + JISX0212-1990
JISX0208-1983 + JISX0212-1990 + UZPJ
JISX0208-1983
JISX0208-1983 + UZPJ
日本語EUC
日本語EUC + UZPJ
Shift-JIS
Shift-JIS + UZPJ</programlisting>
<para>UZPJ雙拼規則等詳細說明請參閱
<command>man 1 gb2jis</command> 的操作指南。</para>
</sect1>
<sect1 id="hztty">
<title>hztty - 在 GB Big5 和 HZ tty 中轉換</title>
<para>
<application>Hztty</application> 可在不同中文編碼格式做轉換。
可轉換國標(GB)/繁體(Big5)/漢字(HZ)標(GB)就是大陸用的簡體字,
繁體(Big5)是台灣用的,漢字(HZ)是其它地區用的,
各地區有不同的中文編碼,有了此程式讓不同地區間的中文溝通更順暢。</para>
<para>安裝 <filename role="package">chinese/hztty</filename>。</para>
<para>
用法很簡單,如果您要在 Big5 的環境底下連上 GB 的
BBS只要依照以下的步驟</para>
<screen>
&prompt.user; <userinput>hztty -I big2gb -O gb2big</userinput>
[hztty started] [using /dev/ttyp3]
&prompt.user; <userinput>telnet bbs.tsinghua.edu.cn</userinput>
&prompt.user; <userinput>exit</userinput>
exit
[hztty exited]</screen>
<para>
這樣子就可以輸出自動將簡體轉為繁體,並將輸入自動由繁體轉為簡體,
就可以很方便的與使用簡體的人溝通了。</para>
<para>
bbs.tsinghua.edu.cn(水木清華) 有 FreeBSD 的討論版。</para>
<figure>
<title>hztty snapshot</title>
<mediaobject>
<imageobject>
<imagedata fileref="images/hztty" format="PNG">
</imageobject>
</mediaobject>
</figure>
</sect1>
<sect1 id="jis2gb">
<title>jis2gb - JIS漢字轉換GB漢字</title>
<para>安裝 <filename role="package">chinese/jis2gb</filename>。</para>
<para>可輸入以下編碼:</para>
<programlisting>
JISX0208-1983 (JISC6226-1978)
JISX0212-1990
日本語EUC
Shift-JIS</programlisting>
<para>可輸出以下編碼:</para>
<programlisting>
GB2312-80 + GB8565-88
GB2312-80
中國語EUC (8-bit GuoBiao)
HZ-encoding</programlisting>
<para>詳細說明請參閱
<command>man 1 jis2gb</command> 的操作指南。</para>
</sect1>
<sect1 id="pycodec">
<title>pycodec - 中文碼/萬國碼轉換程式</title>
<para>
這個套件支援Python和C兩種介面可轉換中文碼和萬國碼(Unicode)。
如果您只用Python寫程式請採用Python介面。
然而如果您喜歡C可以試著使用C介面。
C介面是用Python/C API寫出來的目的是為了得到較佳的效能。
就目前而言Python介面適用GNU/Linux和Windows系統
但是這一版的C介面只能用於GNU/Linux系統。</para>
<para>安裝 <filename role="package">converters/py-cjkcodecs</filename>。</para>
<para>在demo/子目錄下您可以找到test_*.py
這是用來示範如何把中文碼轉換成Unicode
或者從Unicode轉換成中文碼。</para>
<para>
在chinesetw/子目錄下,有四個對照表檔案,如下所示:</para>
<programlisting>
o big52utf1.py
o big52utf2.py
o utf2big51.py
o utf2big52.py</programlisting>
<para>
主檔名中最後一個數字是指BIG5碼的層級如big52utf1.py指的就是第一層
BIG5碼而big52utf2.py指的就是第二層BIG5碼。
由於第一層BIG5碼定義的都是最常用的中文字
因此,把第一層和第二層分開,多少有助於加快辭典的搜尋速度。</para>
<para>
此外倚天版的Big5或是Big5 Plus並不保證能正常運作。</para>
<para>
C介面每個共享模組中只有兩個方函decode()和encode()。
您可以把BIG5字串轉成萬國碼字串也可以直接轉成UTF-8或UTF-16。
最原始的用法,請參見範例。</para>
<programlisting>
#!/usr/local/bin/python
twstring = "這是一個測試, 英文是\"This is a test.\"\n" + \
"先把BIG5碼轉換成Unicode, 再把Unicode轉\n" + \
"回BIG5碼. 效果還不錯, 但效能差一點."
uni = unicode(twstring, "big5_tw")
bstring = uni.encode("big5_tw")
print "Original BGI5 encoded string:"
print twstring
print "Transcode to Unicode encoding:"
print repr(uni)
print "Print as a BIG5 encoded string:"
print bstring</programlisting>
<para>
WWW: <ulink url="http://sourceforge.net/projects/python-codecs/">
http://sourceforge.net/projects/python-codecs/</ulink></para>
</sect1>
<sect1 id="fzzdxfw">
<title>fzzdxfw - 方正中等線繁體</title>
<para>Contributed by 逸晨 (weonfu@hotmail.com)</para>
<para>Last Update: 2003年 4月 6日 周日 15時43分29秒 CST</para>
<para>把簡體網站直接變繁體的方式目前有不少種,
使用南極星的軟體,使用中介型網站例如
<ulink url="http://chinagate.yam.com/">
番薯藤的簡體網頁繁體化</ulink>
另ㄧ種就是直接從字型下手。
在這邊提供從字型下手的方式。</para>
<para><application>fzzdxfw</application> 字型的安裝:</para>
<screen>
&prompt.root; <userinput>cd /usr/ports/outta-port/fzzdxfw</userinput>
&prompt.root; <userinput>make install clean</userinput></screen>
<para>安裝完後,可以用 ttfm.sh --list xttfm 來查看是否有裝好。</para>
<programlisting>
FZZDXFW.TTF -misc-FZZhongDengXian_Z07T-medium-r-normal--0-0-0-0-c-0-gb2312.1980-0
FZZDXFW.TTF -misc-FZZhongDengXian_Z07T-medium-r-normal--0-0-0-0-p-0-iso8859-1
FZZDXFW.TTF -misc-FZZhongDengXian_Z07T-medium-r-normal--0-0-0-0-c-0-iso10646-1</programlisting>
<para>確認後,設定 Mozilla 的字型配置,
繁體字型與歐美字型的部分保持原設定,
只需要修改簡體字型的部分。</para>
<para>如果是 IE 的使用者可以將字型安裝到
<filename>C:/WINDOWS/Fonts</filename> 之下,
然後開啟 IE<option>工具 -&gt; 網際網路選項 -&gt; ㄧ般 -&gt;
字型 -&gt; 字集: 簡體中文 -&gt; 網頁字型: FZZhongDengXian-Z07T -&gt;
純文字字型: FZZhongDengXian-Z07T</option>
並且修改 <option>工具 -&gt; 網際網路選項 -&gt; ㄧ般 -&gt;
存取設定 -&gt; 略過Wab網頁上指定字型樣式</option>
勾起來,可以防止網頁直接寫死字型。</para>
<figure>
<title>fzzdxfw snapshot</title>
<mediaobject>
<imageobject>
<imagedata fileref="images/fzzdxfw" format="PNG">
</imageobject>
</mediaobject>
</figure>
<para>DL: <ulink url="http://dl1.51soft.com:8080/51fonts/cnfont/fangzheng/fzzdxfw.zip">
方正中等線繁體下載位址</ulink></para>
</sect1>
</chapter>
<!--
Local Variables:
mode: sgml
sgml-declaration: "../chapter.decl"
sgml-indent-data: t
sgml-omittag: nil
sgml-always-quote-attributes: t
sgml-parent-document: ("../zh-tut.sgml" "part" "chapter")
End:
-->

View file

@ -0,0 +1,985 @@
<!--
The Chinese FreeBSD Documentation Project
Id: devel.sgml,v 1.53 2003/12/08 11:09:26 statue Exp
$FreeBSD$
-->
<chapter id="devel">
<title>中文程式設計</title>
<para>
以下是一些軟體在中文支援方面,利用程式的判斷。</para>
<para>
原則上如果是用 gtk 寫的軟體,裡面有呼叫到 gtk_set_locale()
這個函式的話應該都沒問題。</para>
<para>
如果是其他的 X 軟體可能要找一下 source 裡面有沒有
setlocale(LC_CTYPE, NULL);
及 XIM 相關函式呼叫情形。如果有遵照正統做法,
<application>xcin2.5</application> 應該都可以跟它搭配良好。</para>
<para>
Qt 沒碰過,所以不知道他怎麼運作。不過猜想 XIM 這段應該跟
gtk 大同小異。</para>
<para>
用 xforms 寫的軟體應該會有問題。</para>
<para>
用 X11R6.4 版以後的 Xt/Xaw 寫的軟體應該是沒問題,
記得在 .Xdefaults 裡頭加入 <option>*international:true</option>
、<option>*fontSet:-*-iso8859-1,-*-16-*-big5-0</option>
等等。</para>
<para>用 fltk 寫的軟體似乎也沒支援 XIM。</para>
<sect1 id="freebsd-prog">
<title>在 FreeBSD 下寫程式應該注意的問題</title>
<para>
在FreeBSD下寫程式結果發現一個中文的問題
例如字串中包含這"許"這個字,因為許字的下半碼是
ascii中的\符號,結果就會造成錯誤,請問這種情形
應該如何解決?又還有沒有其他的碼有這種問題?</para>
<para>在程式中該字前加一個 '\',還有很多有這個問題呢,如下:</para>
<programlisting>
5C +0 +1 +2 +3 +4 +5 +6 +7 +8 +9 +A +B +C +D +E +F
A0 α 么 功 吒 吭 沔 坼 歿 俞 枯 苒 娉 珮
B0 豹 崤 淚 許 廄 琵 跚 愧 稞 鈾 暝 蓋 墦 穀 閱 璞
C0 餐 縷 擺 黠 孀 髏 躡 ふ ж 尐 佢 汻 岤 狖 垥 柦
D0 胐 娖 涂 罡 偅 惝 牾 莍 傜 揊 焮 茻 鄃 幋 滜 綅
E0 赨 塿 槙 箤 踊 嫹 潿 蔌 醆 嬞 獦 螏 餤 燡 螰 駹
F0 礒 鎪 瀙 酀 瀵 騱 酅 贕 鱋 鱭 </programlisting>
<para> '\' 的 ASCII code 是 \0x5c從 [\0xa1-\0xf9][\0x5c]
都會有這個問題。</para>
<programlisting>
#!/usr/bin/perl
#
# create code table (Big5) [\0xa1-0xf9][\0x40-\0x7e\0xa1-\0xfe]
#
# 繁體中文 (Big5) 文字內碼表的產生
open (OUT, "&gt; big55c.txt"); select OUT;
# 文字內碼表的產生
# 開頭的表示
print "\n5C ";
print "+0 +1 +2 +3 +4 +5 +6 +7 +8 +9 +A +B +C +D +E +F\n";
$c = 1; # 1行文字數(16文字)
$head = "";
$line = "";
for ($c1 = 0xA0; $c1 i&lt;= 0xF9; $c1++) { # $c1 是第一個位元 [\0xa1-\0xf9]
$c2=0x5c;
# 開頭第一個字
if ("$head" eq "") {
$head = sprintf ("%02X ", $c1);
}
$line .= " "; # 文字間的空白
if ($c1 == 0xA0) {
$line .= " ";
} else {
$line .= pack("CC", $c1, $c2);
}
if ($c == 16 || $c1 ==0xf9) { # 16文字表示一行
print "$head$line\n";
$head = "";
$line = "";
$c = 1;
} else {
$c++;
}
}
close(OUT);
exit;</programlisting>
</sect1>
<sect1 id="jsp-servlet">
<title>JSP / Servlet 怎樣才能處理中文?</title>
<para>
鄭原真 &a.ycheng; Copyright 2000.</para>
<para>
本文版權 : GPL or BSD style請保留作者姓名。</para>
<para>
本文假設您已經會使用 JSP 或是 Servlet 撰寫英文的 Web-Page。
如果您還不會,或是根本不知道 JSP 或是 Servlet 是幹什麼的,
那這篇文章不是寫給您看的。</para>
<para>
在 Java Servlet Spec v2.0 中,對於多國語言的支援,並不足。
您必須找到 Java Servlet Spec v2.2 的實作才行,筆者試過的
是 Apache Jakarta Tomcat 3.1 軟體(註一)。</para>
<para>
本文測試平台是 Debian Woody, Sun jdk1.2.2, Tomcat 3.1,
mm.mysql-2.0.2</para>
<para>Java Server 如何處理中文。</para>
<para>前言</para>
<para>
首先,如何正確的了解您一個 Big5 中文在 Java 中是正確的
中文 Unicode 呢?</para>
<para>
輸出一個 String("今").length() 吧 ! 由於 "今" 在 Big5 是由兩個
byte 組成,但對 java 來說java 的字元是 unicode也就是說
無論是一個英文字或是一個中文字,其 length() 都是 1. 也就是說,
(new String("今")).length() ==&gt; 1。才是正確的。</para>
<para>Servlet 輸出中文的一個例子。</para>
<para>下面是一個典型的 Java Servlet。</para>
<programlisting>
HelloWorldExample.java =&gt;
----------- cut here -----------------
import java.io.*;
import java.text.*;
import java.util.*;
import javax.servlet.*;
import javax.servlet.http.*;
public class HelloWorldExample extends HttpServlet {
public void doGet(HttpServletRequest request,
HttpServletResponse response)
throws IOException, ServletException
{
response.setLocale(new Locale(new String("zh"), new String("TW")));
response.setContentType("text/html");
PrintWriter out = response.getWriter();
out.println("&lt;html&gt;");
out.println("&lt;head&gt;");
String title = new String("hello 大家好");
out.println("&lt;title&gt;" + title + "&lt;/title&gt;");
out.println("&lt;/head&gt;");
out.println("&lt;body bgcolor=\"white\"&gt;");
out.println("&lt;body&gt;");
out.println("&lt;p&gt;");
out.println("&lt;h1&gt;" + title + "&lt;/h1&gt;");
out.println("&lt;/body&gt;");
out.println("&lt;/html&gt;");
}
}
----------- cut here -----------------</programlisting>
<para>可以正常輸出中文的關鍵是:</para>
<programlisting>
response.setLocale(new Locale(new String("zh"), new String("TW")));</programlisting>
<para>注意這一行應該要放在</para>
<programlisting>
PrintWriter out = response.getWriter();</programlisting>
<para>之前執行。另外編譯時注意</para>
<programlisting>
javac -encoding Big5 HelloWorldExample.java</programlisting>
<para>或是 (linux 上的 jdk1.2.2)</para>
<programlisting>
export LANG=zh_TW.Big5
export LC_CTYPE=zh_TW.Big5
javac HelloWorldExample.java</programlisting>
<para>
注意,這個例子在 jserv v1.1.2 並不能 work因為該版本實做的
JavaSoft Java Servlet APIs 2.0, 而 setLocale 是到
Servlet APIs 2.2 才有。</para>
<para>Java Server Page 如何處理中文</para>
<para>在此簡略說明,先看下面的例子:</para>
<programlisting>
test.jsp
----------------------
&lt;%@ page contentType="text/html; charset=big5" %&gt;
&lt;html&gt;
&lt;body bgcolor="white"&gt;
中文TEST.&lt;p&gt;
&lt;%= (new String("今天")).length() %&gt;
out.println("大家好");
&lt;/body&gt;
&lt;/html&gt;
----------------------</programlisting>
<para>關鍵在第一行。有了這一行就行了。</para>
<para>而如果使用 POST 時,要使用中文就先看下面的例子</para>
<programlisting>
test2.jsp
----------------------
&lt;html&gt;
&lt;head&gt;
&lt;title&gt;Instropection&lt;/title&gt;
&lt;/head&gt;
&lt;meta http-equiv="Content-Type" content="text/html; charset=big5"&gt;
&lt;body&gt;
&lt;body bgcolor="#FFFFFF" text="#000000"&gt;
&lt;form name="form1" action="test3.jsp" method="post" &gt;
&lt;p&gt; 姓名:
&lt;input type="text" name="name"&gt;
&lt;/p&gt;
&lt;p&gt;編號:
&lt;input type="text" name="number"&gt;
&lt;/p&gt;
&lt;p&gt;
&lt;input type="submit" value="傳送"&gt;
&lt;input type="reset" value="清除"&gt;
&lt;/p&gt;
&lt;/form&gt;
&lt;/body&gt;
&lt;/html&gt;
----------------------
test3.jsp
----------------------
&lt;%@ page language="java" contentType="text/html;charset=Big5" %&gt;
&lt;html&gt;
&lt;head&gt;
&lt;title&gt;Instropection&lt;/title&gt;
&lt;/head&gt;
&lt;body&gt;
&lt;%
String name = new String(request.getParameter("name").getBytes("ISO-8859-1"), "Big5");
String number = request.getParameter("number");
%&gt;
姓名:&lt;%= name %&gt;
&lt;br&gt;編號:&lt;%= number %&gt;
&lt;/body&gt;
&lt;/html&gt;
----------------------</programlisting>
<para>
關鍵在於 String(str.getBytes("ISO-8859-1"), "Big5")
java.lang.String 的建構函式可以產生指定特定語系的 String
透過這個範例,可以使 String 正確地轉換中文。</para>
<para>For Hacker</para>
<para>
理論上這一行可以放在文件的任何地方,但由於 Java 時做上
開檔案後通常就必須指定 encoding當 java jsp engine 發現
charset 跟 default 不同時,通常必須重新開檔案。所以實做上
這一行放在越前面越好。不過話是這樣說,由於通常 jsp 會在
run time 被 compile 成 java bytecode也就是說只有在
.jsp 更新時才需要 recompile。overhead 實在有限。</para>
<para>
註一:請到 http://jakarta.apache.org/ 下去 Download。</para>
</sect1>
<sect1 id="java-mysql">
<title>Java 連結到 MySql 如何使用中文?</title>
<para>鄭原真 &a.ycheng; Copyright 2000.</para>
<para>本文版權 : GPL or BSD style請保留作者姓名。</para>
<para>
本文假設您已經會使用 JSP 或是 Servlet 撰寫英文的 Web-Page。
如果您還不會,或是根本不知道 JSP 或是 Servlet 是幹什麼的,
那這篇文章不是寫給您看的。</para>
<para>
在 Java Servlet Spec v2.0 中,對於多國語言的支援,並不足。
您必須找到 Java Servlet Spec v2.2 的實作才行,筆者試過的
是 Apache Jakarta Tomcat 3.1 軟體(註一)。</para>
<para>
本文測試平台是 Debian Woody, Sun jdk1.2.2, Tomcat 3.1,
mm.mysql-2.0.2</para>
<para>
Java 以 jdbc 連結到 databases serverMySql 有 Free 的
jdbc driver。以下不擬說明如何使用 jdbc僅說明如何修改
您的 code 使可以用中文。</para>
<para>
mysql 儲存中文資料有兩種方法,第一種是使用 big5 內碼儲存,
其優點是節省硬碟/記憶體空間,相較於使用 UTF8 之下,若輸出
為 Big5更省去一次的 Unicode (UTF8) 與 Big5 需要經過
Table lookup 的轉換。但使用 Big5 就會有 Big5 先天上的問題。
典型的問題是 Big5 字串在處理字的邊界的問題。Big5 先天上的
問題是這樣的,就以 "問題" 這個字串為例,問字的第二個 byte
跟題字的第一個 byte 所形成的字是 "暋" 字。所以當我們在作
文字搜尋找包含 "暋" 的字串,我們會連包含 "問題" 的字串也
一起找到。但 UTF8 內碼在設計上就避開了這個問題, 犧牲的是
必須用較多的 byte (octets) 表示。</para>
<para>
我只有試過 MySql 內的 Data 用 UTF8Big5 沒試過。要注意的
是,在 UTF8 中,中文的長度是 3 個 bytes由於 MySQL 固定
字串欄位送進過長的資料時,會發生過長處被截斷。但 MySql 不懂
UTF8所以可能發生一個 UTF8 字元第二 or 三個 byte 被截掉
問題,在 ASCII 中問題不大,頂多出現一個 "I Love Yo""u" 不
見了。但在 java 把資料讀進來,把 UTF8 轉成 java 內部的表示
法時,就會發生有些 Byte 無法轉成功的問題,應該會造成
Exception。(註二)</para>
<para>
好,回來,在 jdbc 中,並沒有規範在 Database 中的字元的內碼,
而把這個問題留給各個 jdbc driver 處理。mysql jdbc driver
要在 database 中設為 utf8 的設定方式如下:</para>
<programlisting>
Properties pr;
Connection db;
pr = new Properties();
pr.put("characterEncoding", "UTF8");
pr.put("useUnicode", "TRUE");
Class.forName("org.gjt.mm.mysql.Driver").newInstance();
db = DriverManager.getConnection("jdbc:mysql:///test", pr);</programlisting>
<para>
其餘請自行參考一般 jdbc 程式寫作的資料。當然, compile 此
Servlet 時需要在呼叫 javac 時加上 "-encoding Big5"。</para>
<para>
若要使用 Big5 的話, 上面 "UTF8" 改成 "Big5" 即可。但這樣作會
出現另一個問題, 就是中文第二個 byte 有 '\' 的問題。這個問題我
不知道有沒有方便的解法,不知道 compile mysql 時將 encoding 設
為 big5 可否解決這個問題。(註二)</para>
<para>
註二:這個我沒有測試過,誰要測了跟大家說結果的?</para>
</sect1>
<sect1 id="linux-gtk">
<title>linux-gtk - gtk-1.2.6 的函式庫 rpm有 Big5/GB 的支援</title>
<para>
以下是比 x11-toolkits/linux-gtk 更好的 I18N 的優點。</para>
<programlisting>
Better word wrapping for CJK strings
Specify default font's encoding explicitly
Better XLFD handling
Selection resync fixes
Numerous gtkrc.$locale samples
Other minor fixes</programlisting>
<para>安裝 <filename role="package">chinese/linux-gtk</filename>。</para>
<para>
唯一的缺點是這個套件是 CLE 用來給 i386 平台所使用的,
所以如果是 alpha 的使用者的話仍需使用 x11-toolkits/linux-gtk。</para>
</sect1>
<sect1 id="php-ImageTTFText">
<title>php 的 ImageTTFText() 經常抓錯字?</title>
<para>Contributed by &a.jerry;</para>
<para>Last Update: 2003年 4月29日 周二 19時43分15秒 CST</para>
<para>在安裝 <filename role="package">www/mod_php4</filename>
時必須選擇 GD library support 及 freetype 的套件才能進行下面的步驟。</para>
<para>目前常見的有三種做法,一種是 patch gdttf.c
一種是使用 iconv support 來將編碼轉成 UCS-2
還有一種就是直接使用 <filename role="package">chinese/hc</filename>
的資料庫。</para>
<para>這邊是第一種做法patch gdttf.c 讓 PHP 不會抓錯字。</para>
<programlisting>
--- gdttf.c.orig Mon Oct 16 21:55:47 2000
+++ gdttf.c Sun Dec 31 18:00:34 2000
@@ -654,7 +654,7 @@
TT_BBox **bbox,
char **next)
{
- int pc, ch, len;
+ int pc, ch, len, ch2;
int row, col;
int x2, y2; /* char start pos in pixels */
int x3, y3; /* current pixel pos */
@@ -687,6 +687,8 @@
(*next)++;
if (ch &gt;= 161 /* first code of JIS-8 pair */
&& **next) { /* don't advance past '\0' */
+ ch2 = (**next) & 255;
+ if(ch2 &gt;= 161) ch++; /* Big5 ttf patch */
ch = (ch * 256) + **next;
(*next)++;
}</programlisting>
<para>由於已經處理過 gdttf.c在這邊就可以直接使用中文編碼的字。</para>
<programlisting>
&lt;?php
Header ("Content-type: image/gif");
$im = imagecreate (400, 30);
$black = ImageColorAllocate ($im, 0, 0, 0);
$white = ImageColorAllocate ($im, 255, 255, 255);
ImageTTFText ($im, 20, 0, 10, 20, $white,
"/usr/X11R6/lib/X11/fonts/TrueType/moe_kai.ttf", "這是中文測試 許功蓋 ");
ImagePng ($im);
ImageDestroy ($im);
?&gt;</programlisting>
<para>
第二種是使用 unicode 讓中文正常的顯示,
以下就是 big5 轉 unicode 的做法,
在這邊提供一個小函式來自動判斷為英文還是中文,
英文的部分不需要轉碼,只有中文才需要。</para>
<programlisting>
&lt;?php
/* need iconv module */
function big52uni($text) {
$rtext="";
$max=strlen($text);
for($i=0;$i&lt;$max;$i++){
$h=ord($text[$i]);
if($h>=160 && $i&lt;$max-1){
$rtext.="&#".base_convert(bin2hex(iconv("big5","ucs-2",
substr($text,$i,2))),16,10).";";
$i++;
}else{
$rtext.=$text[$i];
}
}
return $rtext;
}
?&gt;</programlisting>
<para>用法的範例如下,在 ImageTTFText 必須指定系統上的字型,
以下是安裝 <filename role="package">chinese/arphicttf</filename>
來使用文鼎PL上海宋所以必須根據自己的安裝的字型作修改
然後搭配上面的 big52uni 這個函式:</para>
<programlisting>
&lt;?php
Header("Content-type: image/gif");
$im = imagecreate(400,30);
$black = ImageColorAllocate($im, 0,0,0);
$white = ImageColorAllocate($im, 255,255,255);
ImageTTFText($im, 20, 0, 10, 20, $white,
"/usr/local/share/fonts/TrueType/bsmi00lp.ttf",
big52uni("Test中文測試"));
ImageGif($im);
ImageDestroy($im);
?&gt;</programlisting>
<figure>
<title>php-imagettftext snapshot</title>
<mediaobject>
<imageobject>
<imagedata fileref="images/php-imagettftext" format="PNG">
</imageobject>
</mediaobject>
</figure>
<para>
WWW: <ulink url="http://www.php.net/">
http://www.php.net/</ulink></para>
</sect1>
<sect1 id="php-upload">
<title>php 上傳中文檔名的檔案</title>
<para>by Wiseguy.bbs@bbs.nsysu.edu.tw</para>
<para>
另開一個 &lt;input type="hidden" name="filename"&gt;
在 submit 前,把 file 裡的檔名取出來 (用 split('\\'),陣列最後一個。)
放到 filename 去,這樣就可知道原檔名是什麼,而不用 file 裡面處理的檔名。
這種作法可以使中文檔名、含空白、管道字元 | 、反斜線,通通可上傳。</para>
<programlisting>
&lt;?php
if($_FILES['userfile']['name']) {
echo $_POST['fname'];
} else {
?&gt;
&lt;script language="JavaScript"&gt;
function validate() {
var Ary = document.uploadf.userfile.value.split('\\');
document.uploadf.fname.value=Ary[Ary.length-1];
return true;
}
&lt;/script&gt;
&lt;form enctype="multipart/form-data" action="index.php" method="post"
name="uploadf" onsubmit="return validate()"&gt;
Send this file: &lt;input name="userfile" type="file"&gt;
&lt;input type="hidden" name="fname"&gt;
&lt;input type="submit" value="Send File"&gt;
&lt;/form&gt;
&lt;?php } ?&gt;
</programlisting>
<para>
WWW: <ulink url="http://www.php.net/manual/en/features.file-upload.php">
http://www.php.net/manual/en/features.file-upload.php</ulink></para>
</sect1>
<sect1 id="php-pdf">
<title>用 php 製作中文 PDF 檔</title>
<para>Contributed by Tim (tim@dnes.mlc.edu.tw)</para>
<para>Last Update: 2003年 4月20日 周日 15時59分41秒 CST</para>
<para>php 目前可以使用 PDFlib 來建立不內嵌字型的 PDF 檔,
在 pdf_findfont 的部分要給對字型就可以了。</para>
<programlisting>
$font = pdf_findfont($pdf, 'MSung-Light', 'ETen-B5-H', 0); </programlisting>
<para>以下是完整範例,記得要先在該目錄底下建立 hello.pdf
並且將權限改成 666。</para>
<programlisting>
&lt;?php
echo '&lt;meta http-equiv="Content-Type" content="text/html; charset=big5"&gt;';
//create file
$fp = fopen('hello.pdf', 'w');
if(!$fp)
{
echo "Error: could not create the PDF file";
exit;
}
// start the pdf document
$pdf = pdf_open($fp);
pdf_set_info($pdf, "Creator", "pdftest.php");
pdf_set_info($pdf, "Author", "Shen Chun-Hsing");
pdf_set_info($pdf, "Title", "Hello World (PHP)");
// US letter is 11" x 8.5" and there are approximately 72 points per inch
pdf_begin_page($pdf, 8.5*72, 11*72/2);
pdf_add_outline($pdf, 'Page 1');
// 取得字型
$Efont = pdf_findfont($pdf, 'Times-Roman', 'host', 0);
$Cfont = pdf_findfont($pdf, 'MSung-Light', 'ETen-B5-H', 0);
// write text
pdf_setfont($pdf, $Efont, 24);
pdf_set_text_pos($pdf, 50, 700/2);
pdf_show($pdf,'Hello world!');
pdf_continue_text($pdf,'(says PHP)');
pdf_setfont($pdf, $Cfont, 24);
pdf_continue_text($pdf,'細明體中文字測試');
// end the document
pdf_end_page($pdf);
pdf_close($pdf);
fclose($fp);
// display a link to download
echo "&lt;a href = 'hello.pdf' target='_blank'&gt;測試檔PDF&lt;/a&gt;";
echo "&lt;hr&gt;";
show_source( basename( getenv("SCRIPT_FILENAME") ) );
?&gt;</programlisting>
<para>在 pdf_findfont 的部分選擇 ('MSung-Light', 'ETen-B5-H')
這樣子的 CID-Keyed font 就可以使用明體了,
第一個欄位還可以換成 MHei-Medium 來使用楷體,
不過在目前的支援度下,所能看到的不管設定明體或是楷體,
都只會有明體而以,
這必須是 PDF 瀏覽器支援設定的字體有其相對應的字體才行,
而第二個欄位 CMap 基本上建議使用 ETen-B5-H 才能使用倚天外字。</para>
<para>可以用的英文字型如下:
Courier Courier-Bold Courier-Oblique Courier-BoldOblique Helvetica
Helvetica-Bold Helvetica-Oblique Helvetica-BoldOblique Symbol
Times-Roman Times-Bold Times-Italic Times-BoldItalic ZapfDingbats。</para>
<para>可以用的中文 CMap 如下:
B5pc-H B5pc-V HKscs-B5-H HKscs-B5-V ETen-B5-H ETen-B5-V ETenms-B5-H
ETenms-B5-V CNS-EUC-H CNS-EUC-V UniCNS-UCS2-H UniCNS-UCS2-V。</para>
<figure>
<title>php-pdf snapshot</title>
<mediaobject>
<imageobject>
<imagedata fileref="images/php-pdf" format="PNG">
</imageobject>
</mediaobject>
</figure>
<para>而 pdf_add_bookmark 有人說有中文的問題,可是在筆者的測試之下,
Big5 編碼的 bookmark 在 Acroread 5 可以正常看到,或是利用
iconv 轉成 UTF-16 也是正常的,所以如果您看到的 bookmark 有中文問題,
可以利用 iconv("Big5", "UTF-16", "中文字") 來試試看。</para>
<para>WWW: <ulink url="http://www.PDFlib.com/">
http://www.PDFlib.com/</ulink></para>
</sect1>
<sect1 id="tcltk">
<title>Tcl/Tk - 廣為運用的一種高階電腦語言與 GUI 發展工具</title>
<para>
tcl 是一個高階的電腦語言,語法類似 shell script 與 C 語言之間。而
tk 是一個使用者界面發展工具,有 buttons、menus、listboxes、
scrollbars 等等。</para>
<para>
把這兩者結合起來,就形成了強有力的 GUI 發展套件。最新版本的
tcl/tk 支援了多平台的開發程式庫。所以我們可以寫一個 tcl/tk
的程式也稱為script然後在 UNIX 下看起來就像是 Motif
的應用程式;在 Windows9x/NT 下看起來像是 Win32 的應用程式;而在
Macintosh 下看起來像 Mac 的應用程式。</para>
<para>
tcl/tk 的優點第一是 free自由
第二是容易學習,您不須具備 object-oriented 或 threads 或
Microsoft Fundation Classes 的基礎,也不須寫一大串的程式碼。
像是傳統的 Hello, World! 程式,在 tcl/tk 只要兩行就搞定,</para>
<programlisting>
button .b -text "Hello, World!" -command exit
pack .b</programlisting>
<para>
第三是有許多的 extensions延伸套件可以支援其他軟體程式庫
例如 Oracle, Sybase, Informix, OpenGL 等多達 400 種。</para>
<para>安裝 <filename role="package">chinese/tcl83</filename> 與
<filename role="package">chinese/tk83</filename>。</para>
<para>
chinese/tcl83 和 chinese/tk83 主要是補上一個
<option>--enable-i18nImprove</option> 的選項,
修正 XIM 處理有問題的部份。</para>
<para>中文顯示都正常,中文輸入也是正常的。</para>
<programlisting>
#!/usr/local/bin/wish8.3
tk useinputmethods 1
font create bsmilpfont -family "ar pl mingti2l big5" -size 16
label .a -text "標籤" -font bsmilpfont
pack .a
button .b -text "按鈕" -command { puts stdout $cc; exit } -font bsmilpfont
pack .b
entry .c -textvariable cc -font bsmilpfont
pack .c</programlisting>
<figure>
<title>tcltk snapshot</title>
<mediaobject>
<imageobject>
<imagedata fileref="images/tcltk" format="PNG">
</imageobject>
</mediaobject>
</figure>
<para> WWW: <ulink url="http://www.scriptics.com/software/tcltk/8.3.html">
http://www.scriptics.com/software/tcltk/8.3.html</ulink></para>
</sect1>
<sect1 id="postgre">
<title>PostgreSQL 不能處理中文?</title>
<para>
<application>PostgreSQL</application> 中使用中文一向有小問題,
如 '許'、'社' 等等後面是 \ 的中文字都會出搥,直到
6.5 版以後,才加入了 multibyte 的支援。</para>
<para>
<application>PostgreSQL</application> 的語言支援分
前/後端(frontend/backend),無論前端使用何種語言,
後端都會使用設定好的語言存入資料庫中。</para>
<para>
這有什麼好處?例如:後端設定成繁體中文,前端設定成簡體中文,
然後,存入的繁體中文,顯示的是簡體中文,當然,
它不會做中、英翻譯。</para>
<para>
要正確使用中文,比較保險的作法是後端使用 euc_tw
編碼,前端使用 big5 編碼,例如:</para>
<screen>
<prompt>%</prompt> <userinput>createdb --encoding euc_tw test</userinput> ' 建>
立後端為 euc_tw 編碼的 db
<prompt>%</prompt> <userinput>psql test</userinput> ' 使用 psql 管理工具,就像
mysql 般。
<prompt>test=#</prompt> ' 已經進入 psql
<prompt>test=#</prompt> <userinput>\encoding big5</userinput> ' 設定前端為 big5 編碼
<prompt>test=#</prompt> <userinput>create table test (</userinput>
<prompt>test=#</prompt> <userinput>usrname char(20));</userinput> ' 建立 table
<prompt>test=#</prompt> <userinput>insert into test values('許國榮');</userinput> ' 測試
<prompt>test=#</prompt> <userinput>select * from test;</userinput> '您會看到正>
確的答案
<prompt>test=#</prompt> <userinput>\q</userinput></screen>
<para>
也可以在 <application>PostgreSQL</application> 中下
<command>PGCLIENTENCODING=BIG5</command>
的指令,如果是使用 <application>PHP</application>
+ <application>PostgreSQL</application> 則使用以下方式:</para>
<programlisting>
$conn = pg_connect("user=postgres dbname=stip");
pg_exec($conn, "set client_encoding to 'BIG5'");</programlisting>
<para>
WWW: <ulink url="http://www.postgresql.org/">
http://www.postgresql.org/</ulink></para>
</sect1>
<sect1 id="postgresql-jdbc">
<title>PostgreSQL + JDBC + Servlet + XMLC 中文完全解決方案</title>
<para>作者smallufoEmailsmallufo@bigfoot.com</para>
<para>
自古以來 Servlet 連結 Database 在中文方面總是有許多問題,尤其是在
web 端要考慮的因素更多了。有時候form的文字遇到「許功」等字
要使用者自行輸入“\”這個跳說字元有時候明明把「許功」insert
進資料庫,但是取出來又會變成〈?〉;而中文的許多次常用字,
例如宏碁的「碁」,等怪怪的字元,更是讓
programmer 頭髮白了一半。而 encoding 又是個最重要的關鍵,常見的
encoding 有以下幾點:</para>
<programlisting>
code +0 +1 +2 +3 +4 +5 +6 +7 +8 +9 +A +B +C +D +E +F
F9D0 碁 銹 裏 墻 恒 粧 嫺 ╔ ╦ ╗
F9E0 ╠ ╬ ╣ ╚ ╩ ╝ ╒ ╤ ╕ ╞ ╪ ╡ ╘ ╧ ╛ ╓
F9F0 ╥ ╖ ╟ ╫ ╢ ╙ ╨ ╜ ║ ═ ╭ ╮ ╰ ╯ ■ </programlisting>
<itemizedlist>
<listitem><para>
作業系統 Locale 的 encoding
</para></listitem>
<listitem><para>
資料庫端的 encoding
</para></listitem>
<listitem><para>
javac-encoding xxx
</para></listitem>
<listitem><para>
ServletRequest.setContentType("texe/html; charset=xxx)
</para></listitem>
<listitem><para>
web application deployment(web.xml) 所指定的 character-encoding="xxx"
</para></listitem>
<listitem><para>
new String(String.getByte("xxx),"yyy)
</para></listitem>
<listitem><para>
如果使用 xmlc還有 xmlc 的 encoding 以及
org.enhydra.xml.io.OutputOptions.setXmlEncoding("xxx")
</para></listitem>
</itemizedlist>
<para>
這幾種 encoding 萬馬奔騰,常使 programmer 轉的暈頭轉向,
不知目前身在何處,不知多少 programmer 在此浪費青春。</para>
<para>
中文解決方案以前在網路上有許多做法,但是通常都不太完整,
要不然就得大刀闊斧更動到 JDBC driver或是重新 compile
整個資料庫系統。而為了系統的「完整性」,我並不考慮這些做法。
我的作法可以完整保留 postgreSQL 的完整性〈以 RPM 安裝,不用重新
compile〉而且 JDBC driver 不用重新 compile。
以下的步驟後半部主要是針對 XMLC 而言,不過一般「純」的 servlet
程式,應該很容易粹取出來。</para>
<para>以下是我的一些環境:</para>
<para>
RedHat Linux 7.0 (CLE 1.0),其他的中文環境也應該沒問題。
如果您是英文版的,請安裝 Chinese locale patch 即可。
重點是,當您輸入 'set' 時,可以看到 'LANG=zh_TW' 這個環境變數。</para>
<para>Servlet EngineResin 2.0.2</para>
<para>posrgreSQL-7.1.3-1PGDG.i386.rpm檔案大小 1164817 bytes直接以
rpm -Uvh 安裝即可,不用重新 compile。JDBC driver 也是直接使用
postgresql-jdbc-7.1.3-1PGDG.i386.rpm 所安裝的 jdbc7.1-1.2.jar 即可。</para>
<para>資料庫請以 Unicode 編碼〈createdb -E Unicode〉這點最為重要。</para>
<para>Web application Deployment(web.xml) 中的 &lt;web-app&gt; 不要加上
character-encoding="xxx" 這個 attribute</para>
<para>在 servlet 中,請設定 res.setcontentType("text/html; charset=CP950");</para>
<para>form 的參數,直接以 getParameter("xxx") 讀取,
再 insert 進資料庫,不用作任何轉碼。</para>
<para>要從資料庫中讀取資料,得利用:
new String(rs.getString("ColName").getBytes("8859_1"),"CP950") </para>
<para>要輸出整份文件〈implement org.enhydra.xml.xmlc.html.HTMLObject 的文件〉時,
不要用 out.println(doc.toDocument()),請改用如下的方法:</para>
<programlisting>
org.enhydra.xml.io.OutputOptions options = new OutputOptions();
options.setOmitEncoding(false);
options.setXmlEncoding("Big5");
DOMFormatter formatter = new DOMFormatter(options);
if(iChingVotingsPage.getDelefate() != null) {
out.println(formatter.toString(iChingVotingsPage.getDelegate()));
) else {
out.println(formatter.toString(iChingVoringPage));
}</programlisting>
<para>Servlet 檔案要以 javac -encoding CP950 來編譯。</para>
<para>大功告成,如此解決方案,則可以完全正常處理所有罕見以及特殊字元,
不論是插入資料庫,從資料庫取出來在網頁上,都沒有問題。</para>
</sect1>
<sect1 id="java">
<title>Java 中文程式設計</title>
<para>FreeBSD 下的 java distribution 分為 Native JDK For FreeBSD、
Sun JDK For Linux、IBM JDK For Linux、Blackdown JDK For Linux
都可以在 <filename>/usr/ports/java</filename> 目錄下找到,
For Linux 的部分只要裝上 Linux 模擬器就可以執行,
而 Native JDK 就必須自己從 source 編譯。
而且安裝上都必須依照步驟先去網站上下載所需的檔案,
放置到 <filename>/usr/ports/distfiles</filename>。</para>
<para>以最困難的 <filename role="package">java/jdk13</filename> 安裝為例,
你必須到 <ulink url="http://www.sun.com/software/java2/download.html">
Sun Community Source Licensing</ulink> 下載 j2sdk-src-scsl.zip 和
j2sdk-bin.scsl.zip 這兩個檔案,並到
<ulink url="http://www.eyesbeyond.com/freebsddom/java/jdk14.html">
Java 2 on FreeBSD</ulink> 下載 bsd-jdk14-patches.tar.gz。
又因為編譯的時候需要 <filename role="package">java/linux-sun-jdk14</filename>
所以還需要先安裝好才行。
並且根據編譯的需求,我們還需要一個 <option>linprocfs</option>
你可以用 <command>mount -t linprocfs linprocfs /compat/linux/proc</command>
來將 linprocfs 掛上。並在系統上預留 2.5GB 的硬碟空間來進行編譯,
當以上都準備就緒,就可以開始編譯然後等明天再來驗收囉。</para>
<para>想知道您的 JDK 或 JRE 會用什麼樣的編碼方式來和作業系統溝通,
請執行下面的 Java 程式:</para>
<programlisting>
public class ShowNativeEncoding {
public static void main(String[] args) {
String enc = System.getProperty("file.encoding");
System.out.println("NativeEncoding:" + enc);
System.out.println("成功");
}
}</programlisting>
<screen>
&prompt.user; <userinput>javac ShowNativeEncoding.java</userinput>
&prompt.user; <userinput>java ShowNativeEncoding</userinput>
NativeEncoding:Big5
成功</screen>
<para>
如果出現以上的訊息,就表示中文正常,如果沒有的話,
請確定您的 LC_CTYPE 是 zh_TW.Big5或是用
<command>javac -encoding CP950 ShowNativeEncoding.java</command>
來進行編譯,應該會出現如上的顯示才對。</para>
<note>
<para>Big5這是繁體中文 de facto 標準。 </para>
<para>
MS950 或 Cp950ASCII + Big5用於台灣和香港的繁體中文 MS
Windows作業系統。</para></note>
<para>筆者的環境設定 <filename>~/.cshrc</filename></para>
<programlisting>
# For JAVA jdk1.3.1
setenv JAVA_HOME /usr/local/jdk1.3.1
setenv CLASSPATH /usr/local/jdk1.3.1/lib/tools.jar:/usr/local/share/java/classes/:./
setenv PATH /usr/local/jdk1.3.1/bin:$PATH</programlisting>
<para>如果要執行 applet 或是 swing的話
請按照以下步驟設定才能正確的看到中文字,
<filename>font.properties.zh_TW</filename> 為 Forth 提供,
該設定檔專給 arphicttf 使用:</para>
<screen>
&prompt.root; <userinput>cd /usr/local/jdk1.3.1/jre/lib/</userinput>
&prompt.root; <userinput>fetch http://freebsd.sinica.edu.tw/~statue/conf/font.properties.zh_TW</userinput></screen>
<para>
經筆者測試在 mozilla-1.0 + jdk1.3.1p6_4 之後已經不需要設定就可以正確的看到中文,
如果沒辦法就手動作如下步驟:</para>
<screen>
&prompt.root; <userinput>cd /usr/X11R6/lib/mozilla/plugins/</userinput>
&prompt.root; <userinput>ln -s /usr/local/jdk1.3.1/jre/plugin/i386/ns600/libjavaplugin_oji.so libjavaplugin_oji.so</userinput></screen>
<figure>
<title>applet snapshot</title>
<mediaobject>
<imageobject>
<imagedata fileref="images/applet" format="PNG">
</imageobject>
</mediaobject>
</figure>
<figure>
<title>swing snapshot</title>
<mediaobject>
<imageobject>
<imagedata fileref="images/swing" format="PNG">
</imageobject>
</mediaobject>
</figure>
<para>
參考:
<ulink url="http://www.oreilly.com.tw/sleepless/java_big5_1.htm">
Java繁體中文處理完全攻略</ulink>、
<ulink url="http://www.oreilly.com.tw/sleepless/java_big5_2.htm">
Java 繁體中文處理完全攻略(二)</ulink>。</para>
<para>
WWW: <ulink url="http://java.sun.com/">
http://java.sun.com/</ulink></para>
</sect1>
<sect1 id="perl">
<title>Perl 中文程式設計</title>
<para>如何排除 Perl 程式處理中文資料的障礙?</para>
<para>
在 CGI Perl 程式中,有許多符號字元是有特殊用途的,
而不幸的有某些這樣的字元卻與中文字的第二個位元組互相衝突,
以至於會有中文字顯示或比對不正確,甚至是產生錯誤結果的現象,
尤其是 | 及 \ 這兩個字元,所幸我們還有個 quotemeta 指令可以使用,
這個指令可以將指定的字串中每個字元的前面都再多加上一個 \
這個字元,使得字串內的特殊字元在處理時被視為單純的字碼,
請參考下列的範例:</para>
<para>
假設 $str 是一個要做搜尋比對的中文字串,而 $line
是逐行讀入的資料檔內容:</para>
<programlisting>
$restr = quotemeta $str;
if ($line !~ m/$restr/i) { ......
}</programlisting>
<para>
另外若不是以變數來處理的字串,通常我們會使用雙引號來標示及處理,
然而這也是會發生上述的障礙,但是當您直接對雙引號括住的字串使用
quotemeta 來處理時卻又會怪怪的,那怎麼辦呢?很間單!
將雙引號改為單引號就可以囉~因為單引號不會對其內的字元作特殊處理,
換句話講在單引號之內的文字資料將會原原本本的呈現出來,
不會去解譯變數也不會處理 escape 字元 ,例如原來的敘述是:</para>
<programlisting>
print "測試成功的$msg訊息\n";</programlisting>
<para>應改為:</para>
<programlisting>
print '測試成功的訊息!';</programlisting>
<para>
請特別注意 \n 換行符號及 $msg 變數也需拿掉,因為單引號並不處理
escape 字元及變數,如果不將 \n 符號及 $msg 變數拿掉,
那麼顯示出來的字樣將會是</para>
<screen>
成功的$msg訊息\n</screen>
<para>
,如果您仍希望顯示成原來包含變數及換行的效果,
那就必須將單引號與雙引號資料併用,同時以 .
符號來連結成完整的輸出敘述:</para>
<programlisting>
print '成功的'.$msg.'訊息!'."\n";</programlisting>
<para>
上述結論就是當印出 成功的 與 訊息! 字樣是使用單引號,
而換行的 \n 則是用雙引號。</para>
<para>以下是一個將檔案中所有的中文字移除的程式範例:</para>
<programlisting>
#!/usr/bin/perl -w
# ./bg5rm.pl filename
# and it's will generate a filename.bg5rm
$ifname=$ARGV[0];
open(IF,"$ifname");
open(OF,"&gt;${ifname}.bg5rm");
$big5 = "[\xA1-\xF9][\x40-\x7E\xA1-\xFE]";
while(&lt;IF&gt;) {
s/$big5//g;
print OF $_;
print $_;
}
close(IF);
close(OF);</programlisting>
<para>以下是一個將文章中的中英文 word split 進 list</para>
<programlisting>
my $big5 = q{
[\xA1-\xF9][\x40-\x7E\xA1-\xFE]
};
my $big5plus = q{
[\x81-\xFE][\x40-\x7E\x80-\xFE]
};
my @chars = /$big5|$ascii+/gox;
my @charsplus = /$big5plus|$ascii+/gox;</programlisting>
<para>MPX 的 <ulink url="http://www.hkln.net/perl/technique/chinese.htm">
解決 Perl 處理中文字的問題</ulink></para>
<para>CJKV Information Processing 這本書有些不錯的 perl 程式
<ulink url="ftp://ftp.oreilly.com/pub/examples/nutshell/cjkv/perl/">
範例</ulink>,其中 *.pdf 是一些討論 perl 下處理 multibyte 的
papers。</para>
<para>Erik Peterson 寫了一些有用的 <ulink
url="http://www.mandarintools.com/">Perl 程式</ulink>
可處理中文轉換。</para>
<para>
WWW: <ulink url="http://www.perl.org/">
http://www.perl.org/</ulink></para>
</sect1>
<sect1 id="mysql">
<title>MySQL Localisation and International Usage</title>
<para>WWW: <ulink url="http://www.mysql.com/documentation/mysql/bychapter/index.html#Localisation">
MySQL Localisation and International Usage</ulink></para>
<para>動態能從 my.cnf 調整的部份並沒有 big5.conf</para>
<screen>
&prompt.user; <userinput>ls /usr/local/share/mysql/charsets</userinput>
Index danish.conf greek.conf koi8_ukr.conf usa7.conf
README dec8.conf hebrew.conf latin1.conf win1250.conf
cp1251.conf dos.conf hp8.conf latin2.conf win1251.conf
cp1257.conf estonia.conf hungarian.conf latin5.conf win1251ukr.conf
croat.conf german1.conf koi8_ru.conf swe7.conf</screen>
<para>靜態要在 compile 階段完成的部份:</para>
<screen>
&prompt.user; <userinput>ls mysql-3.23.55/strings/ctype*.c</userinput>
mysql-3.23.55/strings/ctype-big5.c mysql-3.23.55/strings/ctype-sjis.c
mysql-3.23.55/strings/ctype-czech.c mysql-3.23.55/strings/ctype-tis620.c
mysql-3.23.55/strings/ctype-euc_kr.c mysql-3.23.55/strings/ctype-ujis.c
mysql-3.23.55/strings/ctype-gb2312.c mysql-3.23.55/strings/ctype.c
mysql-3.23.55/strings/ctype-gbk.c</screen>
<para>也就是說 multibyte support 必須要 compile 時就給他下好這個參數,
是否能直接設定 my.cnf 達到 --with-charset=big5 的效果還不確定。</para>
<para>檢驗方式,進入 mysql 後打:</para>
<screen>
mysql&gt; <userinput>show variables like 'character_sets';</userinput>
mysql&gt; <userinput>show variables like 'character_set';</userinput></screen>
<para>那 character set 影響那些呢?就我所知的有 ORDER BY 和 GROUP BY
的順序,那特殊中文字 insert 進資料的問題還是在嗎?</para>
<note><para>另一常見的問題是MySQL 無法輸入中文資料庫名稱、中文表格名稱、
中文欄位名稱?其實是可以的,只要用 <literal>`</literal>
將中文字包含在內就可以,像是 <command>CREATE DATABASE `哈囉`;</command>。</para></note>
<para>WWW: <ulink url="http://www.mysql.com/">
http://www.mysql.com/</ulink></para>
</sect1>
<sect1 id="ldap">
<title>在 LDAP 下使用中文</title>
<para>Contributed by duncanlo (duncan@twn.wox.org)</para>
<para>Last Update: 2003年 4月24日 周四 05時13分04秒 CST</para>
<para>如果是要將 .ldif 轉入,必須先將中文轉成 utf-8。</para>
<para>安裝 <filename role="package">converter/iconv</filename>
假設要轉碼的檔案是 big5.ldif轉出來的檔案是 utf-8.ldif。</para>
<screen>
&prompt.user; <userinput>iconv -f big5 -t utf-8 big5.ldif > utf-8.ldif</userinput></screen>
<para>然後就可以用 <command>ldapadd</command> 來將 utf-8.ldif 轉入 ldap 了。</para>
<figure>
<title>ldap snapshot</title>
<mediaobject>
<imageobject>
<imagedata fileref="images/ldap" format="PNG">
</imageobject>
</mediaobject>
</figure>
<para>WWW: <ulink url="http://www.iit.edu/~gawojar/ldap/">
Java LDAP Browser/Editor</ulink></para>
</sect1>
<sect1 id="perl-cgi">
<title>用 perl 寫 CGI 時的中文顯示問題?</title>
<para>Contributed by fjj.bbs@bbs.csie.ncku.edu.tw (Frank Millers)</para>
<para>Last Update: Sun Nov 2 17:45:35 2003</para>
<programlisting>
use CGI;
my $q = new CGI;
$q->head(charset=big5);
$q->start_html(lang=big5);</programlisting>
</sect1>
</chapter>
<!--
Local Variables:
mode: sgml
sgml-declaration: "../chapter.decl"
sgml-indent-data: t
sgml-omittag: nil
sgml-always-quote-attributes: t
sgml-parent-document: ("../zh-tut.sgml" "part" "chapter")
End:
-->

View file

@ -0,0 +1,230 @@
<!--
The Chinese FreeBSD Documentation Project
Id: dict.sgml,v 1.4 2003/12/04 13:16:46 statue Exp
$FreeBSD$
-->
<chapter id="dict">
<title>字典軟體</title>
<para></para>
<sect1 id="dictd-database">
<title>dictd-database - dictd 的字典檔資料庫</title>
<para>一套中文與英文的 <application>dictd</application>
字典檔資料庫,所以必須搭配使用。
而 <application>chinese/dictd</application> 則是修正特殊中文字的問題,
如果想要正常使用漢英字典(Cedict),那麼就必須安裝此修正過的 port。
</para>
<para>裡面目前包含四個字典檔moecomp 和 netterm 都是英漢字典檔,
而 pydict 則是英漢、漢英字典檔,目前只有做英漢的部分,
cedict 則也是英漢、漢英字典檔,不過目前只有做漢英的部分。</para>
<para>在安裝完後,必須先修改 <filename>/usr/local/etc/dictd.conf
</filename>,這個檔案是給 <application>net/dictd-database</application>
使用的,如果不打算用英英字典,那麼就全部換成以下的內容來符合
<application>chinese/dictd-database</application> 的要求。</para>
<programlisting>
database moecomp { data "/usr/local/lib/dict/moecomp.dict.dz"
index "/usr/local/lib/dict/moecomp.index" }
database netterm { data "/usr/local/lib/dict/netterm.dict.dz"
index "/usr/local/lib/dict/netterm.index" }
database pydict { data "/usr/local/lib/dict/pydict.dict.dz"
index "/usr/local/lib/dict/pydict.index" }
database cedict { data "/usr/local/lib/dict/cedict.dict.dz"
index "/usr/local/lib/dict/cedict.index" }</programlisting>
<para>然後就可以啟動 <command>/usr/local/etc/rc.d/dictd.sh start
</command>。</para>
<para>接著在去 <filename>/usr/ports/textproc/dict</filename>
安裝 <application>dict</application>,這是一個可以用來存取
DICT 伺服器的用戶端,只能用命令列模式。</para>
<para>用法範例如下:</para>
<screen>
&prompt.user; <userinput>dict -h localhost -D</userinput>
Databases available:
moecomp Taiwan MOE computer dictionary
netterm Network Terminology
pydict pydict data
&prompt.user; <userinput>dict -h localhost -d moecomp hello | less</userinput>
1 definition found
From Taiwan MOE computer dictionary [moecomp]:
hello
呼叫
&prompt.user; <userinput>dict -h localhost 成功</userinput>
1 definition found
From Chinese to English dictionary [cedict]:
成功
[cheng2 gong1]
success
to succeed</screen>
<para>在 <filename>/usr/ports/net/dictd-database</filename>
還有其他的字典檔資料庫,可以參考看看是否需要。</para>
<para>筆者通常都會安裝 <filename>/usr/ports/net/dictd-database
</filename>,然後將所有的資料庫都寫入 <filename>
/usr/local/etc/dictd.conf</filename>,然後用
<command>dict -h localhost hello</command> 來對所有的資料庫查詢,
在查單字的時候蠻方便的。</para>
<figure>
<title>dict snapshot</title>
<mediaobject>
<imageobject>
<imagedata fileref="images/dict" format="PNG">
</imageobject>
</mediaobject>
</figure>
<para>cedict: <ulink url="http://www.mandarintools.com/cedict.html">
CEDICT: Chinese-English Dictionary</ulink></para>
<para>dict: <ulink url="http://www.dict.org/">
http://www.dict.org/</ulink></para>
</sect1>
<sect1 id="pydict">
<title>pyDict - 英漢、漢英兩用字典</title>
<para>在眾多的 Unix-like 翻譯軟體中,鮮少能找到對中文翻譯的程式,而
<application>pyDict</application> 就是這麼一個好用的工具!
pyDict 的字典檔是 xdict 轉出來的, 並經過作者的整理與改善.</para>
<para><application>pyDict</application> 是用
<application>python</application>
加上 <application>gtk</application> 的界面工具集(widgets)
寫成的英漢、漢英兩用字典。
而且支援 XIM是目前中文最好用的字典。
還有個智慧模式,使用起來是不是跟一般的電子字典類似呢?
</para>
<para>啟動說明</para>
<programlisting>
pydict [options] [word]
options:
-h 列出文字模式下的說明
-i console互動模式
-e [word] 英漢查詢(可不加-e
-c [word] 漢英查詢 </programlisting>
<para>console 模式說明:</para>
<para>在終端視窗中會有word:的提示符號,使用者可以鍵入想查
詢的單字。如果想轉成其他模式可以鍵入下列字串:</para>
<programlisting>
-c 轉換成漢英模式
-e 轉換成英漢模式</programlisting>
<para>如果要離開console互動模式可以鍵入-q或是在word:後直
接按Enter鍵就可以了。</para>
<para>如果中文有問題的話,表示 gtk 的中文字型沒設定好,
用 <command>cp /usr/X11R6/lib/X11/pyDict/gtkrc.zh_TW.big5.sample ~/.gtkrc</command>
將 pyDict 的範例拷貝過來使用就可以了。</para>
<para>作者已經很久沒有維護, 目前 <ulink url="http://people.redhat.com/llch/pydict/">llch at redhat.com</ulink> 有修改並移植到 pygtk2 之上.</para>
<figure>
<title>pydict snapshot</title>
<mediaobject>
<imageobject>
<imagedata fileref="images/pydict" format="PNG">
</imageobject>
</mediaobject>
</figure>
<para>
WWW: <ulink url="http://sourceforge.net/projects/pydict/">
http://sourceforge.net/projects/pydict/</ulink></para>
<para>
WWW: <ulink url="http://www.linux.org.tw/~plateau/linux_notes/">
http://www.linux.org.tw/~plateau/linux_notes/</ulink></para>
</sect1>
<sect1 id="stardict">
<title>stardict - 中文與英文的翻譯字典</title>
<para>
一個中文與英文的翻譯字典,由 Motif 開發的,在這個軟體中包含了
星際譯王源程序、圖標和背景圖形文件,漢字字體、音標字體
詞庫、音標庫Readme、開發計劃等文件。 </para>
<para>
功能特性描述:近五萬單詞,常用詞帶音標、具有模糊匹配功能、
具有屏幕取詞功能、自帶漢字字體,無需漢字環境、繁簡兩種字體。
</para>
<para>預設為簡體,若要看到繁體介面,則修改 <filename>
/usr/X11R6/share/stardict/hzfont/fonts.dir</filename></para>
<programlisting>
--- fonts.dir.orig Sat Nov 3 01:17:39 2001
+++ fonts.dir Sat Nov 3 01:14:25 2001
@@ -1,3 +1,3 @@
2
-hz16.pcf hz16
+hz16ft.pcf hz16
yb10x20.pcf yb10x20</programlisting>
<figure>
<title>stardict snapshot</title>
<mediaobject>
<imageobject>
<imagedata fileref="images/stardict" format="PNG">
</imageobject>
</mediaobject>
</figure>
</sect1>
<sect1 id="stardict2">
<title>stardict2</title>
<para>星際譯王 2.0.0,一個運行在GNOME環境下的國際化的詞典軟件
有選中區取詞,通配符匹配,模糊查詢等強大功能。</para>
<para>安裝 <filename role="package">chinese/stardict2</filename>。</para>
<figure>
<title>stardict2 snapshot</title>
<mediaobject>
<imageobject>
<imagedata fileref="images/stardict2" format="PNG">
</imageobject>
</mediaobject>
</figure>
<para>WWW: <ulink url="http://stardict.cosoft.org.cn/">
http://stardict.cosoft.org.cn/</ulink></para>
</sect1>
<sect1 id="oxford">
<title>oxford</title>
<para>oxford is a English to Chinese dictionary, written in Perl.</para>
<para>安裝 <filename role="package">chinese/oxford</filename>。</para>
<figure>
<title>oxford snapshot</title>
<mediaobject>
<imageobject>
<imagedata fileref="images/oxford" format="PNG">
</imageobject>
</mediaobject>
</figure>
<para>WWW: <ulink url="http://igloo.its.unimelb.edu.au/Blowfish/">
http://igloo.its.unimelb.edu.au/Blowfish/</ulink></para>
</sect1>
<sect1 id="edict-big5">
<title>edict-big5 - 日文漢字轉中文漢字後的漢英字典</title>
<para>EDICT 本來是日英字典,不過我透過 <filename role="package">
lang/perl5.8</filename> 的 <command>piconv</command> 將 EUC-JP 轉成 Big5
有許多字無法找到對應的 Big5 所以這個字典檔仍然有許多問題,
筆者也將格式轉成 dict 的格式,因為偏好原因。</para>
<para>選擇 <command>piconv</command> 的原因是目前他比
<command>iconv</command> 具備更多的轉碼對應,
這樣子才能讓能看到的 Big5 更多。</para>
<para><application>edict-big5</application> 的安裝:</para>
<screen>
&prompt.root; <userinput>cd /usr/ports/outta-ports/edict-big5</userinput>
&prompt.root; <userinput>make install clean</userinput></screen>
<figure>
<title>edict-big5 snapshot</title>
<mediaobject>
<imageobject>
<imagedata fileref="images/edict-big5" format="PNG">
</imageobject>
</mediaobject>
</figure>
<para>WWW: <ulink url="http://www.csse.monash.edu.au/~jwb/edict.html">
http://www.csse.monash.edu.au/~jwb/edict.html</ulink></para>
</sect1>
</chapter>
<!--
Local Variables:
mode: sgml
sgml-declaration: "../chapter.decl"
sgml-indent-data: t
sgml-omittag: nil
sgml-always-quote-attributes: t
sgml-parent-document: ("../zh-tut.sgml" "part" "chapter")
End:
-->

View file

@ -0,0 +1,943 @@
<!--
The Chinese FreeBSD Documentation Project
Id: difficult.sgml,v 1.26 2003/11/13 12:02:46 statue Exp
$FreeBSD$
-->
<chapter id="difficult">
<title>中文環境</title>
<para>在談中文環境前,必須先正名一下,台灣是 "Taiwan, Republic of China"
或者簡稱 "Taiwan, ROC"、"Taiwan",千萬不要用 "Taiwan, Province of China"
兩者的差異性十分巨大,不管是在民主政治、人權、言論自由等等。</para>
<sect1 id="chinese-intro">
<title>漢字概論</title>
<para>漢字是由部首等較小的元件組成的;可以將部首等當作建築積木用。
這些元件可作為構成漢字的基本單位用。漢字使用 214 種部首作索引。</para>
<para>漢字的種類很多;常見的有四種:象形(pictographs)、
指事(simple ideographs)、會意(compound ideographs)、
形聲(phonetic ideographs)。</para>
<para>最基本的是象形字;象形字如同是一張小圖,通常與其所表達的對象很像。
如:日、月、山、火、木、車、口。
而指事字則表達數字和方向等抽象概念或意思。
如:上、下、中、一、二、三。
象形字和指事字可以組成更複雜的字,通常其意思是各個組成部分的意思的綜合,
稱為會意字。
如:林、森、明。
形聲字佔了漢字的 90% 以上,一般至少有兩個部分;
一個是語音,另一個則是字源。
如:銅、洞。
漢字可以合併成詞組,用來表達更複雜的意思或概念。</para>
<para>漢字的發展是以表意的圖畫開始的,並保持字形狀與語意的連結。</para>
<table>
<title>不同時期的漢字總數</title>
<tgroup cols="3">
<thead>
<row>
<entry>西元</entry>
<entry>漢字總數</entry>
<entry>參考文獻</entry>
</row>
</thead>
<tbody>
<row>
<entry>100</entry>
<entry>9,353</entry>
<entry>說文解字</entry>
</row>
<row>
<entry>1716</entry>
<entry>47,021</entry>
<entry>康熙字典</entry>
</row>
<row>
<entry>1986</entry>
<entry>56,000</entry>
<entry>漢語大字典</entry>
</row>
<row>
<entry>1994</entry>
<entry>85,000</entry>
<entry>中華字海</entry>
</row>
</tbody>
</tgroup>
</table>
<para>兩千年來,漢字的總數增加了將近五倍。在此期間出現的漢字大多數是形聲字。</para>
</sect1>
<sect1 id="holo">
<title>閩南語和客家話</title>
<para>Contributed by KhoGuan Phuann</para>
<para>Last Update: 2003年10月13日 周一 02時17分56秒 CST</para>
<para>在台灣,漢字的使用,除了國語(Mandarin)的書寫以外,
也有用漢字寫成的閩南話(Holo)或客家話(Hakka)的文字作品
(以下敘述中的台灣話(Taiwanese)包括閩南話及客家話)。
近年來,雖然政府已開始進行母語教育,但其書面文字仍未標準化。
要完全使用漢字來充份書寫台灣話,實際上極困難。
不是要用到一些冷僻的漢字,就是無漢字可用,要創造新的漢字。
一些過去民間常用的台灣話漢字(如 &#20010; )Big5未收
即使是 Unicode 4.0 也還有所遺漏。更不用說台灣話中有許多外來語,
勉強用漢字近音字來表記,非常笨拙。</para>
<para>有許多人主張用漢字與拚音文字混用的方式來書寫台灣話,
以解決上述的問題,也有人主張完全使用拚音文字。</para>
<para>台灣話的拚音文字中,歷史最長久的是「白話字」
(P&ccedil;h-&ouml;e-ji簡寫為 POJ)。
白話字就是教會羅馬字(Church Romanization)
十九世紀從西洋來到福建及廣東傳教的長老教會牧師,
開始設計閩南話及客家話的羅馬拚音書寫系統,並傳播到台灣來。
歷經變遷,目前教會羅馬字是最多人使用的台灣話拚音文字,
並不限於教會人士。</para>
<para>近年台灣語文學會(Taiwan Languages and Literature Society)
以教會羅馬字為基礎加以修訂,制定了台灣語言音標方案(Taiwanese
Language Phonetic Alphabet簡寫為 TLPA)。自教育部於 1998
年公告以來,有越來越多台灣話的語文教材、民間採集、文學作品
以及研究著作採用這套音標。</para>
<para>自由軟體中yudit 這個 Unicode 編輯器,配合相應的 keymap
可以很方便的輸入 POJ 或 TLPA。詳情請參考
<ulink url="http://linux.taigi.idv.tw/nngthe/yudit">
潘科元台語 Linux 網站</ulink>。</para>
</sect1>
<sect1 id="chinese-code">
<title>編碼標準</title>
<para>在電腦開始使用的時候,所有的字都只用 1byte 來儲存,
1byte 包含 8bits每個 bits 都只能表示 on/off
也就是 1byte 只能表示 0000 0000 到 1111 1111 的編碼範圍,
只有 256 個編碼空間,這對中文而言,是不夠的。</para>
<para>我們知道中文字在目前常見的電腦上是由兩個位元組(two bytes)
所編碼組成的。
最常見的編碼方式有台灣地區所通行的 Big5 編碼,及大陸地區所使用的
GB 編碼。而且開頭的位元組幾乎都是大於 128 的數值,也就是所謂
non-ASCII 碼的範圍(ASCII 是指小於 128 的編碼)。</para>
<para>字集(Character Set)是一組符號或文字的組合,
而編碼(Encoding)則是將這一組符號或文字以適當的方式編入位元組中,
以便電腦能夠表示與儲存。
目前現有的字集如中文字集、英文字集、日文字集等,
而中文編碼則是選取部份或全部字集中的部分或全部字,
給予一個號碼如Big5 包含部分中文字集、英文字集、部分日文字集等。</para>
<para>接下來就是萬碼奔騰,眾多中文編碼標準的問題,
目前台灣使用的中文編碼存在許多問題,第一是中文編碼有數種
Big5、CCCII、CNS11643、Big5E、Big5+、ISO 10646、CP950
每個編碼所包含的中文字數不同,編碼方式也不相同,
而且大部分都沒有標準規格,
第二是常用的 Big5 編碼字數不足。</para>
<para>雖然常用的 Big5 已經使用 2bytes 來表示中文字,但是
2bytes = 16bits = 2^16 = 65536 個編碼空間,
以 Big5 的標準而言,為了要和 ASCII 能夠相容,只能使用兩萬多字,
現存的中文字最少在七萬以上,造成許多字在 Big5 的系統下,
無法使用。在加上中文標準繁多,卻又沒有最後的標準規格,
各家廠商所實做產品也就未必相容。
最明顯的例子就是日文平假片假名,
在這些中文編碼中並不是每個都包含,
當遇到所謂的「Big5日文」時就會產生許多問題。</para>
</sect1>
<sect1 id="ascii">
<title>ASCII</title>
<para>ASCII 分成兩個區域0x00 到 0x1F 給控制字元用,共十六個位置。
0x20 到 0x7F 給一般的圖形字元用(大小寫英文、數字和符號)
有 94 個位置0x20 和 0x7F 分別是 SPACE 和 DELETE。</para>
</sect1>
<sect1 id="iso8859-1">
<title>ISO8859-1</title>
<para>又稱為 Latin-10x00 到 0x1F 給控制字元用,共十六個位置。
0x20 到 0x7F 給一般的圖形字元用(大小寫英文、數字和符號)
0xA0 到 0xFF 為 Latin-1 額外加的部份,
由於使用了八位元,讓目前許多僅支援 ISO8859-1 卻不支援 Big5 的,
可以暫時的使用而不會有太多的問題,像是 vi, write, talk, talk,
finger, mail 等等的 FreeBSD 內建程式在顯示中文可以運作,
因為這些程式在處理時不會把 Latin-1 額外加的部份過濾掉,
中文的顯示也就沒有問題。</para>
</sect1>
<sect1 id="big5">
<title>BIG5</title>
<para>BIG5 是在 CCCII 不為政府單位採納,
國家頒布的中文標準碼又不堪用的情況下,
在民國 73 年,由台北市電腦公會主導,聯合了十三家業者,
共同制定,又稱為 BIG5_1984
(包括 5401 個常用字、7652 個次常用字、以及 441 個各式符號)。
Big5 的字符空間是個非連續的 94x157 矩陣,其容量為 14,758 位。</para>
<para>BIG5_ETen 為倚天中文在原本的 BIG5 碼上,
增加了日文、俄文、輸入法特殊符號、七個擴充字、以及表格符號區。</para>
<para>CP950 是微軟在原本的 BIG5 碼上,
增加了七個擴充字、以及表格符號區。</para>
<para>如不去考慮特殊符號,及後來的七個擴充字,
將所有的字分成兩大群: 常用字區與次常用字區,
每一個字區分別用筆畫來排序,
同一個筆畫的字,依部首來排。</para>
<para>目前主推的是 BIG5_ETen每個字由兩個位元組(2 bytes)組成,
其第一位元組編碼範圍為 0xA1 ... 0xF9
第二位元組編碼範圍為 0x40 ... 0x7E 與 0xA1 ... 0xFE
總計收入 13868 個字
(包括 5401 個常用字、7652 個次常用字、7 個擴充字、以及 808 個各式符號)
,其中可以大致劃分為以下幾個字區:</para>
<note><para>由於 CNS11643-1992 初期的不堪用,
Big5 雖然不是國家標準,但是在台灣比 CNS11643-1992
的國家規格用的更廣。換句話說Big5 是台灣的業界標準
(de facto standard)。</para></note>
<table>
<title>BIG5 字區與編碼範圍</title>
<tgroup cols="4">
<thead>
<row>
<entry>第一位元組</entry>
<entry>第二位元組</entry>
<entry>字區</entry>
<entry>制定</entry>
</row>
</thead>
<tbody>
<row>
<entry>A1..A2</entry>
<entry>40..7E, A1..FE</entry>
<entry>各種符號區</entry>
<entry>1984</entry>
</row>
<row>
<entry>A3</entry>
<entry>40..7E, A1..BF</entry>
<entry>各種符號區 (包括標點符號、ASCII 全形符號、注音符號等)</entry>
<entry>1984</entry>
</row>
<row>
<entry>A3</entry>
<entry>E1</entry>
<entry>歐元符號</entry>
<entry>CP950</entry>
</row>
<row>
<entry>A4..C5</entry>
<entry>40..7E, A1..FE</entry>
<entry>常用字區</entry>
<entry>1984</entry>
</row>
<row>
<entry>C6</entry>
<entry>40..7E</entry>
<entry>常用字區</entry>
<entry>1984</entry>
</row>
<row>
<entry>C6</entry>
<entry>A1..FE</entry>
<entry>罕用符號區</entry>
<entry>倚天</entry>
</row>
<row>
<entry>C7</entry>
<entry>40..7E, A1..FE</entry>
<entry>罕用符號區 (包括日文、俄文等)</entry>
<entry>倚天</entry>
</row>
<row>
<entry>C8</entry>
<entry>40..7E, A1..D3</entry>
<entry>罕用符號區 (包括俄文、輸入法特殊符號等)</entry>
<entry>倚天</entry>
</row>
<row>
<entry>C9..F8</entry>
<entry>40..7E, A1..FE</entry>
<entry>次常用字區</entry>
<entry>1984</entry>
</row>
<row>
<entry>F9</entry>
<entry>40..7E, A1..D5</entry>
<entry>次常用字區</entry>
<entry>1984</entry>
</row>
<row>
<entry>F9</entry>
<entry>D6..DC</entry>
<entry>七個擴充字</entry>
<entry>倚天</entry>
</row>
<row>
<entry>F9</entry>
<entry>DD..FE</entry>
<entry>表格符號區</entry>
<entry>倚天</entry>
</row>
</tbody>
</tgroup>
</table>
<table>
<title>七個擴充字</title>
<tgroup cols="4">
<thead>
<row>
<entry>擴充字</entry>
<entry>BIG5 碼</entry>
<entry>Unicode 碼</entry>
<entry>BIG5_1984 的同義字</entry>
</row>
</thead>
<tbody>
<row>
<entry>碁</entry>
<entry>0xF9D6</entry>
<entry>0x88CF</entry>
<entry>棋</entry>
</row>
<row>
<entry>銹</entry>
<entry>0xF9D7</entry>
<entry>0x92B9</entry>
<entry>鏽</entry>
</row>
<row>
<entry>裏</entry>
<entry>0xF9D8</entry>
<entry>0x7CA7</entry>
<entry>裡</entry>
</row>
<row>
<entry>墻</entry>
<entry>0xF9D9</entry>
<entry>0x58BB</entry>
<entry>牆</entry>
</row>
<row>
<entry>恒</entry>
<entry>0xF9DA</entry>
<entry>0x6052</entry>
<entry>恆</entry>
</row>
<row>
<entry>粧</entry>
<entry>0xF9DB</entry>
<entry>0x7881</entry>
<entry>妝</entry>
</row>
<row>
<entry>嫺</entry>
<entry>0xF9DC</entry>
<entry>0x5AFA</entry>
<entry>嫻</entry>
</row>
</tbody>
</tgroup>
</table>
<para>Big5 有兩個重複編碼的漢字,分別是 A461, C94a 和 DCD1, DDFC
CNS11643-1992 刪除了第二次編碼的漢字(C94A 和 DDFC)。</para>
<para>BIG5 最大的問題是字數不足。</para>
</sect1>
<sect1 id="cns11643">
<title>CNS11643</title>
<para>CNS11643 中文標準交換碼, 一般簡稱 CNS 碼或 CNS11643
因<ulink url="http://www.cns11643.gov.tw/">中央標準局
</ulink>公佈及修訂之先後而有二個版本,一般稱為
CNS11643-1986 版(1986公告版)及 CNS11643-1992 版(1992年修訂版)
此二個版本之差異僅在於其所編定之字數不同。 75 年公告之 CNS11643-1986
定義 13,051個漢字(去掉 Big5 多出兩個漢字)
名稱為「通用漢字標準交換碼」
81 年修訂版 CNS11643-1992 擴編為48,027 個漢字,
擴充後修訂名稱為「中文標準交換碼」。</para>
<para>CNS11643 以2個位元組 (byte)為中文碼編碼單位。
字碼中之 00 至 20 以及 7F 均予避開,
則 7bit 字碼集共有 94 個編碼位置,
兩個位元組共可編 8,836 個字碼,訂為一字面。
依字之使用頻率編排於各字面。
依先筆畫後部首排列順序編碼。</para>
<para>CNS11643-1992 的編碼法為ISO-2022-CN、ISO-2022-CN-EXT、
EUC-TW。從某角度來看可以把 Big5 看成是 CNS11643-1992
第一和第二字面的一種編碼法,
因為 CNS11643 直接取用 Big5 的第一和第二級漢字區,
作為 CNS11643 的第一和第二字面。</para>
<para>目前現有的 CNS11643 七個字面的字型可以在
<filename role="package">x11-fonts/intlfonts</filename> 中找到,
有 16、24、40 點字等字體大小可以取用。</para>
<table>
<title>ISO-2022-CN 的規格 -1,2</title>
<tgroup cols="3">
<thead>
<row>
<entry>字集</entry>
<entry>十六進位</entry>
<entry>圖形字符(ASCII)</entry>
</row>
</thead>
<tbody>
<row>
<entry>CNS 11643-1992 第 1 字面</entry>
<entry>1B 24 29 47</entry>
<entry>&lt;ESC&gt; $ ) G</entry>
</row>
<row>
<entry>CNS 11643-1992 第 2 字面</entry>
<entry>1B 24 2A 48</entry>
<entry>&lt;ESC&gt; $ * H</entry>
</row>
<row>
<entry>CNS 11643-1992 第 3 字面</entry>
<entry>1B 24 2B 49</entry>
<entry>&lt;ESC&gt; $ + I</entry>
</row>
<row>
<entry>CNS 11643-1992 第 4 字面</entry>
<entry>1B 24 2B 4A</entry>
<entry>&lt;ESC&gt; $ + J</entry>
</row>
<row>
<entry>CNS 11643-1992 第 5 字面</entry>
<entry>1B 24 2B 4B</entry>
<entry>&lt;ESC&gt; $ + K</entry>
</row>
<row>
<entry>CNS 11643-1992 第 6 字面</entry>
<entry>1B 24 2B 4C</entry>
<entry>&lt;ESC&gt; $ + L</entry>
</row>
<row>
<entry>CNS 11643-1992 第 7 字面</entry>
<entry>1B 24 2B 4D</entry>
<entry>&lt;ESC&gt; $ + M</entry>
</row>
<row>
<entry>One-byte shift</entry>
<entry>0F</entry>
<entry></entry>
</row>
<row>
<entry>Two-byte shift</entry>
<entry>0E</entry>
<entry></entry>
</row>
</tbody>
</tgroup>
</table>
<table>
<title>ISO-2022-CN 的規格 -3</title>
<tgroup cols="3">
<thead>
<row>
<entry>移位種類</entry>
<entry>十六進位</entry>
<entry>字集</entry>
</row>
</thead>
<tbody>
<row>
<entry>SO</entry>
<entry>0E</entry>
<entry>CNS 11643-1992 第 1 字面</entry>
</row>
<row>
<entry>SS2</entry>
<entry>1B 4E</entry>
<entry>CNS 11643-1992 第 2 字面</entry>
</row>
<row>
<entry>SS3</entry>
<entry>1B 4F</entry>
<entry>CNS 11643-1992 第 3 至第 7 字面</entry>
</row>
</tbody>
</tgroup>
</table>
<table>
<title>台灣漢字字集規則</title>
<tgroup cols="6">
<thead>
<row>
<entry>字集</entry>
<entry>公佈時間</entry>
<entry>第一級</entry>
<entry>第二級</entry>
<entry>附加漢字</entry>
<entry>符號</entry>
</row>
</thead>
<tbody>
<row>
<entry>CCCII</entry>
<entry>1980</entry>
<entry>75684</entry>
<entry></entry>
<entry></entry>
<entry></entry>
</row>
<row>
<entry>Big5</entry>
<entry>1984</entry>
<entry>5401</entry>
<entry>7652</entry>
<entry></entry>
<entry>441</entry>
</row>
<row>
<entry>Big5_ETen</entry>
<entry>1985</entry>
<entry>5401</entry>
<entry>7652</entry>
<entry>7</entry>
<entry>808</entry>
</row>
<row>
<entry>CNS11643</entry>
<entry>1992</entry>
<entry>5401</entry>
<entry>7650</entry>
<entry>34976</entry>
<entry>684</entry>
</row>
</tbody>
</tgroup>
</table>
<para>WWW: <ulink url="http://www.cns11643.gov.tw/">
http://www.cns11643.gov.tw/</ulink></para>
</sect1>
<sect1 id="cccii">
<title>CCCII</title>
<para>CCCII(Chinese Character Code for Information Interchange
中文資訊交換碼),是精心設計的台灣字集規則之一。
該規則是台灣的國字整理小組開發的。
第一版頒布於1980年。</para>
<para>CCCII總共有16層每一層都有六個連在一起的94x94字面
(共有94個字面)。
這樣子就產生了一個94x94x94的字碼空間(皆為 0x21-0x7E 的編碼範圍)。
字符按其種類收編於不同的層。</para>
<para>CCCII的漢字先按部首後按總筆劃數排列(昇序)。</para>
<para>CCCII第一層用於基本漢字集合包括 4808 常用漢字,
17032 次常用漢字20583 其他漢字。
剩下的層用於第一層的異體字。</para>
<para>最新的CCCII正式版頒布於1987年共收編了53,940個字符。
下版(1989年)將收編75,684個字符(44,167個正體字和31,517個異體字)。</para>
<para>目前CCCII的實作可以分為直接使用CCCII編碼ISO-2022-CN
<link linkend="cccii-ft">CCCII-FT</link>
以及永麟中文碼等四種。</para>
<table>
<title>CCCII 第一層的構造</title>
<tgroup cols="4">
<thead>
<row>
<entry>字面</entry>
<entry>區</entry>
<entry>字符</entry>
<entry>內容</entry>
</row>
</thead>
<tbody>
<row>
<entry>1</entry>
<entry>1</entry>
<entry>0</entry>
<entry>保留給控制碼</entry>
</row>
<row>
<entry>1</entry>
<entry>2</entry>
<entry>56</entry>
<entry>數學符號</entry>
</row>
<row>
<entry>1</entry>
<entry>3</entry>
<entry>94</entry>
<entry>ASCII</entry>
</row>
<row>
<entry>1</entry>
<entry>4-10</entry>
<entry>0</entry>
<entry>未編排</entry>
</row>
<row>
<entry>1</entry>
<entry>11</entry>
<entry>35</entry>
<entry>中文標點符號</entry>
</row>
<row>
<entry>1</entry>
<entry>12-14</entry>
<entry>214</entry>
<entry>繁體部首</entry>
</row>
<row>
<entry>1</entry>
<entry>15</entry>
<entry>78</entry>
<entry>41中文數字, 37拼音符號, 4音調符號</entry>
</row>
<row>
<entry>1</entry>
<entry>16-67</entry>
<entry>4808</entry>
<entry>常用漢字(213021~21637E)</entry>
</row>
<row>
<entry>1-3</entry>
<entry>68-64</entry>
<entry>17032</entry>
<entry>次常用漢字(216421~23607E)</entry>
</row>
<row>
<entry>3-6</entry>
<entry>65-5</entry>
<entry>20583</entry>
<entry>其他漢字(236121-262543)</entry>
</row>
<row>
<entry>6</entry>
<entry>6-94</entry>
<entry>0</entry>
<entry>未編排</entry>
</row>
</tbody>
</tgroup>
</table>
</sect1>
<sect1 id="euc-tw">
<title>EUC-TW</title>
<para>EUC-TW 將 CNS11643-1992 的 16 進位加上 0x8080。
第二字面轉換 8E A2第三字面轉換 8E A3第四字面轉換 8E A4
第五字面轉換 8E A5第五字面轉換 8E A6第七字面轉換 8E A7。</para>
<table>
<title>10月18日</title>
<tgroup cols="3">
<thead>
<row>
<entry>編碼</entry>
<entry>表示法</entry>
<entry>解釋</entry>
</row>
</thead>
<tbody>
<row>
<entry>CCCII</entry>
<entry>21 23 31 21 23 30 21 43 5B 21 23 31 21 23 38 21 42 73</entry>
<entry>212331:1 212330:0 21435B:月 212331:1 212338:8 214273:日</entry>
</row>
<row>
<entry>Big5</entry>
<entry>31 30 A4 EB 31 38 A4 E9</entry>
<entry>31:1 30:0 A4EB:月 31:1 38:8 A4E9:日</entry>
</row>
<row>
<entry>CNS11643-1992</entry>
<entry>1B 24 29 47 31 30 0E 45 4C 0F 31 38 0E 45 4A 0F</entry>
<entry>1B242947:(第一字面) 31:1 30:0 0E:(漢字) 454C:月 0F:(ASCII) 31:1 38:8 0E:(漢字) 454A:日 0F:(結束)</entry>
</row>
<row>
<entry>EUC-TW</entry>
<entry>31 30 C5 CC 31 38 C5 CA</entry>
<entry>31:1 30:0 C5CC:月 31:1 38:8 C5CA:日</entry>
</row>
</tbody>
</tgroup>
</table>
</sect1>
<sect1 id="gb-code">
<title>GB</title>
<para>在中國,中文信息編碼由政府負責制定並監督實施。
這是為了保證對於所有的系統中文的編碼都是一致的,能夠互相進行操作。
從計算機的應用開始,已經頒布了多種中文信息編碼標準,
常用的是 GB2312-1980GB12345GB13000(GBK),以及最新標準 18030。
值得一提的是,最新的 GB18030 標準將要作為強制標準實行,所有不支持
GB18030 標準的軟體將不能作為產品的出售。</para>
<para>從 GB2312-1980 編碼開始,漢字都是採用雙字節編碼。
為了與系統中基本的 ASCII 字符集區分開,
所有漢字編碼的每個字節的第一位元都是1。例如"啊" 字的編碼為
0xB0A1。</para>
<table>
<title>GB 的漢字編碼規則</title>
<tgroup cols="4">
<thead>
<row>
<entry>編碼</entry>
<entry>第一個字節</entry>
<entry>第二個字節</entry>
<entry>第三個字節</entry>
<entry>第四個字節</entry>
</row>
</thead>
<tbody>
<row>
<entry>GB2312</entry>
<entry>0xB0 - 0xF7</entry>
<entry>0xA0 - 0xFE</entry>
<entry></entry>
<entry></entry>
</row>
<row>
<entry>GBK</entry>
<entry>0x81 - 0xFE</entry>
<entry>0x40 - 0xFE</entry>
<entry></entry>
<entry></entry>
</row>
<row>
<entry>GB18030 的雙字節</entry>
<entry>0x81 - 0xFE</entry>
<entry>0x40 - 0x7E, 0x80 - 0xFE</entry>
<entry></entry>
<entry></entry>
</row>
<row>
<entry>GB18030 的四字節</entry>
<entry>0x81 - 0xFE</entry>
<entry>0x30 - 0x39</entry>
<entry>0x81 - 0xFE</entry>
<entry>0x30 - 0x39</entry>
</row>
</tbody>
</tgroup>
</table>
</sect1>
<sect1 id="iso10646">
<title>Unicode/ISO 10646 </title>
<para>Unicode (Universal Multiple Octet Coded Character Set)
Unicode 國際標準組織於1984年4月成立
IOS / IEC JTC1 / SC2 / WG2工作組針對各國文字、
符號進行統一性編碼1991年美國跨國公司成立Unicode Consortium
並於1991年10月與WG2達成協議採用同一編碼字集 。
目前Unicode是採用16 bit之編碼架構其字集內容與ISO 10646之
BMP(Basic Multilingual Plane)相同。</para>
<para>Unicode (Unicode Consortium)並於1992年6月通過
DIS(Draft International Standard)目前版本為Unicode v2.0
於1996年公佈 內容包含符號6811、 漢字20902、韓文拼音11172、
造字區6400保留20249共65534個碼位 。</para>
<para>
目前碼位空間為 U+0000 到 U+10FFFF共有
1,114,112 個空間。</para>
<para>Unihan3.2 包含超過七萬個 CJK 字。</para>
<para>ISO 10646 HK WWW: <ulink url="http://www.iso10646hk.net/">
http://www.iso10646hk.net/</ulink></para>
<para>WWW: <ulink url="http://www.unicode.org/">
http://www.unicode.org/</ulink></para>
</sect1>
<sect1 id="basic">
<title>基本中文環境的要件</title>
<para>先讓我們一起來想一想,
一個基礎中文平台要能夠做到那些事情,
不妨就以編輯一份文件為例吧(像我現在在這邊寫稿一樣)
我們希望開啟的程式可以有友善的介面,有中文的選單跟說明(中文訊息)
還要有慣用的中文輸入法可以把中文打進去(輸入)
打字進去以後必須可以看到輸入的結果(顯示)
打字出錯了還要可以修改才行,必要的時後還得可以改變字型等等的(處理)
文章打完了,要能夠順利的把結果印出來(列印)
從這一個例子裡面我們就可以歸納出一個基本中文環境,
應該要可以做到下面這幾件事情: </para>
<itemizedlist>
<listitem><para>中文的訊息</para></listitem>
<listitem><para>中文的顯示</para></listitem>
<listitem><para>中文的輸入</para></listitem>
<listitem><para>中文的列印</para></listitem>
<listitem><para>中文的處理</para></listitem>
</itemizedlist>
<para> 上面的列表就是我們認為一個基本中文環境所要滿足的要件,
也是我們在評估一個系統中文支援優劣時所用的基準,
其實所謂的"中文化",代表的就是在作為基礎的英文版作業系統上面,
做出修正的工作,目的不外是要能夠滿足上面所提到的這些要件罷了,
這個列表的順序剛好是依照程式設計加以支援的困難程度排出來的,
順序是從簡單到困難;提供中文的訊息跟介面所牽涉到的大多只是翻譯的工作,
最為簡單,在顯示時要考慮到字型的搭配問題,
在輸入時要有一個程式之間共用的輸入介面,這些就比較困難,
而列印不只要作到應用程式跟列印伺服程式之間的整合,
還需要有產生大點數美觀字體的能力,這件工作牽涉的問題更加複雜了,
這幾點裡面要讓應用程式處理中文是最困難的一部分,
例如中文正規表示法、中文字串搜尋等等,都是目前還難以解決的課題。</para>
<para> 那麼,在目前的 FreeBSD 環境底下,
要用甚麼方法才可以讓系統支援上面提到的這些基本要件呢? </para>
</sect1>
<sect1 id="i18n-l10n">
<title>國際化與中文化</title>
<para>要讓系統支援中文,可能的解決方案不出三種,
一是使用外掛式的中文系統,二是撰寫獨立的中文程式,
三是利用系統上提供的國際化架構來支援。所謂的外掛式中文環境,
指的是如同 DOS 底下的倚天中文或者 Windows 底下的雙橋中文這樣的系統,
在 FreeBSD 系統底下,外掛式的中文環境可以藉著 LD_PRELOAD
的機制來達成,只要設定 LD_PRELOAD 這個環境變數,
適時的指到提供中文支援的動態函式庫去,就可以在程式執行時,
動態的用支援中文的函式來替換掉原本不支援中文的函式,
結果就可以讓不支援中文的程式變得可以顯示中文跟接受中文輸入了,
例如 <application>xa+cv</application> 或者是在
<application>TurboLinux</application> 裡面使用的 <application>
zhWinPro</application> 都是屬於這類的程式。
利用這種方式來提供中文的支援很簡單,很靈活,
也不需要去修改程式的原始碼並重新編譯,
可是這個方法卻沒辦法讓應用程式對中文作正確的"處理"
常見的例子是雖然加上了外掛的中文系統,
可是編輯文字時在中文字上面按一次刪除鍵卻還是只能刪除半個中文,
這是因為在應用程式內部仍然是把一個中文字當成兩個英文字來看待,
而這顯然是不正確的,此外這個方式也不支援跟函式庫作靜態連結的程式,
還控會造成系統的不穩定,因此大家已經理解到這個方式無法解決根本問題,
漸漸的捨棄這種外掛的方式,而用其他的方法提供中文支援了。 </para>
<para>第二種方式是修改程式,直接讓每個程式都支援中文的使用,
這種是最簡單也是最困難的方法,說它簡單,因為這件工作很直接,
FreeBSD 底下的程式又大多數都可以拿到程式的原始碼,
只要對這些原始碼作修正,加入支援中文的部份,就可以支援中文的使用囉,
例如很多人使用的中文 <application>cpine</application>
郵件程式就是用英文版 <application>pine</application> 的原始碼改出來的,
其他如 <application>cxterm</application> 程式或者支援多種語言的
<application>emacs</application>
等等程式都是由應用程式自行提供中文支援的,
這些程式對中文的支援很好,也都受到了大家的歡迎愛用,可是,
使用者一旦離開這些有提供中文支援的程式以後就無法用中文了,
一個 FreeBSD 套件少說有五六百個程式套件,
想要全面的中文化,必須要一個一個完整的對這些程式做出修改才行,
這件工作在人力跟物力上都會是一個天文數字的投資,是不可能的事情,
所以我們前面說這也是最困難的方法 :) 況且,因為編碼系統不一樣,
這些程式拿到日本就要改一次日文版,拿到韓國也要再改一次韓文版,
這種作法會使得資源重複浪費的部份十分嚴重,由此可見,
靠獨立的程式來提供中文環境並不是個聰明的作法,
必須要有更好的方式才行。</para>
<para> 那麼甚麼才是這個更好的方式呢?
"國際化"可能是目前我們找得到的最好解答,
國際化的英文名稱是 InternationalizatioN這個英文單字的第一個字母
I 與最後一個字母 N 之間有 18 個字母,所以也被簡稱為 I18N。
I18N 是一種觀念跟目標,這個想法是要提供一個架構,
讓同樣的程式碼可以適用在各種語文習慣跟編碼系統上面,
程式設計人員只要利用這個架構的機制跟準則撰寫應用程式,
就可以在不需重新編譯程式的情況下,自然的支援各式各樣的語言,
不過為了要達成這樣的目標,作業系統必須提供一定程度的支援,
特別是在各種的程式庫裡面都得有支援 I18N 的 設計才可以,
這邊特別重要的就屬 C 程式庫以及 X 視窗系統的國際化設計了。
過去FreeBSD 上的 C 程式庫跟 X 對國際化的支援都不完整,
整個基礎環境還不成熟,所以多數的程式並沒有照著 I18N 的標準來撰寫,
導致中文化的問題困難重重,這個現象在這一年來已經有了大幅的改善,
目前國際上大家寫程式的時候已經有支援 I18N 的普遍共識了,
主流的程式也都漸漸提供了 I18N 的支援,利用標準的 FreeBSD
國際化架構來支援中文還是要改程式,不過這個改法是國際的主流,
也可以保證投資可以有最大的獲益,所以我們認為這才是建構中文環境的正途,
在後續的文章裡面我們將會一一跟大家介紹目前 FreeBSD 底下 I18N
環境的實作方法,以及設計 I18N 程式所該注意的事項。</para>
<para>一般國際化架構設計的基本原則,
是把程式處理會跟語文編碼相關的部份獨立出來,
這些資料不只是編碼系統的定義,還包括該語文下的一些使用習慣,
例如數字、日期、排序、貨幣的格式,以及翻譯的訊息等等...
這些跟語文環境有相關的資料,我們稱之為 "區域環境資料庫"
(locale database,LOCALization Environment database)
把這些資料分離出來以後,就可以定義一個跟語文編碼無關的介面,
給程式設計師使用,讓程式設計人員在設計程式時不必考慮,
對特定語文環境提供支援的細腹A寫出來的程式就可以不限於支援特定語言
而是在程式執行的時候才依使用者的選擇的區域環境 (locale)
聯繫到不同的資料庫,進而提供該語文的支援。 </para>
<para>I18N 只是提供可能用來支援中文的大架構,要能夠使用中文,
還必須要在這個架構裡面加入對中文語文編碼的支援才可以,
這個在國際化架構之下加入對某種特定語文支援的動作稱為"區域化"
英文稱為 LocalizatioN因為 L 跟 N 之間有 10 個英文字母,
也常被簡稱為 L10N一般的 "中文化"
是泛指為應用程式加上中文支援的過程,不過我們這邊提到的中文化,
事實上就是在國際化架構下面加入中文區域化支援的工作;
就目前的FreeBSD 環境而言,
當前在 FreeBSD 上用來提供中文支援的國際化架構可說是已經大致完備,
底層程式庫的中文區域化工作也都大致完成了,
在這個架構之上已經可以提供一個不錯的中文環境可以用了,說起來,
我們能有今日的中文環境可用,實在要感謝這些國際性程式開發組織(XFree86)
有心重視亞洲語系使用者的需求,此外,
長久以來許許多多網路上自由軟體作者的貢獻也是功不可沒,
正就是因為有這許多前人不計個人報酬的努力,
我們才能享受當前的中文環境。 </para>
</sect1>
<sect1 id="chinese-trans">
<title>可能的問題</title>
<para>許多程式由於各式各樣的原因,
並未考慮到輸入的資料可能是 non-ASCII 碼的問題。
它往往假設了它所要處理的資料都是 ASCII 碼,更糟糕的是,當它遇到
non-ASCII 碼時,常常假設它不存在,而將它的第八個位元截去!
這是所謂的 8-bit clean 問題。</para>
<para>例如,您的 <link linkend="telnet">telnet</link> 程式
總是認為您輸入的都是七位元的 ASCII 碼。當您輸入中文時,
每每將第八位元砍掉,所以都變成亂碼。</para>
<para>網路上的通訊程式也常常只能傳輸七位元的資料。較早期的
<application>sendmail</application> 程式就是惡名昭彰的例子。
<application>sendmail</application> 只能接送含七位元的信件,
導致我們在傳送中文信件時,必須採用各式各樣奇怪的
<link linkend="procmail">編碼格式</link>
(如 uuencodebase64QP 等),這往往又為收信者帶來很大的困擾!
(我常在想如果當初電子郵件的創造者能多一點點的遠見,
我們今天就會少許多的問題!)</para>
<para>在網路上這個問題顯得更為複雜。
即使您和您的收信人的機器都已經安裝了可以處理中文信件的
<application>sendmail</application> 程式
,對方仍有可能收到亂碼信件。
因為這封信在到達對方手中前可能經過好多部主機,
如果其中一部機器的 <application>sendmail</application>
將第八位元截去,事情就完了!
對於 client/server 架構的程式,問題可能出在 client 端,
也可能是在 server 端,或是雙方都有。</para>
<para>除了無法處理 non-ASCII 碼資料的問題之外,
應用程式無法辨識中文編碼也是一大問題。也就是,很多程式
(即使能正確處理八位元的資料)都將一個中文字視為兩個獨立的位元組。
這在許多情況下不會有什麼不好,但在某些場合下就顯得很糟!</para>
<para>最顯然的例子,即使您能正確的輸入中文,可是當您按下倒退鍵
(backspace)時,往往只倒後了一個位元組而將一個好好的中文字截成兩半,
剩下的那半當然就成了亂碼。還有,
文書編輯器可能在一個中文字中間換行而導致出現亂碼,
或是將一行很長的中文句子當作一個很長的英文字母而不換行,
使得畫面變得很難看。</para>
<para>還有更糟的!某些中文字所含的特殊內碼對某些應用程式具有特別的意義,
這導致程式遇到這些內碼時將產生嚴重的錯誤,或是當掉。</para>
<para>下面將試著為這些問題提出一些解決之道,但是這仍是片面的,
不完全的,而且不能令人滿意。
也許只有當所有的軟體都能為中文量身打造時問題才可能真正的解決。</para>
<para>話雖如此,愈來愈多的程式在設計上已經注意到國際化的問題,
例如現在大部分主機的 <application>sendmail</application>
程式都已經能正確處理 8-bit 的信件 ---
因為不僅僅是傳輸中文信件需要 8-bit
現在很多的多媒體郵件也都需要用 8-bit 傳送。
很多軟體已經完全不需修改,
或者只要開啟一些特殊的選項,就能使用中文。
同時也有愈來愈多人正在為軟體的中文化而努力。且讓我們拭目以待。</para>
</sect1>
<sect1 id="locale">
<title>什麼是 locale </title>
<para>locale 是一組 C 程式語言處理自然語言(文字)的程式介面,
也可以簡單的說locale 就是一組 [地區性語言] 的資訊。
由國家語言和各地習俗影響所決定的慣例,或代表一個地理區域的定義所組成,
這些慣例包含文字、日期、數字、貨幣格式和排序等等。這代表著 locale 可讓程式的輸出可以直接反應地方區域性的文化。C 語言的 locale
定義,分為下列各大類:</para>
<itemizedlist>
<listitem><para>LC_ALL 代表所有的 Locale</para></listitem>
<listitem><para>LC_CTYPE 字元定義 (包含字元分類與轉換規則)</para></listitem>
<listitem><para>LC_MESSAGES 訊息顯示</para></listitem>
<listitem><para>LC_TIME 時間格式</para></listitem>
<listitem><para>LC_NUMERIC 數字格式</para></listitem>
<listitem><para>LC_MONETARY 貨幣格式</para></listitem>
<listitem><para>LC_COLLATE 字母順序與特殊字元比較</para></listitem>
</itemizedlist>
<para>其中與一般使用者息息相關的,是字元定義 (LC_CTYPE) 與訊息顯示
(LC_MESSAGES)。LC_CTYPE 直接關係到某些字元或內碼在目前的
locale 下是否可列印?要如何轉換字碼?對應到哪一個字?....
等等。LC_MESSAGES 則關係到軟體的訊息輸出是不是符合地域性,例如
:我們需要的是中文。而一個真正完整支援 locale 系統,
是當使用者在 shell prompt 下,直接設好環境變數後,
則馬上就能切換到那個語言了。例如: </para>
<screen>
&prompt.user; <userinput>setenv LC_CTYPE zh_TW.Big5</userinput> </screen>
<para>locale 命名規則語言_地區名.字元編碼名稱</para>
<para>設定 Locale 的字元定義為台灣地區的 Big5 繁體中文碼定義,
有了正確的 locale 的定義後,使得任何地區的語文,只要在加入適當的
locale data 之後C Library 就能正確地處理軟體顯示訊息,
而我們使用的 [中文] 當然也不例外,而目前中文使用的 locale data
就是 zh_TW.Big5代表的就是中文語系(zh)台灣地區(TW)
使用Big5編碼系統(Big5)。 </para>
</sect1>
</chapter>
<!--
Local Variables:
mode: sgml
sgml-declaration: "../chapter.decl"
sgml-indent-data: t
sgml-omittag: nil
sgml-always-quote-attributes: t
sgml-parent-document: ("../zh-tut.sgml" "part" "chapter")
End:
-->

View file

@ -0,0 +1,910 @@
<!--
The Chinese FreeBSD Documentation Project
Id: faq.sgml,v 1.100 2003/12/08 11:06:41 statue Exp
$FreeBSD$
-->
<chapter id="faq">
<title>常見問題解答</title>
<sect1 id="anti-input">
<title>為何我無法輸入中文?</title>
<para>這個問題問得太籠統了!您是在什麼情況下不能輸入中文的?</para>
<para>如果您是在 console 的 shell 下不能輸入中文,請參考
<link linkend="shell">在 Shell 底下輸入中文</link>
一小節的說明。</para>
<para>如果您是在編輯器中不能輸入,可能您的編輯器無法支援中文。
請參考 <link linkend="software">有用的中文軟體</link>
一節安裝能支援中文的編輯器。
如果是 <application>vi</application> 無法輸入中文請參考
<link linkend="vi">輸入中文會顯示 /XX/XX</link></para>
<para>如果您是 <application>telnet</application>
到別入的機器後不能輸入中文,那麼問題很可能在
<application>telnet</application> 這支程式上。請參考
<link linkend="telnet">telnet</link>
一小節的說明。 </para>
</sect1>
<sect1 id="input-in-netscape">
<title>如何在 Netscape 輸入中文? [OBSOLETE]</title>
<para>安裝 <application>xcin25</application> 並設定好 XIM 即可。請參考
<link linkend="xcin25">xcin25</link>
一節的說明。不過如果 <application>netscape</application>
是以 package 安裝的,可能沒辦法。 </para>
</sect1>
<sect1 id="chitex-cjk">
<title>ChiTeX 與 CJK 有何不同? 可否同時安裝?</title>
<itemizedlist>
<listitem><para>
<application>CJK</application> 的中文字形讀取尋找系統架構在
<application>LaTeX</application> 的 NFSS 上,
</para></listitem>
<listitem><para>
<application>ChiTeX</application> 的中文字形讀取尋找系統是獨立而效率高的系統
</para></listitem>
<listitem><para>
<application>CJK</application> 可使用中文,日文,韓文;而
<application>ChiTeX</application> 只對中文正體字(Big5)
</para></listitem>
<listitem><para>
<application>CJK</application> 只能用在
<application>LaTeX</application> 上;而
<application>ChiTeX</application> 可用在 plain
<application>TeX</application> 與
<application>LaTeX</application> 上。
</para></listitem>
<listitem><para>
<application>ChiTeX</application> 指令簡單但很有用。
</para></listitem>
<listitem><para>
<application>ChiTeX</application> 是接近真正中文
<application>LaTeX</application> 的中文
<application>LaTeX</application>。
</para></listitem>
<listitem><para>
功能的不同...
</para></listitem>
</itemizedlist>
<para><application>ChiTeX</application> 和
<application>CJK</application> 應該是可以同時安裝的,但是
<application>ChiTeX</application> 與
<application>CJK</application> 所用的
<application>ttf2pk</application> 如果同名字,可能有問題。
解決的辦法是在各自起始的指令稿(shell script)中定義 $PATH
變數,使其指向正確的 <application>ttf2pk</application> 位置。
</para>
<para> (感謝陳弘毅教授解答。) </para>
</sect1>
<sect1 id="rxvt-locale">
<title>rxvt-2.7.3 為何是日文的?</title>
<para>請參考<link linkend="rxvt">rxvt</link>。</para>
</sect1>
<sect1 id="speedup-xwin">
<title>加快 X Win 的方法?</title>
<para>用 "<command>startx - -deferglyphs 16</command>"
進入 X 視窗系統試試看,這裡
"<option>-deferglyphs 16</option>" 的參數會讓 X 延遲產生
16bit 字型的時間,
不在第一次載入字型的時候就全部一次產生,而在真正使用到字型
的時候才產生,可以讓載入中文字型的時候不會 hang 住,可以加
快中文字顯示的速度。</para>
</sect1>
<sect1 id="netscape-color">
<title>為何 Netscape 的圖示是黑白的? [OBSOLETE]</title>
<para>
當 <option>bpp</option> 設成 24 時,
<application>Netscape</application>
的圖示就會變成黑白,
只要用 <option>bpp 16</option> 或是
<option>bpp 32</option> 就會變成彩色了。</para>
</sect1>
<sect1 id="ssh">
<title>中文的 SSH client for windows</title>
<para><application>PuTTY</application> 現在有中文相容的版本出來了,
推薦給大家,很小的檔案,只有 216 KB此版中文正常。
<application>PuTTY</application> 中文相容作者:&a.mhsin;
中文相容功能作者網頁: <ulink url="http://www.mhsin.org/putty/">
http://www.mhsin.org/putty/</ulink>,這裡提供一個<ulink
url="http://freebsd.sinica.edu.tw/~statue/putty.exe">下載點</ulink>。</para>
<para>在 0.52 版的 putty 只需要調整一下設定就可以輸入中文了。
Change Settings -&gt; Window -&gt; Appearance -&gt; 的
Set the font used in the terminal window 點 Change 後
將字型選擇細明體或是標楷體的中文字型,並把字集選擇
CHINESE_BIG5這樣子就可以輸入中文囉。</para>
<para>使用新版PuTTY時請記得把Window-->Appearance裡的cursor appearance改成
Underline避免預設的塊狀游標在重繪時會把游標所在的中文字切開。</para>
<para>筆者通常還會把 Terminal 裡面的 <option>Enable blinking text</option>
來支援閃爍字,以及把 Keyboard 裡面的 <option>The Backspace key</option>
改成 <option>Control-H</option> 來使 BackSpace 有效用。</para>
<para>Putty WWW: <ulink url="http://www.chiark.greenend.org.uk/~sgtatham/putty/">
http://www.chiark.greenend.org.uk/~sgtatham/putty/</ulink>。</para>
<para>要不然也可以到 <ulink url="http://www.ssh.com/products/ssh/download.cfm">
http://www.ssh.com/products/ssh/download.cfm</ulink> 抓取
<application>SSHWinClient-3.0.0.exe</application>
此版中文也正常,功能也比 <application>Putty</application>
多很多,不過檔案大了點,約 6.37MB,這裡提供一個
<ulink url="http://freebsd.sinica.edu.tw/~statue/SSHWinClient-3.0.0.exe">下載點</ulink>。</para>
<para>SSHWinClient WWW: <ulink url="http://www.ssh.com/">
http://www.ssh.com/</ulink>。</para>
<para>Chinese Putty WWW: <ulink url="http://mhsin.org/putty/">
http://mhsin.org/putty/</ulink></para>
</sect1>
<sect1 id="input-in-ftp">
<title>在 FTP 中輸入中文?</title>
<para>在終端機底下請試試用 <link linkend="ncftp3">ftp/ncftp3</link>
如果在 X 底下建議使用 <link linkend="iglooftp">ftp/IglooFTP</link>
畫面和使用方式保證愛不釋手。</para>
</sect1>
<sect1 id="oracle8i">
<title>Oracle8i 沒辦法使用中文?</title>
<para>在環境變數中設定 nls_lang</para>
<programlisting>
<!--export nls_lang=American_America.ZHT16BIG5-->
export nls_lang="traditional chinese"</programlisting>
<para>或是設定 NLS_LANG 為 TRADITIONAL CHINESE_TAIWAN.ZHT16BIG5
這兩種方法都有人提出來,不過筆者沒有實際測試過。</para>
<para>WWW: <ulink url="http://www.oracle.com.tw/">
http://www.orcale.com.tw/</ulink></para>
</sect1>
<sect1 id="oracle9i">
<title>安裝 Oracle9i 出現亂碼?</title>
<para>by tommy@teatime.com.tw</para>
<para>Oracle 9i 內的 JAVA 字型設定有點問題,
安裝環境都設為英文就可以安裝了。</para>
<para>如果一定要看到中文,就把下面這個檔案的內容改一改再裝:</para>
<programlisting>
Disk1/stage/Components/oracle.swd.jre/1.1.8.0.0/1/ \
DataFiles/Expanded/linux/lib/font.properties.zh_TW_Big5</programlisting>
<para>或是:</para>
<programlisting>
Disk1/stage/Components/oracle.swd.jre/1.3.1.0.0/1/ \
DataFiles/Expanded/jre/linux/libfont.properties.zh</programlisting>
<para>裡面的 1.1.8.0.0 或是 1.3.1.0.0 要根據您所安裝的
jsdk 內附的版本,並且把 big5 那幾行改為:</para>
<programlisting>
-default-ming-medium-r-normal--*-%d-*-*-c-*-big5-0</programlisting>
<para>就可以了。</para>
<para>或是直該修改 $JAVA_HOME/jre/lib/font.properties
也可以,感謝 jsona laio &lt;freeonfair@yahoo.co.uk&gt;。</para>
</sect1>
<sect1 id="wuftp">
<title>wu-ftp 無法上傳中文檔名的檔案?</title>
<para>為什麼匿名者無法上傳中文檔名的檔案,但卻可上傳英文檔名的檔案?</para>
<para>我想是您在 ftpaccess 設定檔中設定了 patch-filter 了。
只要把以下的設定註解起來,應該就可以傳中文檔名的檔案了。</para>
<programlisting>
# path-filter...
path-filter anonymous /etc/pathmsg ^[-A-Za-z0-9_\.]*$ ^\. ^-
path-filter guest /etc/pathmsg ^[-A-Za-z0-9_\.]*$ ^\. ^-</programlisting>
</sect1>
<sect1 id="kdm">
<title>kdm 登入畫面是亂碼?</title>
<para><filename>/usr/local/share/config/kdmrc</filename> 檔案,
找到 font 相關設定,數字設定第三個欄位的 0 改成 big5 即可。ex:</para>
<programlisting>
FailFont=helvetica,12,5,big5,75,0
GreetFont=charter,24,5,big5,50,0
StdFont=helvetica,12,5,big5,50,0</programlisting>
<para>順便看一下 [Locale] 區段,要正常顯示中文,要補上:</para>
<programlisting>
Country=tw
Language=zh_TW.Big5</programlisting>
<para>另外,中文的環境設定要在 <filename>~/.xsession</filename>
裡面設定,而不是在 <filename>~/.cshrc</filename>。</para>
</sect1>
<sect1 id="vi">
<title>vi 輸入中文會顯示 /XX/XX</title>
<para>這通常都是設定了 LC_CTYPE 為 zh_TW.Big5 或是沒設定 LC_CTYPE
才會發生的問題,在 <filename>~/.cshrc</filename> 中加上下面的
alias 即可:</para>
<programlisting>
alias vi 'env LC_CTYPE=en_US.ISO_8859-1 vi'</programlisting>
<para>或是直接改用 vim6會有更多的功能與支援。</para>
<para>請參考 <link linkend="iso8859-1">ISO8859-1</link> 一節。</para>
</sect1>
<sect1 id="write">
<title>write 無法送中文訊息?</title>
<para>這通常都是設定了 LC_CTYPE 為 zh_TW.Big5 或是沒設定 LC_CTYPE
才會發生的問題,在 <filename>~/.cshrc</filename> 中加上下面的
alias 即可:</para>
<programlisting>
alias write 'env LC_CTYPE=en_US.ISO_8859-1 write'</programlisting>
<para>請參考 <link linkend="iso8859-1">ISO8859-1</link> 一節。</para>
</sect1>
<sect1 id="talk">
<title>talk 無法送中文訊息?</title>
<para>這通常都是設定了 LC_CTYPE 為 zh_TW.Big5 或是沒設定 LC_CTYPE
才會發生的問題,在 <filename>~/.cshrc</filename> 中加上下面的
alias 即可:</para>
<programlisting>
alias talk 'env LC_CTYPE=en_US.ISO_8859-1 talk'</programlisting>
<para>請參考 <link linkend="iso8859-1">ISO8859-1</link> 一節。</para>
</sect1>
<sect1 id="wall">
<title>wall 無法送中文訊息?</title>
<para>這通常都是設定了 LC_CTYPE 為 zh_TW.Big5 或是沒設定 LC_CTYPE
才會發生的問題,在 <filename>~/.cshrc</filename> 中加上下面的
alias 即可:</para>
<programlisting>
alias wall 'env LC_CTYPE=en_US.ISO_8859-1 wall'</programlisting>
<para>請參考 <link linkend="iso8859-1">ISO8859-1</link> 一節。</para>
</sect1>
<sect1 id="finger">
<title>finger 無法看到中文project</title>
<para>這通常都是設定了 LC_CTYPE 為 zh_TW.Big5 或是沒設定 LC_CTYPE
才會發生的問題,在 <filename>~/.cshrc</filename> 中加上下面的
alias 即可:</para>
<programlisting>
alias finger 'env LC_CTYPE=en_US.ISO_8859-1 finger'</programlisting>
<para>請參考 <link linkend="iso8859-1">ISO8859-1</link> 一節。</para>
</sect1>
<sect1 id="mail">
<title>mail 無法看到中文?</title>
<para>這通常都是設定了 LC_CTYPE 為 zh_TW.Big5 或是沒設定 LC_CTYPE
才會發生的問題,在 <filename>~/.cshrc</filename> 中加上下面的
alias 即可:</para>
<programlisting>
alias mail 'env LC_CTYPE=en_US.ISO_8859-1 mail''</programlisting>
<para>請參考 <link linkend="iso8859-1">ISO8859-1</link> 一節。</para>
</sect1>
<sect1 id="xml">
<title>xml 是否具有處理中文的能力?</title>
<para>請參考以下的網址:</para>
<para>WWW: <ulink url="http://www.ascc.net/xml/zh/big5/">
Chinese XML Now</ulink></para>
</sect1>
<sect1 id="rm-i">
<title>如何刪除以中文命名的檔案?</title>
<para>當遇到不知名的亂碼命名檔案時,可以用
<command>rm -i *</command> 來刪除檔案,
它會每一個檔案都詢問您是否要刪除。</para>
</sect1>
<sect1 id="x-win32">
<title>X-win32 如何安裝中文字型?</title>
<para>通常筆者都會使用 kcfonts因為跟預設的系統比較合。</para>
<para>首先在 <filename>chinese/kcfonts</filename> 安裝好後,
將 <filename>/usr/X11R6/lib/X11/fonts/local/</filename> 底下的檔案,
全都搬移到 <filename>C:\Program Files\StarNet\X-Win32 5.1\Lib\Fonts\
</filename> 底下,然後用 <option>Font -&gt; Add... -&gt;
local\</option>,接著 <option>Make FONTS.DIR</option>
並 <option>Edit Alias File...</option></para>
<programlisting>
kc12x24 -kc-fixed-medium-r-normal--24-170-100-100-c-120-iso8859-1
kc15f -kc-fixed-medium-r-normal--16-160-72-72-c-160-big5-0
kc24f -kc-fixed-medium-r-normal--24-240-100-100-c-240-big5-0
kc8x15 -kc-fixed-medium-r-normal--15-170-100-100-c-80-iso8859-1
taipei16 -kc-fixed-medium-r-normal--16-160-72-72-c-160-big5-0
taipei24 -kc-fixed-medium-r-normal--24-240-100-100-c-240-big5-0</programlisting>
<para>或是用 <filename>ports/x11-fonts/getbdf</filename> <command>
getbdf -font "-dynalab-mingliu-medium-r-normal--16-*-*-*-c-*-big5-0"
&gt; mingliu16.bdf</command> 來產生 16pt 的字型,
然後依序產生所需要用的字型。</para>
<para>在 Windows 底下也可以抓取 <filename>ttf2bdf.exe</filename>,將
<filename>C:\Windows\Fonts\mingliu.ttc</filename> 轉成 bdf
然後依照上面的方法也是可以使用的。</para>
</sect1>
<sect1 id="www">
<title>網頁亂碼?</title>
<para>如果是網頁內容,請在網頁的最前面加上:</para>
<programlisting>
&lt;META HTTP-EQUIV="Content-Type" CONTENT="text/html; charset=big5"&gt;
</programlisting>
<para>在網頁中設定後,重讀應該就正常了,如果還是不正常就檢察
<filename>httpd.conf</filename> 看是否有下面這行:
<option>AddDefaultCharset ISO-8859-1</option>
這行設定會讓瀏覽器不會根據網頁中的語言設定而判斷編碼方法,
只要把這行註解掉就可以了。</para>
<para>如果是 URL 列中文變亂碼,這是正常的,您可以用 perl 來編碼:</para>
<programlisting>
$string =~ s/([^0-9A-Za-z])/sprintf("%%%02X",ord($1))/ge;</programlisting>
<para>或是用 perl 來解碼:</para>
<programlisting>
$string =~ s/%([0-9A-Fa-f][0-9A-Fa-f])/chr hex $1/ge;</programlisting>
</sect1>
<sect1 id="vnc">
<title>vnc 抓 XFree86 的中文問題?</title>
<para>by nestlin (nestlin.bbs@nestlin.Dorm13.NCTU.edu.tw)</para>
<para>Q: 請教一下,我在 w2k 中執行 vnc 去抓 bsd 的 xwin 3.3.6 版,
是可以抓進來,但沒有中文,但如果我的在 bsd 上頭使用 startx
跑 xwin 時中文確是正常的,請問我要如何解決 vnc 中 中文的問題。</para>
<para>A: 如果是 GNOME2 的軟體,中文不會有問題,
但是如果是傳統 XLFD 吃字的話,可以參考以下的安裝過程:</para>
<para>安裝 <filename role="package">net/vnc</filename>。</para>
<para>接著修改 <filename>/usr/X11R6/bin/vncserver</filename></para>
<programlisting>
--- vncserver.orig Fri Jan 4 15:45:23 2002
+++ vncserver Fri Jan 4 16:07:47 2002
@@ -149,6 +149,7 @@
# Add font path and color database stuff here, e.g.:
#
+$cmd .= " -fp /usr/X11R6/lib/X11/fonts/misc/,/usr/X11R6/lib/X11/fonts/100dpi/,/usr/X11R6/lib/X11/fonts/local/";
# $cmd .= " -fp /usr/lib/X11/fonts/misc/,/usr/lib/X11/fonts/75dpi/";
# $cmd .= " -co /usr/lib/X11/rgb";
#</programlisting>
<para>接著就可以啟動囉。</para>
<screen>
&prompt.root; <userinput>vncserver :1</userinput> (啟動)
You will require a password to access your desktops.
Password: <userinput>passwd</userinput>
Verify: <userinput>passwd</userinput>
xauth: creating new authority file /root/.Xauthority
New 'X' desktop is statue2.elife.idv.tw:1
Creating default startup script /root/.vnc/xstartup
Starting applications specified in /root/.vnc/xstartup
Log file is /root/.vnc/statue2.elife.idv.tw:1.log
&prompt.root; <userinput>vncpasswd</userinput> (換密碼)
Password: <userinput>passwd</userinput>
Verify: <userinput>passwd</userinput>
&prompt.root; <userinput>ps -aux |grep Xvnc</userinput> (檢查狀態)
root 7103 0.9 0.7 5652 5288 p1 I 3:36下午 0:42.89 Xvnc :1 -desktop
&prompt.root; <userinput>vncserver -kill :1</userinput> (終止)
</screen>
<para>vncviewer 則是以 statue2.elife.idv.tw:1 來連線。</para>
<para>如果不想修改 vncserver 或是想以其他的 window Manager 來啟動,
那麼就要修改 <filename>~/.vnc/xstartup</filename></para>
<programlisting>
xset +fp /usr/X11R6/lib/X11/fonts/misc/
xset +fp /usr/X11R6/lib/X11/fonts/100dpi/
xset +fp /usr/X11R6/lib/X11/fonts/local/
xcin2.5 &
icewm</programlisting>
<para>由於 vnc 是由 XFree86-3 改的,所以現在我還不知道該怎麼使用 TTF。</para>
<para>VNC 是一個很好用的 Remote Desktop Controller但其 X version 是改自
XFree86 3.3.2,所以沒有支援 TrueType 字型。</para>
<para>TridiaVNC 是由 Tridia 公司發展,延續 vnc 的開發,為 vnc 加上許多功能,
如提供更多的壓縮方式,及加入對 xtt 的 TrueType 字型支援。(XFree86-4
內含 xtt module故 TridiaVNC 可以直接使用 XFree86-4 的 TrueType 字型)
</para>
<para>安裝 <filename role="package">net/tridiavnc</filename>。</para>
<para>若系統中已經有 xtt 字型目錄,請於 ~/.vnc/xstart 內加入:</para>
<programlisting>
xset +fp /usr/X11R6/lib/X11/fonts/TrueType</programlisting>
<para>若無,請安裝 ports 裡的 TrueType 字型。</para>
<para>VNC 裡面怎麼打中文只要Ctrl+Space不要被 Windows 吃了就好了,
或是改變 VNC 內的 xin2.5 切換中文的熱鍵也可以。</para>
<figure>
<title>vnc snapshot</title>
<mediaobject>
<imageobject>
<imagedata fileref="images/vnc" format="PNG">
</imageobject>
</mediaobject>
</figure>
<para>RealVNC WWW: <ulink url="http://www.realvnc.com">
http://www.realvnc.com</ulink></para>
<para>tridiaVNC WWW: <ulink url="http://www.tridiavnc.com">
http://www.tridiavnc.com</ulink></para>
<para>tightVNC WWW: <ulink url="http://www.tightvnc.com">
http://www.tightvnc.com</ulink></para>
</sect1>
<sect1 id="cccii-ft">
<title>CCCII-FT</title>
<para>因為基於CCCII的繁體中文內碼一直未定出適當的標準
故 changcs 參考了一些資料(CCCII手冊、EUC-TW內碼)
以下提出一個基於CCCII的繁體字專用中文內碼(暫稱為EUC-CCCII-FT)。</para>
<screen>
&prompt.root; <userinput>cd /usr/ports/outta-port/cccii-ft</userinput>
&prompt.root; <userinput>make install clean</userinput>
Add the following lines into your ~/.Xdefaults:
whterm*font: 12x24
whterm*kanjiMode: euc
whterm*cccii21Font: cccii21Font
whterm*cccii22Font: cccii22Font
whterm*cccii23Font: cccii23Font
whterm*cccii24Font: cccii24Font
whterm*cccii25Font: cccii25Font
whterm*cccii26Font: cccii26Font
&prompt.root; <userinput>xset +fp /usr/X11R6/lib/X11/fonts/cccii/</userinput>
&prompt.root; <userinput>xlsfonts | grep cccii</userinput>
&prompt.root; <userinput>xrdb -load ~/.Xdefaults</userinput>
&prompt.root; <userinput>whterm &</userinput>
&prompt.root; <userinput>cat /usr/X11R6/share/cccii/test_file</userinput></screen>
<figure>
<title>cccii snapshot</title>
<mediaobject>
<imageobject>
<imagedata fileref="images/cccii" format="PNG">
</imageobject>
</mediaobject>
</figure>
<para>
WWW: <ulink url="http://santos.ee.ntu.edu.tw/~changcs/whterm/whterm.html">
http://santos.ee.ntu.edu.tw/~changcs/whterm/whterm.html</ulink></para>
</sect1>
<sect1 id="default-font">
<title>如何更改 X 的預設中文字體?</title>
<para>在安裝完 X 後,選單,顯示都是文鼎中楷,這對用慣了細明體的人,
有著莫大的不便,但是把系統字型全都換成 Ming 體後,也就是文鼎宋體後,
英文字體的變化就會變少了,所以應該有簡單的方式可以取代。</para>
<para>後來看到 &a.edwardlee;
的一篇文章,才知道原來 X 預設抓字型的時候,是以 fonts.dir
的內容來排序的,由於文鼎的 foundry name 都是 Arphic所以就看下一個
family name
AR PL KaitiM Big5 比 AR PL Mingti2L Big5 還前面,所以這就是為什麼,
一般都會抓到楷體的原因。所以就會去改變字型的 family name
來治療這個問題。</para>
<screen>
&prompt.root; <userinput>cd /usr/X11R6/lib/X11/fonts/TrueType</userinput>
&prompt.root; <userinput>perl -pi -e 's/Kai/Nai/g' fonts.alias fonts.dir fonts.scale</userinput></screen>
<para>但是這樣子的做法會讓 KaitiM 的字型在整合上會出現許多問題,
如果都不會使用到 KaitiM 的使用者才建議如此做。</para>
</sect1>
<sect1 id="gdk-warning">
<title>Gdk-WARNING **: BIG5-0</title>
<para>會出現這樣子的訊息通常都是沒設定好 <filename>~/.gtkrc</filename>
請參考 <link linkend="gnome">GNOME 程式的中文支援</link>。</para>
</sect1>
<sect1 id="unzip">
<title>unzip 解開中文檔名變亂碼?</title>
<para>在 Windows 中用 Winzip 壓縮中文檔名的檔案,
抓到 FreeBSD 底下 unzip 會變成亂碼。</para>
<para>安裝 <filename role="package">chinese/unzip</filename>。</para>
<para>或是利用下面有個 leeym 大大的 patch</para>
<programlisting>
--- unzpriv.h.orig Thu Apr 10 02:13:13 2003
+++ unzpriv.h Thu Apr 10 02:24:23 2003
@@ -2333,7 +2333,7 @@
# endif
# define _OEM_INTERN(str1) {register uch *p;\
for (p=(uch *)(str1); *p; p++)\
- *p = native((*p & 0x80) ? oem2iso[*p & 0x7f] : *p);}
+ *p = native(/*(*p & 0x80) ? oem2iso[*p & 0x7f] :*/ *p);}
# endif
#endif
</programlisting>
</sect1>
<sect1 id="squid">
<title>squid 瀏覽 ftp 與 gopher 中文亂碼?</title>
<para>by KTH.bbs&amp;alway.twbbs.org</para>
<para>原本學校使用 Squid 2.1,透過它瀏覽 ftp 站台與
gopher 站台訊息不會有亂碼出現,後來多了一台 2.4STABLEX
以後,發現都會有亂碼的產生,稍微追蹤了一下程式,
原來問題出在 2.4x 以後會將 &gt;=0x7f 與 &lt;=0x1f 的字元編碼成
&#%3d 的格式,因此在不影響穩定度的情況下,
就乾脆把這一段程式給註解掉了,這樣就能解決中文亂碼問題了,
用瀏覽器瀏覽起來真的蠻舒服的 ^^</para>
<programlisting>
--- lib/html_quote.c.orig Wed Jun 5 16:02:30 2002
+++ lib/html_quote.c Wed Jun 5 16:03:07 2002
@@ -114,11 +114,13 @@
* sure all 8-bit characters are encoded to protect from buggy
* clients
*/
+#if 0
if (!escape && (ch &lt;= 0x1F || ch &gt;= 0x7f) && ch != '\n' && ch != '\r' && ch != '\t') {
static char dec_encoded[7];
snprintf(dec_encoded, sizeof dec_encoded, "&#%3d;", (int) ch);
escape = dec_encoded;
}
+#endif
if (escape) {
/* Ok, An escaped form was found above. Use it */
strncpy(dst, escape, 6);</programlisting>
</sect1>
<sect1 id="apache2">
<title>apache2 預設顯示中文網頁</title>
<para>apache2 的httpd.conf裡面有一行設定:</para>
<programlisting>
AddDefaultCharset ISO-8859-1</programlisting>
<para>這一行設定導致瀏覽器不會根據網頁裡面的語言設定而判斷編碼方法,
只要把這行註解掉就可以正常了。</para>
<para>如果要預設為 Big5 編碼,也可以改為:</para>
<programlisting>
AddDefaultCharset Big5</programlisting>
<para>不過如果有使用者的網頁並非 Big5 編碼,
這樣子的設定可能會造成困擾,
不如註解掉由使用者自己去寫以下的標頭更為合適:</para>
<programlisting>
&lt;meta http-equiv="Content-Type" content="text/html; charset=big5"&gt;</programlisting>
</sect1>
<sect1 id="url">
<title>網址列不能使用中文檔名?</title>
<para>網址列不能使用中文,可能是 IE 的預設值造成的。
按造下面的步驟修改看看:</para>
<programlisting>工具(T) -&gt; 網際網路選項(O) -&gt; 進階</programlisting>
<para>裡面有個 <option>永遠將 URL 傳送成 UTF-8 (需要重新啟動)</option>
的選項,把勾取消後,按確定並將 IE 關掉重開。</para>
</sect1>
<sect1 id="wget">
<title>wget 中文檔名變亂碼</title>
<para>中文檔名在平常的情況下會被編碼,
但是在 <option>--cut-dirs</option> 時又是正常的,
那就大家用 <option>--cut-dirs</option>
或是使用 <filename>outta-port/wget</filename> 吧</para>
<programlisting>
wget -r -np -nH --cut-dirs=3 ftp://freebsd.sinica.edu.tw/pub/statue/test/
測試.txt
wget -r -np -nH -nd ftp://freebsd.sinica.edu.tw/pub/statue/test/
%B4%FA%B8%D5.txt
wget "ftp://freebsd.sinica.edu.tw/pub/statue/test/*"
%B4%FA%B8%D5.txt</programlisting>
<para><application>wget</application> 的安裝:</para>
<screen>
&prompt.root; <userinput>cd /usr/ports/outta-port/wget</userinput>
&prompt.root; <userinput>make install clean</userinput></screen>
<para>由於不知名的原因,可能是為了避開特殊檔名,
wget 會自動將抓取檔名的部分用 encode_string 處理過,
所以該 patch 就把被 encode_string 處理成 "%3A" 這種東西,
用 decode_string 還原成 ":"
並套用在目錄與檔案名稱的部分decode_string 是 wget 內建的函式。</para>
<para>WWW: <ulink url="http://sunsite.auc.dk/wget/">
http://sunsite.auc.dk/wget/</ulink></para>
</sect1>
<sect1 id="bdf-newchar">
<title>如何造字?</title>
<para>造字的問題,目前筆者會的只有造點陣字而已。</para>
<para>首先,找到您要改的字型檔,在這邊假設是
<filename>kc15f.bdf</filename>,我只會改 BDF 格式的,
然後把點陣的格式嵌入該字型檔內。</para>
<para>以 '文' 為例,先得到他的 ENCODING</para
<screen>
&prompt.root; <userinput>echo "文" | hexdump</userinput>
0000000 e5a4 000a
0000003
&prompt.root; <userinput>printf %d 0xa4e5</userinput>
42213</screen>
<para>以及他的 ucs-2</para>
<screen>
&prompt.root; <userinput>echo "文" | iconv -f big5 -t ucs-2 | hexdump</userinput>
0000000 8765 0a00
0000004</screen>
<para>我們在這邊以 (方方土) 為例,他的 big5 code 是
0x964f(38479)ucs-2 code 是 0x5803。</para>
<para>先找到 <option>CHARS 13867</option>,因為我們要加新字,
所以改成 <option>CHARS 13868</option>。</para>
<para>然後到這個檔的最後,找最後一個 <option>STARTCHAR</option>
加一,在這邊是 STARTCHAR 13868 為最後一個,所以也加一,
然後將字塞最後,並在 <option>ENDFONT</option> 之前。</para>
<programlisting>
STARTCHAR 13869
ENCODING 38479
SWIDTH 31 0
DWIDTH 16 0
BBX 15 15 1 -3
BITMAP
1830
1424
FEFE
2040
3C78
2488
4488
5528
8A10
0180
0110
3FF8
0100
0104
FFFE
ENDCHAR</programlisting>
<para>然後跟著以下的方式作來讓 X 認識您所造的字:</para>
<screen>
&prompt.root; <userinput>cd /usr/X11R6/lib/X11/fonts/encodings/large/</userinput>
&prompt.root; <userinput>cp big5.eten-0.enc.gz big5.eten-0.enc.gz.bak</userinput>
&prompt.root; <userinput>gunzip big5.eten-0.enc.gz</userinput>
&prompt.root; <userinput>chmod 644 big5.eten-0.enc</userinput>
&prompt.root; <userinput>vim big5.eten-0.enc</userinput>
0x964F 0x5803
&prompt.root; <userinput>chmod 444 big5.eten-0.enc</userinput>
&prompt.root; <userinput>gzip big5.eten-0.enc</userinput>
&prompt.root; <userinput>cd /usr/X11R6/lib/X11/fonts/local</userinput>
&prompt.root; <userinput>fetch kc15f.bdf</userinput>
&prompt.root; <userinput>mkfontdir</userinput>
&prompt.root; <userinput>crxvt -fm -kc-fixed-medium-r-normal--16-160-72-72-c-160-big5-0</userinput>
&prompt.root; <userinput>perl -e 'print pack("CC", 0x96, 0x4F);'</userinput></screen>
</sect1>
<sect1 id="ftpd">
<title>內建 ftpd 的中文問題</title>
<para>Contributed by: Wang.bbs@bbs.ba.mgt.ncu.edu.tw</para>
<para>Last Update: 2003年 4月 1日 周二 12時57分00秒 CST</para>
<para>Q: 4.7 Release 內建 ftpd
例如「程」、「逢」第二個 character 是 '{' 的中文字就下載不下來?</para>
<para>A: 因為 FreeBSD 內建的 FTPD 會將 { 和 \ 的字去除,
如果您想要讓這些中文字可可以正常使用請修改
<filename>/usr/src/libexec/ftpd/ftpcmd.y</filename>
找到下列這一行:</para>
<programlisting>
GLOB_BRACE|GLOB_NOCHECK|GLOB_QUOTE|GLOB_TILDE;</programlisting>
<para>將它改成:</para>
<programlisting>
GLOB_NOCHECK|GLOB_TILDE|GLOB_NOESCAPE;</programlisting>
<para>再重新 compile ftpd</para>
<screen>
&prompt.user; <userinput> man 3 glob</userinput></screen>
<programlisting>
GLOB_NOESCAPE By default, a backslash (`\') character is used to
escape the following character in the pattern, avoiding
any special interpretation of the character. If
GLOB_NOESCAPE is set, backslash escaping is disabled.
GLOB_BRACE Pre-process the pattern string to expand `{pat,pat,...}'
strings like csh(1). The pattern `{}' is left unex-
panded for historical reasons (and csh(1) does the same
thing to ease typing of find(1) patterns).</programlisting>
<para>我也弄成了 outta-port有興趣可以直接到 outta-port/ftpd 底下安裝。</para>
</sect1>
<sect1 id="chm2html">
<title>.chm 怎麼在 Unix 底下觀看?</title>
<para>Contributed by: mison@bbs.ee.ntu.edu.tw</para>
<para>Last Update: 2003年 4月16日 周三 16時35分53秒 CST</para>
<para>目前都是將 <filename>.chm</filename> 解壓縮成
<filename>.html</filename> 後再,再用瀏覽器去看。
現有的 .chm 方案有兩個,一個是
<filename role="package">misc/chmlib</filename>
以及 chmtools不過兩套都沒有解壓縮的工具
或是不適合中文的處理,因此 mison 利用 chmtools 寫了一個
chm2html 的工具,如果有興趣的人可以試試看。</para>
<para><application>outta-port/chm2html</application> 的安裝:</para>
<screen>
&prompt.root; <userinput>cd /usr/ports/outta-port/chm2html</userinput>
&prompt.root; <userinput>make install clean</userinput></screen>
<para>在這邊以一個 <filename>braille.chm</filename> 為例子,
用 <command>chm2html</command>
來解壓縮,並解壓縮到 braille 的目錄下:</para>
<screen>chm2html &lt; braille.chm braille/</screen>
<para>在 braille 的目錄下會產生一個 braille.hhc 的目錄檔,
接著再用 <command>hhc2html.pl</command> 將索引檔轉出來:</para>
<screen>hhc2html.pl braille/braille.hhc &gt; braille/braille.html</screen>
<para>也可以用 <command>hhc2bookmark.pl</command> 將目錄檔轉成
<application>mozilla</application> 的 bookmark 來用:</para>
<screen>hhc2bookmark.pl --lo=on --root=`pwd`/brailee brailee/braille.hhc > bookmark.html</screen>
<para>中文檔名的部分,只是把 chm 裡的 unicode 轉成 big5
這樣只是讓解出來的中文檔名可以讓人看得懂hyper link還是會有問題。</para>
<para>參數 <option>--lo=on</option> 是指定把大寫檔名改為小寫,
這是因為 chm2thml 是根據 chm 檔頭解出檔案,
而 hhc 目錄、chm 檔頭裡的檔名,兩者可能不一致。
所以在第一步 chm 解開後、
自行判斷要不要加 <option>--lo=on</option>。</para>
<para>bookmark 只是一個暫時的解決方案,可以用
<filename>hhc2bookmark.pl</filename> 轉出來的檔案替換原來
<filename>~/.mozilla</filename> 裡的 bookmark
這樣可以模擬 MircoSoft IE 的 text/sitemap其實有更好
的方法, <application>mozilla</application> 有提供
sidebar 和 IE sitemap 類似,或是在 <application>mozilla</application>
讀取到特殊的副檔名或是 MIME Type 時去自動呼叫
chm2html 並作成網頁來讀去。</para>
<para>hyper link 檔名不一致的問題可能千奇百怪,轉目錄的程式是用 perl 寫的,
若有需要,請自行修改 perl 程式裡的 regular expressions</para>
<para>在將 hhc2html.pl 產生的目錄加到 sidebar 中,
我測試的結果,使用如下的方式可以加入 sitebar</para>
<screen>javascript:window.sidebar.addPanel('title','http://','');</screen>
<para>但是把 http:// 換成 file:// 就沒辦法加進去,所以還是直接執行
<command>chm.sh braille.chm</command> 囉。</para>
<para>在特殊檔名或是MIME Type的處理得感謝 bv1al 提供的靈感,
使用 <application>mozilla</application> 也可以用類似方法開啟。</para>
<programlisting>
mozilla pull-down toolbar:
Edit->Preferences->Navigator->HelperApplications->NewType:
Description of type: MicroSoft HTML Help
File extension: chm
MIME Type: chemical/x-chemdraw application/mshelp
Application to use: chm.sh</programlisting>
<para>不過以上的方法在筆者測試下,並沒有作用,如果有人成功請告訴我一下。</para>
<para>MicroSoft 有個程式可以 HTML 轉 CHM也可以轉回來應該是這個
<ulink url="http://download.microsoft.com/download/OfficeXPProf/Install/4.
71.1015.0/W98NT42KMe/EN-US/HTMLHELP.EXE">HTMLHELP.EXE</ulink>
,在 MicroSoft 下處理 HTML 與 CHM 互轉時蠻好用的。</para>
<para>WWW: <ulink url="http://66.93.236.84/~jedwin/projects/chmlib/">
http://66.93.236.84/~jedwin/projects/chmlib/</ulink></para>
<para>WWW: <ulink url="http://www.speakeasy.org/~russotto/chm/">
http://www.speakeasy.org/~russotto/chm/</ulink></para>
</sect1>
<sect1 id="konsole">
<title>konsole 字距過大</title>
<para>Settings -&gt; Font -&gt; Custom -&gt; Terminal 12</para>
<para>Settings -&gt; Size -&gt; 80x24 (VT100)</para>
<figure>
<title>konsole snapshot</title>
<mediaobject>
<imageobject>
<imagedata fileref="images/konsole" format="PNG">
</imageobject>
</mediaobject>
</figure>
</sect1>
<sect1 id="cyrus-imapd2">
<title>Cyrus-IMAP 將 8-bit 文字轉換為 X 的問題</title>
<para>Contributed by 小郭 (jimkou.bbs@bbs.sayya.org)</para>
<para>Last Update: Sat May 17 12:09:58 2003</para>
<para>以 <filename role="package">mail/cyrus-imapd2</filename>-2.1.13
架設郵件伺服器,有些信件的主旨全部變成了 XXXXXX
這是 RFC 2047 的標準不相容 8Bit 主旨的郵件。
目前能用的辦法是將標題編碼,這是比較標準的做法,
或是修改 source code 兩個檔案
<filename>imap/lmtpengine.c</filename> 以及
<filename>imap/message.c</filename>
讓收信的 IMAPD 支援 8Bit 主旨。</para>
<programlisting>
--- imap/lmtpengine.c.orig Sat May 17 14:45:39 2003
+++ imap/lmtpengine.c Sat May 17 14:48:07 2003
@@ -739,6 +739,7 @@
state s = NAME_START;
int r = 0;
int reject8bit = config_getswitch("reject8bit", 0);
+ int ignore8bit = config_getswitch("ignore8bit", 0);
if (namelen == 0) {
namelen += NAMEINC;
@@ -854,7 +855,7 @@
form. */
r = IMAP_MESSAGE_CONTAINS8BIT;
goto ph_error;
- } else {
+ } else if (!ignore8bit) {
/* We have been configured to munge all mail of this
form. */
c = 'X';</programlisting>
<programlisting>
--- imap/message.c.orig Fri Apr 18 06:49:49 2003
+++ imap/message.c Sat May 17 14:46:27 2003
@@ -229,6 +229,7 @@
int n;
int sawcr = 0, sawnl;
int reject8bit = config_getswitch("reject8bit", 0);
+ int ignore8bit = config_getswitch("ignore8bit", 0);
int inheader = 1, blankline = 1;
while (size) {
@@ -264,7 +265,7 @@
/* We have been configured to reject all mail of this
form. */
if (!r) r = IMAP_MESSAGE_CONTAINS8BIT;
- } else {
+ } else if (!ignore8bit) {
/* We have been configured to munge all mail of this
form. */
*p = 'X';</programlisting>
<para>最後再編輯 <filename>${PREFIX}/etc/imapd.conf</filename>
並增加一行:</para>
<programlisting>ignore8bit = yes</programlisting>
<para>RFC 2047 MIME (Multipurpose Internet Mail Extensions) Part Three:
Message Header Extensions for Non-ASCII Text</para>
<para>WWW: <ulink url="http://asg.web.cmu.edu/cyrus/">
http://asg.web.cmu.edu/cyrus/</ulink></para>
</sect1>
<sect1 id="font-width">
<title>英文字和中文字等寬?</title>
<para>Contributed by firefly</para>
<para>TrueType 字體分成兩種,一種是可變字距,也就是每個字符寬度不一樣,
比如 "x" 與 "i",這兩個字符就不等寬,它是在每個字符中紀錄該字符的寬度,
大多數的 TrueType 都是這種格式。 </para>
<para>另一種就是固定字距。也就是每個字符寬度都一樣,這樣顯示或打印時,
會有對齊效果,比較美觀,在英語環境中,不會有任何問題,聰明的您,
知道問題所在了吧。</para>
<para>沒錯CJK 的等寬字體,包含『半寬英數字符』與『全寬 CJK 字符』,
字型引擎會把全寬字寬度套用在半寬字上頭,造成半寬字看起來間距太大,
這就是問題所在。</para>
<para>這裡提供一個方法,讓字型引擎忽略 CJK 字體指定的寬度,
您可以將以下這段內容,複製到 ~/.fonts.conf 中:</para>
<programlisting>
&lt;match target="font"&gt;
&lt;test target="pattern" name="lang" compare="contains"&gt;
&lt;string&gt;zh-tw&lt;/string&gt;
&lt;string&gt;zh-cn&lt;/string&gt;
&lt;string&gt;ja&lt;/string&gt;
&lt;string&gt;ko&lt;/string&gt;
&lt;/test&gt;
&lt;test name="spacing" compare="eq"&gt;
&lt;const>mono&lt;/const&gt;
&lt;/test&gt;
&lt;edit name="globaladvance" mode="assign"&gt;
&lt;bool&gt;false&lt;/bool&gt;
&lt;/edit&gt;
&lt;/match&gt; </programlisting>
<para>以上那段的意思是:當遇到 CJK 字型,又是等寬時,
忽略系統內定寬度,這樣,當系統使用 CJK 等寬字時,
便不會再有間距過大的問題。</para>
<para>因為 MingLiU 宣稱自己是 monospaced 字型,但實際上它有兩種寬度:
中文的全形以及英文的半形。</para>
<programlisting>
&lt;match target="font"&gt;
&lt;test name="family"&gt;&lt;string&gt;MingLiU&lt;/string&gt;&lt;/test&gt;
&lt;edit name="globaladvance"&gt&lt;bool&gt;false&lt;/bool&gt;&lt;/edit&gt;
&lt;/match&gt;</programlisting>
<para>還可以改 spacing0 是 proportional 的 spacing100 是 mono
110 是 charcell。</para>
<programlisting>
&lt;match target="font"&gt;
&lt;test name="family"&gt;&lt;string&gt;MingLiU&lt;/string&gt;&lt;/test&gt;
&lt;edit name="spacing"&gt;&lt;int&gt;0&lt;/int&gt;&lt;/edit&gt;
&lt;/match&gt;</programlisting>
<para>在 X11 Core Font 的部分則是必須修改 XLFD
將 -m- 改成 -p-。</para>
</sect1>
<sect1 id="pw">
<title>pw 開帳號碰到'@'問題?</title>
<para>Q: pw 在開帳號時,只要註解有 '@' 即有下面訊息:</para>
<screen>
&prompt.root; <userinput>pw useradd -n test -c "一" -d /home/test -g nogroup -m -s /bin/tcsh -w yes</userinput>
pw: invalid character `@' at position 1 in gecos field</screen>
<para>A: 徵求解答中。</para>
</sect1>
<sect1 id="smbfs">
<title>mount_smbfs 不能用中文 share 名稱?</title>
<para>Q: mount_smbfs 使用中文 share 名稱遇到如下的錯誤:</para>
<programlisting>mount_smbfs: unable to open connection: syserr = No such file or directory</programlisting>
<para>A: 徵求解答中。</para>
</sect1>
<sect1 id="flash">
<title>flash 中文顯示?</title>
<para>Q: Mozilla瀏覽flash網頁時中文字變成亂碼</para>
<para>A: 徵求解答中。</para>
</sect1>
<sect1 id="gtk-kde">
<title>KDE 下使用 GTK 的字型問題?</title>
<para>Q: 在 KDE 下運行 GTK 的軟體字型怪怪的?</para>
<para>A: 執行 <command>gnome-settings-daemon &</command>,並用
<command>gnome-control-center</command> 來設定字型。</para>
</sect1>
<sect1 id="filename">
<title>檔名大寫換小寫,含子目錄?</title>
<para>Contributed by edwar</para>
<para>big5 中文及特殊字元應該也都沒問題。</para>
<programlisting>
find ./t -depth \
| perl -ne 'chomp;m</[^/]*$>;$d=$`;$_=$f=$&;'\
's/([\x80-\xFF].)|(\w)/$1\l$2/g;system "echo",$d.$f,$d.$_ if $f ne $_'</programlisting>
</sect1>
</chapter>
<!--
Local Variables:
mode: sgml
sgml-declaration: "../chapter.decl"
sgml-indent-data: t
sgml-omittag: nil
sgml-always-quote-attributes: t
sgml-parent-document: ("../zh-tut.sgml" "part" "chapter")
End:
-->

File diff suppressed because it is too large Load diff

View file

@ -0,0 +1,653 @@
<!--
The Chinese FreeBSD Documentation Project
Id: l10n.sgml,v 1.48 2003/11/16 13:15:51 statue Exp
$FreeBSD$
-->
<chapter id="l10n">
<title>FreeBSD 的中文化</title>
<para>如果您還知道有那些 FreeBSD 中文化的計畫,請告訴我
&a.statue;。
</para>
<sect1 id="cfdp">
<title>FreeBSD 中文文件計畫</title>
<para>
FreeBSD 中文文件計畫(FDP)目前正全力進行於 FreeBSD Handbook 文
件的中文翻譯工作,它的網址是
<ulink url="http://freebsd.sinica.edu.tw/~ncvs/zh-translation/">
http://freebsd.sinica.edu.tw/~ncvs/zh-translation/</ulink>。 </para>
<para>
目前在 CFDP 底下有三個文件doc、zh-l10n-tut、zh-tut
和一個 outta-port。 </para>
<para>cvsup 取得方式:</para>
<screen>
&prompt.user; <userinput>fetch ftp://freebsd.sinica.edu.tw/pub/ycheng/CVSUP/outta-port.supfile</userinput>
&prompt.user; <userinput>fetch ftp://freebsd.sinica.edu.tw/pub/ycheng/CVSUP/zh-doc-all.supfile</userinput>
&prompt.user; <userinput>fetch ftp://freebsd.sinica.edu.tw/pub/ycheng/CVSUP/zh-l10n-tut.supfile</userinput>
&prompt.user; <userinput>fetch ftp://freebsd.sinica.edu.tw/pub/ycheng/CVSUP/zh-tut.supfile</userinput>
&prompt.user; <userinput>cvsup -g zh-tut.supfile</userinput>
</screen>
<para>cvs 取得方式:分別為 doc/zh、zh-l10n-tut、zh-tut、outta-port</para>
<screen>
&prompt.user; <userinput>cvs -d :pserver:anoncvs@freebsd.sinica.edu.tw:/home1/ncvs login</userinput>
(Logging in to anoncvs@freebsd.sinica.edu.tw)
CVS password: <userinput>anoncvs</userinput>
&prompt.user; <userinput>cvs -d :pserver:anoncvs@freebsd.sinica.edu.tw:/home1/ncvs checkout zh-tut</userinput> </screen>
</sect1>
<sect1 id="proj">
<title>FreeBSD 中文化計劃</title>
<para>
下列地點可找到 FreeBSD 中文資訊。如果您還知道有其它未列出的,
請告訴我 &a.statue;。 </para>
<itemizedlist>
<listitem><para>
<ulink url="http://freebsd.sinica.edu.tw/~statue/boot/">FreeBSD 中文安裝介面</ulink>(Big5)
</para></listitem>
<listitem><para>
<ulink url="http://freebsd.sinica.edu.tw/zh-fdp/">FreeBSD HandBook 翻譯</ulink>(Big5)
</para></listitem>
<listitem><para>
<ulink url="http://freebsd.sinica.edu.tw/~statue/zh-tut/outta.html">FreeBSD Outta-port</ulink>(Big5)
</para></listitem>
<listitem><para>
<ulink url="http://fatpipi.cirx.org/~vanilla/fcdp.html">FreeBSD FAQ 翻譯</ulink>(Big5)
</para></listitem>
<listitem><para>
<ulink url="http://zope.slat.org/Project/ZopeBook">ZopeBook</ulink>(Big5)
</para></listitem>
<listitem><para>
<ulink url="http://potian.163.net/">CGDP 中文GNU文檔工程</ulink>(GB)
</para></listitem>
<listitem><para>
<ulink url="http://www.cmpp.net/">CMPP 中文MAN-PAGE計劃</ulink>(GB)
</para></listitem>
<listitem><para>
<ulink url="http://www.china-pub.com/computers/eMook/emooknew/RFC/rfc.htm">RFC文檔中文翻譯計劃 </ulink>(GB)
</para></listitem>
<listitem><para>
<ulink url="http://www.pgsqldb.org/">PostgreSQL 中文信息</ulink>(GB)
</para></listitem>
<listitem><para>
<ulink url="http://savannah.gnu.org/projects/chinese/">Savannah: Project Info - Chinese Translators Team</ulink>
</para></listitem>
</itemizedlist>
</sect1>
<sect1 id="wwwsite">
<title>FreeBSD 的中文站台</title>
<para>
下列地點可找到 FreeBSD 中文資訊。如果您還知道有其它未列出的,
請告訴我 &a.statue;。
</para>
<para>推薦網站</para>
<itemizedlist>
<listitem><para>
<ulink url="http://www.study-area.org/">Study Area</ulink>(Big5)
</para></listitem>
<listitem><para>
<ulink url="http://www.gocar.idv.tw">傻瓜的FreeBSD教學網</ulink> (Big5)
</para></listitem>
<listitem><para>
<ulink url="http://www.lsps.tp.edu.tw/~gsyan/freebsd2001/">雄的家</ulink> (Big5)
</para></listitem>
<listitem><para>
<ulink url="http://freebsd.lab.mlc.edu.tw/">苗栗縣大湖鄉大南國民小學 FreeBSD
全球資訊網路架站日誌 </ulink>(Big5)
</para></listitem>
<listitem><para>
<ulink url="http://turtle.ee.ncku.edu.tw/~tung/">優客筆記簿</ulink>(Big5)
</para></listitem>
<listitem><para>
<ulink url="http://ohaha.ks.edu.tw/">OHaHa's 學習心得</ulink>(Big5)
</para></listitem>
<listitem><para>
<ulink url="http://www.europa.idv.tw/">網路農夫</ulink>(Big5)
</para></listitem>
<listitem><para>
<ulink url="http://hk.geocities.com/L142857/ChComp/">中文電腦</ulink>(Big5)
</para></listitem>
<listitem><para>
<ulink url="http://www.freebsd.org.hk ">FreeBSD 資訊網</ulink>(Big5)
</para></listitem>
<listitem><para>
<ulink url="http://www.sinica.edu.tw/~cdp/">文獻處理實驗室</ulink> (Big5)
</para></listitem>
<listitem><para>
<ulink url="http://www.ascc.net/">中央研究院計算中心</ulink> (Big5)
</para></listitem>
<listitem><para>
<ulink url="http://www.iso10646hk.net/">香港 ISO 10646</ulink> (Big5)
</para></listitem>
<listitem><para>
<ulink url="http://140.136.81.146/%7Epg/book/paper.html">自由軟體桌面系統 -GNU/Linux</ulink> (Big5) BROKEN
</para></listitem>
<listitem><para>
<ulink url="http://www.cmex.org.tw/">中推會</ulink>(Big5)
</para></listitem>
<listitem><para>
<ulink url="http://www.cbflabs.com/">朱邦復工作室</ulink>(Big5)
</para></listitem>
<listitem><para>
<ulink url="http://www.liu.com.tw/">無蝦米中文輸入法</ulink>(Big5)
</para></listitem>
<listitem><para>
<ulink url="http://chewing.good-man.org/">酷音中文輸入法</ulink>(Big5)
</para></listitem>
<listitem><para>
<ulink url="http://www.geocities.com/Baja/Mesa/2118/">我的倉頡 - 中文輸入法推廣組織</ulink>(Big5)
</para></listitem>
<listitem><para>
<ulink url="http://netlab.cse.yzu.edu.tw/~statue/cfc/">CFC 中文收藏家</ulink>(Big5)
</para></listitem>
<listitem><para>
<ulink url="http://freebsd.ntu.edu.tw/taiwan/clement">Clem's XEmacs Page</ulink>(Big5)
</para></listitem>
<listitem><para>
<ulink url="http://main.rtfiber.com.tw/~changyj/">龍門少尉的窩</ulink>(Big5)
</para></listitem>
<listitem><para>
<ulink url="http://mouse.oit.edu.tw/">帆毅網路研究室</ulink>(Big5)
</para></listitem>
<listitem><para>
<ulink url="http://www.hello.com.tw/~wolfant/">黑手工人--築夢空間</ulink>(Big5)
</para></listitem>
<listitem><para>
<ulink url="http://www.math.ncu.edu.tw/~shann/Chinese/Welcome.html">中央大學 - 單維彰老師</ulink>(Big5)
</para></listitem>
<listitem><para>
<ulink url="http://mmlab.im.fju.edu.tw/~maa/">小馬的家</ulink>(Big5)
</para></listitem>
<listitem><para>
<ulink url="http://freebsd.netwain.com/">NetWain 工作室</ulink>(Big5) BROKEN
</para></listitem>
<listitem><para>
<ulink url="http://www.homed.idv.tw/freebsd/freebsd.htm">阿正的小窩</ulink>(Big5) BROKEN
</para></listitem>
<listitem><para>
<ulink url="http://ccs.cc.nccu.edu.tw/marr/html/index.html">釋放 PC 的威力</ulink>(Big5) BROKEN
</para></listitem>
<listitem><para>
<ulink url="http://php.lzp.ks.edu.tw/">PHP 架站日記</ulink>(Big5) BROKEN
</para></listitem>
<listitem><para>
<ulink url="http://input.cpatch.org/">中文電腦技術及輸入法(檔案庫)</ulink>(Big5)
</para></listitem>
</itemizedlist>
<para>FreeBSD 資源</para>
<itemizedlist>
<listitem><para>
<ulink url="http://freebsd.ntu.edu.tw/bsd/">台灣大學 FreeBSD WWW Site</ulink>(Big5)
</para></listitem>
<listitem><para>
<ulink url="http://tw.freebsd.org/">交通資工 FreeBSD WWW Site</ulink>(Big5) BROKEN
</para></listitem>
<listitem><para>
<ulink url="http://xcin.linux.org.tw/">XCIN Project 總部</ulink>(Big5)
</para></listitem>
<listitem><para>
<ulink url="http://www.linux.org.tw/hardware/index.php3">台灣linux/freebsd硬體支援資料庫</ulink>(Big5)
</para></listitem>
<listitem><para>
<ulink url="http://turtle.ee.ncku.edu.tw/cgi-bin/boardlist.pl">FreeBSD/Unix/Java/Perl 的 Mailing List and News</ulink>(Big5)
</para></listitem>
<listitem><para>
<ulink url="http://rfc.im.tku.edu.tw">淡江資管RFC 文件檢索站</ulink>(Big5)
</para></listitem>
<listitem><para>
<ulink url="http://bsd.sinica.edu.tw/cgi-bin/cvsweb.cgi/">CVS-Web for FreeBSD Source Tree. </ulink>(Big5) BROKEN
</para></listitem>
<listitem><para>
<ulink url="http://phi.sinica.edu.tw/aspac/">ASPAC 文件</ulink>(Big5)
</para></listitem>
</itemizedlist>
<para>其他發行版本</para>
<itemizedlist>
<listitem><para>
<ulink url="http://www.freebsd.org/">FreeBSD</ulink>(Eng)
</para></listitem>
<listitem><para>
<ulink url="http://www.openbsd.org/">OpenBSD</ulink>(Eng)
</para></listitem>
<listitem><para>
<ulink url="http://www.netbsd.org/">NetBSD</ulink>(Eng)
</para></listitem>
<listitem><para>
<ulink url="http://www.debian.org/intl/zh">Debian 中文計劃</ulink>(Big5)
</para></listitem>
<listitem><para>
<ulink url="http://mdk.linux.org.tw/">Linux Mandrake 中文之家</ulink>(Big5)
</para></listitem>
<listitem><para>
<ulink url="http://i18n.linux.org.tw/">I18N 程式中文化計劃</ulink>(Big5)
</para></listitem>
<listitem><para>
<ulink url="http://cle.linux.org.tw/">中文 GNU/Linux 延伸安裝套件</ulink>(Big5)
</para></listitem>
<listitem><para>
<ulink url="http://kde.linux.org.tw/">KDE 台灣</ulink>(Big5)
</para></listitem>
<listitem><para>
<ulink url="http://www.linux-mandrake.com/zh/big5/">Mandrake Linux</ulink>(Big5)
</para></listitem>
<listitem><para>
<ulink url="http://www.cynix.com.tw/">Cynix OpenLinux</ulink>(Big5) BROKEN
</para></listitem>
<listitem><para>
<ulink url="http://www.linuxcenter.com.tw/">翔威國際 LinuxCenter</ulink>(Big5)
</para></listitem>
<listitem><para>
<ulink url="http://www.turbolinux.com.cn/">TurboLinux</ulink>(GB)
</para></listitem>
<listitem><para>
<ulink url="http://www.bluepoint.com.cn/">Bluepoint Linux</ulink>(GB)
</para></listitem>
<listitem><para>
<ulink url="http://www.cosix.com.cn/">COSIX Linux</ulink>(GB)
</para></listitem>
<listitem><para>
<ulink url="http://www.redflag-linux.com/">Red-flag Linux</ulink>(GB)
</para></listitem>
<listitem><para>
<ulink url="http://www.linuxaid.com.cn/">Tom Linux</ulink>(GB)
</para></listitem>
</itemizedlist>
<para>中文書籍</para>
<itemizedlist>
<listitem><para>
<ulink url="http://www.books.com.tw/exep/prod/booksfile.php?item=0010086875">FreeBSD應用軟體手冊</ulink>(Big5)
</para></listitem>
<listitem><para>
<ulink url="http://www.books.com.tw/exep/prod/booksfile.php?item=0010019198">FreeBSD網路架站實務--附光碟</ulink>(Big5)
</para></listitem>
<listitem><para>
<ulink url="http://www.books.com.tw/exep/prod/booksfile.php?item=0010039387">FreeBSD抓得住INTERNET伺服器架設與管理</ulink>(Big5)
</para></listitem>
<listitem><para>
<ulink url="http://www.books.com.tw/exec/item/0010093569">FreeBSD與Windows整合應用</ulink>(Big5)
</para></listitem>
<listitem><para>
<ulink url="http://www.books.com.tw/exec/item/0010047963">FreeBSD網路應用</ulink>(Big5)
</para></listitem>
<listitem><para>
<ulink url="http://www.books.com.tw/exep/prod/booksfile.php?item=0010013400">FreeBSD 3.X抓得住INTERNET進階伺服器的架設與管理</ulink>(Big5)
</para></listitem>
<listitem><para>
<ulink url="http://www.books.com.tw/exec/item/0010032002">FreeBSD與Windows整合應用(第二版)</ulink>(Big5)
</para></listitem>
<listitem><para>
<ulink url="http://www.books.com.tw/exep/prod/booksfile.php?item=0010086873">FreeBSD安裝設定與使用</ulink>(Big5)
</para></listitem>
<listitem><para>
<ulink url="http://www.books.com.tw/exep/prod/booksfile.php?item=0010007211">使用FreeBSD及Apache活用PHP與MySQL建構Web世界</ulink>(Big5)
</para></listitem>
<listitem><para>
<ulink url="http://www.books.com.tw/exep/prod/booksfile.php?item=0010187476">輕鬆使用LINUX/FREEBSD建置自已的網路王國</ulink>(Big5)
</para></listitem>
<listitem><para>
<ulink url="http://www.books.com.tw/exep/prod/booksfile.php?item=0010148811">FreeBSD系統建構指引</ulink>(Big5)
</para></listitem>
<listitem><para>
<ulink url="http://www.tenlong.com.tw/BookSearch/Search.php?isbn=9867944925">FreeBSD 完全探索 (Absolute BSD: The Ultimate Guide to FreeBSD)
</ulink>(Big5)
</para></listitem>
</itemizedlist>
<para>組織網站</para>
<itemizedlist>
<listitem><para>
<ulink url="http://freebsd.sinica.edu.tw/">FreeBSD 之家</ulink>(Big5)
</para></listitem>
</itemizedlist>
<para>新聞網站</para>
<itemizedlist>
<listitem><para>
<ulink url="http://www.bsdtoday.com/">BSD Today</ulink>
</para></listitem>
<listitem><para>
<ulink url="http://freshports.org/">FreeBSD ports 專門介紹軟體及版本更新通知的網站</ulink>(Eng)
</para></listitem>
<listitem><para>
<ulink url="http://www.daemonnews.org/">Daily Daemon News</ulink>(Eng)
</para></listitem>
<listitem><para>
<ulink url="http://www.posi.net/freebsd/drivers/">BSD 驅動程式資料庫</ulink>(Eng)
</para></listitem>
<listitem><para>
<ulink url="http://www.bsdapps.org/">BSD 應用程式資料庫</ulink>(Eng)
</para></listitem>
</itemizedlist>
<para>文件資源</para>
<itemizedlist>
<listitem><para>
<ulink url="http://www.csie.nctu.edu.tw/document/unixfaq/">UNIX 常見問答集</ulink>(Big5)
</para></listitem>
<listitem><para>
<ulink url="http://freebsd.sinica.edu.tw/~ncvs/zh-big5-FAQ/FAQ.html">FreeBSD 2.X 常見問答集</ulink>(Big5)
</para></listitem>
<listitem><para>
<ulink url="http://freebsd.ntu.edu.tw/~phantom/cfreebsd/">FreeBSD 使用者手冊(FAQ)</ulink>(Big5)
</para></listitem>
<listitem><para>
<ulink url="http://tw.freebsd.org/handbook.big5/handbook.html">FreeBSD 2.1.0 使用手冊</ulink>(Big5)
</para></listitem>
<listitem><para>
<ulink url="http://freebsd.sinica.edu.tw/~ncvs/zh-handbook/handbook.html">FreeBSD 2.2.8 使用手冊</ulink>(Big5)
</para></listitem>
<listitem><para>
<ulink url="http://freebsd.sinica.edu.tw/~ncvs/zh-big5-handbook/index.html">FreeBSD 3.3 使用手冊</ulink>(Big5)
</para></listitem>
<listitem><para>
<ulink url="http://freebsd.sinica.edu.tw/~ncvs/zh-l10n-tut/">FreeBSD 中文使用文件計畫</ulink>(Big5) BROKEN
</para></listitem>
<listitem><para>
<ulink url="http://freebsd.ntu.edu.tw/">台大 FreeBSD 中文 FAQ Web (woju)</ulink>(Big5) BROKEN
</para></listitem>
<listitem><para>
<ulink url="gopher://freebsd.csie.nctu.edu.tw/">交大資工 FreeBSD 版精華區 gopher (jdli)</ulink>(Big5) BROKEN
</para></listitem>
<listitem><para>
<ulink url="http://netlab.cse.yzu.edu.tw/~statue/cfc/docs/mysqldoc_big5/manual_toc.html">MySQL 3.23.pre7 中文使用手冊</ulink>(Big5)
</para></listitem>
<listitem><para>
<ulink url="http://netlab.cse.yzu.edu.tw/~statue/cfc/docs/pos~tgresql_big5/postgres.htm">PostgreSQL 6.5 中文使用手冊</ulink>(Big5)
</para></listitem>
<listitem><para>
<ulink url="http://netlab.cse.yzu.edu.tw/~statue/cfc/docs/pgsqldoc-7.0c/postgres.htm">PostgreSQL 7.0 中文使用手冊</ulink>(Big5)
</para></listitem>
<listitem><para>
<ulink url="http://php.wilson.gs/bible/">PHP 聖經</ulink>(Big5)
</para></listitem>
<listitem><para>
<ulink url="http://mouse.oit.edu.tw/NetBSD/">NetBSD 1.41版安裝手冊</ulink>(Big5)
</para></listitem>
<listitem><para>
<ulink url="http://digital.oit.edu.tw/openbsd/">OpenBSD 簡介與安裝</ulink>(Big5)
</para></listitem>
<listitem><para>
<ulink url="http://residence.educities.edu.tw/yjchen/freebsd/">Servlet + JSP + mysql jdbc + chinese</ulink>(Big5)
</para></listitem>
<listitem><para>
<ulink url="http://netlab.cse.yzu.edu.tw/~statue/cfc/goods/perlfaq/perlfaq/">Perl 常見問題與解答</ulink>(Big5)
</para></listitem>
<listitem><para>
<ulink url="http://mdk.linux.org.tw/lyx-doc/lyx-1.html">中文 LyX 使用簡介</ulink>(Big5)
</para></listitem>
<listitem><para>
<ulink url="http://www.linpus.com.tw/manual/gnome1.0/content.htm">GNOME 1.0 使用者手冊</ulink>(Big5)
</para></listitem>
<listitem><para>
<ulink url="http://www.linpus.com.tw/manual/kdeug/userguide/">KDE 使用者手冊 pre1.0 12/24/1998</ulink>(Big5)
</para></listitem>
<listitem><para>
<ulink url="http://tech.sina.com.cn/focus/FreeBSD/index.shtml">FreeBSD使用大全</ulink>(GB)
</para></listitem>
<listitem><para>
<ulink url="http://www.enctc.edu.tw/other/freebsd.htm">FreeBSD管理介面使用手冊</ulink>(Big5)
</para></listitem>
<listitem><para>
<ulink url="http://coder.9ug.com/language/script/python.html">Python 教學文件</ulink>(Big5)
</para></listitem>
</itemizedlist>
<para>經典文章</para>
<itemizedlist>
<listitem><para>
<ulink url="http://netlab.cse.yzu.edu.tw/~statue/cfc/goods/other/FSF.html">自由軟體基金會 (Free Software Foundation)</ulink>(Big5)
</para></listitem>
<listitem><para>
<ulink url="http://netlab.cse.yzu.edu.tw/~statue/cfc/goods/other/Howto-Become-a-Hacker.html">如何成為一位 Hacker</ulink>(Big5)
</para></listitem>
<listitem><para>
<ulink url="http://netlab.cse.yzu.edu.tw/~statue/cfc/goods/other/Brief-of-History-Hackerdom.html">Hacker 文化簡史</ulink>(Big5)
</para></listitem>
<listitem><para>
<ulink url="http://netlab.cse.yzu.edu.tw/~statue/cfc/goods/homesteeding/">開拓智域</ulink>(Big5)
</para></listitem>
<listitem>
<para><ulink url="http://netlab.cse.yzu.edu.tw/~statue/cfc/goods/cathedral-bazaar/cathedral-bazaar.html">教堂觀與市集觀</ulink>(Big5)</para>
</listitem>
<listitem>
<para><ulink url="http://netlab.cse.yzu.edu.tw/~statue/cfc/goods/other/osr.html">開放原始碼革命</ulink>(Big5)</para>
</listitem>
<listitem>
<para><ulink url="http://netlab.cse.yzu.edu.tw/~statue/cfc/goods/other/open-source.html">Open Source 簡介</ulink>(Big5)</para>
</listitem>
<listitem>
<para><ulink url="http://netlab.cse.yzu.edu.tw/~statue/cfc/goods/other/open-source-def.html">Open Source 的定義</ulink>(Big5)</para>
</listitem>
</itemizedlist>
<para>下載站台</para>
<itemizedlist>
<listitem><para>
<ulink url="ftp://freebsd.csie.nctu.edu.tw/pub/01TW_Service.TXT">台灣公開列表</ulink>
</para></listitem>
</itemizedlist>
</sect1>
<sect1 id="newgroup">
<title>FreeBSD 的中文討論區</title>
<para>
如果您有問題,可以在這些討論區發問,用中文也通哦!不過請確定您
已經先看過了相關的文件或 HOWTO。否則重複問一些 FAQ 是很不
受歡迎的!
</para>
<para>
<ulink url="news://tw.bbs.comp.386bsd">news://tw.bbs.comp.386bsd</ulink></para>
<para>Openfind BBS 網路論壇tw.bbs.comp.386bsd 看板。</para>
<para>
<ulink url="http://bbs.openfind.com.tw/cgi-bin/x_list?BOARD=tw.bbs.comp.386bsd">
http://bbs.openfind.com.tw/cgi-bin/x_list?BOARD=tw.bbs.comp.386bsd</ulink></para>
<para>中研院所架設的台灣 FreeBSD 通信論壇。</para>
<para>
<ulink url="http://freebsd.sinica.edu.tw/mailman/listinfo">
http://freebsd.sinica.edu.tw/mailman/listinfo</ulink></para>
<para>中研院舊版本通信論壇,舊信倉庫。</para>
<para>
<ulink url="http://freebsd.sinica.edu.tw/~majordom/">
http://freebsd.sinica.edu.tw/~majordom/</ulink></para>
<para>香港 bsd talk 通信論壇:</para>
<para>
<ulink url="news://news.linux.org.hk/hklug.bsd.talk">
news://news.linux.org.hk/hklug.bsd.talk</ulink></para>
<para>
<ulink url="http://www.shellhung.org/mailman/listinfo/">
http://www.shellhung.org/mailman/listinfo/</ulink></para>
</sect1>
<sect1 id="irctw">
<title>FreeBSD 的中文 IRC 聊天室</title>
<para>
這是目前 BSD 使用者在網路上聚會聊天的地方,通常都會有一群人在此發呆
、哈拉、打屁。
</para>
<para>
在 FreeBSD 底下通常都是使用 <filename>ports/chinese</filename>
底下的 <application>bitchx</application> 或是
<filename>ports/irc</filename> 底下的
<application>xchat</application> 當作
IRC 用戶端,在 Windows 底下則是以
<ulink url="http://www.mirc.com/">mIRC</ulink> 為主。
</para>
<para>
<application>bitchx</application> 或
<application>xchat</application> 的使用方式:
</para>
<procedure>
<step><para>啟動 irc client</para></step>
<step><para>出現 prompt 後</para></step>
<step><para>/server irc.taiwan.com</para></step>
<step><para>/join #bsdchat</para></step>
</procedure>
<para>mIRC 的使用方式:</para>
<procedure>
<step><para>File -&gt; Options -&gt; Connect -&gt; Add</para></step>
<step><para>IRC Server: irc.taiwan.com</para></step>
<step><para>Connect to IRC Server</para></step>
<step><para>/join #bsdchat</para></step>
</procedure>
<para>
近來因為主機與網路的關係IRC Server 先換到 irc.seed.net.tw。
</para>
<note>
<para>
mIRC 小秘訣:如何用微軟新注音輸入法改字呢?
在要改的那個字上面按空白鍵,然後選擇所要的字,決定後再按空白鍵。
</para>
<para>
mIRC 中文化您需要先安裝mIRC32 v.5.91在您的電腦內,
然後才可執行這個patch檔來進行中文化的工作。使用方法先去
www.mirc.com捉取mIRC591t.exe這個檔回來安裝記住這一版patch
是給mIRC32 v5.91使用的不要拿其他版來patch然後把
p010901.exe 拷貝到您mIRC安裝的目錄下執行p010901.exe。
執行完畢後就會自動產生一個中文化過的mIRC執行檔CmIRC591.exe。
您可以直接在mIRC的目錄下執行這個檔。</para>
</note>
</sect1>
<sect1 id="organisations">
<title>Organisations Working in Open Source</title>
<para>Government</para>
<itemizedlist>
<listitem><para><ulink url="http://www.oss.org.tw/">OpenSource Software Portal(OSSP)</ulink>,IDB MoEA </para></listitem>
</itemizedlist>
<para>Research Institute </para>
<itemizedlist>
<listitem><para><ulink url="http://twgrid.org/">Taiwan Grid Computing Project</ulink>,Computing Center Academia Sinica </para></listitem>
<listitem><para><ulink url="http://opensource.nchc.org.tw/">National Center for High-performance Computing (NCHC)</ulink> </para></listitem>
<listitem><para><ulink url="http://www.openfoundry.org/">Open Source Software Foundry (OSSF)</ulink>,IIS Academia Sinica </para></listitem>
</itemizedlist>
<para>Association</para>
<itemizedlist>
<listitem><para><ulink url="http://www.slat.org/">Software Liberty Association of Taiwan (SLAT) </ulink></para></listitem>
<listitem><para><ulink url="http://linux.tca.org.tw/">Linux Compatibility Test and Certification Center (LCTaCC)</ulink>, TCA</para></listitem>
<listitem><para><ulink url="http://ossc.cosa.org.tw/">Open Source Software Center(OSSC)</ulink>, COSA</para></listitem>
<listitem><para><ulink url="http://twopensource.org/">ICOS</ulink> - Internation Conference on Open Source.</para></listitem>
</itemizedlist>
<para>Education </para>
<itemizedlist>
<listitem><para><ulink url="http://sfs.wpes.tcc.edu.tw/">School Administration System Devloper Portal </ulink></para></listitem>
<listitem><para><ulink url="http://free.tnc.edu.tw/">OSS Portal for Teacher in Tainan </ulink></para></listitem>
<listitem><para><ulink url="http://sfs.ilc.edu.tw/">OSS Portal for Teacher in Yi-Lan </ulink></para></listitem>
<listitem><para><ulink url="http://163.23.89.67/">OSS Portal for Teacher in Chang-Hua </ulink></para></listitem>
<listitem><para><ulink url="http://www.bamboo.hc.edu.tw/linux/">Community College Linux Course in Shin-Chu</ulink>, Bamboo Community College</para></listitem>
<listitem><para><ulink url="http://edu.slat.org/">Open Source Software application consulting center (OSSACC)</ulink>, SLAT</para></listitem>
</itemizedlist>
<para>Training </para>
<itemizedlist>
<listitem><para><ulink url="http://edu.uuu.com.tw/class/series.asp?seat=Linux">UCOM</ulink> - RedHat Certified training. </para></listitem>
<listitem><para><ulink url="http://www.fitpi.com.tw/">Finesse IT</ulink> - Linux SA &amp; embedded Linux training. </para></listitem>
<listitem><para><ulink url="http://www.ginnet.com.tw/class/linux.htm">GIN</ulink> - Linux use &amp; manage training. </para></listitem>
<listitem><para><ulink url="http://www.iiiedu.org.tw/index.aspx">IIIEDU</ulink> - Connected Linux training. </para></listitem>
<listitem><para><ulink url="http://www.shinewave.com.tw/chinese/training/Main_edu.htm">Shinewave</ulink> - LPI Certified Training.</para></listitem>
<listitem><para><ulink url="http://www.oss.com.tw/">OSS School</ulink> - ThizLinux & OSS training.</para></listitem>
<listitem><para><ulink url="http://www.pcschool.com.tw/">Great Master</ulink> - LPI Certified &amp; WebMaster training.</para></listitem>
<listitem><para><ulink url="http://www.lccnet.com.tw/">1ccnet</ulink> - OpenLinux &amp; LPI Certified training.</para></listitem>
<listitem><para><ulink url="http://www.pviva.com/">PEI YA</ulink> - Linux teaching CD.</para></listitem>
</itemizedlist>
<para>Business </para>
<itemizedlist>
<listitem><para><ulink url="http://www.ossti.com/">OSSTI</ulink> - Software technology and service base on GCC compiler. </para></listitem>
<listitem><para><ulink url="http://www.citron.com.tw/">Citron Network</ulink> - VoIP base on <ulink url="http://www.gnugk.org/">Gatekeeper</ulink>. </para></listitem>
<listitem><para><ulink url="http://www.linpus.com.tw/">Linpus</ulink> - Embedded system & Embedded GUI base on Linux,Linpus Linux OS. </para></listitem>
<listitem><para><ulink url="http://www.eshida.com/">Eshida.com</ulink> - Embedded system development tools base on Linux. </para></listitem>
<listitem><para><ulink url="http://www.wiscore.com.tw/">Wiscore</ulink> - Embedded,Information Appliances base on Linux. </para></listitem>
<listitem><para><ulink url="http://www.erexi.com.tw/">Erexi</ulink> - HA,LDAP,Mail,Cluster solutions base on Turbolinux. </para></listitem>
<listitem><para><ulink url="http://www.toppoint.com.tw/">toppoint</ulink> - small SI with OSS solutions. </para></listitem>
<listitem><para><ulink url="http://www.brain-c.com/">brain-c</ulink> - small SI with OSS solutions. </para></listitem>
<listitem><para><ulink url="http://www.synology.com/">Synology</ulink> - NAS base on FreeBSD. </para></listitem>
<listitem><para><ulink url="http://www.dbmaker.com.tw/">SYSCOM</ulink> - Database support with FreeBSD. </para></listitem>
<listitem><para><ulink url="http://www.pgsql.com.tw/">datsoft</ulink> - ERP base on PostgreSQL. </para></listitem>
</itemizedlist>
<para>FS/OSS User Group</para>
<itemizedlist>
<listitem><para><ulink url="http://www.bug.club.tw/">FreeBSD User Club</ulink></para></listitem>
<listitem><para><ulink url="http://www.debian.org.tw/">Debian Linux User Group</ulink></para></listitem>
<listitem><para><ulink url="http://www.gentoo.org.tw/">Gentoo Linux User Group</ulink></para></listitem>
<listitem><para><ulink url="http://www.slackware.org.tw/">Slackware Linux User Group</ulink></para></listitem>
<listitem><para><ulink url="http://tnlug.linux.org.tw/">Tainan Linux User Group</ulink></para></listitem>
<listitem><para><ulink url="http://kalug.linux.org.tw/">Kaohsiung Linux User Group</ulink></para></listitem>
<listitem><para><ulink url="http://turtle.ee.ncku.edu.tw/openwebmail/">OpenWebMail</ulink></para></listitem>
<listitem><para><ulink url="http://www.zope.org.tw/">Zope</ulink></para></listitem>
<listitem><para><ulink url="http://www.postgresql.idv.tw/">PostgreSQL</ulink></para></listitem>
<listitem><para><ulink url="http://phpbb-tw.net/phpbb/">phpBB</ulink></para></listitem>
<listitem><para><ulink url="http://www.phpnuke-tw.com/">PHP-Nuke</ulink></para></listitem>
<listitem><para><ulink url="http://tw.xoops.org/">XOOPS</ulink></para></listitem>
<listitem><para><ulink url="http://phpbb.elixus.org/">Blog</ulink></para></listitem>
<listitem><para><ulink url="http://wiki.newzilla.org/WiKi">Wiki</ulink></para></listitem>
<listitem><para><ulink url="http://kde.linux.org.tw/">KDE</ulink></para></listitem>
<listitem><para><ulink url="http://ooo.tnc.edu.tw/">OpenOffice</ulink></para></listitem>
<listitem><para><ulink url="http://www.csie.ntu.edu.tw/~b7506051/mozilla/">Mozilla</ulink></para></listitem>
<listitem><para><ulink url="http://www.python.org.tw/">Python</ulink></para></listitem>
<listitem><para><ulink url="http://www.doochun.org/">DooChun</ulink> - Embedded Linux base on x86</para></listitem>
<listitem><para><ulink url="http://savannah.gnu.org/projects/chinese/">GNUCTT</ulink> - GNU Chinese Translators Team. </para></listitem>
<listitem><para><ulink url="http://cle.linux.org.tw/">CLE</ulink> - Chinese Linnux Extension. </para></listitem>
<listitem><para><ulink url="http://xcin.linux.org.tw/">XCIN</ulink> - An XIM (X Input Method) server. </para></listitem>
<listitem><para><ulink url="http://sourceforge.net/projects/big5con">big5con</ulink> - A Chinese input in console mode. </para></listitem>
<listitem><para><ulink url="http://chewing.good-man.org/">Chewing</ulink> - A Chinese input base on XCIN. </para></listitem>
<listitem><para><ulink url="http://i18n.linux.org.tw/">I18N Linux</ulink></para></listitem>
<listitem><para><ulink url="http://wiki.debian.org.tw/index.php?page=3Anoppix">3Anoppix</ulink> - Chinese localization of KNOPPIX. </para></listitem>
</itemizedlist>
<para>OSS Portals / Websites </para>
<itemizedlist>
<listitem><para><ulink url="http://www.linuxfab.com/">LinuxFab</ulink> - Open Source Community Portal</para></listitem>
<listitem><para><ulink url="http://www.linux.org.tw/">Linux Portal</ulink></para></listitem>
<listitem><para><ulink url="http://phorum.study-area.org/">Study-Area</ulink> - OSS & Computer forum </para></listitem>
<listitem><para><ulink url="http://www.freenix-server.info/">Freenix</ulink> - Freenix Server Document Project </para></listitem>
<listitem><para><ulink url="http://anti_ms.tripod.com/">Anti-MS News</ulink></para></listitem>
<listitem><para><ulink url="http://www.linuxuser.com.tw/">Linux User News</ulink></para></listitem>
<listitem><para><ulink url="http://www.linuxnews.idv.tw/">Linux News</ulink></para></listitem>
<listitem><para><ulink url="http://www.cyut.edu.tw/~ckhung/a/">Chao-Kuei Hung's Home Page </ulink></para></listitem>
<listitem><para><ulink url="http://www.europa.idv.tw/index.php">Internet farmer</ulink></para></listitem>
<listitem><para><ulink url="http://www.toppoint.com.tw/charles">Charles' phpBB</ulink></para></listitem>
</itemizedlist>
</sect1>
</chapter>
<!--
Local Variables:
mode: sgml
sgml-declaration: "../chapter.decl"
sgml-indent-data: t
sgml-omittag: nil
sgml-always-quote-attributes: t
sgml-parent-document: ("../zh-tut.sgml" "part" "chapter")
End:
-->

Some files were not shown because too many files have changed in this diff Show more