[PREVIOUS CHAPTER] [______TOC_______]
6 Several Utilities (bin/, lib/Utilities/ ...)


In this chapter we describe utility programs under bin/ and
contrib/Utilities/.

6.1	analyze_mail_error.pl (replaced to libexec/mead.pl)

use libexec/mead.pl.

6.2	Archive Generator


Please see the chapter of "archive" (../daily 3.0).

6.3	base64decode.pl base64encode.pl

BASE64 encoder and decoder. A part of library uses this.

6.4	cron (bin/cron.pl)


cron is a tiny program which is almost compatible of Vixie Cron.
Please see cron chapter (../digest 2.17).

6.5	Daemon-ize programs


Example:

	% bin/daemon.pl cron.pl $PWD


to make cron.pl a daemon. perl version of the following C program.
This may work on BSD's.

#include <stdio.h>
#include <sys/ioctl.h>
#include <sgtty.h>
#include <sys/file.h>

void usage()
{
  char *string="USAGE: targetprogram";
  fputs(string,stderr);
  exit(0);
}

main(argc, argv)
     int argc;
     char **argv;
{
  int f;

  f = open( "/dev/tty", O_RDWR, 0);
  if( -1 == ioctl(f ,TIOCNOTTY, NULL))
    exit(1);
  close(f);

  if( argc > 1 )
    execvp(*(++argv), argv);
  else
    usage();

  exit(0);
}

6.6	daily, log analyzer 

	% bin/daily.pl -f etc/daily.ignore log


which shows ambiguous yesterday lines in the log file($LOGFILE).

	/usr/local/fml/etc/daily.ignore


	/usr/local/fml/etc/daily.ignore
	("FML installed directory"/etc/daily.ignore)


determines which lines daily.pl ignores. This file contains key
phrases regarded as valid in the context of FML operations. We
recommend you run daily.pl and check the output. If it has superfluous
lines, you add needless phrase patterns to "daily.ignore". It is good
to run daily.pl each morning by cron.

	daily.pl [-hd] [-f patfile] [-t trap_patfile] [-p days]

	-h        this message
	-d        debug mode

	-f file   pattern file to ignore
	-t file   pattern file to trap (evaluated before ignore list)
	-p days   scan at which day (default is 1, that is "yesterday")

Example: for elena ML (/var/spool/ml/elena)

[$HOME/sbin/daily.sh]

	#!/bin/sh
	/usr/local/fml/bin/daily.pl -f $HOME/etc/daily.ignore \
		-t $HOME/etc/daily.trap /var/spool/ml/elena/log

[crontab]
0 5 * * * /bin/sh $HOME/sbin/daily.sh


6.7	Checking DNS


A small program to check DNS values.

	% make dns_check


runs this program.

6.8	emumail.pl


Emulation program of output from sendmail into fml.pl which is for
debug only.


"makefml test <ML>" is the same function and more useful I believe.

6.9	Expire


6.10	WIX Language Formatter  (bin/fwix.pl)


Please see the chapter ../documentation 2.0

6.11	gen_summary.pl (summary re-creator)


When summary file is broken, you can re-create summary file with this
program from ML articles in the spool.

in fml-support ML's Count: 02393


   gen_summary.pl -I /usr/local/fml Mailing List's spool > summary


	-I lib*.pl locations (required)
	-m MIME decoding

6.12	bin/msend_master.sh

example of control over multiple msending processes.
See also INSTALL file.


6.13	bin/more_secure_cf.pl

a real program of "make secure" operation.


6.14	Multipart Canceler Filter (bin/multipart.pl)

Author: Yuao TANIGAWA <yuao@infonia.or.jp>


You can use "| multipart.pl | fml.pl" in include file.
This cancels out multipart mails to inject it to fml.pl since 
commands in multipart mails could fail.

From:    Yuao TANIGAWA <yuao@infonia.or.jp>
Subject: Multipart Canceler
To:      fml-support@axion.phys.titech.ac.jp (fml supporting ML)
Date:    Fri, 10 Jan 1997 21:09:03 +0200
X-Mail-Count: 01937


6.15	NEWSYSLOG SHELL VERSION (bin/newsyslog.sh)


Inheritance in the age without libnewsyslog.pl


6.16	A demo of SMTP library


A demo.

6.17	initialize and change password  (bin/passwd.pl)


Please use "makefml passwd ML ...", which is more useful today.


