[TECHNICAL KNOWHOW ABOUT MHPOPD]


1.Identifiers for Machine Dependency

  In machine.h, or config.h built by "make config", the
various identifiers are defined. These identifiers are
established to merge the differences from each OS.
  If you cannot compile successfully or find some strange
behaviors, you can define/undefine these identifiers to
modify it.
  The following is the meaning of each identifier.

SYSV
SVR4
BSD4
BSD43	This indicates the oriented type of OS. SYSV, SVR4
	is referred in the latter part of machine.h for the
	definition unique with OS. BSD4, BSD43 is defined
	only as an information, not to be referred in actual
	sources.

OSTYPE	This indicates the OS name. It is used to setup the
	floppy drive in the default value, according to each
	OS.

CODEEUC	This means to use EUC-JP (Extended Unix Code) as the
	Kanji code. If undefined, it means Shift JIS is used.
	This concerns the man page after installation, and
	the default value when you don't define the Kanji
	code, and so on.
	You can dynamically change the Kanji code used in
	input/output and filename, after compiled.
NOMULTIKANJI
	It is not necessary to consider the environment which
	has multiple Kanji codes.
PATHNOCASE
	System calls ignore case for any filename.
COMMNOCASE
	Shell ignore case for any shell command name.
ENVNOCASE
	System calls ignore case for any environment variable.
NOUID
	Neither user ID nor group ID don't exist.
NODIRLOOP
	Any directory structure can never loop.
NOSYMLINK
	Symbolic link system is not implemented.
BSPATHDELIM
	The path delimiter is a backslash character.
USECRNL
	The character who indicates end of line is CR-NL.
CWDINPATH
	The current work directory is always included in
	the command search path implicitly.
USEMANLANG
	The search pathname referred to man(1) includes the
	string shown by the environment variable LANG, such
	as '/usr/man/ja_JP.SJIS/', to support M17N.
USEDATADIR
	fd-unicd.tbl, which is the transformation table for
	UNICODE, is not placed on the same directory as the
	executable binary of fd, but on the directory which
	is specified by DATADIR in Makefile.in.
SUPPORTSJIS
	cc(1) or man(1) supports Shift JIS perfectly. Even
	for the Kanji whose second byte is '\', this '\' is
	not treated as a meta character.
BSDINSTALL
	The BSD-like install(1) is installed on the standard
	command search path, and can use the option -c (copy)
	and -s (strip).
BSDINSTCMD
	If the command name of the BSD-like install(1) is
	not "install", you can define that command name.
	It will be meaningless in case that BSDINSTALL is
	not defined.
TARUSESPACE
	tar(1) with t option will output the list in which
	each file mode string (Ex:rw-rw-rw-) is always followed
	by spaces. In the BSDish OS, it seems usually followed
	by not spaces but UID/GID. In the GNU tar, it is
	followed by spaces.
	Even if you are wrong to define, the description of
	.fd2rc and /etc/fd2rc can change it dynamically.
TARFROMPAX
	The implementation of tar(1) comes from pax(1), and
	the output of -t option follows the format used by
	pax(1).
	Even if you are wrong to define, the description of
	.fd2rc and /etc/fd2rc can change it dynamically.
CPP7BIT	cpp(1) cannot pass through any 8bit character, such
	as the Kanji.
CCCOMMAND
	This indicates the fullpath of the C compiler which
	you want to use as standard. In some OS, both of BSD
	version cc and SYSV version cc exists at once, you
	should choose only one. If undefined, 'cc' is used.
EXTENDCCOPT
	This indicates the option gave to cc(1). If undefined,
	"-O" is assigned. In case it cannot support "-O"
	(Optimize), you should define null.
CCOUTOPT
	This indicates the option to give cc(1) the output
	filename, when it only compile and don't link (with
	-c option). This must include the make(1) macro for
	output filename. You must define this, when you don't
	need the default value "-o $@".
