Index: tags/r89-trunk/.bash_profile
===================================================================
--- tags/r89-trunk/.bash_profile	(revision 90)
+++ tags/r89-trunk/.bash_profile	(revision 90)
@@ -0,0 +1,6 @@
+# set PATH so it includes user's private bin if it exists
+if [ -d "$HOME/.bin" ] ; then
+    PATH="$HOME/.bin:$PATH"
+fi
+
+/usr/bin/screen -d -RR -U
Index: tags/r89-trunk/.bashrc
===================================================================
--- tags/r89-trunk/.bashrc	(revision 90)
+++ tags/r89-trunk/.bashrc	(revision 90)
@@ -0,0 +1,123 @@
+# ~/.bashrc: executed by bash(1) for non-login shells.
+# see /usr/share/doc/bash/examples/startup-files (in the package bash-doc)
+# for examples
+
+# If not running interactively, don't do anything
+[ -z "$PS1" ] && return
+
+# don't put duplicate lines in the history. See bash(1) for more options
+export HISTCONTROL=ignoredups
+# ... and ignore same sucessive entries.
+export HISTCONTROL=ignoreboth
+
+# check the window size after each command and, if necessary,
+# update the values of LINES and COLUMNS.
+shopt -s checkwinsize
+
+# make less more friendly for non-text input files, see lesspipe(1)
+[ -x /usr/bin/lesspipe ] && eval "$(SHELL=/bin/sh lesspipe)"
+
+# set variable identifying the chroot you work in (used in the prompt below)
+if [ -z "$debian_chroot" ] && [ -r /etc/debian_chroot ]; then
+    debian_chroot=$(cat /etc/debian_chroot)
+fi
+
+# set a fancy prompt (non-color, unless we know we "want" color)
+case "$TERM" in
+    xterm-color) color_prompt=yes;;
+esac
+
+# uncomment for a colored prompt, if the terminal has the capability; turned
+# off by default to not distract the user: the focus in a terminal window
+# should be on the output of commands, not on the prompt
+#force_color_prompt=yes
+
+if [ -n "$force_color_prompt" ]; then
+    if [ -x /usr/bin/tput ] && tput setaf 1 >&/dev/null; then
+	# We have color support; assume it's compliant with Ecma-48
+	# (ISO/IEC-6429). (Lack of such support is extremely rare, and such
+	# a case would tend to support setf rather than setaf.)
+	color_prompt=yes
+    else
+	color_prompt=
+    fi
+fi
+
+if [ "$color_prompt" = yes ]; then
+    PS1='${debian_chroot:+($debian_chroot)}\[\033[01;32m\]\u@\h\[\033[00m\]:\[\033[01;34m\]\w\[\033[00m\]\$ '
+else
+    PS1='${debian_chroot:+($debian_chroot)}\u@\h:\w\$ '
+fi
+unset color_prompt force_color_prompt
+
+# If this is an xterm set the title to user@host:dir
+case "$TERM" in
+xterm*|rxvt*)
+    PROMPT_COMMAND='echo -ne "\033]0;${USER}@${HOSTNAME}: ${PWD/$HOME/~}\007"'
+    ;;
+*)
+    ;;
+esac
+
+# Alias definitions.
+# You may want to put all your additions into a separate file like
+# ~/.bash_aliases, instead of adding them here directly.
+# See /usr/share/doc/bash-doc/examples in the bash-doc package.
+
+#if [ -f ~/.bash_aliases ]; then
+#    . ~/.bash_aliases
+#fi
+
+# enable color support of ls and also add handy aliases
+if [ "$TERM" != "dumb" ] && [ -x /usr/bin/dircolors ]; then
+    eval "`dircolors -b`"
+    alias ls='ls --color=auto'
+    #alias dir='ls --color=auto --format=vertical'
+    #alias vdir='ls --color=auto --format=long'
+
+    #alias grep='grep --color=auto'
+    #alias fgrep='fgrep --color=auto'
+    #alias egrep='egrep --color=auto'
+fi
+
+# some more ls aliases
+#alias ll='ls -l'
+#alias la='ls -A'
+#alias l='ls -CF'
+
+# enable programmable completion features (you don't need to enable
+# this, if it's already enabled in /etc/bash.bashrc and /etc/profile
+# sources /etc/bash.bashrc).
+if [ -f /etc/bash_completion ]; then
+    . /etc/bash_completion
+fi
+
+umask 022   # create new file with '644'
+ulimit -c 0 # no dump core
+export PAGER=less
+export LESS='-X -i -P ?f%f:(stdin).  ?lb%lb?L/%L..  [?eEOF:?pb%pb\%..]'
+
+HISTSIZE=50000
+HISTFILESIZE=50000
+
+set -o notify   # notify end of background job immediately
+
+shopt -s histappend     # append command history instead of overwrite
+shopt -s checkhash      # check always PATH hash table
+shopt -s cmdhist        # save multi lines command to one line
+shopt -s no_empty_cmd_completion    # no complementation with no input
+shopt -s histverify     # check command history before execute
+
+
+# view last 30 history or search from last 1000 history
+function i {
+    if [ "$1" ]; then history 1000 | grep "$@"; else history 30; fi
+}
+
+# view last 30 history or search from all history
+function I {
+    if [ "$1" ]; then history | grep "$@"; else history 30; fi
+}
+
+alias vi='vim'
+alias sudo='sudo -H '
Index: tags/r89-trunk/.bin/get_ip_from_ifconfig.pl
===================================================================
--- tags/r89-trunk/.bin/get_ip_from_ifconfig.pl	(revision 90)
+++ tags/r89-trunk/.bin/get_ip_from_ifconfig.pl	(revision 90)
@@ -0,0 +1,14 @@
+#!/usr/bin/perl
+use strict;
+use Data::Dumper;
+
+my $interface;
+my %IPs;
+
+foreach ( qx{ (LC_ALL=C /sbin/ifconfig -a 2>&1) } ) {
+	$interface = $1 if /^(\S+?):?\s/;
+        next unless defined $interface;
+        $IPs{$interface}->{STATE}=uc($1) if /\b(up|down)\b/i;
+        $IPs{$interface}->{IP}=$1 if /inet\D+(\d+\.\d+\.\d+\.\d+)/i;
+}
+print Dumper(\%IPs);
Index: tags/r89-trunk/.bin/get_ip_from_ioctl.pl
===================================================================
--- tags/r89-trunk/.bin/get_ip_from_ioctl.pl	(revision 90)
+++ tags/r89-trunk/.bin/get_ip_from_ioctl.pl	(revision 90)
@@ -0,0 +1,36 @@
+#!/usr/bin/perl
+use strict;
+use warnings;
+require 'sys/ioctl.ph';
+use Socket;
+
+my %interfaces;
+my $max_addrs = 30;
+socket(my $socket, AF_INET, SOCK_DGRAM, 0) or die "socket: $!";
+
+{
+    my $ifreqpack = 'a16a16';
+    my $buf = pack($ifreqpack, '', '') x $max_addrs;
+    my $ifconf = pack('iP', length($buf), $buf);
+
+    # This does the actual work
+    ioctl($socket, SIOCGIFCONF(), $ifconf) or die "ioctl: $!";
+
+    my $len = unpack('iP', $ifconf);
+    substr($buf, $len) = '';
+
+    %interfaces = unpack("($ifreqpack)*", $buf);
+
+    unless (keys(%interfaces) < $max_addrs) {
+        # Buffer was too small
+        $max_addrs += 10;
+        redo;
+    }
+}
+
+for my $addr (values %interfaces) {
+    $addr = inet_ntoa((sockaddr_in($addr))[1]);
+}
+
+use Data::Dumper;
+print Dumper \%interfaces;
Index: tags/r89-trunk/.bin/smartgrep
===================================================================
--- tags/r89-trunk/.bin/smartgrep	(revision 90)
+++ tags/r89-trunk/.bin/smartgrep	(revision 90)
@@ -0,0 +1,5 @@
+for DEVICE in `ls /dev/[hs]d?`
+do
+    echo -n "$DEVICE: "
+    sudo smartctl -a $DEVICE | grep $1
+done
Index: tags/r89-trunk/.bin/svnst
===================================================================
--- tags/r89-trunk/.bin/svnst	(revision 90)
+++ tags/r89-trunk/.bin/svnst	(revision 90)
@@ -0,0 +1,3 @@
+#! /bin/sh
+
+svn st $@ | grep "^[^?]"
Index: tags/r89-trunk/.bin/wake
===================================================================
--- tags/r89-trunk/.bin/wake	(revision 90)
+++ tags/r89-trunk/.bin/wake	(revision 90)
@@ -0,0 +1,53 @@
+#!/usr/bin/perl
+
+use Cwd qw( realpath );
+use File::Basename qw( fileparse );
+
+@cfg = ('.wake', ( (fileparse( realpath($0) ))[1] ) . '.wake');
+$mac = {};
+
+$x = '[0-9a-fA-F]';
+$macre = "$x$x:$x$x:$x$x:$x$x:$x$x:$x$x";
+$ipre = "\d{1,3}\.\d{1,3}\.\d{1,3}\.\d{1,3}";
+
+foreach my $cfg (@cfg) {
+	open(CFG, $cfg);
+	while (<CFG>) {
+		next if /^\s*#/;
+		next if /^\s*$/;
+		
+		chomp;
+		my($host, $hw, $ip) = split;
+		push @{$mac->{lc($host)}}, { MAC => $hw, IP => $ip };
+	}
+}
+
+if (@ARGV) {
+	foreach $host (@ARGV) {
+		if ($host =~ /$macre/) {
+			print qx(wakeonlan $host);
+		}
+		elsif (@physical = @{$mac->{lc($host)}}) {
+		    foreach my $mac (@physical) {
+		        if ($mac->{IP}) {
+		            print qx(wakeonlan -i $mac->{IP} $mac->{MAC});
+		        }
+		        else {
+		            print qx(wakeonlan $mac->{MAC});
+		        }
+		    }
+		}
+		else {
+			print lc($host) . ": no such host in the list.\n";
+		}
+	}
+}
+else {
+	foreach $host (sort keys %$mac) {
+	    $physical = $mac->{lc($host)};
+	    foreach my $mac (@$physical) {
+	        print "$host -> $mac->{MAC} -> $mac->{IP}\n";
+	    }
+	}
+}
+
Index: tags/r89-trunk/.profile
===================================================================
--- tags/r89-trunk/.profile	(revision 90)
+++ tags/r89-trunk/.profile	(revision 90)
@@ -0,0 +1,21 @@
+# ~/.profile: executed by the command interpreter for login shells.
+# This file is not read by bash(1), if ~/.bash_profile or ~/.bash_login
+# exists.
+# see /usr/share/doc/bash/examples/startup-files for examples.
+# the files are located in the bash-doc package.
+
+# the default umask is set in /etc/profile
+#umask 022
+
+# if running bash
+if [ -n "$BASH_VERSION" ]; then
+    # include .bashrc if it exists
+    if [ -f "$HOME/.bashrc" ]; then
+	. "$HOME/.bashrc"
+    fi
+fi
+
+# set PATH so it includes user's private bin if it exists
+if [ -d "$HOME/bin" ] ; then
+    PATH="$HOME/bin:$PATH"
+fi
Index: tags/r89-trunk/.screenrc
===================================================================
--- tags/r89-trunk/.screenrc	(revision 90)
+++ tags/r89-trunk/.screenrc	(revision 90)
@@ -0,0 +1,12 @@
+escape ^x^x
+autodetach on
+defbce on
+vbell off
+defscrollback 10000
+startup_message off
+hardstatus on
+hardstatus alwayslastline
+hardstatus string "%{.bW}%{.rW}%n: %t %{-} %=%{..G}%H %{..Y}LoadAvg: %l %0c "
+caption always "%{= wk} %-w%{=bu dr}%n %t%{-}%+w"
+logfile /home/mitty/.screen/%y-%m-%d_%0c:%s.%n.log
+deflog on
Index: tags/r89-trunk/commentary/debhw/20101212.txt
===================================================================
--- tags/r89-trunk/commentary/debhw/20101212.txt	(revision 90)
+++ tags/r89-trunk/commentary/debhw/20101212.txt	(revision 90)
@@ -0,0 +1,102 @@
+ÍoCgPÊ
+fBXNÍubNPÊ
+	ðjIoÜÅ512bytePÊ
+t@CVXeÍ±ÌubNÌg¢ûðßÜµå¤AÆ¢¤[
+
+
+åÌÍAÇÌuubNvðg¤©ð¨IÈ Æ©ÉuAddressvð¢Äâè­èµ½
+	No.0 blockÍA³ñA1ÍB³ñAÆ¢¤æ¤ÉB
+	telR}h(?)
+	
+EÇ±ðgÁÄ¢é©
+	¡ÌubNÌêàAPêÌubNÅÏÞêà é
+	UnixÅÌp³ê½AubNª©®Åg£³êéÆ¢¤@\ÍÇá»³êÈªçàLÜÁÄ¢Á½
+ENªg¤©
+	inode
+	http://www.tamacom.com/tour/kernel/unix/S/61.html
+	32sÚ
+		i_mode
+			t@CÌ[h
+			shortÈÌÅ16bit
+			rwxÅ3bit * 3 = 9bit
+	63sÚ`
+		Bê½[h (i_mode)
+		`67sÚ
+		D => directory
+		R => regular file
+	àeª[UÉJú³êÄ¢éÌªregular file
+	directoryÍOSªgp·éÌÅA[UÍÊÓ¯µÈ¢
+
+¡úÍinodeµ©µÈ¢æ
+
+`IÈ*nixÌt@CVXe
+
+fBXNàÌÔ
+	æª superblock => ñÈ~
+	inodeGA
+	êÊubN
+superblock
+	SÌÌîñ
+	ú»·éÌÍmkfsÌc[
+inodeGA
+	inodeªÅÜèÅ¬ÁµèüÁÄ¢é
+	inodeÌzñ
+êÊubN
+	directoryâregular fileÅÜÁÄ¢é
+
+mkfsµ½¾¯ÅÍt@CVXeÆµÄF¯³êÈ¢
+t@CVXeÆµÄAmkfsµ½fBXNðOSÉF¯³¹éÌÍmountR}h
+
+mountR}hª½ð·é©
+	superblockðÇñÅA³µ¢FS©Av½IÈs®ªÈ¢©
+	mount /dev/blockdev mountpoint
+		inodeÌ2ÔðÇñÅAmountpointÉÇL
+		2ÔÈÌÍÜÁÄ¢é
+		inodeÌ2ÔÍñíÉdv
+	umount
+		t@CªSÄÂ¶Ä¢é©
+			inodeªSÄlock³êÄ¢È¢
+inodeÌ2Ô
+	eFSÌ2ÔinodeÍfBNg\¢ÌrootÆÈÁÄ¢é
+	mkfsR}hÌFSÌú»¼ãÍAmkfsR}hª2ÔðfBNgÉK¸Zbg·é
+
+inodeêÂªêÂÌt@C
+
+inodeÌzñ©çA¢gpÌinodeðTµÄ«ÄAãÉÇÝÝAregular <= +1µÄdiskÉ«ß·
+	¢gpðT·ASYÍÊÉ é
+êÊubNÌó«ÌæðT·
+	T·ASYªÊÉ é
+	39sÚÌNADDRª¢gp
+
+*nixÅÍinode©Ìªt@C
+	ut@C = inodev
+	inodeÍ¯ÊqÅÍÈ¢ÌÅAÔªÂ¢Ä¢é
+		ui_nov
+		uls -ivÅinodeÔªoé
+	"ls -id /"
+		=> 2
+lnR}hÅhardlinkðìé
+	t@CðinodeÌÔÅÄÔÌÍÊ|ÈÌÅA¼OðÂ¯é
+	t@C¼Í¡Â¯çêé
+Á¦é^C~OÍrmR}hðÅÁ½uÔÆÍÀçÈ¢
+
+uino <=> file namevÌgÝí¹ðzñÆµÄÁÄ¢ézªé
+	|ino | file name |
+	| 41 |   file A  |
+	| 41 |   file B  |
+	Ìæ¤ÈÇëIÈ¨
+	ÀÍ±êªfBNgt@C
+		fBNgt@Cð³î©éÆ©¦é
+		"cat ."
+			LinuxÍ\¢ªá¤ÌÅ©êÈ¢
+	¡ÌLinuxÆV7Ìt@CVXeÌ\¢Í¯¶
+		t@CVXeÌî{IÈfUC\¢Í¯¶
+		à¿ëñÀãÌHvEi»Í é
+		AeB[NÈUnixð¡ñæèã°½RÍ±ê
+
+tempt@C
+	t@CðìÁ½uÔÉunlink => vZXªÌµÄàèÉt@CªÁ¦é
+
+ÌÍfBXNª¿Åå«ÈPêfBXNðpÓ·éÌªïµ©Á½ÌÅA
+¬³ÈfBXNðÚ¬ØµÄAå«­©¹éÆ¢¤ê÷Ìô
+	=> inode 2
Index: tags/r89-trunk/cron.daily/apt-cron
===================================================================
--- tags/r89-trunk/cron.daily/apt-cron	(revision 90)
+++ tags/r89-trunk/cron.daily/apt-cron	(revision 90)
@@ -0,0 +1,9 @@
+#!/bin/sh
+
+set -e
+
+/usr/bin/aptitude update > /dev/null 2>&1
+
+if [ `/usr/bin/aptitude -s -y safe-upgrade | /bin/grep -c ^0` -eq 0 ]; then
+    /usr/bin/aptitude -s -y safe-upgrade | /bin/grep '^[ T0-9]'
+fi
Index: tags/r89-trunk/geshi/index.php
===================================================================
--- tags/r89-trunk/geshi/index.php	(revision 90)
+++ tags/r89-trunk/geshi/index.php	(revision 90)
@@ -0,0 +1,228 @@
+<?php
+/**
+ * GeSHi example script
+ *
+ * Just point your browser at this script (with geshi.php in the parent directory,
+ * and the language files in subdirectory "../geshi/")
+ *
+ * @author  Nigel McNie
+ * @version $Id: example.php 1512 2008-07-21 21:05:40Z benbe $
+ */
+header('Content-Type: text/html; charset=utf-8');
+
+error_reporting(E_ALL);
+
+// Rudimentary checking of where GeSHi is. In a default install it will be in ../, but
+// it could be in the current directory if the include_path is set. There's nowhere else
+// we can reasonably guess.
+if (is_readable('../geshi.php')) {
+    $path = '../';
+} elseif (is_readable('geshi.php')) {
+    $path = './';
+} else {
+    die('Could not find geshi.php - make sure it is in your include path!');
+}
+require $path . 'geshi.php';
+
+$fill_source = false;
+if (isset($_POST['submit'])) {
+    if (get_magic_quotes_gpc()) {
+        $_POST['source'] = stripslashes($_POST['source']);
+    }
+    if (!strlen(trim($_POST['source']))) {
+        if(! isset($_POST['language'])) { $_POST['language'] = 'php'; }
+        $_POST['language'] = preg_replace('#[^a-zA-Z0-9\-_]#', '', $_POST['language']);
+        $_POST['source'] = implode('', @file($path . 'geshi/' . $_POST['language'] . '.php'));
+        $_POST['language'] = 'php';
+    } else {
+        $fill_source = true;
+    }
+
+    // Here's a free demo of how GeSHi works.
+
+    // First the initialisation: source code to highlight and the language to use. Make sure
+    // you sanitise correctly if you use $_POST of course - this very script has had a security
+    // advisory against it in the past because of this. Please try not to use this script on a
+    // live site.
+    $geshi = new GeSHi($_POST['source'], $_POST['language']);
+
+    // Use the PRE_VALID header. This means less output source since we don't have to output &nbsp;
+    // everywhere. Of course it also means you can't set the tab width.
+    // HEADER_PRE_VALID puts the <pre> tag inside the list items (<li>) thus producing valid HTML markup.
+    // HEADER_PRE puts the <pre> tag around the list (<ol>) which is invalid in HTML 4 and XHTML 1
+    // HEADER_DIV puts a <div> tag arount the list (valid!) but needs to replace whitespaces with &nbsp
+    //            thus producing much larger overhead. You can set the tab width though.
+    $geshi->set_header_type(GESHI_HEADER_PRE_VALID);
+
+    // Enable CSS classes. You can use get_stylesheet() to output a stylesheet for your code. Using
+    // CSS classes results in much less output source.
+    $geshi->enable_classes();
+
+    // Enable line numbers. We want fancy line numbers, and we want every 5th line number to be fancy
+    $geshi->enable_line_numbers(GESHI_FANCY_LINE_NUMBERS, 10);
+
+    // Set the style for the PRE around the code. The line numbers are contained within this box (not
+    // XHTML compliant btw, but if you are liberally minded about these things then you'll appreciate
+    // the reduced source output).
+    $geshi->set_overall_style('font: normal normal 90% monospace; color: #000066; border: 1px solid #d0d0d0; background-color: #ffffff;', false);
+
+    // Set the style for line numbers. In order to get style for line numbers working, the <li> element
+    // is being styled. This means that the code on the line will also be styled, and most of the time
+    // you don't want this. So the set_code_style reverts styles for the line (by using a <div> on the line).
+    // So the source output looks like this:
+    //
+    // <pre style="[set_overall_style styles]"><ol>
+    // <li style="[set_line_style styles]"><div style="[set_code_style styles]>...</div></li>
+    // ...
+    // </ol></pre>
+    $geshi->set_line_style('color: #003030;', 'font-weight: bold; color: #006060;', true);
+    $geshi->set_code_style('color: #000020;', true);
+
+    // Styles for hyperlinks in the code. GESHI_LINK for default styles, GESHI_HOVER for hover style etc...
+    // note that classes must be enabled for this to work.
+    $geshi->set_link_styles(GESHI_LINK, 'color: #000060;');
+    $geshi->set_link_styles(GESHI_HOVER, 'background-color: #f0f000;');
+
+    // Use the header/footer functionality. This puts a div with content within the PRE element, so it is
+    // affected by the styles set by set_overall_style. So if the PRE has a border then the header/footer will
+    // appear inside it.
+    //$geshi->set_header_content('<SPEED> <TIME> GeSHi &copy; 2004-2007, Nigel McNie, 2007-2008 Benny Baumann. View source of example.php for example of using GeSHi');
+    //$geshi->set_header_content_style('font-family: sans-serif; color: #808080; font-size: 70%; font-weight: bold; background-color: #f0f0ff; border-bottom: 1px solid #d0d0d0; padding: 2px;');
+
+    // You can use <TIME> and <VERSION> as placeholders
+    $geshi->set_footer_content('Parsed in <TIME> seconds at <SPEED>, using GeSHi <VERSION>');
+    $geshi->set_footer_content_style('font-family: sans-serif; color: #808080; font-size: 70%; font-weight: bold; background-color: #f0f0ff; border-top: 1px solid #d0d0d0; padding: 2px;');
+} else {
+    // make sure we don't preselect any language
+    $_POST['language'] = null;
+}
+?>
+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
+     "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
+<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
+<head>
+    <title>GeSHi - Generic Syntax Highlighter</title>
+    <style type="text/css">
+    <!--
+    <?php
+    if (isset($_POST['submit'])) {
+        // Output the stylesheet. Note it doesn't output the <style> tag
+        echo $geshi->get_stylesheet(true);
+    }
+    ?>
+    html {
+        background-color: #f0f0f0;
+    }
+    body {
+        font-family: Verdana, Arial, sans-serif;
+        margin: 10px;
+        border: 2px solid #e0e0e0;
+        background-color: #fcfcfc;
+        padding: 5px;
+    }
+    h2 {
+        margin: .1em 0 .2em .5em;
+        border-bottom: 1px solid #b0b0b0;
+        color: #b0b0b0;
+        font-weight: normal;
+        font-size: 150%;
+    }
+    h3 {
+        margin: .1em 0 .2em .5em;
+        color: #b0b0b0;
+        font-weight: normal;
+        font-size: 120%;
+    }
+    #footer {
+        text-align: center;
+        font-size: 80%;
+        color: #a9a9a9;
+    }
+    #footer a {
+        color: #9999ff;
+    }
+    textarea {
+        border: 1px solid #b0b0b0;
+        font-size: 90%;
+        color: #333;
+        margin-left: 20px;
+    }
+    select, input {
+        margin-left: 20px;
+    }
+    p {
+        font-size: 90%;
+        margin-left: .5em;
+    }
+    -->
+    </style>
+</head>
+<body>
+<!--
+<h2>GeSHi Example Script</h2>
+<p>To use this script, make sure that <strong>geshi.php</strong> is in the parent directory or in your
+include_path, and that the language files are in a subdirectory of GeSHi's directory called <strong>geshi/</strong>.</p>
+<p>Enter your source and a language to highlight the source in and submit, or just choose a language to
+have that language file highlighted in PHP.</p>
+-->
+<?php
+if (isset($_POST['submit'])) {
+    // The fun part :)
+    echo $geshi->parse_code();
+    echo '<hr />';
+    echo '</body>';
+    echo '</html>';
+    exit;
+}
+?>
+<h2>GeSHi - Generic Syntax Highlighter</h2>
+<ul>
+  <li><a href="docs/geshi-doc.html">GeSHi Documentation</a></li>
+  <li><a href="docs/api/">GeSHi API</a></li>
+</ul>
+<form action="<?php echo basename($_SERVER['PHP_SELF']); ?>" method="post">
+<h3>Source to highlight</h3>
+<p>
+<textarea rows="30" cols="120" name="source" id="source"><?php echo $fill_source ? htmlspecialchars($_POST['source']) : '' ?></textarea>
+</p>
+<h3>Choose a language</h3>
+<p>
+<select name="language" id="language">
+<?php
+if (!($dir = @opendir(dirname(__FILE__) . '/geshi'))) {
+    if (!($dir = @opendir(dirname(__FILE__) . '/../geshi'))) {
+        echo '<option>No languages available!</option>';
+    }
+}
+$languages = array();
+while ($file = readdir($dir)) {
+    if ( $file[0] == '.' || strpos($file, '.', 1) === false) {
+        continue;
+    }
+    $lang = substr($file, 0,  strpos($file, '.'));
+    $languages[] = $lang;
+}
+closedir($dir);
+sort($languages);
+foreach ($languages as $lang) {
+    if (isset($_POST['language']) && $_POST['language'] == $lang) {
+        $selected = 'selected="selected"';
+    } else {
+        $selected = '';
+    }
+    echo '<option value="' . $lang . '" '. $selected .'>' . $lang . "</option>\n";
+}
+
+?>
+</select>
+</p>
+<p>
+<input type="submit" name="submit" value="Highlight Source" />
+<input type="submit" name="clear" onclick="document.getElementById('source').value='';document.getElementById('language').value='';return false" value="clear" />
+</p>
+</form>
+<div id="footer">GeSHi &copy; Nigel McNie, 2004, released under the GNU GPL<br />
+For a better demonstration, check out the <a href="http://qbnz.com/highlighter/demo.php">online demo</a>
+</div>
+</body>
+</html>
Index: tags/r89-trunk/iproute/setroute-rhel.sh
===================================================================
--- tags/r89-trunk/iproute/setroute-rhel.sh	(revision 90)
+++ tags/r89-trunk/iproute/setroute-rhel.sh	(revision 90)
@@ -0,0 +1,43 @@
+#!/bin/sh
+
+set -x
+
+IFACE="${1:?"usage: $0 <ether_device> [gateway] "}"
+GATEWAY=$2
+
+TID=`/sbin/ip addr show dev ${IFACE} | grep -w ${IFACE}: | tr -s ' ' | cut -d : -f 1`
+
+if [ "${GATEWAY}" = "down" ]; then
+    # delete routing table and policy and exit
+    ## routing table is automatically flushed, so 'route flush' can be removed
+    /sbin/ip route flush table ${TID}
+    ## device has no longer any IP addr, so do not use IPADDR
+    /sbin/ip rule del table ${TID} priority ${TID}
+    /sbin/ip route flush cache
+    echo "remove routing table and policy for ${IFACE}"
+    exit
+fi
+
+
+# get IP address, network mask, default gateway info
+IPADDR=`/sbin/ip addr show dev ${IFACE} | grep -w inet | tr -s ' ' | cut -d ' ' -f 3 | cut -d / -f 1`
+NETWORK=`/sbin/ip route show dev ${IFACE} | grep -w ${IPADDR} | tr -s ' ' | cut -d ' ' -f 1`
+
+if [ -z "${GATEWAY}" ]; then
+    GATEWAY=`/sbin/ip route show dev ${IFACE} | grep -w default | tr -s ' ' | cut -d ' ' -f 3`
+fi
+if [ -z "${GATEWAY}" ]; then
+    GATEWAY=`/sbin/ip route | grep -w default | tr -s ' ' | cut -d ' ' -f 3`
+    # this may add wrong default route especially on RHEL
+fi
+
+
+# set routing table
+/sbin/ip route add ${NETWORK} dev ${IFACE} table ${TID}
+/sbin/ip route add default via ${GATEWAY} dev ${IFACE} table ${TID}
+
+# set routing policy
+/sbin/ip rule add from ${IPADDR} table ${TID} priority ${TID}
+
+/sbin/ip route flush cache
+echo "add routing table and policy for ${IFACE} on table ${TID}"
Index: tags/r89-trunk/iproute/setroute.sh
===================================================================
--- tags/r89-trunk/iproute/setroute.sh	(revision 90)
+++ tags/r89-trunk/iproute/setroute.sh	(revision 90)
@@ -0,0 +1,58 @@
+#!/bin/sh
+
+# set individualized routing table and policy for each network device
+
+
+set -x
+
+## INTERFACES(5)
+# IFACE  physical name of the interface being processed
+# METHOD method of the interface (e.g., static)
+# MODE   start if run from ifup, stop if run from ifdown
+# PHASE  as per MODE, but with finer granularity, distinguishing the pre-
+#        up, post-up, pre-down and post-down phases.
+
+# optional arugument to set default gateway manually
+GATEWAY=$1
+
+TID=`/sbin/ip addr show dev ${IFACE} | grep -w ${IFACE}: | tr -s ' ' | cut -d : -f 1`
+
+if [ "${PHASE}" = "post-down" ]; then
+    # delete routing table and policy and exit
+    ## routing table is automatically flushed, so 'route flush' can be removed
+    /sbin/ip route flush table ${TID}
+    ## device has no longer any IP addr, so do not use IPADDR
+    /sbin/ip rule del table ${TID} priority ${TID}
+    /sbin/ip route flush cache
+    echo "remove routing table and policy for ${IFACE}"
+    exit
+fi
+
+
+# get IP address, network mask, default gateway info
+IPADDR=`/sbin/ip addr show dev ${IFACE} | grep -w inet | tr -s ' ' | cut -d ' ' -f 3 | cut -d / -f 1`
+if [ -z "${IPADDR}" ]; then
+    # fail to bind IP address to device
+    echo "${IFACE} has no IP address."
+    exit
+fi
+NETWORK=`/sbin/ip route show dev ${IFACE} | grep -w ${IPADDR} | tr -s ' ' | cut -d ' ' -f 1`
+
+if [ -z "${GATEWAY}" ]; then
+    GATEWAY=`/sbin/ip route show dev ${IFACE} | grep -w default | tr -s ' ' | cut -d ' ' -f 3`
+fi
+if [ -z "${GATEWAY}" ]; then
+    GATEWAY=`/sbin/ip route | grep -w default | tr -s ' ' | cut -d ' ' -f 3`
+    # this may add wrong default route especially on RHEL
+fi
+
+
+# set routing table
+/sbin/ip route add ${NETWORK} dev ${IFACE} table ${TID}
+/sbin/ip route add default via ${GATEWAY} dev ${IFACE} table ${TID}
+
+# set routing policy
+/sbin/ip rule add from ${IPADDR} table ${TID} priority ${TID}
+
+/sbin/ip route flush cache
+echo "add routing table and policy for ${IFACE} on table ${TID}"
Index: tags/r89-trunk/iptables/setfilter
===================================================================
--- tags/r89-trunk/iptables/setfilter	(revision 90)
+++ tags/r89-trunk/iptables/setfilter	(revision 90)
@@ -0,0 +1,105 @@
+#!/bin/sh -e
+
+### BEGIN INIT INFO
+# Provides:          setfilter
+# Required-Start:    ufw
+# Required-Stop:     
+# Default-Start:     S
+# Default-Stop:      
+# Short-Description: set network filters with iptables
+### END INIT INFO
+
+PATH="/sbin:/bin:/usr/sbin:/usr/bin"
+
+. /lib/lsb/init-functions
+
+if [ -s /etc/ufw/ufw.conf ]; then
+    . /etc/ufw/ufw.conf
+else
+    log_failure_msg "Could not find /etc/ufw/ufw.conf (aborting)"
+    exit 1
+fi
+
+RULES_PATH="/etc/ufw"
+
+case "$1" in
+start)
+    if iptables -L LOG_ICMP -t raw -n >/dev/null 2>&1 ; then
+        # if firewall loaded, tell to reload instead
+        log_action_msg "Network filter already started, use 'force-reload'"
+        exit 0
+    fi
+    if [ "$ENABLED" = "yes" ] || [ "$ENABLED" = "YES" ]; then
+        log_action_begin_msg "Setting network filter"
+        error=""
+        
+        tables="raw mangle nat"
+        for table in $tables
+        do
+            RULES="$RULES_PATH/$table.rules"
+            
+            #flush the chains
+            iptables -F -t $table || error="yes"
+            iptables -X -t $table || error="yes"
+            
+            if [ -s "$RULES" ]; then
+                if ! iptables-restore -n < $RULES ; then
+                    log_action_cont_msg "Problem running '$RULES'"
+                    error="yes"
+                fi
+            else
+                log_action_cont_msg "Couldn't find '$RULES'"
+            fi
+        done
+    
+        if [ "$error" = "yes" ]; then
+            log_action_end_msg 1
+            exit 1
+        else
+            log_action_end_msg 0
+        fi
+    else
+        log_action_begin_msg "Skipping network filter (not enabled)"
+        log_action_end_msg 0
+    fi
+    ;;
+stop)
+    if [ "$ENABLED" != "yes" ] && [ "$ENABLED" != "YES" ]; then
+        log_action_begin_msg "Skipping network filter (not enabled)"
+        log_action_end_msg 0
+        exit 0
+    fi
+    
+    log_action_begin_msg "Stopping network filter"
+    error=""
+    
+    tables="raw mangle nat"
+    for table in $tables
+    do
+        iptables -F -t $table || error="yes"
+        iptables -X -t $table || error="yes"
+    done
+    
+    if [ "$error" = "yes" ]; then
+        log_action_end_msg 1
+        exit 1
+    else
+        log_action_end_msg 0
+    fi
+    ;;
+restart|force-reload)
+    if [ "$ENABLED" = "yes" ] || [ "$ENABLED" = "YES" ]; then
+        $0 stop
+        $0 start
+    else
+        log_warning_msg "Skipping $1 (not enabled)"
+    fi
+    ;;
+*)
+    echo "Usage: /etc/init.d/setfilter {start|stop|restart|force-reload}"
+    exit 1
+    ;;
+esac
+
+exit 0
+
Index: tags/r89-trunk/iptables/setlan2wan.sh
===================================================================
--- tags/r89-trunk/iptables/setlan2wan.sh	(revision 90)
+++ tags/r89-trunk/iptables/setlan2wan.sh	(revision 90)
@@ -0,0 +1,35 @@
+#!/bin/sh
+
+# enable access to WAN device on router node from LAN clients
+#
+
+set -x
+
+## INTERFACES(5)
+# IFACE  physical name of the interface being processed
+# METHOD method of the interface (e.g., static)
+# MODE   start if run from ifup, stop if run from ifdown
+# PHASE  as per MODE, but with finer granularity, distinguishing the pre-
+#        up, post-up, pre-down and post-down phases.
+
+LANIF="${1:?"usage: $0 <LAN_device> <IPADDR> "}"
+LANIP="${2:?"usage: $0 <LAN_device> <IPADDR> "}"
+
+WANIP=`/sbin/ip addr show dev ${IFACE} | grep -w inet | tr -s ' ' | cut -d ' ' -f 3 | cut -d / -f 1`
+
+if [ "${PHASE}" = "pre-down" ]; then
+    # delete rule and exit
+    /sbin/iptables -t nat -D PREROUTING -i ${LANIF} -d ${WANIP} -j DNAT --to-destination ${LANIP}
+    echo "remove rule for access to WAN device on router node from LAN clients"
+    exit
+fi
+
+
+# set rule
+(
+sleep 60
+
+/sbin/iptables -t nat -A PREROUTING -i ${LANIF} -d ${WANIP} -j DNAT --to-destination ${LANIP}
+echo "set rule for access to WAN device on router node from LAN clients"
+
+) &
Index: tags/r89-trunk/iptables/setmasq.sh
===================================================================
--- tags/r89-trunk/iptables/setmasq.sh	(revision 90)
+++ tags/r89-trunk/iptables/setmasq.sh	(revision 90)
@@ -0,0 +1,26 @@
+#!/bin/sh
+
+# set IP MASQUERADE with post-up command in INTERFACES(5)
+
+
+set -x
+
+## INTERFACES(5)
+# IFACE  physical name of the interface being processed
+# METHOD method of the interface (e.g., static)
+# MODE   start if run from ifup, stop if run from ifdown
+# PHASE  as per MODE, but with finer granularity, distinguishing the pre-
+#        up, post-up, pre-down and post-down phases.
+
+# optional argument to set default gateway devices connected to WAN manually
+# (try each of them in order)
+
+if [ "${PHASE}" = "post-down" ]; then
+    # remove MASQUERADE rule and exit
+    /sbin/iptables -t nat -D POSTROUTING -o ${IFACE} -j MASQUERADE
+    exit
+fi
+
+
+# set MASQUERADE rule
+/sbin/iptables -t nat -A POSTROUTING -o ${IFACE} -j MASQUERADE
Index: tags/r89-trunk/iptables/setnapt.sh
===================================================================
--- tags/r89-trunk/iptables/setnapt.sh	(revision 90)
+++ tags/r89-trunk/iptables/setnapt.sh	(revision 90)
@@ -0,0 +1,54 @@
+#!/bin/sh
+
+# set IP MASQUERADE for listed devices
+# this script must be set on the LAN gateway device
+
+
+set -x
+
+## INTERFACES(5)
+# IFACE  physical name of the interface being processed
+# METHOD method of the interface (e.g., static)
+# MODE   start if run from ifup, stop if run from ifdown
+# PHASE  as per MODE, but with finer granularity, distinguishing the pre-
+#        up, post-up, pre-down and post-down phases.
+
+# optional argument to set default gateway devices connected to WAN manually
+# (try each of them in order)
+GATEWAYS="$@"
+
+if [ "${PHASE}" = "post-down" ]; then
+    # flush POSTROUTING chain and exit
+    /sbin/iptables -t nat -F POSTROUTING
+    exit
+fi
+
+
+(
+
+# wait for initialization of WAN device with DHCPd 
+sleep 60
+
+if [ -z "${GATEWAYS}" ]; then
+    GATEWAYS=`/sbin/ip route show table main | grep -w default | tr -s ' ' | cut -d ' ' -f 5`
+fi
+
+for GW in ${GATEWAYS}; do
+    if [ ${GW} = ${IFACE} ]; then
+        # skip if device is the LAN gateway
+        continue
+    fi
+    
+    IPADDR=`/sbin/ip addr show dev ${GW} | grep -w inet | tr -s ' ' | cut -d ' ' -f 3 | cut -d / -f 1`
+    if [ -z "${IPADDR}" ]; then
+        # device doesn't seem to have an IP address
+        continue
+    fi
+    
+    ## set masquerade rule to all devices
+    #  because there is no way to know which one is default gateway
+    #  without manual specification
+    /sbin/iptables -t nat -A POSTROUTING -o ${GW} -j MASQUERADE
+done
+
+) &
Index: tags/r89-trunk/iptables/ufw/after.rules
===================================================================
--- tags/r89-trunk/iptables/ufw/after.rules	(revision 90)
+++ tags/r89-trunk/iptables/ufw/after.rules	(revision 90)
@@ -0,0 +1,37 @@
+#
+# rules.input-after
+#
+# Rules that should be run after the ufw command line added rules. Custom
+# rules should be added to one of these chains:
+#   ufw-after-input
+#   ufw-after-output
+#   ufw-after-forward
+#
+
+# Don't delete these required lines, otherwise there will be errors
+*filter
+:ufw-after-input - [0:0]
+:ufw-after-output - [0:0]
+:ufw-after-forward - [0:0]
+# End required lines
+
+## allow connections to the local services from WAN
+# ssh 22/tcp
+-A ufw-after-input -p tcp --syn -m state --state NEW --dport 22 -j ACCEPT
+# https 443/tcp
+-A ufw-after-input -p tcp --syn -m state --state NEW --dport 443 -j ACCEPT
+
+# don't log noisy services by default
+-A ufw-after-input -p udp --dport 137 -j RETURN
+-A ufw-after-input -p udp --dport 138 -j RETURN
+-A ufw-after-input -p tcp --dport 139 -j RETURN
+-A ufw-after-input -p tcp --dport 445 -j RETURN
+-A ufw-after-input -p udp --dport 67 -j RETURN
+-A ufw-after-input -p udp --dport 68 -j RETURN
+
+# catchall for logging
+-A ufw-after-input -m limit --limit 3/min --limit-burst 10 -j LOG --log-prefix "[UFW BLOCK INPUT]: " --log-level err
+-A ufw-after-forward -m limit --limit 3/min --limit-burst 10 -j LOG --log-prefix "[UFW BLOCK FORWARD]: " --log-level err
+
+# don't delete the 'COMMIT' line or these rules won't be processed
+COMMIT
Index: tags/r89-trunk/iptables/ufw/before.rules
===================================================================
--- tags/r89-trunk/iptables/ufw/before.rules	(revision 90)
+++ tags/r89-trunk/iptables/ufw/before.rules	(revision 90)
@@ -0,0 +1,90 @@
+#
+# rules.before
+#
+# Rules that should be run before the ufw command line added rules. Custom
+# rules should be added to one of these chains:
+#   ufw-before-input
+#   ufw-before-output
+#   ufw-before-forward
+#
+
+# Don't delete these required lines, otherwise there will be errors
+*filter
+:ufw-before-input - [0:0]
+:ufw-before-output - [0:0]
+:ufw-before-forward - [0:0]
+:ufw-not-local - [0:0]
+# End required lines
+
+
+# allow all on loopback
+-A ufw-before-input -i lo -j ACCEPT
+-A ufw-before-output -i lo -j ACCEPT
+
+# connection tracking rules
+-A ufw-before-input -m conntrack --ctstate RELATED,ESTABLISHED -j ACCEPT
+-A ufw-before-forward -m conntrack --ctstate RELATED,ESTABLISHED -j ACCEPT
+
+# drop INVALID packets
+# uncomment to log INVALID packets
+-A ufw-before-input -m conntrack --ctstate INVALID -j LOG --log-prefix "[UFW BLOCK INVALID]: " --log-level err -m limit --limit 3/min --limit-burst 10
+-A ufw-before-input -m conntrack --ctstate INVALID -j DROP
+
+## Ingress filter (see RFC 2827) (eth0:LAN<192.168.100.0/24>)
+-A ufw-before-forward -i eth0 -s ! 192.168.100.0/24 -j LOG --log-tcp-options --log-ip-options --log-prefix "[UFW BLOCK LOG_INGRESS]: " --log-level err -m limit --limit 3/min --limit-burst 10
+-A ufw-before-forward -i eth0 -s ! 192.168.100.0/24 -j DROP
+
+## DROP CIFS(Samba) access from/to WAN(eth1)
+-A ufw-before-input   -i eth1 -p tcp -m multiport --dports 135,137:139,445 -j DROP
+-A ufw-before-input   -i eth1 -p udp -m multiport --dports 135,137:139,445 -j DROP
+-A ufw-before-forward -i eth1 -p tcp -m multiport --dports 135,137:139,445 -j DROP
+-A ufw-before-forward -i eth1 -p udp -m multiport --dports 135,137:139,445 -j DROP
+-A ufw-before-forward -o eth1 -p tcp -m multiport --dports 135,137:139,445 -j DROP
+-A ufw-before-forward -o eth1 -p udp -m multiport --dports 135,137:139,445 -j DROP
+-A ufw-before-output  -o eth1 -p tcp -m multiport --dports 135,137:139,445 -j DROP
+-A ufw-before-output  -o eth1 -p udp -m multiport --dports 135,137:139,445 -j DROP
+
+## Access from LAN
+-A ufw-before-input -i eth0 -j ACCEPT
+-A ufw-before-forward -i eth0 -j ACCEPT
+
+# connection tracking for outbound
+-A ufw-before-output -p tcp -m state --state NEW,ESTABLISHED,RELATED -j ACCEPT
+-A ufw-before-output -p udp -m state --state NEW,ESTABLISHED,RELATED -j ACCEPT
+
+# ok icmp codes
+-A ufw-before-input -p icmp --icmp-type destination-unreachable -j ACCEPT
+-A ufw-before-input -p icmp --icmp-type source-quench -j ACCEPT
+-A ufw-before-input -p icmp --icmp-type time-exceeded -j ACCEPT
+-A ufw-before-input -p icmp --icmp-type parameter-problem -j ACCEPT
+-A ufw-before-input -p icmp --icmp-type echo-request -j ACCEPT
+
+# allow dhcp client to work
+-A ufw-before-input -p udp --sport 67 --dport 68 -j ACCEPT
+
+#
+# ufw-not-local
+#
+-A ufw-before-input -j ufw-not-local
+
+# if LOCAL, RETURN
+-A ufw-not-local -m addrtype --dst-type LOCAL -j RETURN
+
+# if MULTICAST, RETURN
+-A ufw-not-local -m addrtype --dst-type MULTICAST -j RETURN
+
+# if BROADCAST, RETURN
+-A ufw-not-local -m addrtype --dst-type BROADCAST -j RETURN
+
+-A ufw-not-local -m limit --limit 3/min --limit-burst 10 -j LOG --log-prefix "[UFW BLOCK NOT-TO-ME]: " --log-level err
+
+# all other non-local packets are dropped
+-A ufw-not-local -j DROP
+
+# allow MULTICAST, be sure the MULTICAST line above is uncommented
+-A ufw-before-input -s 224.0.0.0/4 -j ACCEPT
+-A ufw-before-input -d 224.0.0.0/4 -j ACCEPT
+
+
+# don't delete the 'COMMIT' line or these rules won't be processed
+COMMIT
Index: tags/r89-trunk/iptables/ufw/mangle.rules
===================================================================
--- tags/r89-trunk/iptables/ufw/mangle.rules	(revision 90)
+++ tags/r89-trunk/iptables/ufw/mangle.rules	(revision 90)
@@ -0,0 +1,12 @@
+#
+# This file is used by /etc/init.d/setfilter
+#
+# Rules that should be stored in mangle table.
+
+
+*mangle
+# to overcome criminally braindead ISPs or servers which block ICMP Fragmentation Needed packets
+# see iptables(8)
+-A FORWARD -p tcp --tcp-flags SYN,RST SYN -j TCPMSS --clamp-mss-to-pmtu
+
+COMMIT
Index: tags/r89-trunk/iptables/ufw/nat.rules
===================================================================
--- tags/r89-trunk/iptables/ufw/nat.rules	(revision 90)
+++ tags/r89-trunk/iptables/ufw/nat.rules	(revision 90)
@@ -0,0 +1,18 @@
+#
+# This file is used by /etc/init.d/setfilter
+#
+# Rules that should be stored in nat table.
+# These are mainly used to IP MASQUERADE and REDIRECT.
+
+
+*nat
+
+## port REDIRECT to local services
+# 8443/tcp -> 443/tcp
+-A PREROUTING -p tcp --dport 8443 -j REDIRECT --to-port 443
+# WAN 8000/tcp -> 443/tcp
+-A PREROUTING -p tcp -i eth1 --dport 8000 -j REDIRECT --to-port 443
+# LAN 8000/tcp -> 22/tcp
+-A PREROUTING -p tcp -i eth0 --dport 8000 -j REDIRECT --to-port 22
+
+COMMIT
Index: tags/r89-trunk/iptables/ufw/raw.rules
===================================================================
--- tags/r89-trunk/iptables/ufw/raw.rules	(revision 90)
+++ tags/r89-trunk/iptables/ufw/raw.rules	(revision 90)
@@ -0,0 +1,33 @@
+#
+# This file is used by /etc/init.d/setfilter
+#
+# Rules that should be stored in raw table.
+# These are mainly used to filter evil or wrong packets.
+
+
+*raw
+:LOG_ICMP - [0:0]
+:LOG_SPOOF - [0:0]
+
+## LOG and DROP fragmented packets (not head fragments)
+-A PREROUTING --fragment -j LOG --log-prefix "[UFW BLOCK FRAGMENTED]: " --log-level err -m limit --limit 3/min --limit-burst 10
+-A PREROUTING --fragment -j DROP
+
+## LOG and DROP strange icmp packets
+-A LOG_ICMP -j LOG --log-prefix "[UFW BLOCK BAD-ICMP]: " --log-level err -m limit --limit 3/min --limit-burst 10
+-A LOG_ICMP -j DROP
+# Too large icmp requests
+-A PREROUTING -p icmp --icmp-type echo-request -m length --length 128: -j LOG_ICMP
+# Too many times of icmp requests (only 5 packets per second if over 10pkts/sec)
+-A PREROUTING -p icmp --icmp-type echo-request -m limit --limit 5/s --limit-burst 10 -j ACCEPT
+-A PREROUTING -p icmp --icmp-type echo-request -j LOG_ICMP
+
+## LOG and DROP IP spoofing (eth1:WAN)
+-A LOG_SPOOF -j LOG --log-prefix "[UFW BLOCK IP-SPOOFING]: " --log-level err -m limit --limit 3/min --limit-burst 10
+-A LOG_SPOOF -j DROP
+-A PREROUTING -i eth1 -s    127.0.0.0/8 -j LOG_SPOOF
+-A PREROUTING -i eth1 -s     10.0.0.0/8 -j LOG_SPOOF
+-A PREROUTING -i eth1 -s  172.16.0.0/12 -j LOG_SPOOF
+-A PREROUTING -i eth1 -s 192.168.0.0/16 -j LOG_SPOOF
+
+COMMIT
Index: tags/r89-trunk/misc/checkalive.pl
===================================================================
--- tags/r89-trunk/misc/checkalive.pl	(revision 90)
+++ tags/r89-trunk/misc/checkalive.pl	(revision 90)
@@ -0,0 +1,35 @@
+#!/usr/bin/perl -w
+
+use strict;
+use warnings;
+use utf8;
+
+use Crypt::SSLeay;
+use LWP::UserAgent;
+use HTTP::Request::Common;
+use YAML::Tiny;
+use FindBin qw($Bin);
+
+my $conf = YAML::Tiny->read("$Bin/checkalive.yml")->[0];
+
+my $ua = LWP::UserAgent->new;
+
+foreach my $url (@{$conf->{urls}}) {
+    my $response = $ua->request(GET $url);
+    logging($response->status_line, " ", $url);
+}
+
+sub logging {
+    my (@msg) = @_;
+    
+    my $logfile = "$Bin/checkalive." . today() . ".log";
+    open LOG, ">>$logfile";
+    print LOG "[" . localtime() . "] ($$) " , @msg, "\n";
+    close LOG;
+}
+
+sub today {
+    my ($s, $mi, $h, $d, $mo, $y, $w) = localtime();
+    $mo++; $y += 1900;
+    return sprintf("%4d%02d%02d", $y, $mo, $d, $h, $mi, $s);
+}
Index: tags/r89-trunk/misc/checkalive.yml
===================================================================
--- tags/r89-trunk/misc/checkalive.yml	(revision 90)
+++ tags/r89-trunk/misc/checkalive.yml	(revision 90)
@@ -0,0 +1,5 @@
+urls :
+  - http://www.coins.tsukuba.ac.jp/
+  - https://www.coins.tsukuba.ac.jp/
+  - http://www.coins.tsukuba.ac.jp/~s0711489/
+  - https://www.coins.tsukuba.ac.jp/~s0711489/
Index: tags/r89-trunk/openssl/CA.sh
===================================================================
--- tags/r89-trunk/openssl/CA.sh	(revision 90)
+++ tags/r89-trunk/openssl/CA.sh	(revision 90)
@@ -0,0 +1,140 @@
+#!/bin/sh
+#
+# CA - wrapper around ca to make it easier to use ... basically ca requires
+#      some setup stuff to be done before you can use it and this makes
+#      things easier between now and when Eric is convinced to fix it :-)
+#
+# CA -newca ... will setup the right stuff
+# CA -newreq ... will generate a certificate request 
+# CA -sign ... will sign the generated request and output 
+#
+# At the end of that grab newreq.pem and newcert.pem (one has the key 
+# and the other the certificate) and cat them together and that is what
+# you want/need ... I'll make even this a little cleaner later.
+#
+#
+# 12-Jan-96 tjh    Added more things ... including CA -signcert which
+#                  converts a certificate to a request and then signs it.
+# 10-Jan-96 eay    Fixed a few more bugs and added the SSLEAY_CONFIG
+#		   environment variable so this can be driven from
+#		   a script.
+# 25-Jul-96 eay    Cleaned up filenames some more.
+# 11-Jun-96 eay    Fixed a few filename missmatches.
+# 03-May-96 eay    Modified to use 'ssleay cmd' instead of 'cmd'.
+# 18-Apr-96 tjh    Original hacking
+#
+# Tim Hudson
+# tjh@cryptsoft.com
+#
+
+# default openssl.cnf file has setup as per the following
+# demoCA ... where everything is stored
+
+if [ -z "$OPENSSL" ]; then OPENSSL=openssl; fi
+
+DAYS="-days 3650"	# 10 years
+CADAYS="-days 3650"	# 10 years
+REQ="$OPENSSL req $SSLEAY_CONFIG"
+CA="$OPENSSL ca $SSLEAY_CONFIG"
+VERIFY="$OPENSSL verify"
+X509="$OPENSSL x509"
+
+CATOP=./demoCA
+CAKEY=./cakey.pem
+CAREQ=./careq.pem
+CACERT=./cacert.pem
+
+for i
+do
+case $i in
+-\?|-h|-help)
+    echo "usage: CA -newcert|-newreq|-newca|-sign|-verify" >&2
+    exit 0
+    ;;
+-newcert) 
+    # create a certificate
+    $REQ -new -x509 -keyout newkey.pem -out newcert.pem $DAYS
+    RET=$?
+    echo "Certificate is in newcert.pem, private key is in newkey.pem"
+    ;;
+-newreq) 
+    # create a certificate request
+    $REQ -new -keyout newkey.pem -out newreq.pem $DAYS
+    RET=$?
+    echo "Request is in newreq.pem, private key is in newkey.pem"
+    ;;
+-newca)     
+    # if explicitly asked for or it doesn't exist then setup the directory
+    # structure that Eric likes to manage things 
+    NEW="1"
+    if [ "$NEW" -o ! -f ${CATOP}/serial ]; then
+	# create the directory hierarchy
+	mkdir ${CATOP} 
+	mkdir ${CATOP}/certs 
+	mkdir ${CATOP}/crl 
+	mkdir ${CATOP}/newcerts
+	mkdir ${CATOP}/private
+	echo "00" > ${CATOP}/serial
+	touch ${CATOP}/index.txt
+    fi
+    if [ ! -f ${CATOP}/private/$CAKEY ]; then
+	echo "CA certificate filename (or enter to create)"
+	read FILE
+
+	# ask user for existing CA certificate
+	if [ "$FILE" ]; then
+	    cp $FILE ${CATOP}/private/$CAKEY
+	    RET=$?
+	else
+	    echo "Making CA certificate ..."
+	    $REQ -new -keyout ${CATOP}/private/$CAKEY \
+			   -out ${CATOP}/$CAREQ
+	    $CA -out ${CATOP}/$CACERT $CADAYS -batch \
+			   -keyfile ${CATOP}/private/$CAKEY -selfsign \
+			   -extensions v3_ca \
+			   -infiles ${CATOP}/$CAREQ 
+	    RET=$?
+	fi
+    fi
+    ;;
+-xsign)
+    $CA -policy policy_anything -infiles newreq.pem 
+    RET=$?
+    ;;
+-sign|-signreq) 
+    $CA -policy policy_anything -out newcert.pem -infiles newreq.pem
+    RET=$?
+    cat newcert.pem
+    echo "Signed certificate is in newcert.pem"
+    ;;
+-signcert) 
+    echo "Cert passphrase will be requested twice - bug?"
+    $X509 -x509toreq -in newreq.pem -signkey newreq.pem -out tmp.pem
+    $CA -policy policy_anything -out newcert.pem -infiles tmp.pem
+    cat newcert.pem
+    echo "Signed certificate is in newcert.pem"
+    ;;
+-verify) 
+    shift
+    if [ -z "$1" ]; then
+	    $VERIFY -CAfile $CATOP/$CACERT newcert.pem
+	    RET=$?
+    else
+	for j
+	do
+	    $VERIFY -CAfile $CATOP/$CACERT $j
+	    if [ $? != 0 ]; then
+		    RET=$?
+	    fi
+	done
+    fi
+    exit 0
+    ;;
+*)
+    echo "Unknown arg $i";
+    exit 1
+    ;;
+esac
+done
+exit $RET
+
Index: tags/r89-trunk/openssl/openssl.cnf
===================================================================
--- tags/r89-trunk/openssl/openssl.cnf	(revision 90)
+++ tags/r89-trunk/openssl/openssl.cnf	(revision 90)
@@ -0,0 +1,313 @@
+#
+# OpenSSL example configuration file.
+# This is mostly being used for generation of certificate requests.
+#
+
+# This definition stops the following lines choking if HOME isn't
+# defined.
+HOME			= .
+RANDFILE		= $ENV::HOME/.rnd
+
+# Extra OBJECT IDENTIFIER info:
+#oid_file		= $ENV::HOME/.oid
+oid_section		= new_oids
+
+# To use this configuration file with the "-extfile" option of the
+# "openssl x509" utility, name here the section containing the
+# X.509v3 extensions to use:
+# extensions		= 
+# (Alternatively, use a configuration file that has only
+# X.509v3 extensions in its main [= default] section.)
+
+[ new_oids ]
+
+# We can add new OIDs in here for use by 'ca' and 'req'.
+# Add a simple OID like this:
+# testoid1=1.2.3.4
+# Or use config file substitution like this:
+# testoid2=${testoid1}.5.6
+
+####################################################################
+[ ca ]
+default_ca	= CA_default		# The default ca section
+
+####################################################################
+[ CA_default ]
+
+dir		= ./demoCA		# Where everything is kept
+certs		= $dir/certs		# Where the issued certs are kept
+crl_dir		= $dir/crl		# Where the issued crl are kept
+database	= $dir/index.txt	# database index file.
+#unique_subject	= no			# Set to 'no' to allow creation of
+					# several ctificates with same subject.
+new_certs_dir	= $dir/newcerts		# default place for new certs.
+
+certificate	= $dir/cacert.pem 	# The CA certificate
+serial		= $dir/serial 		# The current serial number
+crlnumber	= $dir/crlnumber	# the current crl number
+					# must be commented out to leave a V1 CRL
+crl		= $dir/crl.pem 		# The current CRL
+private_key	= $dir/private/cakey.pem# The private key
+RANDFILE	= $dir/private/.rand	# private random number file
+
+x509_extensions	= usr_cert		# The extentions to add to the cert
+
+# Comment out the following two lines for the "traditional"
+# (and highly broken) format.
+name_opt 	= ca_default		# Subject Name options
+cert_opt 	= ca_default		# Certificate field options
+
+# Extension copying option: use with caution.
+# copy_extensions = copy
+
+# Extensions to add to a CRL. Note: Netscape communicator chokes on V2 CRLs
+# so this is commented out by default to leave a V1 CRL.
+# crlnumber must also be commented out to leave a V1 CRL.
+# crl_extensions	= crl_ext
+
+default_days	= 3650			# how long to certify for
+default_crl_days= 30			# how long before next CRL
+default_md	= sha1			# which md to use.
+preserve	= no			# keep passed DN ordering
+
+# A few difference way of specifying how similar the request should look
+# For type CA, the listed attributes must be the same, and the optional
+# and supplied fields are just that :-)
+policy		= policy_match
+
+# For the CA policy
+[ policy_match ]
+countryName		= match
+stateOrProvinceName	= match
+organizationName	= match
+organizationalUnitName	= optional
+commonName		= supplied
+emailAddress		= optional
+
+# For the 'anything' policy
+# At this point in time, you must list all acceptable 'object'
+# types.
+[ policy_anything ]
+countryName		= optional
+stateOrProvinceName	= optional
+localityName		= optional
+organizationName	= optional
+organizationalUnitName	= optional
+commonName		= supplied
+emailAddress		= optional
+
+####################################################################
+[ req ]
+default_bits		= 1024
+default_keyfile 	= privkey.pem
+distinguished_name	= req_distinguished_name
+attributes		= req_attributes
+x509_extensions	= v3_ca	# The extentions to add to the self signed cert
+
+# Passwords for private keys if not present they will be prompted for
+# input_password = secret
+# output_password = secret
+
+# This sets a mask for permitted string types. There are several options. 
+# default: PrintableString, T61String, BMPString.
+# pkix	 : PrintableString, BMPString.
+# utf8only: only UTF8Strings.
+# nombstr : PrintableString, T61String (no BMPStrings or UTF8Strings).
+# MASK:XXXX a literal mask value.
+# WARNING: current versions of Netscape crash on BMPStrings or UTF8Strings
+# so use this option with caution!
+string_mask = nombstr
+
+# req_extensions = v3_req # The extensions to add to a certificate request
+
+[ req_distinguished_name ]
+countryName			= Country Name (2 letter code)
+countryName_default		= AU
+countryName_min			= 2
+countryName_max			= 2
+
+stateOrProvinceName		= State or Province Name (full name)
+stateOrProvinceName_default	= Some-State
+
+localityName			= Locality Name (eg, city)
+
+0.organizationName		= Organization Name (eg, company)
+0.organizationName_default	= Internet Widgits Pty Ltd
+
+# we can do this but it is not needed normally :-)
+#1.organizationName		= Second Organization Name (eg, company)
+#1.organizationName_default	= World Wide Web Pty Ltd
+
+organizationalUnitName		= Organizational Unit Name (eg, section)
+#organizationalUnitName_default	=
+
+commonName			= Common Name (eg, YOUR name)
+commonName_max			= 64
+
+emailAddress			= Email Address
+emailAddress_max		= 64
+
+# SET-ex3			= SET extension number 3
+
+[ req_attributes ]
+challengePassword		= A challenge password
+challengePassword_min		= 4
+challengePassword_max		= 20
+
+unstructuredName		= An optional company name
+
+[ usr_cert ]
+
+# These extensions are added when 'ca' signs a request.
+
+# This goes against PKIX guidelines but some CAs do it and some software
+# requires this to avoid interpreting an end user certificate as a CA.
+
+basicConstraints=CA:FALSE
+
+# Here are some examples of the usage of nsCertType. If it is omitted
+# the certificate can be used for anything *except* object signing.
+
+# This is OK for an SSL server.
+nsCertType			= server
+
+# For an object signing certificate this would be used.
+# nsCertType = objsign
+
+# For normal client use this is typical
+# nsCertType = client, email
+
+# and for everything including object signing:
+# nsCertType = client, email, objsign
+
+# This is typical in keyUsage for a client certificate.
+# keyUsage = nonRepudiation, digitalSignature, keyEncipherment
+
+# This will be displayed in Netscape's comment listbox.
+nsComment			= "OpenSSL Generated Certificate"
+
+# PKIX recommendations harmless if included in all certificates.
+subjectKeyIdentifier=hash
+authorityKeyIdentifier=keyid,issuer
+
+# This stuff is for subjectAltName and issuerAltname.
+# Import the email address.
+# subjectAltName=email:copy
+# An alternative to produce certificates that aren't
+# deprecated according to PKIX.
+# subjectAltName=email:move
+
+# Copy subject details
+# issuerAltName=issuer:copy
+
+#nsCaRevocationUrl		= http://www.domain.dom/ca-crl.pem
+#nsBaseUrl
+#nsRevocationUrl
+#nsRenewalUrl
+#nsCaPolicyUrl
+#nsSslServerName
+
+[ v3_req ]
+
+# Extensions to add to a certificate request
+
+basicConstraints = CA:FALSE
+keyUsage = nonRepudiation, digitalSignature, keyEncipherment
+
+[ v3_ca ]
+
+
+# Extensions for a typical CA
+
+
+# PKIX recommendation.
+
+subjectKeyIdentifier=hash
+
+authorityKeyIdentifier=keyid:always,issuer:always
+
+# This is what PKIX recommends but some broken software chokes on critical
+# extensions.
+#basicConstraints = critical,CA:true
+# So we do this instead.
+basicConstraints = CA:true
+
+# Key usage: this is typical for a CA certificate. However since it will
+# prevent it being used as an test self-signed certificate it is best
+# left out by default.
+# keyUsage = cRLSign, keyCertSign
+
+# Some might want this also
+nsCertType = sslCA, emailCA
+
+# Include email address in subject alt name: another PKIX recommendation
+# subjectAltName=email:copy
+# Copy issuer details
+# issuerAltName=issuer:copy
+
+# DER hex encoding of an extension: beware experts only!
+# obj=DER:02:03
+# Where 'obj' is a standard or added object
+# You can even override a supported extension:
+# basicConstraints= critical, DER:30:03:01:01:FF
+
+[ crl_ext ]
+
+# CRL extensions.
+# Only issuerAltName and authorityKeyIdentifier make any sense in a CRL.
+
+# issuerAltName=issuer:copy
+authorityKeyIdentifier=keyid:always,issuer:always
+
+[ proxy_cert_ext ]
+# These extensions should be added when creating a proxy certificate
+
+# This goes against PKIX guidelines but some CAs do it and some software
+# requires this to avoid interpreting an end user certificate as a CA.
+
+basicConstraints=CA:FALSE
+
+# Here are some examples of the usage of nsCertType. If it is omitted
+# the certificate can be used for anything *except* object signing.
+
+# This is OK for an SSL server.
+# nsCertType			= server
+
+# For an object signing certificate this would be used.
+# nsCertType = objsign
+
+# For normal client use this is typical
+# nsCertType = client, email
+
+# and for everything including object signing:
+# nsCertType = client, email, objsign
+
+# This is typical in keyUsage for a client certificate.
+# keyUsage = nonRepudiation, digitalSignature, keyEncipherment
+
+# This will be displayed in Netscape's comment listbox.
+nsComment			= "OpenSSL Generated Certificate"
+
+# PKIX recommendations harmless if included in all certificates.
+subjectKeyIdentifier=hash
+authorityKeyIdentifier=keyid,issuer:always
+
+# This stuff is for subjectAltName and issuerAltname.
+# Import the email address.
+# subjectAltName=email:copy
+# An alternative to produce certificates that aren't
+# deprecated according to PKIX.
+# subjectAltName=email:move
+
+# Copy subject details
+# issuerAltName=issuer:copy
+
+#nsCaRevocationUrl		= http://www.domain.dom/ca-crl.pem
+#nsBaseUrl
+#nsRevocationUrl
+#nsRenewalUrl
+#nsCaPolicyUrl
+#nsSslServerName
+
+# This really needs to be in place for it to be a proxy certificate.
+proxyCertInfo=critical,language:id-ppl-anyLanguage,pathlen:3,policy:foo
Index: tags/r89-trunk/pxelinux.cfg/default
===================================================================
--- tags/r89-trunk/pxelinux.cfg/default	(revision 90)
+++ tags/r89-trunk/pxelinux.cfg/default	(revision 90)
@@ -0,0 +1,24 @@
+TIMEOUT 300
+
+menu title Installer multi boot menu
+
+LABEL localHDD
+localboot 0
+
+menu begin lucid-amd64
+	label backmain
+		menu label ^Back..
+		menu exit
+	menu title Install Ubuntu 10.04 on AMD64
+	include ubuntu-installer/amd64/boot-screens/menu.cfg
+	default ubuntu-installer/amd64/boot-screens/vesamenu.c32
+menu end
+
+menu begin lucid-i386
+	label backmain
+		menu label ^Back..
+		menu exit
+	menu title Install Ubuntu 10.04 on Intel x86
+	include ubuntu-installer/i386/boot-screens/menu.cfg
+	default ubuntu-installer/i386/boot-screens/vesamenu.c32
+menu end
Index: tags/r89-trunk/sakura-editor/DrRacket.kwd
===================================================================
--- tags/r89-trunk/sakura-editor/DrRacket.kwd	(revision 90)
+++ tags/r89-trunk/sakura-editor/DrRacket.kwd	(revision 90)
@@ -0,0 +1,41 @@
+// DrRacket "Advanced Student" keywords definition file
+
+// definition
+define
+define-struct
+
+// expr
+begin
+begin0
+set!
+delay
+lambda
+É
+local
+letrec
+shared
+let
+let*
+recur
+cond
+else
+case
+if
+when
+unless
+and
+or
+time
+empty
+true
+false
+
+// test-case
+check-expect
+check-within
+check-member-of
+check-range
+check-error
+
+// library-require
+require
Index: tags/r89-trunk/sakura-editor/DrRacket2.kwd
===================================================================
--- tags/r89-trunk/sakura-editor/DrRacket2.kwd	(revision 90)
+++ tags/r89-trunk/sakura-editor/DrRacket2.kwd	(revision 90)
@@ -0,0 +1,285 @@
+// DrRacket "Advanced Student" keywords definition file
+// prim-op
+
+// Numbers: Integers, Rationals, Reals, Complex, Exacts, Inexacts
+<
+<=
+=
+>
+>=
+abs
+acos
+add1
+angle
+asin
+atan
+ceiling
+complex?
+conjugate
+cos
+cosh
+current-seconds
+denominator
+e
+even?
+exact->inexact
+exact?
+exp
+expt
+floor
+gcd
+imag-part
+inexact->exact
+inexact?
+integer->char
+integer-sqrt
+integer?
+lcm
+log
+magnitude
+make-polar
+make-rectangular
+max
+min
+modulo
+negative?
+number->string
+number?
+numerator
+odd?
+pi
+positive?
+quotient
+random
+rational?
+real-part
+real?
+remainder
+round
+sgn
+sin
+sinh
+sqr
+sqrt
+sub1
+tan
+zero?
+
+// Booleans
+boolean=?
+boolean?
+false?
+not
+
+// Symbols
+symbol->string
+symbol=?
+symbol?
+
+// Lists
+append
+assoc
+assq
+caaar
+caadr
+caar
+cadddr
+caddr
+cadr
+car
+cdaar
+cdadr
+cdar
+cddar
+cdddr
+cddr
+cdr
+cons
+cons?
+eighth
+empty?
+fifth
+first
+fourth
+length
+list
+list*
+list-ref
+list?
+make-list
+member
+member?
+memq
+memv
+null
+null?
+pair?
+remove
+rest
+reverse
+second
+seventh
+sixth
+third
+
+// Posns
+make-posn
+posn
+posn-x
+posn-y
+posn?
+set-posn-x!
+set-posn-y!
+
+// Characters
+char->integer
+char-alphabetic?
+char-ci<=?
+char-ci<?
+char-ci=?
+char-ci>=?
+char-ci>?
+char-downcase
+char-lower-case?
+char-numeric?
+char-upcase
+char-upper-case?
+char-whitespace?
+char<=?
+char<?
+char=?
+char>=?
+char>?
+char?
+
+// Strings
+explode
+format
+implode
+int->string
+list->string
+make-string
+replicate
+string
+string->int
+string->list
+string->number
+string->symbol
+string-alphabetic?
+string-append
+string-ci<=?
+string-ci<?
+string-ci=?
+string-ci>=?
+string-ci>?
+string-copy
+string-ith
+string-length
+string-lower-case?
+string-numeric?
+string-ref
+string-upper-case?
+string-whitespace?
+string<=?
+string<?
+string=?
+string>=?
+string>?
+string?
+substring
+
+// Images
+image=?
+image?
+
+// Misc
+=~
+current-milliseconds
+eof
+eof-object?
+eq?
+equal?
+equal~?
+eqv?
+error
+exit
+force
+gensym
+identity
+promise?
+sleep
+struct?
+void
+void?
+
+// Numbers
+*
++
+-
+/
+
+// Higher-Order Functions
+andmap
+apply
+argmax
+argmin
+build-list
+build-string
+compose
+filter
+foldl
+foldr
+for-each
+map
+memf
+ormap
+procedure?
+quicksort
+sort
+
+// Reading and Printing
+display
+newline
+pretty-print
+print
+printf
+read
+with-input-from-file
+with-input-from-string
+with-output-to-file
+with-output-to-string
+write
+
+// Vectors
+build-vector
+make-vector
+vector
+vector-length
+vector-ref
+vector-set!
+vector?
+
+// Boxes
+box
+box?
+set-box!
+unbox
+
+// Hash Tables
+hash-copy
+hash-count
+hash-eq?
+hash-equal?
+hash-eqv?
+hash-for-each
+hash-has-key?
+hash-map
+hash-ref
+hash-ref!
+hash-remove!
+hash-set!
+hash-update!
+hash?
+make-hash
+make-hasheq
+make-hasheqv
Index: tags/r89-trunk/snuploader/upload.cgi
===================================================================
--- tags/r89-trunk/snuploader/upload.cgi	(revision 90)
+++ tags/r89-trunk/snuploader/upload.cgi	(revision 90)
@@ -0,0 +1,1081 @@
+#!/usr/bin/perl
+use vars qw(%set %in);
+use strict;
+$set{'log_file'} = './log.cgi';		#Ot@C¼
+$set{'max_log'} = 30;		#Û
+$set{'max_size'} = 1*1024;		#ÅåeeÊ(KB)
+$set{'min_flag'} = 0;		#Å¬eÊ§Àðgp·é=1
+$set{'min_size'} = 100;		#Å¬eeÊ(KB)
+$set{'max_all_flag'} = 0;		#eÊ§Àðgp·é=1
+$set{'max_all_size'} = 20*1024;		#§ÀeÊ(KB)
+$set{'file_pre'} = 'up';		#t@CÚª«
+$set{'pagelog'} = 10;		#1y[WÉ\¦·ét@C
+$set{'base_html'} = 'upload.html';		#1y[WÚÌt@C¼
+$set{'interval'} = 0;		#¯êIPeÔub
+$set{'deny_host'} = '';		#eÖ~IP/HOST ,ÅæØé ex.(bbtec.net,219.119.66,ac.jp)
+$set{'admin_name'} = 'admin';		#ÇÒOCID
+$set{'admin_pass'} = '1234';		#ÇÒpX[h
+
+# Èº5ÚðÄÝè·éÛÉÍPATHCfBNgÍ / ÅIíé±Æ
+# $set{'html_dir'},$set{'base_cgi'}ð ./ ÈOÉÝè·éê,
+# Ü½ÍDLkeyðgpµ È¨©ÂHTMLLbV
+($set{'dummy_html'} = 2 or 3)ðgp·éêÍ
+# $set{'base_cgi'} , $set{'http_html_path'} , $set{'http_src_path'} ðtpX(http://`` or /``)ÅLq·é
+$set{'html_dir'} = './';		# àHTMLÛ¶fBNg
+$set{'src_dir'} = './src/';		# àt@CÛ¶fBNg
+$set{'base_cgi'} = './upload.cgi'; # ±ÌXNvg¼ http://`ÌwèÂ\
+$set{'http_html_path'} = './';		# htmlQÆ httpPATH http://`ÌwèÂ\
+$set{'http_src_path'} = './src/';		# fileQÆ httpPATH http://`ÌwèÂ\
+
+$set{'dlkey'} = 0;		# DLKeyðgp·é=1,DLkeyK{=2
+$set{'up_ext'} = 'txt,lzh,zip,rar,gca,mpg,mp3,avi,swf,bmp,jpg,gif,png'; #Abv[hÅ«éî{g£q ¼pp¬¶ ,ÅæØé
+$set{'up_all'} = 0;		#o^ÈOÌàÌàUP³¹çêéæ¤É·é=1
+$set{'ext_org'} = 0;	#$set{'up_all'}ª1ÌIWiÌg£qÉ·é=1
+$set{'deny_ext'} = 'php,php3,phtml,rb,sh,bat,dll'; 	#eÖ~Ìg£q ¼pp¬¶ ,ÅæØé
+$set{'change_ext'} = 'cgi->txt,pl->txt,log->txt,jpeg->jpg,mpeg->mpg';		#g£qÏ· O->ã ¼pp¬¶ ,ÅæØé
+
+$set{'home_url'} = '';		#[HOME]ÌNæ ÎpXÍ http://©çnÜéâÎpX
+$set{'html_all'} = 1;		#[ALL]ðo·=1
+$set{'dummy_html'} = 0;		#t@CÂÊHTMLðì¬·é Êít@CÌÝ=1,DLKeyÝèt@CÌÝ=2,·×Ä=3
+$set{'find_crypt'} = 1;		#Ã»ZIPðo·é=1
+$set{'binary_compare'} = 0;		#ù¶t@CÆoCiär·é=1
+$set{'post_flag'} = 0;		#PostKeyðgp·é=1
+$set{'post_key'} = 'postkey';		#PostKey ,ÅæØéÆ¡wè ex.(postkey1,postkey2)
+$set{'disp_error'} = 1;		#[U[ÉG[ð\¦·é=1
+$set{'error_level'} = 1;		#G[OðL^·é=1
+$set{'error_log'} = './error.cgi';		#G[Ot@C¼
+$set{'error_size'} = 1024;	# G[OÅåeÊ(KB) §ÀÈµ=0
+$set{'zero_clear'} = 1;		#t@Cª©Â©çÈ¢êO©çí·é=1
+
+$set{'disp_comment'} = 1; 	#Rgð\¦·é=1
+$set{'disp_date'} = 1;		#útð\¦·é=1
+$set{'disp_size'} = 1;		#TCYð\¦·é=1
+$set{'disp_mime'} = 1;		#MIMETYPEð\¦·é=1
+$set{'disp_orgname'} = 1;	#IWit@C¼ð\¦·é=1
+
+$set{'per_upfile'} = 0666;		#Abv[ht@CÌp[~bV suexec=0604,other=0666
+$set{'per_dir'} = 0777;		#\[XAbvfBNgÌp[~bV suexec=0701,other=0777
+$set{'per_logfile'} = 0666;		#Ot@CÌp[~bV@suexec=0600,other=0666
+$set{'link_target'} = '';		#target®«
+
+#------
+$set{'ver'} = '2005/10/10e';
+$set{'char_delname'} = 'D';
+
+$in{'time'} = time(); $in{'date'} = conv_date($in{'time'});
+$in{'addr'} = $ENV{'REMOTE_ADDR'};
+$in{'host'} = gethostbyaddr(pack('C4',split(/\./, $in{'addr'})), 2) || $ENV{'REMOTE_HOST'} || '(none)';
+
+if($in{'addr'} eq $in{'host'}){ $in{'host'} = '(none)'; }
+
+$set{'html_head'} =<<"EOM";
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
+<html lang="ja">
+<HEAD>
+<META name="robots" content="noindex,nofollow">
+<META name="ROBOTS" content="NOINDEX,NOFOLLOW">
+<META http-equiv="Content-type" content="text/html; charset=Shift_JIS">
+<META http-equiv="Pragma" content="no-cache">
+<META http-equiv="Cache-Control" content="no-cache">
+<META http-equiv="Expires" content="0">
+<TITLE>Uploader</TITLE>
+EOM
+
+$set{'html_css'} =<<"EOM";
+<META http-equiv="Content-Style-Type" content="text/css">
+<STYLE type="text/css"><!--
+input,td{ font-size: 10pt;font-family:Chicago,Verdana,Arial,sans-serif,"lr oSVbN"; }
+a:hover { background-color:#EECCCC; }
+input,textarea{	border-top : 1px solid ; border-bottom : 1px solid ; border-left : 1px solid ; border-right : 1px solid ;font-size:10pt;background-color:#FFFFFF; }
+-->
+</STYLE>
+EOM
+
+unless(-e $set{'log_file'}){ &init; }
+unless(-e $set{'base_html'}){ &makehtml; }
+{ #fR[h
+	my $readbuffsize = 1024*8;
+	if ($ENV{'REQUEST_METHOD'} eq "POST" && $ENV{'CONTENT_TYPE'} =~ /multipart\/form-data/i){
+		if ($ENV{'CONTENT_LENGTH'} > ($set{'max_size'} * 1024 + 1024)){ if($ENV{'SERVER_SOFTWARE'} =~ /IIS/){ while(read(STDIN,my $buff,$readbuffsize)){} } &error(106,$ENV{'CONTENT_LENGTH'});}
+	}else{
+		if ($ENV{'CONTENT_LENGTH'} > 1024*100){ error(98); }
+	}
+	my %ck; foreach(split(/;/,$ENV{'HTTP_COOKIE'})){ my($key,$val) = split(/=/); $key =~ s/\s//g; $ck{$key} = $val;}
+	my @ck = split(/<>/,$ck{'SN_USER'});
+	if(length($ck[0]) < 5){ 
+		my @salt = ('a'..'z', 'A'..'Z', '0'..'9', '.', '/'); srand;
+		my $salt = $salt[int(rand(@salt))] . $salt[int(rand(@salt))];
+		$in{'user'} = crypt($in{'addr'}.$in{'time'}, $salt);
+	}else{ $in{'user'} = $ck[0]; }
+
+	if($ENV{'REQUEST_METHOD'} eq "POST" && $ENV{'CONTENT_TYPE'} =~ /multipart\/form-data/i){
+		my %FORM;	my $subbuff; my $filename;	my $valuename;
+		my $upflag;	my $valueflag; my $bound;	my $mime;
+		my $readlength = 0;
+		my $random = int(rand(900000)) + 100000;
+		my $endflag = 0;
+		binmode(STDIN);
+		while(<STDIN>){	$readlength += length($_); if(/(--.*)\r\n$/){ $bound = $1; last; }}
+		if(-e "$set{'src_dir'}$random.temporary"){ $random++; }
+		if(-e "$set{'src_dir'}$random.temporary"){ $random++; }
+		if(-e "$set{'src_dir'}$random.temporary"){ &error(204); }
+
+		open(OUT,">$set{'src_dir'}$random.temporary");
+		binmode(OUT);
+		my $formbuff;
+		while(my $buff = <STDIN>){
+			$readlength += length($buff);
+			if($upflag == 1){ if($buff =~ /Content-Type:\s(.*)\r\n$/i){ $mime = $1; } $upflag++; next;}
+			if($upflag == 2){
+				while(1){
+					my $readblen; my $filebuff;
+					if($ENV{'CONTENT_LENGTH'} - $readlength < $readbuffsize){ $readblen = $ENV{'CONTENT_LENGTH'} - $readlength; }
+					else{ $readblen = $readbuffsize; }
+					if(!read(STDIN,$filebuff,$readblen)){ last };
+					$readlength += length($filebuff);
+					if($ENV{'CONTENT_LENGTH'} - $readlength < $readbuffsize){
+						my $readblen = $ENV{'CONTENT_LENGTH'} - $readlength;
+						read(STDIN,my $subbuff,$readblen);
+						$readlength += length($subbuff);
+						$filebuff .= $subbuff;
+						$endflag = 1;
+					}
+					my $offset = index($filebuff,$bound);
+					if($offset >= 0){
+						$buff = substr($filebuff,0,$offset-2); my $subbuff = substr($filebuff,$offset);
+						print OUT $buff; $upflag = 0; $formbuff .= $subbuff; last;
+					}else{ print OUT $filebuff;	}
+				}
+				if($endflag){ last; }
+				next;
+			}
+			if($buff =~ /^Content-Disposition:\sform-data;\sname=\"upfile\";\sfilename=\"(.*)\"\r\n$/i){
+				$filename = $1;	$upflag = 1; next;
+			}
+			$formbuff .= $buff;
+		}
+		close(OUT);
+		chmod($set{'per_upfile'},"$set{'src_dir'}$random.temporary");
+		{ my $value;
+			foreach my $buff(split(/\r\n/,$formbuff)){
+				$buff .= "\r\n";
+				if($buff =~ /^$bound\-\-/){ $FORM{$value} =~ s/\r\n$//; $valueflag = 0; last;}
+				if($buff =~ /^$bound/){ $FORM{$value} =~ s/\r\n$//; $valueflag = 0; next;}
+				if($valueflag == 1){ $valueflag++; next; }
+				if($valueflag == 2){ $FORM{$value} .= $buff; }
+				if($buff =~ /^Content-Disposition: form-data; name=\"(.+)\"\r\n$/){ $value = $1; $valueflag++; }
+			}
+		}
+		if($upflag || $valueflag){ unlink("$set{'src_dir'}$random.temporary"); &error(108);}
+
+	    $in{'postname'} = $FORM{'postname'};
+		$in{'org_pass'} = $in{'pass'} = $FORM{'pass'};
+		$in{'dlkey'} = $FORM{'dlkey'};
+		$in{'comment'} = $FORM{'comment'};
+		$in{'jcode'} = $FORM{'jcode'};
+		$in{'postkey'} = $FORM{'postkey'};
+		$in{'upfile'} = $filename;
+		$in{'type'} = $mime;
+		$in{'tmpfile'} = "$set{'src_dir'}$random.temporary";
+		$in{'orgname'} = $in{'upfile'};
+		if(-s "$in{'tmpfile'}" == 0){ unlink("$in{'tmpfile'}"); &error(99) }
+		if($set{'min_flag'} && ((-s "$in{'tmpfile'}") < $set{'min_size'} * 1024)){ &error(107,(-s "$in{'tmpfile'}"));}
+		if((-s "$in{'tmpfile'}") > $set{'max_size'} * 1024){ &error(106,(-s "$in{'tmpfile'}"));}
+		if($set{'post_flag'} && !check_postkey($in{'postkey'})){ &error(109); }
+		if($set{'dlkey'} == 2 && !$in{'dlkey'}){ unlink("$in{'tmpfile'}"); &error(61); }
+	}else{
+		my ($buffer,%FORM,@admin_delno);
+		if ($ENV{'REQUEST_METHOD'} eq "POST") { read(STDIN, $buffer, $ENV{'CONTENT_LENGTH'});}
+		else { $buffer = $ENV{'QUERY_STRING'}; }
+		my @pairs = split(/&/,$buffer);
+		foreach my $pair (@pairs) {
+			my ($name, $value) = split(/=/, $pair);
+			$value =~ tr/+/ /;
+			$value =~ s/%([a-fA-F0-9][a-fA-F0-9])/pack("C", hex($1))/eg;
+			if($name eq 'admin_delno'){
+				push(@admin_delno,$value);
+			}else{
+				$FORM{$name} = $value;
+			}
+		}
+		$in{'delpass'} = $FORM{'delpass'};
+		$in{'delno'} = $FORM{'delno'};
+		$in{'file'} = $FORM{'file'};
+		$in{'dlkey'} = $FORM{'dlkey'};
+		$in{'mode'} = $FORM{'mode'};
+		$in{'checkmode'} = $FORM{'checkmode'};
+		$in{'admin_delno'} = join(',',@admin_delno);
+		if($in{'delno'} eq $set{'admin_name'} && $in{'delpass'} eq $set{'admin_pass'}){ &admin_mode(); }
+		if(!$in{'delno'} && $in{'delpass'} eq $set{'admin_pass'}){ &makehtml; &quit; }
+	}
+
+	my @denyhost = split(/,/,$set{'deny_host'});
+	foreach my $value (@denyhost){
+		if ($in{'addr'} =~ /$value/ || $in{'host'} =~ /$value/){ &error(101);}
+	}
+
+	my @form = ($in{'postname'},$in{'comment'},$in{'orgname'},$in{'type'},$in{'dlkey'});
+	foreach my $value (@form) {
+		if (length($value) > 128) { $value = substr($value,0,128).'...'; }
+#		$value =~ s/&/&amp;/g;
+		$value =~ s/"/&quot;/g;
+		$value =~ s/</&lt;/g;
+		$value =~ s/>/&gt;/g;
+		$value =~ s/\r//g;
+		$value =~ s/\n//g;
+		$value =~ s/\t//g;
+		$value =~ s/\0//g;
+	}
+	($in{'postname'},$in{'comment'},$in{'orgname'},$in{'type'},$in{'dlkey'}) = @form;
+}
+
+
+if($in{'mode'} eq 'delete'){ &delete(); &quit(); }
+if($in{'mode'} eq 'dl'){ &dlfile;} #DL
+if(!$in{'upfile'}){ &error(99); }
+
+{#C
+
+	open(IN,$set{'log_file'})||&error(303);
+	my @log = <IN>;
+	close(IN);
+	my ($no,$lastip,$lasttime) = split(/<>/,$log[0]);
+
+	if($set{'interval'} && $in{'time'} <= ($lasttime + $set{'interval'}) && $in{'addr'} eq $lastip){ &error(203);}
+	$in{'ext'} = extfind($in{'orgname'}); if(!$in{'ext'}){ &error(202); }
+
+	my $orgname;
+	if(split(/\//,$in{'orgname'}) > split(/\\/,$in{'orgname'})){	my @name = split(/\//,$in{'orgname'}); $orgname = $name[$#name]; }
+	else{ my @name = split(/\\/,$in{'orgname'}); $orgname = $name[$#name];}
+	
+	my @salt = ('a'..'z', 'A'..'Z', '0'..'9', '.', '/');
+	srand;
+	my $salt = $salt[int(rand(@salt))] . $salt[int(rand(@salt))];
+	$in{'pass'} = crypt($in{'pass'}, $salt);
+
+	if($set{'binary_compare'}){
+		my @files = globfile("$set{'src_dir'}",".*");
+		my @dir = globdir("$set{'src_dir'}",".*");
+		foreach my $dir (@dir){	push(@files,globfile($dir."/",".*")); }
+		foreach my $value (@files){
+			next if($value =~ /\.temporary$/);
+			if(binarycmp($in{'tmpfile'},$value)){ unlink($in{'tmpfile'}); &error(205,$value);}
+		}
+	}
+
+	if($set{'find_crypt'}){
+		open(FILE,$in{'tmpfile'}); binmode(FILE); seek(FILE,0,0); read(FILE,my $buff,4); my $crypt_flag = 0;
+		if($buff =~ /^\x50\x4b\x03\x04$/){ seek(FILE,6,0); read(FILE,my $buff,1); $crypt_flag = 1 if(($buff & "\x01") eq "\x01"); }
+		close(FILE);
+		$in{'comment'} = '<font color="#FF0000">*</font>'.$in{'comment'} if($crypt_flag);
+	}
+
+	open(IN,$set{'log_file'})||&error(303);
+	@log = <IN>;
+	close(IN);
+	($no,$lastip,$lasttime) = split(/<>/,$log[0]);
+	shift(@log);
+	$no++;
+	my $tmpno = sprintf("%04d",$no);
+
+	my $dlsalt;
+	my $filedir;
+	my $allsize = (-s $in{'tmpfile'});
+	
+	if($set{'dlkey'} && $in{'dlkey'}){
+		my @salt = ('a'..'z', 'A'..'Z', '0'..'9'); srand;
+		for (my $c = 1; $c <= 20; ++$c) { $dlsalt .= $salt[int(rand(@salt))]; }
+	 	$filedir = "$set{'src_dir'}$set{'file_pre'}${tmpno}.$in{'ext'}_$dlsalt/";
+		mkdir($filedir,$set{'per_dir'});
+		rename("$in{'tmpfile'}","$filedir$set{'file_pre'}$tmpno.$in{'ext'}");
+		open(OUT,">${filedir}index.html");
+		close(OUT);
+		chmod($set{'per_upfile'},"${filedir}index.html");
+		$in{'comment'} = '<font color="#FF0000">[DLKey] </font>'.$in{'comment'};
+	}else{
+		undef $in{'dlkey'};
+		rename("$in{'tmpfile'}","$set{'src_dir'}$set{'file_pre'}$tmpno.$in{'ext'}");
+	}
+
+	if (length($orgname) > 128) { $orgname = substr($orgname,0,128).'...'; }
+
+	my @note;
+	if($set{'post_flag'} && $set{'post_key'}){
+		push(@note,'PostKey:'.$in{'postkey'});
+	}
+	if($ENV{'SERVER_SOFTWARE'} =~ /Apache|IIS/){
+		my $disptime;
+		my $time = time() - $in{'time'};
+		my @str = ('Upload:','b');
+		my $disptime = $time.$str[1];
+		push(@note,$str[0].$disptime);
+	}
+	if($in{'dlkey'}){
+		my @salt = ('a'..'z', 'A'..'Z', '0'..'9', '.', '/'); srand;
+		my $salt = $salt[int(rand(@salt))] . $salt[int(rand(@salt))];
+		my $crypt_dlkey  = crypt($in{'dlkey'}, $salt);
+		push(@note,"DLKey<!-- DLKey:".$crypt_dlkey." --><!-- DLpath:".$dlsalt." -->");
+	}
+	my $note = join(',',@note);
+	my $usersalt = substr($in{'user'},0,2);
+	my $userid = crypt($in{'user'},$usersalt);
+	$in{'time'} = time();
+#	$in{'date'} = conv_date(time());
+	my @new;
+	$new[0] = "$no<>$in{'addr'}<>$in{'time'}<>1\n";
+    my $addlog = "$no<>$in{'postname'}<>$in{'ext'}<>$in{'date'}<>$in{'comment'}<>$in{'type'}<>$orgname<>$in{'addr'}<>$in{'host'}<>$in{'pass'},$userid<>$set{'file_pre'}<>$note<>1\n";
+	$new[1] = $addlog;
+
+#	open(OUT,">>./alllog.cgi"); print OUT $addlog; close(OUT);
+
+	my $i = 2;
+
+	foreach my $value (@log){
+		my ($no,$postname,$ext,$date,$comment,$mime,$orgname,$addr,$host,$pass,$filepre,$note,$dummy) = split(/<>/,$value);
+		if(!$dummy){ $filepre = $set{'file_pre'};}
+		$no = sprintf("%04d",$no);
+
+		my $filename;
+		my $filedir;
+		if($note =~ /DLpath:(.+)\s/){
+			my $dlpath = $1;
+			$filename = "$set{'src_dir'}$filepre$no.${ext}_$dlpath/$filepre$no.$ext";
+			$filedir = "$set{'src_dir'}$filepre$no.${ext}_$dlpath/";
+		}else{
+			$filename = "$set{'src_dir'}$filepre$no.$ext";
+		}
+		$allsize += (-s $filename);
+		
+		if($i <= $set{'max_log'} && !($set{'max_all_flag'} && $set{'max_all_size'}*1024 < $allsize)){ 
+			if((-e $filename)||!$set{'zero_clear'}){ push(@new,$value); $i++; }
+		}else{
+			if(unlink($filename)){
+				unlink("$set{'src_dir'}$filepre$no.$ext.html"); if($filedir){ foreach(globfile($filedir,".*")){ unlink; } } rmdir($filedir);
+			}elsif(unlink($filename)){
+				unlink("$set{'src_dir'}$filepre$no.$ext.html"); if($filedir){ foreach(globfile($filedir,".*")){ unlink; } } rmdir($filedir);
+			}elsif(-e $filename){
+				push(@new,$value);
+			}else{
+				unlink("$set{'src_dir'}$filepre$no.$ext.html"); if($filedir){ foreach(globfile($filedir,".*")){ unlink; } } rmdir($filedir);
+			}
+		}
+	}
+	logwrite(@new);
+	if($in{'dlkey'} && ( $set{'dummy_html'} == 2 || $set{'dummy_html'} == 3)){
+		&makedummyhtml("$set{'file_pre'}$tmpno.$in{'ext'}",$in{'comment'},"$set{'file_pre'}$tmpno.$in{'ext'}",$dlsalt,$in{'date'},$in{'type'},$orgname,$no);
+	}elsif(!$in{'dlkey'} && ($set{'dummy_html'} == 1 || $set{'dummy_html'} == 3)){
+		&makedummyhtml("$set{'file_pre'}$tmpno.$in{'ext'}");
+	}
+	&makehtml(); &quit();
+}
+
+sub makehtml{
+
+	my ($buff,$init,$postval,$dlkey);
+	my $page = 0; my $i = 1;
+	
+	open(IN,$set{'log_file'})||&error(303);
+	my $log = my @log = <IN>;
+	close(IN);
+	
+	if($log == 1){ $log++; $init++;}
+	my $lastpage = int(($log - 2)/$set{'pagelog'}) + 1;
+	$postval = ' obj.postkey.value =  unescape(p[2]);' if($set{'post_flag'});
+	my $header =<<"EOM";
+$set{'html_head'}<META http-equiv="Content-Script-Type" content="text/javascript">
+<script type="text/javascript">
+<!--
+function getCookie(obj,cookiename){
+	var i,str; c = new Array(); p = new Array("","",""); str = document.cookie;c = str.split(";");
+	for (i = 0; i < c.length; i++) { if (c[i].indexOf(cookiename+"=") >= 0) { p = (c[i].substr(c[i].indexOf("=")+1)).split("<>"); break; }}
+	if(cookiename == "SN_UPLOAD"){ obj.postname.value = unescape(p[0]); obj.pass.value =  unescape(p[1]);$postval }
+	else if(cookiename == "SN_DEL"){ obj.delpass.value =  unescape(p[1]);}
+	return true;
+}
+function delnoin(no){
+	document.Del.delno.value = no;
+	document.Del.del.focus();
+}
+//-->
+</script>
+$set{'html_css'}</HEAD>
+<body bgcolor="#ffffff" text="#000000" LINK="#6060FF" VLINK="#6060FF" ALINK="#6060FF" onload="getCookie(document.Form,'SN_UPLOAD');getCookie(document.Del,'SN_DEL');">
+<table summary="title" width="100%"><tr><td bgcolor="#caccff"><strong><font size="4" color="#3366cc">Uploader</font></strong></td></tr></table>
+<p>
+Now.. Testing..
+</p>
+EOM
+	my $maxsize = 'Max '.dispsize($set{'max_size'}*1024);
+	my ($minsize,$total);
+	if($set{'min_flag'}){ $minsize = 'Min '.dispsize($set{'min_size'}*1024).' - '; }
+	if($set{'max_all_flag'}){ $total .= ' Total '.dispsize($set{'max_all_size'}*1024);}
+	$header .= qq|<FORM METHOD="POST" ENCTYPE="multipart/form-data" ACTION="$set{'base_cgi'}" name="Form">NAME (ÈªÂ)<br><INPUT TYPE=text SIZE="20" NAME="postname"><br> FILE $minsize$maxsize (*$set{'max_log'}Files$total)<br>|;
+	$header .='<INPUT TYPE=file  SIZE="40" NAME="upfile">';
+	$header .= ' DLKey: <INPUT TYPE=text SIZE="8" NAME="dlkey" maxlength="8">' if($set{'dlkey'});
+	$header .= '
+DELKey: <INPUT TYPE=password SIZE="10" NAME="pass" maxlength="8"><br>
+COMMENT<br>
+<INPUT TYPE=text SIZE="45" NAME="comment">
+<INPUT TYPE=hidden NAME="jcode" VALUE="¿">
+<INPUT TYPE=submit VALUE="Upload"><INPUT TYPE=reset VALUE="Cancel"><br>
+';
+	if($set{'post_flag'}){ $header .= 'PostKey<br><INPUT TYPE=password SIZE="10" NAME="postkey" maxlength="10">'; }
+	$header .= '</FORM>';
+
+	my $allsize = 0;
+	my @files = globfile("$set{'src_dir'}",".*");
+	my @dir = globdir("$set{'src_dir'}",".*");
+	foreach my $dir (@dir){	push(@files,globfile($dir."/",".*")); }
+	foreach my $value (@files){ $allsize += (-s "$value"); }
+
+	$allsize = dispsize($allsize);
+
+	my $footer = "</table><HR size=1>Used ${allsize}\n<br>";
+	if($set{'up_all'} && !$set{'ext_org'}){ $footer .= $set{'up_ext'}.' +'; }
+	elsif(!$set{'up_all'}){ $footer .= $set{'up_ext'}; }
+	$footer .= "\n<table summary=\"footer\" width=\"100%\"><tr><td><div align=left><FORM METHOD=POST ACTION=\"$set{'base_cgi'}\" name=\"Del\"><span style='font-size:9pt'><input type=hidden name=mode value=delete>No.<input type=text size=4 name=delno> key<input type=password size=4 name=delpass> <input type=submit value=\"del\" name=del></span></form></div>\n";
+	$footer .= "</td><td><div align=right><!-- $set{'ver'} --><a href=\"http://sugachan.dip.jp/download/\" target=\"_blank\"><small>Sn Uploader</small></a></div></td></tr></table>\n</body>\n</html>";
+
+	my $info_title = "<table summary=\"upinfo\" width=\"100%\">\n<tr><td></td><td>NAME</td><td>FILE</td>";
+	if($set{'disp_comment'}){ $info_title .= "<td>COMMENT</td>"; } if($set{'disp_size'}){ $info_title .= "<td>SIZE</td>"; } if($set{'disp_date'}){ $info_title .= "<td>DATE</td>"; }
+	if($set{'disp_mime'}){ $info_title .= "<td>MIME</td>"; } if($set{'disp_orgname'}){ $info_title .= "<td>ORIG</td>"; }
+	$info_title .= "</tr>\n";
+
+	my $home_url_link;
+	if($set{'home_url'}){ $home_url_link = qq|<a href="$set{'home_url'}">[HOME]</a> |;}
+	if($set{'html_all'}){
+		my $buff; my $no = 1; my $time = time; my $subheader;
+		foreach my $value (@log){
+			my ($no,$postname,$ext,$date,$comment,$mime,$orgname,$addr,$host,$pass,$dummy) = split(/<>/,$value);
+			if(!$dummy){ next; }
+			$buff .= makeitem($value);
+		}
+		$subheader .= "[ALL] ";
+		while($no <= $lastpage){
+			if($no == $page) { $subheader .= "\[$no\] ";}
+			else{	if($no == 1){ $subheader .= "<a href=\"$set{'http_html_path'}$set{'base_html'}?$time\">\[$no\]</a> "}
+					else{$subheader .= "<a href=\"$set{'http_html_path'}$no.html?$time\">\[$no\]</a> ";}	}
+			$no++;
+		}
+		$subheader .= $info_title;
+		open(OUT,">$set{'html_dir'}all.html")||&error(306,"$set{'html_dir'}all.html");
+		print OUT $header."<hr size=1>".$home_url_link.$subheader."<hr size=1>".$buff.$footer;
+		close(OUT);
+		chmod($set{'per_upfile'},"$set{'html_dir'}all.html");
+	}else{ unlink("$set{'html_dir'}all.html"); }
+	
+	while($log > $i){
+		$buff .= makeitem($log[$i]) unless($init);
+		if(($i % $set{'pagelog'}) == 0||$i == $log -1){
+			$page++; my $subheader; my $no = 1;	my $time = time;
+			if($set{'html_all'}){ $subheader .= "<a href=\"./all.html?$time\">[ALL]</a> "; }
+			while($no <= $lastpage){
+				if($no == $page) { $subheader .= "\[$no\] ";}
+				else{	if($no == 1){ $subheader .= "<a href=\"$set{'http_html_path'}$set{'base_html'}?$time\">\[$no\]</a> "}
+						else{$subheader .= "<a href=\"$set{'http_html_path'}$no.html?$time\">\[$no\]</a> ";}
+				}
+				$no++;
+			}
+			$subheader .= $info_title;
+			my $loghtml;
+			if($page == 1){	$loghtml = "$set{'html_dir'}$set{'base_html'}"; }
+			else{ $loghtml = "$set{'html_dir'}$page.html"; }
+
+			open(OUT,">$loghtml") || &error(306,"$loghtml");
+			print OUT $header."<hr size=1>".$home_url_link.$subheader."<hr size=1>".$buff.$footer;
+			close(OUT);
+			chmod($set{'per_upfile'},$loghtml);
+			undef $buff;
+		}
+		$i++;
+	}
+
+	while($page < 1000){
+		$page ++;
+		if(-e "$set{'html_dir'}$page.html"){ unlink("$set{'html_dir'}$page.html"); }else{ last; }
+	}
+}
+
+sub delete{
+	my $mode = $_[0];
+	my @delno = split(/,/,$_[1]);
+	my $delno; my $flag = 0; my $tmpaddr;
+	my $delnote;
+
+	if($in{'delno'} =~ /(\d+)/){ $delno = $1; }
+	if($mode ne 'admin' && !$in{'delno'}){ return; }
+	elsif($mode ne 'admin' && !$delno){ &error(401,$in{'delno'}); }
+
+	open(IN,$set{'log_file'})|| &error(303);
+	my @log = <IN>;
+	close(IN);
+
+	if($in{'addr'} =~ /(\d+).(\d+).(\d+).(\d+)/){ $tmpaddr = "$1.$2.$3."; }
+	my $findflag = 0;
+	foreach my $value (@log){
+		my ($no,$postname,$ext,$date,$comment,$mime,$orgname,$addr,$host,$pass,$filepre,$note,$dummy) = split(/<>/,$value);
+		$delnote = $note;
+		my $delflag = 0;
+		if(!$addr){ next; }
+		if($mode eq 'admin'){
+			foreach my $delno (@delno){ if($no == $delno){ $delflag = 1; last; } }
+		}elsif($no == $delno){
+			$findflag = 1;
+			unless ($addr =~ /^$tmpaddr/){
+				my ($pass,$id) = split(/,/,$pass);
+				my $delpass = $in{'delpass'} || $in{'addr'}.time();
+				my $salt = substr($pass, 0, 2);	$delpass = crypt($delpass,$salt);
+				my $usersalt = substr($in{'user'},0,2); my $userid = crypt($in{'user'},$usersalt);
+				if ($in{'delpass'} ne $set{'admin_pass'} && $delpass ne $pass && $userid ne $id){ 
+					if($mode ne 'admin'){ if(!$dummy){ $filepre = $set{'file_pre'};} $no = sprintf("%04d",$no); &error(404,"$filepre$no.$ext");}
+				}
+			}
+			$delflag = 1;
+		}
+		if($delflag){
+#			open(OUT,">>./del.cgi"); print OUT $value; close(OUT);
+			$flag = 1;
+			if(!$dummy){ $filepre = $set{'file_pre'};}
+			$no = sprintf("%04d",$no);
+			my $filename;
+			my ($dlpath,$filedir);
+			if($delnote =~ /DLpath:(.+)\s/){
+				$dlpath = $1;
+				$filename = "$set{'src_dir'}$filepre$no.${ext}_$dlpath/$filepre$no.$ext";
+				$filedir = "$set{'src_dir'}$filepre$no.${ext}_$dlpath/";
+			}else{
+				$filename = "$set{'src_dir'}$filepre$no.$ext";
+			}
+			
+			if(unlink($filename)){
+				unlink("$set{'src_dir'}$filepre$no.$ext.html"); if($filedir){ foreach(globfile($filedir,".*")){ unlink; } rmdir($filedir);} undef $value;
+			}elsif(unlink($filename)){
+				unlink("$set{'src_dir'}$filepre$no.$ext.html"); if($filedir){ foreach(globfile($filedir,".*")){ unlink; } rmdir($filedir);} undef $value;
+			}elsif(!(-e $filename)){
+				unlink("$set{'src_dir'}$filepre$no.$ext.html"); if($filedir){ foreach(globfile($filedir,".*")){ unlink; } rmdir($filedir);} undef $value;
+			}else{
+				if($mode ne 'admin'){ &error(403,"$filepre$no.$ext");}
+			}
+		}
+	}
+	if($mode ne 'admin' && !$findflag){ &error(402,$delno); }
+	if($flag){
+		logwrite(@log);
+		&makehtml();
+	}
+}
+
+
+sub quit{
+	my ($cookiename,$buff);
+	my $flag = 0;
+	my @tmpfiles = globfile("$set{'src_dir'}","\.temporary");
+	foreach my $value (@tmpfiles){ if((stat($value))[10] < time - 60*60){ unlink("$value"); $flag++; } }
+	&makehtml() if($flag);
+	$buff =<<"EOM";
+$set{'html_head'}<META HTTP-EQUIV="Refresh" CONTENT="1;URL=$set{'http_html_path'}$set{'base_html'}">
+EOM
+	if($in{'jcode'} || $in{'mode'} eq 'delete'){
+		$buff .=<<"EOM";
+<META HTTP-EQUIV="Set-Cookie" content="SN_USER=$in{'user'}&lt;&gt;1; path=/; expires=Tue, 31-Dec-2030 23:59:59 GMT">
+<META HTTP-EQUIV="CONTENT-SCRIPT-TYPE" CONTENT="text/javascript">
+<script type="text/javascript">
+<!--
+setCookie();
+function setCookie() {
+	var key0,key1,key2;
+	var tmp = "path=/; expires=Tue, 31-Dec-2030 23:59:59; ";
+EOM
+		if($in{'jcode'}){
+			my %ck; foreach(split(/;/,$ENV{'HTTP_COOKIE'})){ my($key,$val) = split(/=/); $key =~ s/\s//g; $ck{$key} = $val;}
+			my @ck = split(/<>/,$ck{'SN_DEL'});
+			if(!$ck[0] && $in{'org_pass'}){	$buff .= qq|\tdocument.cookie = "SN_DEL="+escape('$in{'org_pass'}')+"<>;"+ tmp;\n|;}
+			$cookiename = 'SN_UPLOAD'; $buff .= "\tkey0 = escape('$in{'postname'}'); key1 = escape('$in{'org_pass'}'); key2 = escape('$in{'postkey'}');\n";}
+		else{ $cookiename = 'SN_DEL'; $buff .= "\tkey0 = ''; key1 = escape('$in{'delpass'}'); key2 = '';\n"; }
+		$buff .= qq|\tdocument.cookie = "$cookiename="+key0+"<>"+key1+"<>"+key2+"; "+ tmp;\n}\n//-->\n</script>\n|;
+	}
+	$buff .=<<"EOM";
+<body>
+<br><br><div align=center><font size="+1"><br><br>
+<a href="$set{'http_html_path'}$set{'base_html'}?$in{'time'}">click here!</a></font><br>
+</div>
+</body></html>
+EOM
+	print "Content-type: text/html\n\n";
+	print $buff;
+	exit;
+}
+
+sub admin_mode{
+	&errorclear() if($in{'mode'} eq 'errorclear');
+	&delete('admin',$in{'admin_delno'}) if($in{'mode'} eq 'delete');
+
+	open(IN,$set{'log_file'})||error(303);
+	my @log = <IN>;
+	close(IN);
+
+	my ($header,$buff,$footer,$value);
+	$buff =<<"EOM";
+$set{'html_head'}$set{'html_css'}</HEAD>
+<body bgcolor="#ffffff" text="#000000" LINK="#6060FF" VLINK="#6060FF" ALINK="#6060FF">
+EOM
+
+	$buff .= leaddisp(0,1,1).'<a name="up"></a><table summary="title" width="100%"><tr><td bgcolor="#caccff"><strong><font size="4" color="#3366cc">Upload Info</font></strong></td></tr></table>';
+	$buff .= qq|<table summary="check"><tr><td><form action="$set{'base_cgi'}" method="POST"><input type=hidden name="checkmode" value="allcheck"><input type=hidden name=delno value="$in{'delno'}"><input type=hidden name=delpass value="$in{'delpass'}"><input type=submit value="·×Ä`FbN"></form></td><td><form action="$set{'base_cgi'}" method="POST"><input type=hidden name="checkmode" value="nocheck"><input type=hidden name=delno value="$in{'delno'}"><input type=hidden name=delpass value="$in{'delpass'}"><input type=submit value="·×ÄO·"></form></td><td><form action="$set{'base_cgi'}" method="POST"><input type=hidden name=delpass value="$set{'admin_pass'}"><input type=submit value="HTMLðXV·é/OAEg"></form></td></tr></table>\n<form action="$set{'base_cgi'}" method="POST"><input type=hidden name="mode" value="delete"><input type=hidden name=delno value="$in{'delno'}"><input type=hidden name=delpass value="$in{'delpass'}"><input type=submit value="`FbNµ½àÌðí"><br>\n|."<table summary=\"upinfo\" width=\"100%\">\n<tr><td>DEL</td><td>NAME</td><td>FILE</td><td>COMMENT</td><td>SIZE</td><td>ADDR</td><td>HOST</td><td>DATE</td><td>NOTE</td><td>MIME</td><td>ORIG</td></tr>\n";
+	shift(@log);
+	foreach (@log){	$buff .= makeitem($_,'admin'); }
+	$buff .= '</table></form><br><br>';
+
+	if($set{'error_level'}){
+		$buff .= leaddisp(-1,0,1).'<a name="error"></a><table summary="errortitle" width="100%"><tr><td bgcolor="#caccff"><strong><font size="4" color="#3366cc">Error Info</font></strong></td></tr></table>';
+		$buff .= qq|<form action="$set{'base_cgi'}" method="POST"><input type=hidden name=mode value="errorclear"><input type=hidden name=delno value="$in{'delno'}"><input type=hidden name=delpass value="$in{'delpass'}"><input type=submit value="G[ONA"></form>|;
+		$buff .= "<table summary=\"errorinfo\" width=\"100%\">\n<tr><td>DATE</td><td>ADDR</td><td>HOST</td><td>NOTE</td></tr>\n";
+		if(open(IN,$set{'error_log'})){	@log = reverse(<IN>); close(IN); foreach (@log){ my ($date,$no,$note,$addr,$host) = split(/<>/); $buff .= "<tr><td>$date</td><td>$addr</td><td>$host</td><td>$note</td></tr>\n"; }}
+		$buff .= "</table><br><br>\n";
+	}
+
+	$buff .= leaddisp(-1,-1,0);
+	$buff .= '<a name="set"></a><table summary="settitle" width="100%"><tr><td bgcolor="#caccff"><strong><font size="4" color="#3366cc">Setting Info</font></strong></td></tr></table>'."\n<table summary=\"setting\">\n";
+	$buff .= tablestr('XNvgVer',$set{'ver'});
+	$buff .= tablestr('COt@C',$set{'log_file'});
+	if($set{'error_level'}){
+		$buff .= tablestr('G[Ot@C',$set{'error_log'});
+		if($set{'error_size'}){ $buff .= tablestr('G[OÅåeÊ',dispsize($set{'error_size'}*1024).' '.($set{'error_size'}*1024).'Bytes'); }
+		else{ $buff .= tablestr('G[OÅåeÊ§À','³'); }
+	}else{ $buff .= tablestr('G[OL^','³'); }
+	$buff .= tablestr('Û',$set{'max_log'});
+	$buff .= tablestr('ÅåeeÊ',dispsize($set{'max_size'}*1024).' '.($set{'max_size'}*1024).'Bytes');
+
+	if($set{'min_flag'}){ $buff .= tablestr('Å¬§ÀeÊ',dispsize($set{'min_size'}*1024).' '.($set{'min_size'}*1024).'Bytes'); }
+	else{ $buff .= tablestr('Å¬§ÀeÊ',"³"); }
+	if($set{'max_all_flag'}){ $buff .= tablestr('eÊ§À',dispsize($set{'max_all_size'}*1024).' '.($set{'max_all_size'}*1024).'Bytes'); }
+	else{ $buff .= tablestr('eÊ§À',"³"); }
+
+	$buff .= tablestr("t@CÚª«",$set{'file_pre'});
+	$buff .= tablestr("HTMLÛ¶fBNg",$set{'html_dir'});
+	$buff .= tablestr("t@CÛ¶fBNg",$set{'src_dir'});
+	if($set{'http_html_path'} && $set{'html_dir'} ne $set{'http_html_path'}){ $buff .= "<tr><td>HTTP_HTML_PATH</td><td>$set{'http_html_path'}</td></tr>\n";}
+	if($set{'http_src_path'} && $set{'src_dir'} ne $set{'http_src_path'}){ $buff .= "<tr><td>HTTP_SRC_PATH</td><td>$set{'http_src_path'}</td></tr>\n";}
+	$buff .= tablestr('1y[WÉ\¦·ét@C',$set{'pagelog'});
+	if($set{'interval'} > 0){ $value = $set{'interval'}.'b'; }else{ $value = '³'; }
+	$buff .= tablestr('¯êIPeÔub§À',$value);
+	if($set{'up_ext'}){	$set{'up_ext'} =~ s/,/ /g; $buff .= tablestr('eÂ\î{g£q',$set{'up_ext'}); }
+	if($set{'deny_ext'}){ $set{'deny_ext'} =~ s/,/ /g; $buff .= tablestr('eÖ~g£q',$set{'deny_ext'}); }
+	if($set{'change_ext'}){	$set{'change_ext'} =~ s/,/ /g; $set{'change_ext'} =~ s/>/&gt;/g; $buff .= tablestr('g£qÏ·',$set{'change_ext'});	}
+
+	if($set{'up_all'}){	$buff .= tablestr('wèOg£qAbv[hÂ','L'); if($set{'ext_org'}){ $buff .= tablestr('wèOt@Cg£q','IWi'); }else{ $buff .= tablestr('wèOt@Cg£q','bin'); }}
+	else{$buff .= tablestr('wèOg£qAbv[hÂ','³');}
+
+	if($set{'find_crypt'}){ $value = 'L'; }else{ $value = '³';}
+	$buff .= tablestr('Ã»A[JCuo(ZIP)',$value);
+	if($set{'binary_compare'}){ $value = 'L'; }else{ $value = '³';}
+	$buff .= tablestr('oCiär',$value);
+	if($set{'post_flag'}){ $value = 'L'; }else{ $value = '³';}
+	$buff .= tablestr('PostKeye§À',$value);
+	if($set{'dlkey'}){ if($set{'dlkey'} == 2){$value = 'K{'}else{$value = 'CÓ';}}else{ $value = '³';}
+	$buff .= tablestr('DLkey',$value);
+	if($set{'dummy_html'}){ if($set{'dummy_html'} == 3){$value = 'ALL'}elsif($set{'dummy_html'} == 2){$value = 'DLKeyÌÝ';}else{$value = 'Êít@CÌÝ';}}else{ $value = '³';}
+	$buff .= tablestr('ÂÊHTMLLbV
+',$value);
+	if($set{'disp_error'}){ $value = 'L'; }else{ $value = '³';}
+	$buff .= tablestr('[UG[\¦',$value);
+	if($set{'zero_clear'}){ $value = 'L'; }else{ $value = '³';}
+	$buff .= tablestr('íÏt@CXg©®Á',$value);
+	if($set{'home_url'}){ $buff .= "<tr><td>HOMEURL</td><td>$set{'home_url'}</td></tr>\n";}
+
+	$buff .= '</table></body></html>';
+
+	print "Content-type: text/html\n\n";
+	print $buff;
+	exit;
+}
+
+sub extfind{
+	my $orgname = @_[0];
+	my @filename = split(/\./,$orgname);
+	my $ext = $filename[$#filename];
+	$ext =~ tr/[A-Z]/[a-z]/;
+	foreach my $value (split(/,/,$set{'change_ext'})){ my ($src,$dst) = split(/->/,$value); if($ext eq $src){ $ext = $dst; last; }}
+	foreach my $value (split(/,/,$set{'deny_ext'})){ if($ext eq $value){ &error(206,$ext); }}
+	foreach my $value (split(/,/,$set{'up_ext'})){ if ($ext eq $value) { return $value; } }
+	if(length($ext) >= 5 || length($ext) == 0){ $ext = 'bin'; }
+	unless ($ext =~ /^[A-Za-z0-9]+$/){ $ext = 'bin'; }
+	if($set{'up_all'} && $set{'ext_org'}){ return $ext;}
+	elsif($set{'up_all'}){ return 'bin'; }
+	return 0;
+}
+
+
+sub conv_date{
+	my @date = gmtime($_[0] + 9*60*60);
+	$date[5] -= 100; $date[4]++;
+	if ($date[5] < 10) { $date[5] = "0$date[5]" ; }	if ($date[4] < 10) { $date[4] = "0$date[4]" ; }
+	if ($date[3] < 10) { $date[3] = "0$date[3]" ; }	if ($date[2] < 10) { $date[2] = "0$date[2]" ; }
+	if ($date[1] < 10) { $date[1] = "0$date[1]" ; }	if ($date[0] < 10) { $date[0] = "0$date[0]" ; }
+	my @w = ('Sun','Mon','Tue','Wed','Thu','Fri','Sat');
+	return ("$date[5]/$date[4]/$date[3]($w[$date[6]]),$date[2]:$date[1]:$date[0]");
+}
+
+sub dispsize{
+	my $size = $_[0];
+	if($size >= 1024*1024*1024*100){ $size = int($size/1024/1024/1024).'GB';}
+	elsif($size >= 1024*1024*1024*10){ $size = sprintf("%.1fGB",$size/1024/1024/1024);}
+	elsif($size > 1024*1024*1024){ $size = sprintf("%.2fGB",$size/1024/1024/1024);}
+	elsif($size >= 1024*1024*100){ $size = int($size/1024/1024).'MB'; }
+	elsif($size > 1024*1024){ $size =  sprintf("%.1fMB",$size/1024/1024); }
+	elsif($size > 1024){ $size = int($size/1024).'KB'; }
+	else{ $size = int($size).'B';}
+	return $size;
+}
+
+sub makeitem{
+	my ($src,$mode) = @_; my ($buff,$check,$target);
+	my ($no,$postname,$ext,$date,$comment,$mime,$orgname,$addr,$host,$pass,$filepre,$note,$dummy) = split(/<>/,$src);
+	if(!$dummy){ $filepre = $set{'file_pre'}; }
+	my $orgno = $no;
+	$no = sprintf("%04d",$no);
+	my $size = 0;
+	my $dlpath = 0;
+
+	if($note =~ /DLpath:(.+)\s/){
+		$dlpath = $1;
+		$size = dispsize(-s "$set{'src_dir'}$filepre$no.${ext}_$dlpath/$filepre$no.$ext");
+	}else{
+		$size = dispsize(-s "$set{'src_dir'}$filepre$no.$ext");
+	}
+
+	my $path = $set{'http_src_path'} || $set{'src_dir'};
+	if($set{'link_target'}){ $target = qq| target="$set{'link_target'}"|; }
+	if($mode eq 'admin'){
+		if($dlpath){ $path .= "$filepre$no.${ext}_$dlpath/"; }
+		if($addr eq $host){ undef $host; }
+		if($in{'checkmode'} eq 'allcheck'){$check = ' checked';}
+		$buff = "<tr><td><INPUT TYPE=checkbox NAME=\"admin_delno\" VALUE=\"$no\"$check></td><td>$postname</td><td><a href=\"$path$filepre$no.$ext\"$target>$filepre$no.$ext</a></td><td>$comment</td><td>$size</td><td>$addr</td><td>$host</td><td>$date</td><td>$note</td><td>$mime</td><td>$orgname</td></tr>\n";
+	}else{
+		my($d_com,$d_date,$d_size,$d_mime,$d_org);
+		if($set{'disp_comment'}){ $d_com = "<td>$comment</td>"; } if($set{'disp_size'}){ $d_size = "<td>$size</td>"; } if($set{'disp_date'}){ $d_date= "<td>$date</td>"; }
+		if($set{'disp_mime'}){ $d_mime = "<td>$mime</td>"; } if($set{'disp_orgname'}){ $d_org = "<td>$orgname</td>"; }
+		if(-e "$set{'src_dir'}$filepre$no.$ext.html"){$buff = "<tr><td><SCRIPT type=\"text/javascript\" Language=\"JavaScript\"><!--\ndocument.write(\"<a href=\\\"javascript:delnoin($orgno)\\\">$set{'char_delname'}<\\/a>\");\n// --></SCRIPT></td><td>$postname</td><td><a href=\"$path$filepre$no.$ext.html\"$target>$filepre$no.$ext</a></td>$d_com$d_size$d_date$d_mime$d_org</tr>\n";}
+		elsif($dlpath){$buff = "<tr><td><SCRIPT type=\"text/javascript\" Language=\"JavaScript\"><!--\ndocument.write(\"<a href=\\\"javascript:delnoin($orgno)\\\">$set{'char_delname'}<\\/a>\");\n// --></SCRIPT></td><td>$postname</td><td><a href=\"$set{'base_cgi'}?mode=dl&file=$orgno\">$filepre$no.$ext</a></td>$d_com$d_size$d_date$d_mime$d_org</tr>\n";}
+		else{ $buff = "<tr><td><SCRIPT type=\"text/javascript\" Language=\"JavaScript\"><!--\ndocument.write(\"<a href=\\\"javascript:delnoin($orgno)\\\">$set{'char_delname'}<\\/a>\");\n// --></SCRIPT></td><td>$postname</td><td><a href=\"$path$filepre$no.$ext\"$target>$filepre$no.$ext</a></td>$d_com$d_size$d_date$d_mime$d_org</tr>\n";}
+	}
+	return $buff;
+}
+
+sub makedummyhtml{
+	my ($filename,$com,$file,$orgdlpath,$date,$mime,$orgname,$no) = @_;
+	my $buff;
+
+	if(!$no){
+		$buff = "<html><head><title>$filename</title></head><body>";
+		$buff .= qq|Download <a href="./$filename">$filename</a>|;
+		$buff .= '</body></html>';
+	}else{
+		$buff = cryptfiledl($com,$file,$orgdlpath,$date,$mime,$orgname,$no);
+	}
+
+	open(OUT,">$set{'src_dir'}$filename.html")||&error(307,"$set{'src_dir'}$filename.html");
+	print OUT $buff;
+	close(OUT);
+	chmod($set{'per_upfile'},"$set{'src_dir'}$filename.html");
+	return 1;
+}
+
+
+sub logwrite{
+	my @log = @_;
+	open(OUT,"+>$set{'log_file'}")||&error(304);
+	eval{ flock(OUT, 2);};
+	eval{ truncate(OUT, 0);};
+	seek(OUT, 0, 0);
+	print OUT @log;
+	eval{ flock(OUT, 8);};
+	close(OUT);
+	chmod($set{'per_upfile'},$set{'log_file'});
+	return 1;
+}
+
+sub binarycmp{
+	my ($src,$dst) = @_;
+	return 0 if (-s $src != -s $dst);
+	open(SRC,$src)||return 0; open(DST,$dst)||return 0;
+	my ($buff,$buff2);
+	binmode(SRC); binmode(DST); seek(SRC,0,0); seek(DST,0,0); 
+	while(read(SRC,$buff,8192)){ read(DST,$buff2,8192); if($buff ne $buff2){ close(SRC); close(DST); return 0; } }
+	close(SRC); close(DST);
+	return 1;
+}
+
+sub init{
+	my $buff;
+	if(open(OUT,">$set{'log_file'}")){
+		print OUT "0<>0<>0<>1\n";
+		close(OUT);
+		chmod($set{'per_logfile'},$set{'log_file'});
+	}else{
+		$buff = "<tr><td>COÌì¬É¸sµÜµ½</td></tr>";
+	}
+	
+	unless (-d "$set{'src_dir'}"){
+		if(mkdir("$set{'src_dir'}",$set{'per_dir'})){
+			chmod($set{'per_dir'},"$set{'src_dir'}");
+			open(OUT,">$set{'src_dir'}index.html");
+			close(OUT);
+			chmod($set{'per_upfile'},"$set{'src_dir'}index.html");
+		}else{
+			$buff .= "<tr><td>SourceÛ¶fBNgÌì¬É¸sµÜµ½</td></tr>";
+		}
+	}
+
+	unless (-d "$set{'html_dir'}"){
+		if(mkdir("$set{'html_dir'}",$set{'per_dir'})){
+			chmod($set{'per_dir'},"$set{'html_dir'}");
+		}else{
+			$buff .= "<tr><td>HTMLÛ¶fBNgÌì¬É¸sµÜµ½</td></tr>";
+		}
+	}
+
+	if($buff){
+		$buff .= "<tr><td>fBNgÉ«Ý Àª é©mFµÄ­¾³¢</td></tr>";
+		&error_disp($buff,'init');
+	}
+}
+
+sub check_postkey{
+	my $inputkey = @_[0];
+	my @key = split(/,/,$set{'post_key'});
+	foreach my $key (@key){ if($inputkey eq $key){ return 1; } }
+	return 0;
+}
+
+sub leaddisp{
+	my @src = @_;
+	my ($str,$count);
+	foreach my $value (@src){
+		my ($mark,$name,$link); $count++;
+		if($count == 1){ $name = 'Upload Info'; $link = 'up'; }
+		elsif($count == 2){ $name = 'Error Info'; $link = 'error'; next if(!$set{'error_level'}); }
+		elsif($count == 3){ $name = 'Setting Info'; $link = 'set'; }
+		if($value){ if($value > 0){ $mark = '¥'; }else{ $mark = '£'; } $str .= qq|<a href="#$link">${mark}${name}</a> |; }
+		else{ $str .= qq|[$name] |; }
+	}
+	return $str;
+}
+
+sub errorclear{
+	open(OUT,">$set{'error_log'}")||return 0;
+	eval{ flock(OUT, 2);}; eval{ truncate(OUT, 0);}; seek(OUT, 0, 0); eval{ flock(OUT, 8);}; close(OUT);
+	chmod($set{'per_upfile'},$set{'log_file'});
+	return 1;
+}
+
+sub tablestr{
+	my ($value1,$value2) = @_;
+	return ("<tr><td>$value1</td><td>$value2</td></tr>\n");
+}
+
+sub globfile{
+	my ($src_dir,$filename) = @_;
+	opendir(DIR,$src_dir)||return 0; my @dir = readdir(DIR); closedir(DIR);
+	my @new = (); foreach my $value (@dir){ push(@new,"$src_dir$value") if($value =~ /$filename/ && !(-d "$src_dir$value")); }
+	return @new;
+}
+
+sub globdir{
+	my ($src_dir,$dir) = @_;
+	opendir(DIR,$src_dir)||return 0; my @dir = readdir(DIR); closedir(DIR);
+	my @new = (); foreach my $value (@dir){ if($value eq '.' ||$value eq '..' ){ next; } push(@new,"$src_dir$value") if($value =~ /$dir/ && (-d "$src_dir$value")); }
+	return @new;
+}
+
+sub error_disp{
+	my ($message,$mode) = @_;
+	my $url;
+	if($mode eq 'init'){ $url = qq|<a href="$set{'base_cgi'}">[[h]</a>|; }else{ $url = qq|<a href="$set{'http_html_path'}$set{'base_html'}">[ßé]</a>|; }
+	my $buff =<<"EOM";
+$set{'html_head'}$set{'html_css'}</HEAD>
+<body bgcolor="#ffffff" text="#000000" LINK="#6060FF" VLINK="#6060FF" ALINK="#6060FF">
+<div align="center">
+<table summary="error">
+$message
+<tr><td></td></tr>
+<tr><td><div align="center">$url</div></td></tr>
+</table>
+<br><br>
+<table summary="info">
+<tr>
+<td>DATE</td><td>$in{'date'}</td></tr>
+<tr><td>ADDR</td><td>$in{'addr'}</td></tr>
+<tr><td>HOST</td><td>$in{'host'}</td></tr>
+</table>
+</div>
+</body></html>
+EOM
+	print "Content-type: text/html\n\n";
+	print $buff;
+	exit;
+}
+
+sub error{
+	my ($no,$note) = @_;
+	if (length($note) > 64) { $note = substr($note,0,64).'...'; }
+	$note =~ s/&/&amp;/g; $note =~ s/\"/&quot;/g; $note =~ s/</&lt;/g; $note =~ s/>/&gt;/g; $note =~ s/\r//g; $note =~ s/\n//g; $note =~ s/\t//g; $note =~ s/\0//g;
+	my ($message,$dispmsg,$flag);
+	
+	if($no == 98){ $message = ""; }
+	elsif($no == 99){ $message = "UpFileÈµ"; }
+	elsif($no == 101){ $message = "eÖ~HOST"; }
+	elsif($no == 106){ $flag = 1; $message = "POSTTCY´ß"; $note = dispsize($note); $dispmsg= '<tr><td>t@CðAbv[hÅ«Ü¹ñÅµ½</td></tr><tr><td>Abv[ht@C('.$note.')Í ÅåeÊÝè('.dispsize($set{'max_size'}*1024).')ðz¦Ä¢Ü·</td></tr>';}
+	elsif($no == 107){ $flag = 1; $message = "POSTTCYß¬"; $note = dispsize($note); $dispmsg= '<tr><td>t@CðAbv[hÅ«Ü¹ñÅµ½</td></tr><tr><td>Abv[ht@C('.$note.')Í Å¬eÊÝè('.dispsize($set{'min_size'}*1024).')¢Å·</td></tr>';}
+	elsif($no == 108){ $flag = 1; $message = "POSTf[^s®S"; $dispmsg = '<tr><td>t@CðAbv[hÅ«Ü¹ñÅµ½</td></tr><tr><td>POSTf[^ªs®SÅ·</td></tr>';}
+	elsif($no == 109){ $flag = 1; $message = "POSTKeysêv"; $dispmsg = '<tr><td>t@CðAbv[hÅ«Ü¹ñÅµ½</td></tr><tr><td>POSTKeyªêvµÜ¹ñ</td></tr>';}
+	elsif($no == 202){ $flag = 1; $message = "g£qí¸"; $dispmsg = '<tr><td>t@CðAbv[hÅ«Ü¹ñÅµ½</td></tr><tr><td>eÅ«ég£qÍ'.$set{'up_ext'}.'Å·</td></tr>';}
+	elsif($no == 203){ $flag = 1; $message = "e·¬"; $dispmsg = '<tr><td>t@CðAbv[hÅ«Ü¹ñÅµ½</td></tr><tr><td>¯êIPAhX©ç'.$set{'interval'}.'bÈàÉÄeÅ«Ü¹ñ</td></tr>';}
+	elsif($no == 204){ $flag = 1; $message = "êt@C«ß¸"; $dispmsg = '<tr><td>t@CðAbv[hÅ«Ü¹ñÅµ½</td></tr><tr><td>êt@CÌì¬É¸sµÜµ½</td></tr>';}
+	elsif($no == 205){ $flag = 1; $message = "¯êt@C¶Ý"; $note =~ /([^\/]+)$/; my $filename = $1; $dispmsg = '<tr><td>t@CðAbv[hÅ«Ü¹ñÅµ½</td></tr><tr><td>¯êt@Cª '.$filename.' É¶ÝµÜ·</td></tr>';}
+	elsif($no == 206){ $flag = 1; $message = "Ö~g£q"; $dispmsg = '<tr><td>t@CðAbv[hÅ«Ü¹ñÅµ½</td></tr><tr><td>g£q '.$note.' ÍAbv[hÅ«Ü¹ñ</td></tr>';}
+	elsif($no == 303){ $flag = 1; $message = "Ot@CÉÇÝß¸"; $dispmsg = '<tr><td>COÌÇÝÝÉ¸sµÜµ½</td></tr>';}
+	elsif($no == 304){ $flag = 1; $message = "Ot@CÉ«ß¸"; $dispmsg = '<tr><td>COÌ«ÝÉ¸sµÜµ½</td></tr>';}
+	elsif($no == 306){ $message = "t@CXgHTML«ß¸";}
+	elsif($no == 307){ $message = "t@CHTMLt@C«ß¸";}
+	elsif($no == 401){ $flag = 1; $message = "íNo.oÅ«¸"; $dispmsg = '<tr><td>t@CðíÅ«Ü¹ñÅµ½</td></tr><tr><td>'.$note.' ©çíNo.ðoÅ«Ü¹ñÅµ½</td></tr><tr><td>'.$set{'file_pre'}.'0774.zipÌê No.ÉÍ 774 ðüÍµÜ·</td></tr>';}
+	elsif($no == 402){ $flag = 1; $note = sprintf("%04d",int($note)); $message = "íNo.¶Ý¹¸"; $dispmsg = '<tr><td>t@CðíÅ«Ü¹ñÅµ½</td></tr><tr><td>'.$set{'file_pre'}.$note.'.*** ÍCOÉ¶ÝµÜ¹ñ</td></tr>';}
+	elsif($no == 403){ $flag = 1; $message = "íANZXÛ"; $dispmsg = '<tr><td>t@CðíÅ«Ü¹ñÅµ½</td></tr><tr><td>t@CíðÍ½µÄ¢Ü·ª '.$note.' Ìt@CÌíªÛ³êÜµ½</td></tr><tr><td>ANZXªßèÈêÍÔðu¢ÄÄì·éÆíÅ«é±Æª èÜ·</td></tr>';}
+	elsif($no == 404){ $flag = 1; $message = "íKeysêv"; $dispmsg = '<tr><td>t@CðíÅ«Ü¹ñÅµ½</td></tr><tr><td>'.$note.' íKeyªêvµÜ¹ñÅµ½</td></tr>';}
+
+	elsif($no == 51){ $flag = 1; $message = "[DLMode] No.©Â©ç¸";  $dispmsg = '<tr><td>[DLMode] t@Cª©Â©èÜ¹ñÅµ½</td></tr><tr><td>'.$note.' ©çt@CNo.ðoÅ«Ü¹ñÅµ½</td></tr>'; }
+	elsif($no == 52){ $flag = 1; $message = "[DLMode] File©Â©ç¸";  $dispmsg = '<tr><td>[DLMode] t@Cª©Â©èÜ¹ñÅµ½</td></tr><tr><td>'.$set{'file_pre'}.$note.'.*** ÍCOÉ¶ÝµÜ¹ñ</td></tr>'; }
+	elsif($no == 53){ $flag = 1; $message = "[DLMode] DLkey¢Ýè";  $dispmsg = '<tr><td>[DLMode] orgDLkeyError</td></tr><tr><td>'.$note.' DLKeyª¢ÝèÅ·</td></tr>'; }
+	elsif($no == 54){ $flag = 1; $message = "[DLMode] DLkeysêv";  $dispmsg = '<tr><td>[DLMode] orgDLkeyError</td></tr><tr><td>'.$note.' DLKeyªêvµÜ¹ñÅµ½</td></tr>'; }
+	elsif($no == 55){ $flag = 1; $message = "[DLMode] File Oepn Error";  $dispmsg = '<tr><td>[DLMode] Open Error</td></tr><tr><td>'.$note.' t@CÌÇÝÝÉ¸sµÜµ½</td></tr>'; }
+	elsif($no == 56){ $flag = 1; $message = "[DLMode] File Not Found";  $dispmsg = '<tr><td>[DLMode] Not Found</td></tr><tr><td>'.$note.' t@Cª¶ÝµÜ¹ñ</td></tr>'; }
+
+	elsif($no == 61){ $flag = 1; $message = "DLkey¢Ýè";  $dispmsg = '<tr><td>DLKeyª¢ÝèÅ·</td></tr>'; }
+
+	unlink($in{'tmpfile'});
+	if($note){$message .= ' ';}
+	if($set{'error_level'} && $no > 100){
+		unless(-e $set{'error_log'}){
+			open(OUT,">$set{'error_log'}");
+			close(OUT);
+			chmod($set{'per_logfile'},$set{'error_log'});
+		}
+		if($set{'error_size'} && ((-s $set{'error_log'}) > $set{'error_size'} * 1024)){
+			my $err_bkup = "$set{'error_log'}.bak.cgi";
+			unlink($err_bkup);
+			rename($set{'error_log'},$err_bkup);
+			open(OUT,">$set{'error_log'}");
+			close(OUT);
+			chmod($set{'per_logfile'},$set{'error_log'});
+		}
+		open(OUT,">>$set{'error_log'}");
+		print OUT "$in{'date'}<>$no<>$message$note<>$in{'addr'}<>$in{'host'}<>1\n";
+		close(OUT);
+	}
+	&error_disp($dispmsg) if($flag && $set{'disp_error'});
+	&quit();
+}
+
+sub dlfile{
+	my $msg;
+	my ($orgdlkey,$orgdlpath);
+	my ($dlext,$dlfilepre);
+	my ($dl_date,$dl_comment,$dl_size,$dl_mime,,$dl_orgname);
+	my $dlno = 0;
+	my $findflag;
+
+	open(IN,$set{'log_file'})||&error(303);
+	my @log = <IN>;
+	close(IN);
+	shift(@log);
+
+	if($in{'file'} =~ /(\d+)/){ $dlno = $1; }
+	if($dlno == 0) { &error(51,$in{'file'}); }
+
+	foreach my $value (@log){
+		my ($no,$postname,$ext,$date,$comment,$mime,$orgname,$addr,$host,$pass,$filepre,$note,$dummy) = split(/<>/,$value);
+			my @note = split(/,/,$note);
+			if(int($dlno) == $no){
+				$dl_comment = $comment;
+				$dl_mime = $mime;
+				$dl_date = $date;
+				$dl_orgname = $orgname;
+				$dlext = $ext;
+				$dlfilepre = $filepre;
+				foreach my $tmpnote (@note){
+					if($tmpnote =~ /\!--\sDLKey:(.+)\s--.*\!--\sDLpath:(.+)\s--/){
+						$orgdlkey = $1;
+						$orgdlpath = $2;
+						last;
+					}
+				}
+				$findflag = 1;
+				last;
+			}
+	}
+
+	my $dlfile = $dlfilepre.sprintf("%04d",int($dlno)).'.'.$dlext;
+	if(!(-e "$set{'src_dir'}${dlfile}_$orgdlpath/$dlfile")){ &error(56,"$dlfile----$set{'src_dir'}${dlfile}_$orgdlpath/$dlfile"); }
+
+	if($in{'dlkey'}){
+		my $dlsalt = substr($orgdlkey,0,2);
+		my $dlkey = crypt($in{'dlkey'},$dlsalt);
+
+		if($findflag == 0){ &error(52,$dlfile); }
+		elsif(!$orgdlkey){ &error(53,$dlfile); }
+		elsif($orgdlkey ne $dlkey && $set{'admin_pass'} ne $in{'dlkey'}){ &error(54,$dlfile); }
+		#print "Location: $set{'http_src_path'}${dlfile}_$orgdlpath/$dlfile\n\n";
+		my $buff =<<"EOM";
+$set{'html_head'}$set{'html_css'}
+<META HTTP-EQUIV="Refresh" CONTENT="1;URL=$set{'http_src_path'}${dlfile}_$orgdlpath/$dlfile">
+</HEAD>
+<body bgcolor="#ffffff" text="#000000" LINK="#6060FF" VLINK="#6060FF" ALINK="#6060FF">
+<div align="center">
+<br>
+<table summary="dlfrom">
+<tr><td>òÎÈ¢êÍ <a href="$set{'http_src_path'}${dlfile}_$orgdlpath/$dlfile">±¿ç</a> ©ç</td></tr>
+</table>
+</div>
+</body></html>
+EOM
+		print "Content-type: text/html\n\n";
+		print $buff;
+	}else{
+		my $buff = cryptfiledl($dl_comment,$dlfile,$orgdlpath,$dl_date,$dl_mime,$dl_orgname,$dlno);
+		print "Content-type: text/html\n\n";
+		print $buff;
+	}
+	exit;
+}
+
+sub cryptfiledl{
+		my($com,$file,$orgdlpath,$date,$mime,$orgname,$no) = @_;
+		my($d_com,$d_date,$d_size,$d_mime,$d_org);
+
+		if($set{'disp_comment'}){ $d_com = "<tr><td>COMMENT</td><td>$com</td></td>"; } if($set{'disp_size'}){ $d_size = "<tr><td>SIZE</td><td>".dispsize(-s "$set{'src_dir'}${file}_$orgdlpath/$file")." (".(-s "$set{'src_dir'}${file}_$orgdlpath/$file")."bytes)"."</td></tr>"; } if($set{'disp_date'}){ $d_date= "<tr><td>DATE</td><td>$date</td></tr>"; }
+		if($set{'disp_mime'}){ $d_mime = "<tr><td>ORGMIME</td><td>$mime</td></tr>"; } if($set{'disp_orgname'}){ $d_org = "<tr><td>ORGNAME</td><td>$orgname</td></tr>"; }
+
+		my $buff =<<"EOM";
+$set{'html_head'}$set{'html_css'}</HEAD>
+<body bgcolor="#ffffff" text="#000000" LINK="#6060FF" VLINK="#6060FF" ALINK="#6060FF">
+<div align="center">
+<br>
+$file ÉÍDLKeyªÝè³êÄ¢Ü·
+<table summary="dlform">
+<tr><td></td></tr>
+<FORM METHOD=POST ACTION="$set{'base_cgi'}" name="DL">
+<tr><td>
+<input type=hidden name=file value=$no>
+<input type=hidden name=jcode value="¿">
+<input type=hidden name=mode value=dl></td></tr>
+$d_com$d_date$d_size$d_mime$d_org
+<tr><td>DLKey:<input type=text size=8 name="dlkey"></td></tr>
+<tr><td><input type=submit value="DownLoad"></td></tr>
+</FORM>
+</table>
+</div>
+</body></html>
+EOM
+
+	return $buff;
+}
Index: tags/r89-trunk/swat/lang/ja/help/welcome.html
===================================================================
--- tags/r89-trunk/swat/lang/ja/help/welcome.html	(revision 90)
+++ tags/r89-trunk/swat/lang/ja/help/welcome.html	(revision 90)
@@ -0,0 +1,71 @@
+<h3>SWAT へようこそ!</h3>
+
+上のボタンをクリックして設定を行ってください。
+
+<h3><a href="/swat/help/manpages/samba.7.html" target="docs">Samba</a> ドキュメント</h3>
+
+<ul>
+ <li><b>デーモン</b>
+   <ul>
+    <li><a href="/swat/help/manpages/smbd.8.html" target="docs">smbd</a> - SMB デーモン
+    <li><a href="/swat/help/manpages/nmbd.8.html" target="docs">nmbd</a> - NetBIOS ネームサーバ
+    <li><a href="/swat/help/manpages/winbindd.8.html" target="docs">winbindd</a> - winbind デーモン
+   </ul>
+ <li><b>設定ファイル</b>
+   <ul>
+    <li><a href="/swat/help/manpages/smb.conf.5.html" target="docs">smb.conf</a> - Samba 設定ファイル
+    <li><a href="/swat/help/manpages/lmhosts.5.html" target="docs">lmhosts</a> - NetBIOS の hosts ファイル
+    <li><a href="/swat/help/manpages/smbpasswd.5.html" target="docs">smbpasswd</a> - SMB パスワードファイル
+   </ul>
+ <li><b>管理ユーティリティ</b>
+   <ul>
+    <li><a href="/swat/help/manpages/smbcontrol.1.html" target="docs">smbcontrol</a> - Samba デーモンへのコントロールメッセージの送出
+    <li><a href="/swat/help/manpages/smbpasswd.8.html" target="docs">smbpasswd</a> - SMB パスワードの管理
+    <li><a href="/swat/help/manpages/swat.8.html" target="docs">SWAT</a> - Web 設定ツール
+    <li><a href="/swat/help/manpages/net.8.html" target="docs">net</a> - Samba およびリモートの CIFS サーバの管理ツール
+    <li><a href="/swat/help/manpages/pdbedit.8.html" target="docs">pdbedit</a> - Samba のユーザアカウント管理ツール
+    <li><a href="/swat/help/manpages/tdbbackup.8.html" target="docs">tdbbackup</a> - TDB データベースのバックアップツール
+   </ul>
+ <li><b>クライアントツール</b>
+   <ul>
+    <li><a href="/swat/help/manpages/rpcclient.1.html" target="docs">rpcclient</a> - コマンドラインの MS-RPC クライアント
+    <li><a href="/swat/help/manpages/smbtar.1.html" target="docs">smbtar</a> - SMB バックアップツール
+    <li><a href="/swat/help/manpages/smbclient.1.html" target="docs">smbclient</a> - コマンドラインの SMB クライアント
+    <li><a href="/swat/help/manpages/smbmnt.8.html"  target="docs">smbmnt</a> - Linux 上の SMB ファイルシステムをマウントする際の補助ツール
+    <li><a href="/swat/help/manpages/smbmount.8.html"  target="docs">smbmount</a> - Linux における SMB ファイルシステムのマウントを実現するユーザ空間のツール
+    <li><a href="/swat/help/manpages/smbspool.8.html"  target="docs">smbspool</a> - コマンドラインの SMB 印刷クライアント
+    <li><a href="/swat/help/manpages/smbumount.8.html"  target="docs">smbumount</a> - Linux における SMB ファイルシステムのアンマウントを実現するユーザ空間のツール
+    <li><a href="/swat/help/manpages/ntlm_auth.1.html" target="docs">ntlm_auth</a> - 別プログラムからの NTLM 認証の使用を実現
+    <li><a href="/swat/help/manpages/smbcquotas.1.html" target="docs">smbcquotas</a> - NTFS 5 共有のクォータ情報の設定と取得
+    <li><a href="/swat/help/manpages/smbsh.1.html" target="docs">smbsh</a> - UNIX シェルを用いたリモート SMB 共有へのアクセスを実現
+    <li><a href="/swat/help/manpages/smbtree.1.html" target="docs">smbtree</a> - テキストベースの SMB ネットワークブラウジング
+    <li><a href="/swat/help/manpages/smbspool.8.html" target="docs">smbspool</a> - 印刷ジョブを SMB プリンタに送信
+   </ul>
+ <li><b>診断ユーティリティ</b>
+   <ul>
+    <li><a href="/swat/help/manpages/smbstatus.1.html" target="docs">smbstatus</a> - Samba の監視
+    <li><a href="/swat/help/manpages/testparm.1.html" target="docs">testparm</a> - 設定ファイルの整合性の検査
+    <li><a href="/swat/help/manpages/testprns.1.html" target="docs">testprns</a> - プリンタ設定の検査
+    <li><a href="/swat/help/manpages/nmblookup.1.html" target="docs">nmblookup</a> - NetBIOS 名の検索ツール
+    <li><a href="/swat/help/manpages/wbinfo.1.html" target="docs">wbinfo</a> - winbind 情報の取得ツール
+   </ul>
+ <li><b>その他のユーティリティ</b>
+   <ul>
+    <li><a href="/swat/help/manpages/profiles.1.html" target="docs">profiles</a> - 別ドメインへのプロファイルの移行
+    <li><a href="/swat/help/manpages/editreg.1.html" target="docs">editreg</a> - Windows レジストリファイルの編集
+    <li><a href="/swat/help/manpages/log2pcap.1.html" target="docs">log2pcap</a> - Samba のログファイルから pcap ファイルの生成
+   </ul>
+ <li><b>書籍</b>
+   <ul>
+    <li><a href="/swat/help/using_samba/toc.html" target="docs">Using Samba 第二版</a> - 著者: Jay Ts, Robert Eckstein, David Collier-Brown
+    <li><a href="/swat/help/Samba3-HOWTO/" target="docs">The Official Samba HOWTO and Reference Guide</a>
+    <li><a href="/swat/help/Samba3-ByExample/" target="docs">Samba 3 by Example</a>
+    <li><a href="/swat/help/Samba3-Developers-Guide/" target="docs">The Samba Developer Guide</a>
+   </ul>
+</ul>
+ 
+ <h3>フィードバック</h3>
+
+ このバージョンの SWAT に関する問題についての議論を行ないたい方は、
+ <A HREF="http://lists.samba.org/">samba</A> メーリングリストへの参加をお願いします。
+<small>(もしくは <A HREF="http://www.samba.gr.jp/ml/">sugj-tech</A> メーリングリストに日本語でお願いします)</small>
Index: tags/r89-trunk/swat/xinetd.d/swat
===================================================================
--- tags/r89-trunk/swat/xinetd.d/swat	(revision 90)
+++ tags/r89-trunk/swat/xinetd.d/swat	(revision 90)
@@ -0,0 +1,12 @@
+service swat
+{
+	port		= 901
+	socket_type	= stream
+	wait		= no
+	only_from	= 127.0.0.1
+	only_from	+= 192.168.0.0/24
+	user		= root
+	server		= /usr/sbin/swat
+	log_on_failure	+= USERID
+	disable		= no
+}
Index: tags/r89-trunk/trac/custom.css
===================================================================
--- tags/r89-trunk/trac/custom.css	(revision 90)
+++ tags/r89-trunk/trac/custom.css	(revision 90)
@@ -0,0 +1,56 @@
+.wikipage h1 {;
+    background-color: #ffffcc;
+    border-color: yellow;
+    border-style: solid;
+    border-width: 0 0 0.3em 0.3em;
+    padding: 0.2em 0.4em;
+    /* cancel browser.css */
+    margin-right: 0;
+}
+
+.wikipage h2 {
+    background-color: #ffffcc;
+    border-color: yellow;
+    border-style: solid;
+    border-width: 0 0 0.2em 0.6em;
+    padding: 0.2em 0.6em;
+}
+
+.wikipage h3 {
+    background-color: #ffffcc;
+    border-color: yellow;
+    border-style: double;
+    border-width: 0 0 0.2em 1em;
+    padding: 0.2em 0.7em;
+}
+
+.wikipage h4 {
+    background-color: #ffffcc;
+    padding: 0.2em 0.6em;
+}
+
+.wikipage h5 {
+    background-color: #ffffcc;
+    border-color: yellow;
+    border-style: solid;
+    border-width: 0 0 0 1em;
+    padding: 0.2em 0.4em;
+}
+
+.wikipage h6 {
+    background-color: #ffffcc;
+    border-color: yellow;
+    border-style: double;
+    border-width: 0 0 0 2em;
+    padding: 0.2em 0.4em;
+}
+
+/* expand edit text area */
+#edit #text {
+    min-height: 20em;
+}
+
+/* Quick search */
+#proj-search {
+    width: 20em;
+}
Index: tags/r89-trunk/trac/site.html
===================================================================
--- tags/r89-trunk/trac/site.html	(revision 90)
+++ tags/r89-trunk/trac/site.html	(revision 90)
@@ -0,0 +1,11 @@
+<html xmlns="http://www.w3.org/1999/xhtml"
+      xmlns:xi="http://www.w3.org/2001/XInclude"
+      xmlns:py="http://genshi.edgewall.org/"
+      py:strip="">
+  <!--! Add site-specific style sheet -->
+  <head py:match="head" py:attrs="select('@*')">
+    ${select('*|comment()|text()')}
+    <link rel="stylesheet" type="text/css"
+          href="/static/htdocs/custom.css" />
+  </head>
+</html>
Index: tags/r89-trunk/twitter/get_oauth.pl
===================================================================
--- tags/r89-trunk/twitter/get_oauth.pl	(revision 90)
+++ tags/r89-trunk/twitter/get_oauth.pl	(revision 90)
@@ -0,0 +1,34 @@
+#!/usr/bin/env perl
+use strict;
+use warnings;
+use utf8;
+use Net::Twitter::Lite;
+
+use YAML::Tiny;
+my $config = (YAML::Tiny->read('config.yml'))->[0];
+
+my $consumer_key = $config->{'consumer_key'};
+my $consumer_key_secret = $config->{'consumer_secret'};
+my $access_token = $config->{'access_token'};
+my $access_token_secret = $config->{'access_token_secret'};
+
+my $nt = Net::Twitter::Lite->new(
+  traits          => ['API::REST', 'OAuth'],
+  consumer_key    => $consumer_key,
+  consumer_secret => $consumer_key_secret,
+);
+print 'access this url by bot account : '.$nt->get_authorization_url."\n";
+print 'input verifier PIN : ';
+my $verifier = <STDIN>;
+chomp $verifier;
+
+my $token = $nt->request_token;
+my $token_secret = $nt->request_token_secret;
+
+$nt->request_token($token);
+$nt->request_token_secret($token_secret);
+
+my($at, $ats) = $nt->request_access_token(verifier => $verifier);
+
+print "Access token : ".$at."\n";
+print "Access token secret : ".$ats."\n";
Index: tags/r89-trunk/twitter/nt_bot.pl
===================================================================
--- tags/r89-trunk/twitter/nt_bot.pl	(revision 90)
+++ tags/r89-trunk/twitter/nt_bot.pl	(revision 90)
@@ -0,0 +1,23 @@
+#!/usr/bin/env perl
+use strict;
+use warnings;
+use utf8;
+use Net::Twitter;
+
+use YAML::Tiny;
+my $config = (YAML::Tiny->read('config.yml'))->[0];
+
+my $consumer_key = $config->{'consumer_key'};
+my $consumer_key_secret = $config->{'consumer_secret'};
+my $access_token = $config->{'access_token'};
+my $access_token_secret = $config->{'access_token_secret'};
+
+my $nt = Net::Twitter->new(
+  traits          => ['API::REST', 'OAuth'],
+  consumer_key    => $consumer_key,
+  consumer_secret => $consumer_key_secret,
+);
+$nt->access_token($access_token);
+$nt->access_token_secret($access_token_secret);
+
+my $res = $nt->update({ status => "Perl から Twiitter を更新するテストですよー" });
Index: tags/r89-trunk/twitter/show_status.pl
===================================================================
--- tags/r89-trunk/twitter/show_status.pl	(revision 90)
+++ tags/r89-trunk/twitter/show_status.pl	(revision 90)
@@ -0,0 +1,61 @@
+#! /usr/bin/perl -w
+
+use strict;
+use warnings;
+use utf8;
+
+## IMPORTANT ##
+# When Net::Twitter::Lite encounters a Twitter API error or a network error, 
+# it throws a Net::Twitter::Lite::Error object. 
+# You can catch and process these exceptions by using eval blocks and testing $@
+## from http://search.cpan.org/perldoc?Net::Twitter::Lite#ERROR_HANDLING
+use Net::Twitter::Lite;
+use Data::Dumper;
+
+my $bot = Net::Twitter::Lite->new;
+
+eval {
+    foreach my $id (@ARGV) {
+        my $res = $bot->show_status($id);
+        foreach my $line (split /\n/, Dumper $res) {
+            if ($line =~ /undef/) { next; }
+            unless ($line =~ / => {/
+                ||  $line =~ / = /
+                ||  $line =~ /status/
+                ||  $line =~ /'text'/
+                ||  $line =~ /created/
+                ||  $line =~ /'id'/
+                ||  $line =~ /name/
+                ||  $line =~ / },/
+                ||  $line =~ / };/
+            ) { next; }
+            print $line, "\n";
+        }
+    }
+};
+if ($@) {
+    evalrescue($@);
+}
+print "truncated output done\n";
+
+
+sub evalrescue {
+    # output error message at eval error
+    
+    use Scalar::Util qw(blessed);
+    
+    if (blessed $@ && $@->isa('Net::Twitter::Lite::Error')) {
+        warn $@->error;
+        if ($@->twitter_error) {
+            my %twitter_error = %{$@->twitter_error};
+            map {
+                $twitter_error{"$_ => "} = $twitter_error{$_} . "\n";
+                delete $twitter_error{$_}
+            } keys %twitter_error;
+            warn join("", %twitter_error);
+        }
+    }
+    else {
+        warn $@;
+    }
+}
Index: tags/r89-trunk/twitter/twitterbot.pl
===================================================================
--- tags/r89-trunk/twitter/twitterbot.pl	(revision 90)
+++ tags/r89-trunk/twitter/twitterbot.pl	(revision 90)
@@ -0,0 +1,237 @@
+#! /usr/bin/perl -w
+
+use strict;
+use warnings;
+use utf8;
+
+## IMPORTANT ##
+# When Net::Twitter::Lite encounters a Twitter API error or a network error, 
+# it throws a Net::Twitter::Lite::Error object. 
+# You can catch and process these exceptions by using eval blocks and testing $@
+## from http://search.cpan.org/perldoc?Net::Twitter::Lite#ERROR_HANDLING
+use Net::Twitter::Lite;
+use FindBin qw($Bin);
+use YAML::Tiny;
+use Date::Parse qw(str2time);
+
+my $_execmode = $ARGV[0] || 0;
+sub VERBOSE () { $_execmode eq 'verbose' };
+sub DEBUG   () { VERBOSE or $_execmode eq 'debug' };
+use Data::Dumper;
+
+DEBUG and warn "$0: debug mode";
+
+my $conf = loadconf("$Bin/config.yml");
+if (! defined $conf) {
+    die "$0: cannot parse config file.\n";
+}
+my $stat = loadconf("$Bin/status.yml");
+if (! defined $stat) {
+    $stat = {};
+}
+
+my $bot = login($conf);
+if (! $bot->authorized) {
+    die "$0: this client is not yet authorized.\n";
+}
+
+my $tweets = {};
+%$tweets = (
+    %$tweets,
+    %{ or_search($bot, $conf->{hashtag}, $stat->{search}) }
+);
+%$tweets = (
+    %$tweets,
+    %{ mentions_ids($bot, $stat->{mention}) }
+);
+
+foreach my $id (sort keys %$tweets) {
+    # $tweets->{$id}{type} eq 'search'  => found by search API
+    #                      eq 'mention' => found by mention API
+    if ($tweets->{$id}{type} eq 'retweet') {
+        next;
+    }
+    DEBUG or sleep($conf->{sleep});
+    
+    # do retweet found tweets
+    my $res;
+    eval {
+        DEBUG  or $res = $bot->retweet($id);
+        DEBUG and warn "retweet($id) => ", Dumper($tweets->{$id});
+    };
+    if ($@) {
+        evalrescue($@);
+        warn "status_id => $id\n";
+        next;
+    }
+    
+    $stat->{$tweets->{$id}{type}} = $id;
+}
+
+if ($tweets) {
+    # save last status to yaml file
+    DEBUG  or YAML::Tiny::DumpFile("$Bin/status.yml", $stat);
+    DEBUG and warn "status.yml => ", Dumper($stat);
+}
+
+
+sub loadconf {
+    # load configration data from yaml formatted file
+    #   param   => scalar string of filename
+    #   ret     => hash object of yaml data
+    
+    my $file = shift @_;
+    
+    my $yaml = YAML::Tiny->read($file);
+    
+    if ($!) {
+        warn "$0: '$file' $!\n";
+    }
+    
+    return $yaml->[0];
+}
+
+sub login {
+    # make Net::Twitter::Lite object and login
+    #   param   => hash object of configration
+    #   ret     => Net::Twitter::Lite object
+    
+    my $conf = shift @_;
+    
+    my $bot = Net::Twitter::Lite->new(
+        consumer_key    => $conf->{consumer_key},
+        consumer_secret => $conf->{consumer_secret},
+    );
+    
+    $bot->access_token($conf->{access_token});
+    $bot->access_token_secret($conf->{access_token_secret});
+    
+    return $bot;
+}
+
+sub or_search {
+    # search tweets containing keywords
+    #   param   => Net::Twitter::Lite object, ArrayRef of keywords, since_id
+    #   ret     => HashRef of status_id (timeline order is destroyed)
+    #               or undef (none is found)
+    
+    my $bot      = shift @_;
+    my $keywords = shift @_;
+    my $since_id = shift @_ || 1;
+    
+    my $key = "";
+    foreach my $word (@$keywords) {
+        if ($key) {
+            $key .= " OR $word";
+        }
+        else {
+            $key = $word;
+        }
+    }
+    DEBUG and warn "searching '$key'";
+    
+    my $res;
+    my $ids = {};
+    eval {
+        if ($key) {
+            $res = $bot->search(
+                {
+                    q           => $key,
+                    since_id    => $since_id,
+                }
+            );
+        }
+        VERBOSE and warn Dumper($res);
+        if ($res->{results}) {
+            foreach my $tweet (@{$res->{results}}) {
+                my $res = $bot->show_status($tweet->{id});
+                VERBOSE and warn Dumper($res);
+                
+                my $id = {
+                    date        => str2time($res->{created_at}),
+                    screen_name => $res->{user}{screen_name},
+                    status_id   => $res->{id},
+                    text        => $res->{text},
+                    user_id     => $res->{user}{id},
+                };
+                if ($res->{retweeted_status}) {
+                    $id->{retweet_of}   = $res->{retweeted_status}{id};
+                    $id->{type}         = 'retweet';
+                }
+                else {
+                    $id->{type} = 'search';
+                }
+                $ids->{$tweet->{id}} = $id;
+            }
+        }
+    };
+    if ($@) {
+        evalrescue($@);
+    }
+    
+    DEBUG and warn "search result => ", Dumper($ids);
+    return $ids;
+}
+
+sub mentions_ids {
+    # return status_ids mentioned to me
+    #   param   => Net::Twitter::Lite object, since_id
+    #   ret     => HashRef of status_id (timeline order is destroyed)
+    #               or undef (none is found)
+    
+    my $bot      = shift @_;
+    my $since_id = shift @_ || 1;
+    
+    my $res;
+    eval {
+        $res = $bot->mentions(
+            {
+                since_id    => $since_id,
+            }
+        );
+        VERBOSE and warn Dumper($res);
+    };
+    if ($@) {
+        evalrescue($@);
+    }
+    
+    my $ids = {};
+    if ($res && @{$res}) {
+        $ids = {
+            map {
+                $_->{id} => {
+                    date        => str2time($_->{created_at}),
+                    screen_name => $_->{user}{screen_name},
+                    status_id   => $_->{id},
+                    text        => $_->{text},
+                    type        => 'mention',
+                    user_id     => $_->{user}{id},
+                }
+            } @{$res}
+        };
+    }
+    
+    DEBUG and warn "mentions result => ", Dumper($ids);
+    return $ids;
+}
+
+sub evalrescue {
+    # output error message at eval error
+    
+    use Scalar::Util qw(blessed);
+    
+    if (blessed $@ && $@->isa('Net::Twitter::Lite::Error')) {
+        warn $@->error;
+        if ($@->twitter_error) {
+            my %twitter_error = %{$@->twitter_error};
+            map {
+                $twitter_error{"$_ => "} = $twitter_error{$_} . "\n";
+                delete $twitter_error{$_}
+            } keys %twitter_error;
+            warn join("", %twitter_error);
+        }
+    }
+    else {
+        warn $@;
+    }
+}
Index: tags/r89-trunk/twitter/user_timeline.pl
===================================================================
--- tags/r89-trunk/twitter/user_timeline.pl	(revision 90)
+++ tags/r89-trunk/twitter/user_timeline.pl	(revision 90)
@@ -0,0 +1,128 @@
+#! /usr/bin/perl -w
+
+use strict;
+use warnings;
+use utf8;
+
+## IMPORTANT ##
+# When Net::Twitter::Lite encounters a Twitter API error or a network error, 
+# it throws a Net::Twitter::Lite::Error object. 
+# You can catch and process these exceptions by using eval blocks and testing $@
+## from http://search.cpan.org/perldoc?Net::Twitter::Lite#ERROR_HANDLING
+use Net::Twitter::Lite;
+use FindBin qw($Bin);
+use YAML::Tiny;
+use Data::Dumper;
+use Encode;
+
+if (@ARGV < 1) {
+    die "usage: $0 screen_name [number_of_pages|all [dump]]\n";
+}
+my $screen_name = $ARGV[0];
+my $pages = $ARGV[1] || 1;
+if ($pages eq 'all') {
+    $pages = -1;
+}
+my $dump = $ARGV[2] || 0;
+
+my $conf = loadconf("$Bin/config.yml");
+if (! defined $conf) {
+    die "$0: cannot parse config file.\n";
+}
+
+my $bot = login($conf);
+if (! $bot->authorized) {
+    die "$0: this client is not yet authorized.\n";
+}
+
+
+eval {
+    my $page = 0;
+    while ($pages - $page && $page <= 160) {
+        $page++;
+        my $res = $bot->user_timeline(
+            {
+                screen_name => $screen_name,
+                page        => $page,
+            }
+        );
+        
+        if ($dump) {
+            foreach my $line (split /\n/, Dumper $res) {
+                if ($line =~ /undef/) { next; }
+                print $line, "\n";
+            }
+        }
+        else {
+            foreach my $status (@{$res}) {
+                my $text = "";
+                $text .= $status->{user}{name};
+                $text .= " [" . $status->{created_at} . "]";
+                $text .= " (". $status->{id} . ")";
+                $text .= " ". encode('utf8', $status->{text});
+                $text =~ s/\n//;
+                print $text, "\n";
+            }
+        }
+    }
+};
+if ($@) {
+    evalrescue($@);
+}
+print "done\n";
+
+
+sub loadconf {
+    # load configration data from yaml formatted file
+    #   param   => scalar string of filename
+    #   ret     => hash object of yaml data
+    
+    my $file = shift @_;
+    
+    my $yaml = YAML::Tiny->read($file);
+    
+    if ($!) {
+        warn "$0: '$file' $!\n";
+    }
+    
+    return $yaml->[0];
+}
+
+sub login {
+    # make Net::Twitter::Lite object and login
+    #   param   => hash object of configration
+    #   ret     => Net::Twitter::Lite object
+    
+    my $conf = shift @_;
+    
+    my $bot = Net::Twitter::Lite->new(
+        consumer_key    => $conf->{consumer_key},
+        consumer_secret => $conf->{consumer_secret},
+    );
+    
+    $bot->access_token($conf->{access_token});
+    $bot->access_token_secret($conf->{access_token_secret});
+    
+    return $bot;
+}
+
+sub evalrescue {
+    # output error message at eval error
+    
+    use Scalar::Util qw(blessed);
+    
+    if (blessed $@ && $@->isa('Net::Twitter::Lite::Error')) {
+        warn $@->error;
+        if ($@->twitter_error) {
+            my %twitter_error = %{$@->twitter_error};
+            map {
+                $twitter_error{"$_ => "} = $twitter_error{$_} . "\n";
+                delete $twitter_error{$_}
+            } keys %twitter_error;
+            warn join("", %twitter_error);
+        }
+    }
+    else {
+        warn $@;
+    }
+}
Index: tags/r89-trunk/vmware/hotaddbridge
===================================================================
--- tags/r89-trunk/vmware/hotaddbridge	(revision 90)
+++ tags/r89-trunk/vmware/hotaddbridge	(revision 90)
@@ -0,0 +1,69 @@
+#!/bin/bash
+##############################################
+# Add VMWare Network Bridged devices hot
+#
+# Revisions
+# J.Gargano - 2009-07-08 - 1.1
+#
+#############################################
+
+echo "Locating Existing Devices"
+for dev in $(ls /dev/vmnet*);
+do
+    echo " Found $dev"
+done
+echo
+printf "Please enter a device number that does not exist in this list: "
+read num
+# Check if it exists
+if [ -e /dev/vmnet$num ];then
+    echo "/dev/vmnet$num exists! Exiting."
+    exit 1
+fi
+
+
+# Select an interface
+echo
+echo "Locating interfaces to bridge"
+for int in $(ifconfig |grep "^[a-z,A-Z]" |cut -d' ' -f1);
+do
+    echo $int
+done
+printf "Please enter a interface: "
+read interface
+
+# Check if it exists
+ifconfig $interface >/dev/null 2>&1
+ret=$?
+if [ $ret != 0 ];then
+    if [ "$1" != "-d" ]; then
+        echo "Can't find interface. Exiting!"
+        exit 1
+    else
+        echo "Use dummy device: $interface"
+        dummy="Dummy "
+    fi
+fi
+
+
+# Create device
+echo "Creating device /dev/vmnet$num"
+mknod --mode=600 /dev/vmnet$num c 119 $num
+
+# Add to vmware netmap configuration
+# open netmap.conf and get next number in list
+let nextnetnum=$(cat /etc/vmware/netmap.conf | tail -1 | cut -d'.' -f1 | sed -e s/network//)+1
+
+echo "Adding network$nextnetnum to /etc/vmware/netmap.conf"
+
+echo "network$nextnetnum.name = \"${dummy}Bridged to $interface\"">> /etc/vmware/netmap.conf
+echo "network$nextnetnum.device = \"vmnet$num\"">> /etc/vmware/netmap.conf
+
+# Add to vmware locations configuration
+echo "answer VNET_${num}_NAME ${dummy}Bridged to $interface" >> /etc/vmware/locations
+echo "answer VNET_${num}_INTERFACE $interface" >> /etc/vmware/locations
+echo "remove_file /dev/vmnet$num" >> /etc/vmware/locations
+echo "file /dev/vmnet$num" >> /etc/vmware/locations
+
+# Start Service
+`which vmnet-bridge` -d /var/run/vmnet-bridge-$num.pid -n $num -i $interface