FML saves crypted passwords for remote administration authentication
in $DIR/etc/passwd. So you should use a special program to encrypt
passwords for initialization and change.


 passwd.pl [-i] [-f password-file] user password


   -i initialize
   -f password file	 


Example:

	% passwd.pl -i fukachan@phys.titech.ac.jp 


shows

	Address: fukachan@phys.titech.ac.jp 
	Password: 


Please input your password. The password file contains

	fukachan@phys.titech.ac.jp 32ZrV/XvYj1kY


where this "32ZrV/XvYj1kY" is a crypted password.


6.18	get mails via POP3


This gets mails from a mail server via POP3 and injects them into
fml.pl and runs ML. The real program is libexec/popfml.pl, others is a
link to it.


6.19	split and send files (bin/split_and_msend.pl)


Obsolete.

6.20	SPOOL -> HTML Hierarchy (bin/spool2html.pl)


make HTML style articles of ML. In default this generates index.html,
thread.html (thread) and each article.html. Please run this program in
ML's HOME DIRECTORY ($DIR) or define -D $DIR.

SYNOPSIS:

  spool2html.pl [-h] [-I INC] [-f cf] [-d HTML_DIR] [-t TYPE] [-D DIR] SPOOL

    -h    this message
    -d    $HTML_DIR
    -t    number of day ($HTML_INDEX_UNIT)


    -h    this message
    -d    $HTML_DIR
    -f    config.ph location
    -t    number of day ($HTML_INDEX_UNIT)
    -D    $DIR
    -I    path; add path to @INC

    SPOOL $SPOOL_DIR

Example:
   % cd /var/spool/ml/elena
   % spool2html.pl -I /usr/local/fml -d /htdocs /var/spool/ml/elena/spool


Attention: Without -D, $DIR == $PWD.

6.21	MH scan.format (lib/Utilities/scan.format)


Please input lib/Utilities/scan.format to your ~/Mail, MH scan shows
the following


  65 -06/14 Horaki Hikari fml-su Subject uja  <<UJA
     Date:  From:         X-ML-Name: Subject:


It must be useful. You can write MH scan.format if you understand

	if	%<
	elif	%?
	else	%|
	fi	%>


Statement Examples:


%?{X-Mailinglist-Name}%6{X-Mailinglist-Name}\


%?(match NetBSD.ORG)NetBSD\

6.22	to make articles by "mget" mbox style (lib/Utilities/packmbox.pl)

packmbox.pl	(by ukai@hplj.hpl.hp.com)


By lib/Utilities/packmbox.pl, you do to make mbox style file. 

	(cd spool; packmbox.pl ) > ~/mbox


You can incorporate mails to your ~/Mail/inbox if with MH

	inc -file ~/mbox -truncate 


6.23	RMAIL -> fml.pl

Rmail2fml.pl	(yamane@ngi.co.jp)


	RMAIL file -> fml.pl

6.24	Stardate (STAR TREK)


Add a special header field Stardate which is STAR TREK's date:-).

	X-Stardate: [-31]8122.12


If you use MH, you can replace MH post by my-mh-post.pl (perl) or
my-mh-post(shell) to add Stardate in your mail when sending.


libstardate.pl is stardate library.


* This algorithm is one of stardate calculation. Several
interpretation are available for stardate, but I choice one of them.

6.25	weekend-msend.sh


FML drives Matomeokuri / Digest in the interval 24 hours, so FML does
not implement sending once in a week.  To send articles in a week once
in a week, you run weekend-msend.sh once in a week where you set m=1u
as a digest parameter. 


In default you cannot configure FML to control weekly digest
configurations for each address by remote (e.g. command).
# Of course, you can hack FML.


The heart of weekly-msend is 

        MSEND_RC=$DIR/weekend/msendrc
        ACTIVE_LIST=$DIR/weekend/actives
        MEMBER_LIST=$DIR/weekend/members


and "address option" in actives or members (depended on modes).  You
require "1" of "m=1" as an option since we require msend.pl works
always.


	address m=1u


6.26	Append X-Stardate: (Emacs Lisp)


Please load contrib/Utilities/stardate.el and add the following codes
to your ~/.emacs. mh-comp generates draft buffer with X-Stardate:.  I
check this code on mule-2.3.


(load-library "stardate")
(setq startrek-stardate-process "/some-directory-path/libstardate.pl")