CCLNKOPT
	This indicates the option to give cc(1) the output
	filename, when it links the executable file (without
	-c option). This must include the make(1) macro for
	output filename. You must define this, when you don't
	need the default value "-o $@".
USETERMINFO
	The terminfo(5) library is used as the terminal database
	instead of the termcap(5) library.
TERMCAPLIB
	This indicates the library which is need to be link
	as the termcap(5) library. If undefined, -ltermcap
	is assigned.
REGEXPLIB
	This indicates the library which is need to be link
	as the regular expression library, if need.
SOCKETLIB
	This indicates the libraries which are need to be link
	as the socket libraries, if need.
EXTENDLIB
	This indicates the other library which is need to be
	link, if need.

NOFILEMACRO
	cc(1) cannot evaluate the macro __FILE__.
NOFUNCMACRO
	cc(1) cannot evaluate the macro __FUNCTION__.
NOLINEMACRO
	cc(1) cannot evaluate the macro __LINE__.
FORCEDSTDC
	Although __STDC__ is not pre-defined, the compiler
	requires the ANSI standard C format in the prototype
	declaration and so on. If you trust it is based on
	ANSI, it is no problem to define this unconditionally.
STRICTSTDC
	The compiler has the strict ANSI standard C specifications
	not to allow the coexistence of the modern type
	prototype declaration and the classical type function
	declaration of K&R. You should define this, when
	there are a number of errors concerned the type of
	function argument.
NOCONST	Although __STDC__ is pre-defined, the compiler expects
	the classical C language specifications of K&R.
NOCONST	Although __STDC__ is pre-defined, the compiler does
	not support the "const" qualifier.
NOVOID	The "void" type cannot be used.
NOLONGLONG
	The "long long" type cannot be used.
HAVELONGLONG
	The "long long" type is supported.
NOUID_T	uid_t, gid_t is not defined in <sys/type.h>
USEPID_T
	fork(2) and wait(2) treat a prosess ID as a type of
	pid_t.
DECLSIGLIST
	The global variable sys_siglist[] is declared in
	<signal.h>, not to need to declare again in the source
	list.
NOSIGLIST
	The global variable sys_siglist[] don't exist in
	the standard library.
DECLERRLIST
	The global variable sys_siglist[] is declared in
	<stdio.h> or <errno.h>, not to need to declare again
	in the source list.
PWNEEDERROR
	Linking /lib/libPW.a requires to prepare the global
	variable Error[] in the source,
NOERRNO	The global variable errno is not declared in <errno.h>.
NOFILEMODE
	The constant S_IRUSR, S_IWUSR, etc. are not declared
	in <sys/stat.h>.
NOUNISTDH
	<unistd.h> don't exist.
NOSTDLIBH
	<stdlib.h> don't exist.
NOTZFILEH
	<tzfile.h> don't exist.
USELEAPCNT
	The structure tzhead has the member tzh_leapcnt.
USESELECTH
	The structure fd_set which is needed when use the
	function select(2) is defined in <sys/select.h>.
USESYSDIRH
	The constant DEV_BSIZE which indicates the block
	of the directory file is defined in <sys/dir.h>.
USETIMEH
	The structure tm is not defined in <sys/types.h>
	nor <sys/time.h>, to require <time.h>.
USESTDARGH
	The type va_list for variable argument is defined
	in <stdarg.h>.
USEMKDEVH
	The macro (or function) major()/minor() for the device
	number is defined <sys/mkdev.h>.
USEMKNODH
	The macro (or function) major()/minor() for the device
	number is defined <sys/mknod.h>.
USELOCKFH
	The constants which indicate the commands for the
	function lockf(2) to lock files is defined in
	<sys/lockf.h>.
USETERMIO
	The structure termio is used as the terminal interface.
USETERMIOS
	The structure termios is used as the terminal interface.
	If both USETERMIO and USETERMIOS is undefined, the
	structure sgttyb is used.
HAVECLINE
	The structure termios has the member c_line.
USEDEVPTMX
	The device file /dev/ptmx and /dev/pts/? are used for
	the pseudo terminal. If undefined, /dev/ptyXX and
	/dev/ttyXX are used.
USEDIRECT
	The structure direct is used instead of dirent.
SYSVDIRENT
	The structure dirent doesn't have the member d_fileno
	and has the member d_ino.
NODNAMLEN
	The structure dirent doesn't have the member d_namlen.
NODRECLEN
	The structure dirent doesn't have the member d_reclen.
	It has the member d_fd instead.
DNAMESIZE
	The size of tha member d_name of the structure dirent.
HAVETIMEZONE
	The global variable timezone indicates the offset
	value from GMT.
NOTMGMTOFF
	The structure tm doesn't have the member tm_gmtoff.

(The following 5 identifiers is exclusive. These can not be
defined simultaneously.)
USESTATVFSH
	The functions declared in <sys/statvfs.h> is used to
	get the filesystem information.
USESTATFSH
	The functions declared in <sys/statfs.h> is used to
	get the filesystem information.
USEVFSH
	The functions declared in <sys/vfs.h> is used to get
	the filesystem information.
USEMOUNTH
	The functions declared in <sys/mount.h> is used to
	get the filesystem information.
USEFSDATA
	The functions using the structure fs_data is used to
	get the filesystem information.

USEFFSIZE
	The structure statfs has the member f_fsize, which
	indicates the block size of the filesystem. If undefined,
	member f_bsize is referred.
	In case of that USESTATVFSH, USEFSDATA is defined,
	this is meaningless.
STATFSARGS
	This indicates the number of arguments used by
	function statfs(2).
	In case of that USESTATVFSH, USEFSDATA is defined,
	this is meaningless.

(The following 9 identifiers is exclusive. These can not be
defined simultaneously.)
USEMNTENTH
	The functions declared in <mntent.h> is used to get
	the mount information.
USEMNTTABH
	The functions declared in <sys/mnttab.h> is used to
	get the mount information.
USEGETFSSTAT
	The function getfsstat(2) is used to get the mount
	information.
USEGETVFSTAT
	The function getvfsstat(2) is used to get the mount
	information.
USEMNTCTL
	The function mntctl(3) is used to get the mount
	information.
USEMNTINFOR
	The function getmntinfo_r(3) is used to get the mount
	information.
USEMNTINFO
	The function getmntinfo(3) is used to get the mount
	information.
USEGETMNT
	The function getmnt(3) is used to get the mount
	information.
USEGETFSENT
	The function getfsent(3) is used to get the mount
	information.
	(This method can get only the information before mount,
	not to be recommended. Suppose that it is a last
	resort.)

(The following 2 identifiers is exclusive. These can not be
defined simultaneously. In case of that the identifier except
USEMNTINFO is defined among the above 8 choices, this is
meaningless.)
USEVFCNAME
	The structure vfsconf has the member vfc_name, which
	indicates the string to mean the mount type. And,
	getvfsbytype() is used to get the type vfsconf.
USEFFSTYPE
	The structure statfs has the member f_fdtypename,
	which indicates the string to mean the mount type.

(The following 3 identifiers is exclusive. These can not be
defined simultaneously.)
USERE_COMP
	The function re_comp(3) is used to search the regular
	expression.
USEREGCOMP
	The function regcomp(3) is used to search the regular
	expression.
USEREGCMP
	The function regcmp(3) is used to search the regular
	expression.

USERAND48
	The function for random number generator is not random(3)
	but rand48(3).
USESETENV
	The function setenv(3) is available to set the environ
	variables.
NOSELECT
	The function select(2) is unavailable for the low
	level input/output.
DEFFDSETSIZE
	The function select(2) needs the FD_SETSIZE identifier
	to be pre-defined as the maximum number of openable
	files.
SELECTRWONLY
	The function select(2) cannot respond the file descriptor
	opened as read/write.
NOVSPRINTF
	The function vsprintf(3) is unavailable for the
	formatted output.
NOTERMVAR
	The termcap(5) library has not the global variables;
	PC, ospeed, BC and UP.
USEUTIME
	The function utimes(2) is unavailable to set the
	timestamp, and utime(3) is used instead.
USEGETWD
	The function getcwd(3) is unavailable to get the
	current directory, and getwd(3) is used instead.
USEFCNTLOCK
	The function fnctl(2) is used instead of flock(2) to
	lock files.
USELOCKF
	The function flock(2) is unavailable to lock files,
	and lockf(2) is used instead.
NOFLOCK
	Both of the function flock(2) and lockf(2) are
	unavailable to lock files.
NOSYSLOG
	The function syslog(3) is unavailable for system
	logger.
USETIMELOCAL
	The function timelocal(3) is available as the inverse
	function of localtime(3) for the time conversion.
USEMKTIME
	The function mktime(3) is used instead of timelocal(3)
	for the time conversion.
USESYSCONF
	The function sysconf(3) is used to get the system
	configurations.
USELLSEEK
	The function _llseek(2) is used instead of lseek(2)
	for the file control. In the 32bit Linux environment,
	lseek(2) cannot specify the offset value over 2^32
	bytes, so that _llseek(2) is necessary.
USEUNAME
	The function uname(2) is used instead of gethostname(2)
	to get the hostname.
USEWAITPID
	The function waitpid(2) is used instead of wait3(2)
	to wait the software signals.
USESIGACTION
	The function sigaction(2) is used instead of signal(2)
	to control the signals.
USESIGPMASK
	The function sigprocmask(2) is used instead of
	sigsetmask(2) to control the signals.
USERESOURCEH
	The functions declared in <sys/resource.h> is used to
	get/set the resource information.
USEULIMITH
	The functions declared in <ulimit.h> is used to get/set
	the resource information.
USEGETRUSAGE
	The function getrusage(2) is used to get the process
	time information.
USETIMES
	The function times(2) is used to get the process time
	information.
GETPGRPVOID
	The function getpgrp(2) has no argument, to get the
	process group.
USESETPGID
	The function setpgid(2) is used instead of getpgrp(2)
	to set the process group.
USESETVBUF
	The function setvbuf(3) is used instead of setlinebuf(3)
	to buffer the stream.
SIGARGINT
	The second argument of the software signal function
	signal(3) must be the pointer to the function which
	returns the type int.
SIGFNCINT
	The second argument of the software signal function
	signal(3) must be the pointer to the function which
	has the argument of the type int.
USESTRERROR
	The function strerror(3) is used instead of sys_errlist[]
	to get error messages.
GETTODARGS
	This indicates the number of arguments used by
	function gettimeofday(3). The default value is 2.
USESETSID
	The function setsid(2) can be used to control session.
USESOCKLEN
	The third argument of the socket function bind(2)/
	connect(2)/accept(2) must be the type socklen_t.
USESETREUID
	The function setreuid(2) is used instead of geteuid(2)
	to set the user ID.
USESETRESUID
	The function setresuid(2) is used instead of geteuid(2)
	to set the user ID.
USESETREGID
	The function setregid(2) is used instead of getegid(2)
	to set the group ID.
USESETRESGID
	The function setresgid(2) is used instead of getegid(2)
	to set the group ID.

SENSEPERSEC
	This indicates the number to sense the key input per
	second. It is suitable in case that the terminal
	communication speed is slow. The default value is 50
	per second.
WAITKEYPAD
	This indicates the time to wait after getting the
	inputted keycode of ESC. It is suitable in case of
	that the terminal communication speed is slow. The
	default value is 360ms.
WAITMETA
	This indicates the time to wait after getting the
	inputted keycode of META. It is suitable in case of
	that the terminal communication speed is slow. The
	default value is 60ms. If you define the too long
	value, the autorepeat of the META key becomes ineffective.
HDDMOUNT
	This causes the floppy drive function to support the
	hard disk drive. It will be defined in case of that
	you want this function on the environment except
	PC-UNIX.


2.Invoking the MH Command

  MHpopd will use each MH command such as inc(1) and send(1),
which can be replaced with another command by configurations.
  It is assumed as the MH command, so that the command need
to correspond to it. You can refer to the following condition
whan each MH command is invoked.

o inc(1)
Command name:
	specified by incproc the parameter
Arguments:
	none
Current directory:
	~/Mail/inbox
Current folder:
	inbox

o rmm(1)
Command name:
	specified by rmmproc the parameter
Arguments:
	list of the object message number
Current directory:
	the object folder directory
Current folder:
	the object folder

o send(1)
Command name:
	specified by sendproc the parameter
Arguments:
	"draft" or "<Draft-Folder>/<message number>"
Current directory:
	~/Mail
Current folder:
	no specified

o pick(1)
Command name:
	specified in the mail sort controlling file
Arguments:
	specified in the mail sort controlling file
Current directory:
	~/Mail/inbox
Current folder:
	inbox


3.Executing the Command inc(1)

  It is a necessary condition for using MHpopd that the
environment for each MH command is configured. Above all,
you need to take care of executing inc(1).


  First of all, inc(1) requires your password if it receives
mails from some outer server. Then it cannot be automatically
executed.
  It is a solution that you specify the password prompt with
incprompt the parameter of the server configuration file.
  This method will automatically input your password to inc(1)
with the pseudo teminal. This password string is only the
password specified by mh-password or my-password.

  It is another solution that you use the pseudo terminal
software like expect(1) to make the script which input password
to inc(1).
  For example, the following script will be available for
except(1).
	#!/usr/local/bin/expect -f
	spawn /usr/local/bin/inc
	expect "Password *:"
	send "PASSWORD\r"
	expect eof
	exit
  If you want to treat more strictly such as error handling,
you should refer to each documents of expect(1).

  It is another solution that you will not need to input
password with .netrc.
  You write the following line in .netrc just under your home
directory.
	"machine SERVER.DOMAIN passwd PASSWORD"
Then the password string "PASSWORD" will use to access the
mail server "SERVER.DOMAIN".
  This is purely a function of MH, you can refer to each MH
documents for details. You should make inc(1) executed from
MHpopd, after you confirm it enough in the local environment.


  Next, you should notice that inc(1) itself cannot sort nor
filter mails.
  It is a solution that you specify the assignment to sort
with pick(1) and pickfile the parameter of the server
configuration file.
  This may be the easiest method, in case that mails can be
sorted simply with pick(1) and refile(1) the MH command.

  It is another solution that you write the script for inc(1).
You can write the script, which will select mails from inbox
with pick(1) and sort mails with refile(1) after inc(1) has
been executed.
  This way is purely to list some statements, so that the
script may be a simple shell script. pock(1) and refile(1)
are the MH command too, you can refer to each MH documents
for details.

  Another solution is slocal(1) the MH command. It is the
software to filter mails before receiving them into your mail
box, and sort mails according to description of .maildelivery
under your home directory.
  This is purely a function of MH too, you can refer to each
MH documents for details.


4.Permission to Execute

  It may be safe that you don't specify shell scripts as each
command invoked from MHpopd, as possible. It is to avoid some
security holes.
  But, MHpopd will be executed with the permission of each
user after user authentication, then these command cannot
execute as root.

  It mey be safer that MHpopd runs not as root but as a normal
user from the start.
  In this case, you may be forbidden to use the port under
1024, the "well-known port", for POP3 or SMTP.  You should
specify a large port number to avoid it.
  But, it is no wonder that the server executed as a normal
user cannot send/receive mails of the other user. Then you
need to run servers which are assigned diferrent port as
many as client users.

  Though you can also run servers as a normal user when they
will be invoked from inetd(8), you should describe service
names as many as users in /etc/services for different port.
