--- /dev/null
+set ts=2
+set sw=2
--- /dev/null
+ GNU GENERAL PUBLIC LICENSE
+ Version 2, June 1991
+
+ Copyright (C) 1989, 1991 Free Software Foundation, Inc.
+ 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+ Everyone is permitted to copy and distribute verbatim copies
+ of this license document, but changing it is not allowed.
+
+ Preamble
+
+ The licenses for most software are designed to take away your
+freedom to share and change it. By contrast, the GNU General Public
+License is intended to guarantee your freedom to share and change free
+software--to make sure the software is free for all its users. This
+General Public License applies to most of the Free Software
+Foundation's software and to any other program whose authors commit to
+using it. (Some other Free Software Foundation software is covered by
+the GNU Library General Public License instead.) You can apply it to
+your programs, too.
+
+ When we speak of free software, we are referring to freedom, not
+price. Our General Public Licenses are designed to make sure that you
+have the freedom to distribute copies of free software (and charge for
+this service if you wish), that you receive source code or can get it
+if you want it, that you can change the software or use pieces of it
+in new free programs; and that you know you can do these things.
+
+ To protect your rights, we need to make restrictions that forbid
+anyone to deny you these rights or to ask you to surrender the rights.
+These restrictions translate to certain responsibilities for you if you
+distribute copies of the software, or if you modify it.
+
+ For example, if you distribute copies of such a program, whether
+gratis or for a fee, you must give the recipients all the rights that
+you have. You must make sure that they, too, receive or can get the
+source code. And you must show them these terms so they know their
+rights.
+
+ We protect your rights with two steps: (1) copyright the software, and
+(2) offer you this license which gives you legal permission to copy,
+distribute and/or modify the software.
+
+ Also, for each author's protection and ours, we want to make certain
+that everyone understands that there is no warranty for this free
+software. If the software is modified by someone else and passed on, we
+want its recipients to know that what they have is not the original, so
+that any problems introduced by others will not reflect on the original
+authors' reputations.
+
+ Finally, any free program is threatened constantly by software
+patents. We wish to avoid the danger that redistributors of a free
+program will individually obtain patent licenses, in effect making the
+program proprietary. To prevent this, we have made it clear that any
+patent must be licensed for everyone's free use or not licensed at all.
+
+ The precise terms and conditions for copying, distribution and
+modification follow.
+\f
+ GNU GENERAL PUBLIC LICENSE
+ TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION
+
+ 0. This License applies to any program or other work which contains
+a notice placed by the copyright holder saying it may be distributed
+under the terms of this General Public License. The "Program", below,
+refers to any such program or work, and a "work based on the Program"
+means either the Program or any derivative work under copyright law:
+that is to say, a work containing the Program or a portion of it,
+either verbatim or with modifications and/or translated into another
+language. (Hereinafter, translation is included without limitation in
+the term "modification".) Each licensee is addressed as "you".
+
+Activities other than copying, distribution and modification are not
+covered by this License; they are outside its scope. The act of
+running the Program is not restricted, and the output from the Program
+is covered only if its contents constitute a work based on the
+Program (independent of having been made by running the Program).
+Whether that is true depends on what the Program does.
+
+ 1. You may copy and distribute verbatim copies of the Program's
+source code as you receive it, in any medium, provided that you
+conspicuously and appropriately publish on each copy an appropriate
+copyright notice and disclaimer of warranty; keep intact all the
+notices that refer to this License and to the absence of any warranty;
+and give any other recipients of the Program a copy of this License
+along with the Program.
+
+You may charge a fee for the physical act of transferring a copy, and
+you may at your option offer warranty protection in exchange for a fee.
+
+ 2. You may modify your copy or copies of the Program or any portion
+of it, thus forming a work based on the Program, and copy and
+distribute such modifications or work under the terms of Section 1
+above, provided that you also meet all of these conditions:
+
+ a) You must cause the modified files to carry prominent notices
+ stating that you changed the files and the date of any change.
+
+ b) You must cause any work that you distribute or publish, that in
+ whole or in part contains or is derived from the Program or any
+ part thereof, to be licensed as a whole at no charge to all third
+ parties under the terms of this License.
+
+ c) If the modified program normally reads commands interactively
+ when run, you must cause it, when started running for such
+ interactive use in the most ordinary way, to print or display an
+ announcement including an appropriate copyright notice and a
+ notice that there is no warranty (or else, saying that you provide
+ a warranty) and that users may redistribute the program under
+ these conditions, and telling the user how to view a copy of this
+ License. (Exception: if the Program itself is interactive but
+ does not normally print such an announcement, your work based on
+ the Program is not required to print an announcement.)
+\f
+These requirements apply to the modified work as a whole. If
+identifiable sections of that work are not derived from the Program,
+and can be reasonably considered independent and separate works in
+themselves, then this License, and its terms, do not apply to those
+sections when you distribute them as separate works. But when you
+distribute the same sections as part of a whole which is a work based
+on the Program, the distribution of the whole must be on the terms of
+this License, whose permissions for other licensees extend to the
+entire whole, and thus to each and every part regardless of who wrote it.
+
+Thus, it is not the intent of this section to claim rights or contest
+your rights to work written entirely by you; rather, the intent is to
+exercise the right to control the distribution of derivative or
+collective works based on the Program.
+
+In addition, mere aggregation of another work not based on the Program
+with the Program (or with a work based on the Program) on a volume of
+a storage or distribution medium does not bring the other work under
+the scope of this License.
+
+ 3. You may copy and distribute the Program (or a work based on it,
+under Section 2) in object code or executable form under the terms of
+Sections 1 and 2 above provided that you also do one of the following:
+
+ a) Accompany it with the complete corresponding machine-readable
+ source code, which must be distributed under the terms of Sections
+ 1 and 2 above on a medium customarily used for software interchange; or,
+
+ b) Accompany it with a written offer, valid for at least three
+ years, to give any third party, for a charge no more than your
+ cost of physically performing source distribution, a complete
+ machine-readable copy of the corresponding source code, to be
+ distributed under the terms of Sections 1 and 2 above on a medium
+ customarily used for software interchange; or,
+
+ c) Accompany it with the information you received as to the offer
+ to distribute corresponding source code. (This alternative is
+ allowed only for noncommercial distribution and only if you
+ received the program in object code or executable form with such
+ an offer, in accord with Subsection b above.)
+
+The source code for a work means the preferred form of the work for
+making modifications to it. For an executable work, complete source
+code means all the source code for all modules it contains, plus any
+associated interface definition files, plus the scripts used to
+control compilation and installation of the executable. However, as a
+special exception, the source code distributed need not include
+anything that is normally distributed (in either source or binary
+form) with the major components (compiler, kernel, and so on) of the
+operating system on which the executable runs, unless that component
+itself accompanies the executable.
+
+If distribution of executable or object code is made by offering
+access to copy from a designated place, then offering equivalent
+access to copy the source code from the same place counts as
+distribution of the source code, even though third parties are not
+compelled to copy the source along with the object code.
+\f
+ 4. You may not copy, modify, sublicense, or distribute the Program
+except as expressly provided under this License. Any attempt
+otherwise to copy, modify, sublicense or distribute the Program is
+void, and will automatically terminate your rights under this License.
+However, parties who have received copies, or rights, from you under
+this License will not have their licenses terminated so long as such
+parties remain in full compliance.
+
+ 5. You are not required to accept this License, since you have not
+signed it. However, nothing else grants you permission to modify or
+distribute the Program or its derivative works. These actions are
+prohibited by law if you do not accept this License. Therefore, by
+modifying or distributing the Program (or any work based on the
+Program), you indicate your acceptance of this License to do so, and
+all its terms and conditions for copying, distributing or modifying
+the Program or works based on it.
+
+ 6. Each time you redistribute the Program (or any work based on the
+Program), the recipient automatically receives a license from the
+original licensor to copy, distribute or modify the Program subject to
+these terms and conditions. You may not impose any further
+restrictions on the recipients' exercise of the rights granted herein.
+You are not responsible for enforcing compliance by third parties to
+this License.
+
+ 7. If, as a consequence of a court judgment or allegation of patent
+infringement or for any other reason (not limited to patent issues),
+conditions are imposed on you (whether by court order, agreement or
+otherwise) that contradict the conditions of this License, they do not
+excuse you from the conditions of this License. If you cannot
+distribute so as to satisfy simultaneously your obligations under this
+License and any other pertinent obligations, then as a consequence you
+may not distribute the Program at all. For example, if a patent
+license would not permit royalty-free redistribution of the Program by
+all those who receive copies directly or indirectly through you, then
+the only way you could satisfy both it and this License would be to
+refrain entirely from distribution of the Program.
+
+If any portion of this section is held invalid or unenforceable under
+any particular circumstance, the balance of the section is intended to
+apply and the section as a whole is intended to apply in other
+circumstances.
+
+It is not the purpose of this section to induce you to infringe any
+patents or other property right claims or to contest validity of any
+such claims; this section has the sole purpose of protecting the
+integrity of the free software distribution system, which is
+implemented by public license practices. Many people have made
+generous contributions to the wide range of software distributed
+through that system in reliance on consistent application of that
+system; it is up to the author/donor to decide if he or she is willing
+to distribute software through any other system and a licensee cannot
+impose that choice.
+
+This section is intended to make thoroughly clear what is believed to
+be a consequence of the rest of this License.
+\f
+ 8. If the distribution and/or use of the Program is restricted in
+certain countries either by patents or by copyrighted interfaces, the
+original copyright holder who places the Program under this License
+may add an explicit geographical distribution limitation excluding
+those countries, so that distribution is permitted only in or among
+countries not thus excluded. In such case, this License incorporates
+the limitation as if written in the body of this License.
+
+ 9. The Free Software Foundation may publish revised and/or new versions
+of the General Public License from time to time. Such new versions will
+be similar in spirit to the present version, but may differ in detail to
+address new problems or concerns.
+
+Each version is given a distinguishing version number. If the Program
+specifies a version number of this License which applies to it and "any
+later version", you have the option of following the terms and conditions
+either of that version or of any later version published by the Free
+Software Foundation. If the Program does not specify a version number of
+this License, you may choose any version ever published by the Free Software
+Foundation.
+
+ 10. If you wish to incorporate parts of the Program into other free
+programs whose distribution conditions are different, write to the author
+to ask for permission. For software which is copyrighted by the Free
+Software Foundation, write to the Free Software Foundation; we sometimes
+make exceptions for this. Our decision will be guided by the two goals
+of preserving the free status of all derivatives of our free software and
+of promoting the sharing and reuse of software generally.
+
+ NO WARRANTY
+
+ 11. BECAUSE THE PROGRAM IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY
+FOR THE PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN
+OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES
+PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED
+OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
+MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE ENTIRE RISK AS
+TO THE QUALITY AND PERFORMANCE OF THE PROGRAM IS WITH YOU. SHOULD THE
+PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING,
+REPAIR OR CORRECTION.
+
+ 12. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING
+WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY AND/OR
+REDISTRIBUTE THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES,
+INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING
+OUT OF THE USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED
+TO LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY
+YOU OR THIRD PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER
+PROGRAMS), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE
+POSSIBILITY OF SUCH DAMAGES.
+
+ END OF TERMS AND CONDITIONS
+\f
+ How to Apply These Terms to Your New Programs
+
+ If you develop a new program, and you want it to be of the greatest
+possible use to the public, the best way to achieve this is to make it
+free software which everyone can redistribute and change under these terms.
+
+ To do so, attach the following notices to the program. It is safest
+to attach them to the start of each source file to most effectively
+convey the exclusion of warranty; and each file should have at least
+the "copyright" line and a pointer to where the full notice is found.
+
+ <one line to give the program's name and a brief idea of what it does.>
+ Copyright (C) <year> <name of author>
+
+ This program is free software; you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation; either version 2 of the License, or
+ (at your option) any later version.
+
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with this program; if not, write to the Free Software
+ Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+
+
+Also add information on how to contact you by electronic and paper mail.
+
+If the program is interactive, make it output a short notice like this
+when it starts in an interactive mode:
+
+ Gnomovision version 69, Copyright (C) year name of author
+ Gnomovision comes with ABSOLUTELY NO WARRANTY; for details type `show w'.
+ This is free software, and you are welcome to redistribute it
+ under certain conditions; type `show c' for details.
+
+The hypothetical commands `show w' and `show c' should show the appropriate
+parts of the General Public License. Of course, the commands you use may
+be called something other than `show w' and `show c'; they could even be
+mouse-clicks or menu items--whatever suits your program.
+
+You should also get your employer (if you work as a programmer) or your
+school, if any, to sign a "copyright disclaimer" for the program, if
+necessary. Here is a sample; alter the names:
+
+ Yoyodyne, Inc., hereby disclaims all copyright interest in the program
+ `Gnomovision' (which makes passes at compilers) written by James Hacker.
+
+ <signature of Ty Coon>, 1 April 1989
+ Ty Coon, President of Vice
+
+This General Public License does not permit incorporating your program into
+proprietary programs. If your program is a subroutine library, you may
+consider it more useful to permit linking proprietary applications with the
+library. If this is what you want to do, use the GNU Library General
+Public License instead of this License.
--- /dev/null
+# $Id$
+# automake source include to the begin of all Makefile.am's
+# Copyright (C) 2003 Jan Kratochvil <project-www.jankratochvil.net@jankratochvil.net>
+#
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; exactly version 2 of June 1991 is required
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write to the Free Software
+# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+
+
+# Set all needed variables to their empty values to prevent "variable `...' not defined"
+# Any further settings should be done exclusively by += operator
+EXTRA_DIST=
+BUILT_SOURCES=
+CLEANFILES=
+MAINTAINERCLEANFILES=
+noinst_DATA=
+
+# Force delete of target file if command fails.
+# Generally better behaviour but it requires GNU make. Harmless otherwise.
+.DELETE_ON_ERROR:
+
+%.html: %.html.pl $(top_srcdir)/My/Web.pm $(top_srcdir)/WebConfig.pm
+ perl -I$(top_srcdir) >$@ $<
+
--- /dev/null
+# $Id$
+# automake source for the toplevel Makefile
+# Copyright (C) 2003 Jan Kratochvil <project-www.jankratochvil.net@jankratochvil.net>
+#
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; exactly version 2 of June 1991 is required
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write to the Free Software
+# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+
+
+include $(top_srcdir)/Makefile-head.am
+
+AUTOMAKE_OPTIONS=foreign
+SUBDIRS=macros project
+## to automatically rebuild aclocal.m4 if any of the macros in
+## `macros/' change
+@MAINT@include macros/macros.dep
+@MAINT@macros/macros.dep: macros/Makefile.am
+@MAINT@ cd macros && $(MAKE) macros.dep
+
+EXTRA_DIST+= \
+ INSTALL \
+ config.rpath \
+ mkinstalldirs \
+ Makefile-head.am \
+ autogen.pl \
+ .vimrc \
+ ChangeLog
+
+MAINTAINERCLEANFILES+= \
+ ChangeLog
+
+CLEANFILES+= \
+ ChangeLog.bak
+
+if MAINTAINER_MODE
+ChangeLog:
+ cvs2cl.pl --usermap cvs2cl-usermap --window 3600 --separate-header --no-wrap --file $@ .
+
+else
+ChangeLog:
+ touch $@
+
+endif
+
+EXTRA_DIST+= \
+ index.html.pl
+
+noinst_DATA+= \
+ index.html
--- /dev/null
+#! /usr/bin/perl
+#
+# $Id$
+# Local package configuration for HTML/XHTML output generation
+# Copyright (C) 2003 Jan Kratochvil <project-www.jankratochvil.net@jankratochvil.net>
+#
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; exactly version 2 of June 1991 is required
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write to the Free Software
+# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+
+
+package WebConfig;
+require 5.6.0; # at least 'use warnings;' but we need some 5.6.0+ modules anyway
+use vars qw($VERSION);
+$VERSION=do { my @r=(q$Revision$=~/\d+/g); sprintf "%d.".("%03d"x$#r),@r; };
+use strict;
+use warnings;
+
+require Exporter;
+use vars qw(@ISA @EXPORT);
+@ISA=qw(Exporter);
+@EXPORT=qw(%WebConfig);
+
+our %WebConfig=(
+ "admin_mail"=>'web-www.jankratochvil.net@jankratochvil.net',
+ "viewcvs"=>map({ (!$_ ? $_ : s#^/#http://cvs.jankratochvil.net/viewcvs/energie/#); } $ENV{"SCRIPT_NAME"}),
+ "title_prefix"=>"Jan Kratochvil",
+ );
+
+1;
--- /dev/null
+#! /usr/bin/perl
+#
+# $Id$
+# Run to generate the initial Makefiles etc. after CVS checkout.
+# Copyright (C) 2003 Jan Kratochvil <project-www.jankratochvil.net@jankratochvil.net>
+#
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; exactly version 2 of June 1991 is required
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write to the Free Software
+# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+
+
+require 5.6.0; # at least 'use warnings;' but we need some 5.6.0+ modules anyway
+use vars qw($VERSION);
+$VERSION=do { my @r=(q$Revision$=~/\d+/g); sprintf "%d.".("%03d"x$#r),@r; };
+use strict;
+use warnings;
+
+use lib "./macros/";
+use AutoGen;
+
+use Carp qw(cluck confess);
+
+
+AutoGen->run(
+ "name"=>"www.jankratochvil.net",
+ "COPYRIGHT_HOLDER"=>'Jan Kratochvil <project-www.jankratochvil.net@jankratochvil.net>',
+ "ARGV"=>\@ARGV,
+ "clean"=>[qw(
+ ./ChangeLog.bak
+ ./INSTALL
+ *.html
+ )],
+ );
--- /dev/null
+# $Id$
+# Source file to generate "./configure" to prepare package for compilation
+# Copyright (C) 2003 Jan Kratochvil <project-www.jankratochvil.net@jankratochvil.net>
+#
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; exactly version 2 of June 1991 is required
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write to the Free Software
+# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+
+
+AC_INIT(./Makefile-head.am)
+AM_INIT_AUTOMAKE(www.jankratochvil.net,1.0cvs)
+AM_MAINTAINER_MODE
+
+dnl "Makefile" output files MUST have pathnames incl./excl. "./" prefix as specified!
+AC_OUTPUT([
+Makefile
+./macros/Makefile
+./project/Makefile
+./project/step/Makefile
+./project/icp/Makefile
+./project/FordFulk/Makefile
+./project/Heat/Makefile
+./project/kix/Makefile
+./project/patchd2/Makefile
+./project/doswatch/Makefile
+./project/oslik/Makefile
+./project/pipebuf/Makefile
+./project/smbfs/Makefile
+./project/tcpdump/Makefile
+./project/kware/Makefile
+./project/mdsms/Makefile
+./project/xbill/Makefile
+./project/mot2as/Makefile
+./project/vblib/Makefile
+./project/wllib/Makefile
+./project/tcp_rto/Makefile
+./project/redirector_ad/Makefile
+./project/timeplan/Makefile
+./project/fixhtml/Makefile
+./project/winvnc/Makefile
+./project/Nokia61/Makefile
+./project/tac_plus/Makefile
+./project/badblock_guess/Makefile
+./project/d1xnet/Makefile
+./project/netstat/Makefile
+./project/ircon/Makefile
+./project/sshpatch/Makefile
+./project/mod_auth_tacacs/Makefile
+./project/surprise/Makefile
+])
+
+echo done.
--- /dev/null
+short:Jan Kratochvil <project-www.jankratochvil.net@jankratochvil.net>
+lace:Jan Kratochvil <project-www.jankratochvil.net@jankratochvil.net>
--- /dev/null
+#! /usr/bin/perl
+#
+# $Id$
+# Main page Perl template.
+# Copyright (C) 2003 Jan Kratochvil <project-www.jankratochvil.net@jankratochvil.net>
+#
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; exactly version 2 of June 1991 is required
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write to the Free Software
+# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+
+
+require 5.6.0; # at least 'use warnings;' but we need some 5.6.0+ modules anyway
+use vars qw($VERSION $CVS_ID);
+$VERSION=do { my @r=(q$Revision$=~/\d+/g); sprintf "%d.".("%03d"x$#r),@r; };
+$CVS_ID=q$Id$;
+use strict;
+use warnings;
+
+use My::Web;
+use Carp qw(cluck confess);
+
+
+My::Web->init(
+ "title"=>'Homepage of Jan Kratochvil alias Lace',
+ );
+My::Web->heading();
+
+print <<'HERE';
+<h1>Jan Kratochvil</h1>
+<hr>
+
+<h2><a href="project/">Software projects</a></h2>
+<blockquote>
+<p>List of my software projects</p>
+</blockquote>
+
+<h2><a href="http://cvs.jankratochvil.net/">ViewCVS of my CVS repository</a></h2>
+<blockquote>
+<p>My public CVSROOT; Accessible storage of all of my projects, config files, webs and more.</p>
+</blockquote>
+
+<h2>Contact</h2>
+<blockquote>
+<p>e-mail: <a href="mailto:web-www.jankratochvil.net@jankratochvil.net">web-www.jankratochvil.net@jankratochvil.net</a></p>
+</blockquote>
+
+HERE
+
+My::Web->footer();
--- /dev/null
+DirectoryIndex list.cgi.pl index.html
--- /dev/null
+DirectoryIndex FordFulk.shtml
--- /dev/null
+#include <stdio.h>
+#include <assert.h>
+#include <stdlib.h>
+#include <limits.h>
+#include <unistd.h>
+
+int N=INT_MAX,N1,N2,TOT=0;
+char tty;
+
+struct E {
+ struct E *next,*forw;
+ struct V *s,*d;
+ int f,c;
+ };
+
+struct V {
+ struct V *path;
+ struct E *e,*back;
+ } *V,**patht;
+
+static void get(const char *s,int *vp)
+{
+int i;
+
+ if (tty) { fputs(s,stdout); fputs(": ",stdout); fflush(stdout); }
+ i=scanf("%d",vp); assert(i==1);
+ assert(*vp>=1 && *vp<=N);
+}
+
+int main(void)
+{
+int i,V1,V2,C,diff;
+
+ tty=!!ttyname(STDIN_FILENO);
+ get("Number of cities",&N ); assert(N>=2);
+ get("Starting city #" ,&N1);
+ get("Ending city #" ,&N2);
+ if (tty) puts("Write <start city> <end city> <capacity> triples. Finish by EOF");
+ V=calloc(N+1,sizeof(*V)); assert(V);
+ while ((i=scanf("%d%d%d",&V1,&V2,&C))==3) {
+struct E *e,*e0,*e1;
+
+ assert(V1>=1 && V1<=N && V2>=1 && V2<=N && V1!=V2 && C>0);
+ for (e=V[V1].e;e;e=e->next) assert(!(e->forw==e && e->d==V+V2));
+ e0=malloc(sizeof(*e0)); assert(e0);
+ e1=malloc(sizeof(*e1)); assert(e1);
+ e0->next=V[V1].e; V[V1].e=e0;
+ e1->next=V[V2].e; V[V2].e=e1;
+ e0->s=V+V1; e0->d=V+V2;
+ e1->s=V+V2; e1->d=V+V1;
+ e0->forw=e1->forw=e0;
+ e0->f=0; e0->c=C;
+ e1->f=e1->c=-1;
+ }
+ assert(i<=0);
+
+ for (;;) {
+struct V *p,*p2;
+struct E *e;
+int d;
+
+ for (i=1;i<=N;i++) V[i].path=NULL;
+ patht=&V[N1].path;
+ V[N1].back=NULL;
+ for (p=V+N1;p && p!=V+N2;p=p->path)
+ for (e=p->e;e;e=e->next)
+ if (!e->d->path &&
+ (( e==e->forw && e->f<e->c )
+ ||( e!=e->forw && e->forw->f>0 ))) {
+ *patht=e->d; patht=&e->d->path;
+ e->d->back=e;
+ }
+ if (!p) break;
+ diff=INT_MAX;
+ for (p2=p;(e=p->back);p=e->s) {
+ d=(e==e->forw ? e->c-e->f : e->f);
+ assert(d>0);
+ if (d<diff) diff=d;
+ }
+ assert(p==V+N1); assert(diff>0 || diff<INT_MAX);
+
+ for (p=p2;(e=p->back);p=e->s)
+ if (e==e->forw) e->f+=diff;
+ else e->f-=diff;
+ if (p2->back->forw==p2->back) TOT+=diff;
+ else TOT-=diff;
+ assert(TOT>0);
+ }
+ printf("Total network flow is: %d\n",TOT);
+ return(EXIT_SUCCESS);
+}
--- /dev/null
+do
+ for Eij as all the edges
+ mark Eij as candidate (green) if
+ t(Eij)<c(E), or
+ Eji exists and t(Eji)>0
+ mark 'Source' as active
+ while ('s'=first active node) and
+ if this 's' is not 'Target' do
+ for 't' as all the unmarked nodes
+ if exists edge 'Est' and its a candidate one
+ add 't' end of active nodes
+ record 's' to 't' for backtrace
+ mark node 's' as passed
+ if 's' is empty (no 'Target' reachable)
+ finish the algorithm
+ clean the backtraces not on 't'->'s' path
+ 'd'=+infinity
+ start at 's' and...
+ while still backtracable for 'j' backwards to 'i' do
+ if 'Eij' is a candidate
+ 'd'=min('d',c('Eij')-t('Eij'))
+ if 'Eji' is a candidate
+ 'd'=min('d',t('Eji'))
+ start at 's' and...
+ while still backtracable for 'j' backwards to 'i' do
+ if 'Eij' is a candidate
+ t('Eij')+='d'
+ if 'Eji' is a candidate
+ t('Eji')-='d'
+ network and variable cleanup (only 't()' remains)
+ forever (until line 15 finishes)
+-
+0
+Algorithm is currently stopped. You may use the control buttons to clear the
+state and restart whole simulation.
+-
+1 31
+The cycle will run as long as there are some paths to improve.
+Exit check is done on the line 15.
+-
+2-3
+In this cycle we're marking the directions and edges which would
+be eventually usable during next processing...
+-
+4
+In forward direction such path must have some capacity left [t(E)<c(e)].
+-
+5
+In backward direction there must exist appropriate inverse edge and this one
+must have t(E)>0.
+-
+6-13
+We're searching any existing path from source 's' to the target 't'
+which uses only marked (green) edges in correctly marked directions.
+In fact it is a wide-search with recording of back-path into each node.
+After reaching the target we can track the recorded path back to the
+source 's'.
+-
+14-15
+If no target 't' was found that means that:
+|1) Target is separated completely from the source or
+|2) There's no (other) paths which can be
+improved and which are connecting the source and target nodes.
+-
+16
+A little tidy up to clear the diagram.
+-
+17-23
+We're trying to find maximum 'd' which is improvable on ALL the edges
+used in the path found. Such 'd' must be >0 as otherwise one of such
+edges wouldn't be marked on the algorithm lines 1-5.
+-
+24-29
+We have the final value of 'd' so we can now on all the same edges
+contained in the path found apply appropriate improvements.
+-
+30
+All the temporary variables and data structures are no longer needed and
+may be freed now. The only result from this one pass of algorithm is
+the improvement in values of function 't()'
+-
+-
+0 0 0 1 0 2 0 3
+1 0 1 1 1 2
+ 2 3
+-
+1 5 2
+5 4 3
+2 3 1
+4 7 5
+7 4 7
+7 2 1
+5 6 2
+5 0 4
+0 6 9
+-
+5 3
+-
--- /dev/null
+7 1 7
+1 2 7
+1 3 10
+2 4 8
+2 5 4
+3 2 8
+3 5 3
+3 6 3
+4 7 4
+4 5 3
+5 7 7
+6 5 4
+6 7 5
--- /dev/null
+import java.applet.*;
+import java.awt.*;
+import java.util.*;
+import java.net.*;
+import java.io.*;
+
+public
+class FordFulk extends Applet
+{
+int WIRESHIFT=8,WIREARROW=16;
+double NODEGAPSCALE=1./2;
+double WIREFONTSCALE=1.,NODEFONTSCALE=3./2;
+double WIRECAPBALANCE=3./5,WIREFLGBALANCE=4./5;
+int WIREFLGRADIUS=8;
+FordFulkNet net;
+Color wirecolor=Color.blue,
+ wiretextfgcolor=Color.yellow,
+ wiretextbgcolor=Color.black,
+ wireflgyescolor=Color.green,
+ wireflgnocolor =Color.red,
+ wirebackcolor =Color.green,
+ nodeactivecolor=Color.magenta,
+ nodepassedcolor=Color.blue,
+ tgttextfgcolor =Color.white,
+ tgttextbgcolor =Color.black,
+ tgtarrowcolor =Color.cyan;
+String DATAFN;
+
+List codelist;
+TextField linenotext,stopattext,statustext;
+Button singlestep,nextlinestep,advancestep,continuerun,stopnow,resetnow;
+Choice codespeed;
+FordFulkTextArea guidearea;
+int lineno=0,stopat=0,linestot=0;
+boolean stopplus=false;
+static String cs_s[]={"fastest","100ms","1/2s","2s"},stext[]={"Working...","Delaying...","Ready."};
+Hashtable guides=new Hashtable();
+
+FordFulkThread thread;
+boolean suspendtest=true,suspendbug=true;
+long BUGGYSLEEP=100;
+
+ static String sectionToString(FordFulkDataStream is,String sep) throws IOException
+ {
+ String s="",l;
+ boolean f=true;
+ while ((l=is.getLine())!=null) { if (f) f=false; else s+=sep; s+=l; }
+ is.nextSection();
+ return s;
+ }
+
+ static StreamTokenizer sectionStreamTokenizer(FordFulkDataStream is) throws IOException
+ { return new StreamTokenizer(new StringBufferInputStream(sectionToString(is,"\n"))); }
+
+ static Vector readNumberChunk(FordFulkDataStream ffds,int divisor) throws IOException
+ {
+ StreamTokenizer fs=sectionStreamTokenizer(ffds);
+ Vector r=new Vector();
+ do switch (fs.nextToken()) {
+ case fs.TT_NUMBER:
+ r.addElement(new Integer(new Double(fs.nval).intValue()));
+ continue;
+ case fs.TT_EOF: break;
+ default:
+ throw new IOException("Unexpected data type "+fs.ttype+",nval="+fs.nval+",sval="+fs.sval);
+ } while (fs.ttype!=fs.TT_EOF);
+ if ((r.size()%divisor)!=0) throw new IOException("Trailing specification of number data (div="+divisor+")");
+ return r;
+ }
+
+ public void initError(String s,Exception e)
+ { s="Applet init error: "+s+" of \""+DATAFN+"\": "+e.toString(); showStatus(s); System.out.println(s); }
+
+ public TextField labeledText(Panel p,String lab,String ini)
+ {
+ Panel p1=new Panel();
+ p1.setLayout(new GridBagLayout());
+ if (lab!=null) p1.add(new Label(lab));
+ TextField r=new TextField(ini,ini.length());
+ r.setEditable(false);
+ p1.add(r);
+ p.add(p1);
+ return r;
+ }
+
+ public void init()
+ {
+ DATAFN=getParameter("DataFile");
+ setLayout(new GridLayout(1,0));
+ Vector pnts,wires,inis;
+ { Panel p=new Panel();
+ GridBagLayout gb=new GridBagLayout();
+ p.setLayout(gb);
+ GridBagConstraints gbc=new GridBagConstraints();
+ gbc.fill=GridBagConstraints.BOTH;
+ gbc.gridwidth=GridBagConstraints.REMAINDER;
+ gbc.weightx=1;
+ p.setBackground(Color.lightGray);
+ try {
+ { Panel p1=new Panel();
+ p1.setLayout(new FlowLayout());
+ linenotext=labeledText(p1,"Line","- ");
+ stopattext=labeledText(p1,"Stop","- ");
+ { Panel p2=new Panel();
+ p2.setLayout(new GridBagLayout());
+ p2.add(new Label("Delay"));
+ p2.add(codespeed=new Choice());
+ for (int i=0;i<4;i++) codespeed.addItem(cs_s[i]);
+ codespeed.select(1);
+ p1.add(p2);
+ }
+ statustext=labeledText(p1,null,stext[0]);
+ gbc.weighty=0;
+ gb.setConstraints(p1,gbc);
+ p.add(p1);
+ }
+ { Panel p1=new Panel();
+ p1.setLayout(new GridLayout(2,3));
+ p1.add(singlestep =new Button("Single step" ));
+ p1.add(nextlinestep=new Button("Stop @ next" ));
+ p1.add(advancestep =new Button("Any further" ));
+ p1.add(continuerun =new Button("Continue/Run"));
+ p1.add(stopnow =new Button("Stop now" ));
+ p1.add(resetnow =new Button("Reset & stop"));
+ gbc.weighty=1;
+ gb.setConstraints(p1,gbc);
+ p.add(p1);
+ }
+ codelist=new List(20,false);
+ FordFulkDataStream f=new FordFulkDataStream(new URL(getDocumentBase(),DATAFN).openStream());
+ String line;
+ while ((line=f.getLine())!=null) {
+ codelist.addItem(": "+line);
+ linestot++;
+ }
+ int lnol=new Integer(linestot).toString().length();
+ for (int i=1;i<=linestot;i++) {
+ String s="0000"+new Integer(i).toString();
+ codelist.replaceItem(s.substring(s.length()-lnol)+codelist.getItem(i-1),i-1);
+ }
+ f.nextSection();
+
+ for (;;) {
+ Vector which;
+ f.lineLimit(1);
+ which=readNumberChunk(f,1);
+ if (which.size()==0) break;
+ int lj=0;
+ String rng="";
+ boolean mult=false;
+ for (int i=0;i<which.size();i++) {
+ int j=((Integer)which.elementAt(i)).intValue();
+ if (j<0) { mult=true; rng+=" to "+(lj=-j); }
+ else {
+ if (rng.length()!=0) { mult=true; rng+=", "; }
+ rng+=(lj=j);
+ }
+ }
+ String s=(!mult && lj==0?"":("Comment for line"+(mult?"s ":" ")+rng+":\n"));
+ s+=sectionToString(f," ").replace('|','\n');
+ lj=0;
+ for (int i=0;i<which.size();i++) {
+ int j=((Integer)which.elementAt(i)).intValue();
+ if (j<0) while (lj<=-j) {
+ guides.put(new Integer(lj),s);
+ lj++;
+ }
+ else guides.put(new Integer(j),s);
+ lj=Math.abs(j);
+ }
+ }
+
+ pnts=readNumberChunk(f,2);
+ wires=readNumberChunk(f,3);
+ inis=readNumberChunk(f,2);
+ if (inis.size()!=2) throw new IOException("Source/dest chunk must have 2 values, not "+inis.size()+"!");
+ }
+ catch (MalformedURLException e) { initError("Malformed URL",e); return; }
+ catch (IOException e) { initError("Read",e); return; }
+ net=new FordFulkNet(this);
+ net.setup(pnts,wires,inis);
+ gbc.weighty=32;
+ gbc.gridheight=GridBagConstraints.REMAINDER;
+ gb.setConstraints(net,gbc);
+ p.add(net);
+ add(p);
+ }
+ { Panel p=new Panel();
+ GridBagLayout gb=new GridBagLayout();
+ p.setLayout(gb);
+ GridBagConstraints gbc=new GridBagConstraints();
+ gbc.fill=GridBagConstraints.BOTH;
+ gbc.gridwidth=GridBagConstraints.REMAINDER;
+ gbc.weightx=1;
+ gbc.weighty=3;
+ gb.setConstraints(codelist,gbc);
+ p.add(codelist);
+
+ guidearea=new FordFulkTextArea();
+ guidearea.setEditable(false);
+ gbc.weighty=1;
+ gb.setConstraints(guidearea,gbc);
+ p.add(guidearea);
+ add(p);
+ }
+ }
+
+ public void start()
+ {
+ lineno=0; codeListSelect();
+ newStopAt(0);
+ javaCleanCode(true);
+ thread=new FordFulkThread(this,false);
+ thread.start();
+ new FordFulkThread(this,true).start();
+ }
+
+ public synchronized void setNumText(TextField t,int i,boolean ifplus)
+ {
+ String s;
+ switch (i) {
+ case -1: s="single"; break;
+ case 0: s="stop"; break;
+ case Integer.MAX_VALUE: s="never"; break;
+ default: s=new Integer(i).toString()+(ifplus?"+":"");
+ }
+ t.setText(s);
+}
+
+ public synchronized void codeListSelect()
+ {
+ setNumText(linenotext,lineno,false);
+ if (lineno!=0) {
+ codelist.select(lineno-1);
+ codelist.makeVisible(lineno-1);
+ }
+ else codelist.deselect(codelist.getSelectedIndex());
+ String s=(String)guides.get(new Integer(lineno));
+ if (s==null) s="Sorry, no guide defined for line "+lineno+".";
+ guidearea.setRawText(s);
+ }
+
+ public synchronized void newStopAt(int newstop)
+ {
+ setNumText(stopattext,stopat=newstop,stopplus);
+ if (thread==null) return;
+ thread.resume(); thread.interrupt();
+ }
+
+ public synchronized boolean handleEvent(Event ev)
+ {
+ if (ev.target==codelist && (ev.id==ev.LIST_SELECT || ev.id==ev.LIST_DESELECT || ev.id==ev.ACTION_EVENT))
+ { newStopAt(codelist.getSelectedIndex()+1); return true; }
+ switch (ev.id) {
+ case ev.LIST_SELECT:
+ break;
+ case ev.ACTION_EVENT:
+ if (ev.target==nextlinestep)
+ { stopplus=false; newStopAt(lineno+1); return true; }
+ if (ev.target==singlestep)
+ { newStopAt(-1); return true; }
+ if (ev.target==continuerun)
+ { newStopAt(Integer.MAX_VALUE); return true; }
+ if (ev.target==advancestep)
+ { stopplus=true; newStopAt(lineno+1); return true; }
+ if (ev.target==stopnow)
+ { newStopAt(0); return true; }
+ if (ev.target==resetnow)
+ {
+ lineno=0; codeListSelect();
+ newStopAt(0);
+ javaCleanCode(true);
+ return true;
+ }
+ break;
+ }
+ return false;
+ }
+
+ public String getAppletInfo()
+ {
+ return(
+ "FordFulk by Jan Kratochvil <short@ucw.cz> in 1998.\n"+
+ "Redistribution permitted under GNU General Public License (AKA GPL) version 2 (exactly) found on ftp://prep.ai.mit.edu/pub/gnu/GPL."
+ );
+ }
+
+ public static void drawLine(Graphics g,Point p1,Point p2)
+ { g.drawLine(p1.x,p1.y,p2.x,p2.y); }
+ public static void drawString(Graphics g,String s,FordFulkPoint p,Color Bg,boolean docen,double fntscl)
+ {
+ Font of=g.getFont();
+ g.setFont(new Font(of.getName(),of.getStyle(),(int)(of.getSize()*fntscl)));
+ FontMetrics m=g.getFontMetrics();
+ int w=m.stringWidth(s);
+ if (docen) p.translate(-w/2.,+m.getAscent()/2.);
+ Point ip=p.point();
+ if (Bg!=null) {
+ int h=m.getAscent()+m.getDescent();
+ Color tc=g.getColor();
+ g.setColor(Bg);
+ g.fillRect(ip.x,ip.y-m.getAscent(),w,h);
+ g.setColor(tc);
+ }
+ g.drawString(s,ip.x,ip.y);
+ g.setFont(of);
+ }
+ public static void fillCircleColor(Graphics g,Point p,int r,Color c)
+ {
+ if (c!=null) g.setColor(c);
+ g.fillOval(p.x,p.y,r,r);
+ }
+
+Enumeration l2e=null;
+FordFulkWire l3w=null,l5w=null,l20w=null;
+Vector l6v=null;
+int l7S=0,l9T=0,l17D=0,l18J=0,l19I=0;
+
+ public synchronized void javaCleanCode(boolean hard)
+ {
+ FordFulk main=this; //for future separation
+
+ Enumeration e=main.net.W.elements();
+ while (e.hasMoreElements()) {
+ FordFulkWire w=(FordFulkWire)e.nextElement();
+ w.flgforw=w.flgback=null;
+ if (hard) w.T=0;
+ }
+ for (int i=0;i<main.net.nodes;i++) {
+ main.net.A[i].state=null;
+ main.net.A[i].back=-1;
+ }
+ for (int i=0;i<7;i++) main.net.tgtseta(i,null);
+ main.net.tgtsetD(null);
+ main.net.repaint();
+ }
+
+ public int javaCode()
+ {
+ FordFulk main=this; //for future separation
+
+ switch (lineno) {
+ case 0:
+ javaCleanCode(true);
+ break;
+ case 1:
+ break;
+ case 2:
+ l2e=main.net.W.elements();
+ break;
+ case 3:
+ if (!l2e.hasMoreElements()) {
+ main.net.repaint();
+ return 6;
+ }
+ l3w=(FordFulkWire)l2e.nextElement();
+ main.net.tgtseta(0,main.net.A[l3w.i]);
+ main.net.tgtseta(1,l3w);
+ main.net.tgtseta(2,null);
+ main.net.tgtseta(3,main.net.A[l3w.j]);
+ main.net.repaint();
+ break;
+ case 4:
+ l3w.flgforw=((l3w.T<l3w.C) ?main.wireflgyescolor:main.wireflgnocolor);
+ l5w=(FordFulkWire)main.net.W.get(new Point(l3w.j,l3w.i));
+ main.net.tgtseta(2,l5w);
+ main.net.repaint();
+ break;
+ case 5:
+ l3w.flgback=((l5w!=null && l5w.T>0) ?main.wireflgyescolor:main.wireflgnocolor);
+ for (int i=0;i<=3;i++) main.net.tgtseta(i,null);
+ main.net.repaint();
+ return 3;
+ case 6:
+ main.net.A[main.net.iniS].state=main.nodeactivecolor;
+ l6v=new Vector();
+ l6v.addElement(new Integer(main.net.iniS));
+ main.net.repaint();
+ break;
+ case 7:
+ if (l6v.size()==0) return 14;
+ l7S=((Integer)l6v.elementAt(0)).intValue();
+ main.net.tgtseta(4,main.net.A[l7S]);
+ main.net.repaint();
+ break;
+ case 8:
+ if (l7S==main.net.iniD) return 14;
+ l9T=-1;
+ break;
+ case 9:
+ while (++l9T<main.net.nodes)
+ if (main.net.A[l9T].state==null) {
+ main.net.tgtseta(6,main.net.A[l9T]);
+ main.net.repaint();
+ return 0;
+ }
+ main.net.tgtseta(5,null);
+ main.net.tgtseta(6,null);
+ main.net.repaint();
+ return 13;
+ case 10:
+ FordFulkWire wST=(FordFulkWire)main.net.W.get(new Point(l7S,l9T));
+ FordFulkWire wTS=(FordFulkWire)main.net.W.get(new Point(l9T,l7S));
+ if (!((wST!=null && wST.flgforw==main.wireflgyescolor)
+ ||(wTS!=null && wTS.flgback==main.wireflgyescolor)))
+ return 9;
+ main.net.tgtseta(5,wST);
+ main.net.repaint();
+ break;
+ case 11:
+ main.net.A[l9T].state=main.nodeactivecolor;
+ l6v.addElement(new Integer(l9T));
+ main.net.repaint();
+ break;
+ case 12:
+ main.net.A[l9T].back=l7S;
+ main.net.repaint();
+ return 9;
+ case 13:
+ l6v.removeElementAt(0);
+ main.net.A[l7S].state=main.nodepassedcolor;
+ main.net.repaint();
+ return 7;
+ case 14:
+ if (l6v.size()!=0) return 16;
+ break;
+ case 15:
+ return 99;
+ case 16:
+ int i;
+ for (i=0;i<main.net.nodes;i++) main.net.A[i].backused=false;
+ i=main.net.iniD;
+ for (i=main.net.iniD;i>=0;i=main.net.A[i].back) main.net.A[i].backused=true;
+ for (i=0;i<main.net.nodes;i++)
+ if (!main.net.A[i].backused) main.net.A[i].back=-1;
+ main.net.repaint();
+ break;
+ case 17:
+ l17D=Integer.MAX_VALUE;
+ main.net.tgtsetD("inf");
+ main.net.repaint();
+ break;
+ case 18:
+ case 24:
+ main.net.tgtseta(0,main.net.A[l19I=main.net.iniD]);
+ main.net.repaint();
+ break;
+ case 19:
+ case 25:
+ main.net.tgtseta(1,null);
+ main.net.tgtseta(3,main.net.A[l18J=l19I]);
+ if ((l19I=main.net.A[l18J].back)==-1) {
+ main.net.tgtseta(0,null);
+ main.net.tgtseta(1,null);
+ main.net.repaint();
+ return lineno+5;//19->24,25->30
+ }
+ main.net.tgtseta(0,main.net.A[l19I]);
+ l20w=(FordFulkWire)main.net.W.get(new Point(l19I,l18J));
+ main.net.tgtseta(1,l20w);
+ main.net.repaint();
+ break;
+ case 20:
+ case 26:
+ if (l20w==null || l20w.flgforw!=main.wireflgyescolor) return lineno+2;//20->22,26->28
+ main.net.tgtseta(1,l20w);
+ main.net.repaint();
+ break;
+ case 21:
+ l17D=Math.min(l17D,l20w.C-l20w.T);
+ main.net.tgtsetD(new Integer(l17D).toString());
+ main.net.repaint();
+ break;
+ case 27:
+ l20w.T+=l17D;
+ main.net.repaint();
+ break;
+ case 22:
+ case 28:
+ if (l20w==null || l20w.flgback!=main.wireflgyescolor) return lineno-3;//22->19,28->25
+ break;
+ case 23:
+ l17D=Math.min(l17D,((FordFulkWire)main.net.W.get(new Point(l18J,l19I))).T);
+ main.net.tgtsetD(new Integer(l17D).toString());
+ main.net.repaint();
+ return 19;
+ case 29:
+ ((FordFulkWire)main.net.W.get(new Point(l18J,l19I))).T-=l17D;
+ main.net.repaint();
+ break;
+ case 30:
+ javaCleanCode(false);
+ break;
+ case 31:
+ return 1;
+ }
+ return 0;
+ }
+
+ public synchronized void cycle()
+ {
+ statustext.setText(stext[0]);
+ codeListSelect();
+ if (stopat==0) return;
+ int newline;
+ if ((newline=javaCode())==0) newline=lineno+1;
+ if (newline>linestot) {
+ newline=0;
+ setNumText(stopattext,stopat=0,stopplus=false);
+ }
+ if (stopat==-1 || stopat==newline || (stopat<newline && stopplus))
+ setNumText(stopattext,stopat=0,stopplus=false);
+ lineno=newline;
+ codeListSelect();
+ }
+}
+
+class FordFulkTextArea extends TextArea
+{
+private String conts="";
+static final int VBARWIDTH=40,CHARWIDTH=8;
+boolean painted=false,once=true;
+int lastwidth=-1;
+
+ public void setRawText(String s)
+ {
+ if (conts==s) return;
+ conts=s;
+ lastwidth=-1;
+ if (!painted) rawRefresh(null);
+ repaint();
+ }
+
+ public void paint(Graphics g)
+ {
+ if (!painted) {
+ painted=true;
+ if (!once)
+ System.out.println("M$ Internet Explorer TextArea paint() override bug was a false alarm, this JVM is OK, sorry.");
+ }
+ rawRefresh(g.getFontMetrics());
+ super.paint(g);
+ }
+
+ public synchronized void rawRefresh(FontMetrics m)
+ {
+ int cols=Math.max(10,size().width-VBARWIDTH);
+ if (cols==lastwidth) return;
+ String s=new String(conts),line="",nline;
+ int totc=0;
+ setText("");
+ int spl=(m==null?CHARWIDTH/2:m.stringWidth(" "));
+ int ll=Integer.MAX_VALUE,cl;
+ while ((cl=s.length())<ll && cl>0) {
+ cl=ll;
+ int i,j;
+ if (s.charAt(0)=='\n') {
+ appendText(line+"\n");
+ line="";
+ s=s.substring(1);
+ continue;
+ }
+ while ((i=s.indexOf(' '))==0) s=s.substring(1);
+ if (i==-1) i=s.length();
+ if ((j=s.substring(0,i).indexOf('\n'))!=-1) i=j;
+ nline=new String(line);
+ if (line.length()!=0) nline+=" ";
+ nline+=s.substring(0,i);
+ int thisw;
+ if (m!=null) thisw=m.stringWidth(nline);
+ else thisw=nline.length()*CHARWIDTH;
+ if (thisw>cols && line.length()!=0) {
+ appendText(line+"\n");
+ line=s.substring(0,i);
+ }
+ else line=nline;
+ s=s.substring(i);
+ }
+ appendText(line);
+ }
+}
+
+class FordFulkThread extends Thread
+{
+FordFulk main;
+static int cs_v[]={0,100,500,2000};
+boolean justfortest;
+
+ public FordFulkThread(FordFulk _main,boolean _justfortest)
+ {
+ main=_main;
+ if (justfortest=_justfortest) setDaemon(true);
+ }
+
+ public void run()
+ {
+ if (justfortest) {
+ while (main.suspendtest) {
+ try {
+ main.thread.countStackFrames();
+ main.suspendbug=false;
+ main.thread.resume();
+ if (!main.suspendtest) break;
+ }
+ catch (IllegalThreadStateException e) {}
+ try { sleep(main.BUGGYSLEEP); }
+ catch (InterruptedException e) {}
+ }
+ stop();
+ return;
+ }
+ suspend();
+ main.suspendtest=false;
+ if (main.suspendbug)
+ System.out.println("Netscape Communicator suspend() bug, workarounding it...");
+ for (;;) {
+ main.cycle();
+ if (main.stopat==0) {
+ main.statustext.setText(main.stext[2]);
+ while (main.stopat==0) {
+ if (!main.suspendbug) suspend();
+ else try { sleep(main.BUGGYSLEEP); }
+ catch (InterruptedException e) {}
+ }
+ }
+ else {
+ main.statustext.setText(main.stext[1]);
+ if (main.guidearea.once) {
+ main.guidearea.once=false;
+ System.out.println("M$ Internet Explorer TextArea paint() override bug, workarounding it...");
+ }
+ try { sleep((long)cs_v[main.codespeed.getSelectedIndex()]); }
+ catch (InterruptedException e) {}
+ }
+ }
+ }
+}
+
+class FordFulkDataStream extends DataInputStream
+{
+private String TERM="-";
+private int togo=-1;
+
+ public FordFulkDataStream(InputStream s)
+ { super(s); }
+ public void lineLimit(int _togo)
+ { togo=_togo; }
+
+ public String getLine() throws IOException
+ {
+ if (togo==0) return null;
+ String l=readLine();
+ if (l==null) { togo=0; return null; }
+ if (l.trim().compareTo(TERM)==0) { togo=0; return null; }
+ togo--;
+ return l;
+ }
+
+ public void nextSection() throws IOException
+ {
+ if (togo!=0) throw new IOException("nextSection() but togo=="+togo+"!");
+ togo=-1;
+ }
+}
+
+class FordFulkPoint
+{
+double x,y;
+
+ public FordFulkPoint(int _x,int _y)
+ { x=_x; y=_y; }
+ public FordFulkPoint(double _x,double _y)
+ { x=_x; y=_y; }
+ public FordFulkPoint(FordFulkPoint p)
+ { x=p.x; y=p.y; }
+ public FordFulkPoint(Point p)
+ { x=p.x; y=p.y; }
+ public FordFulkPoint(FordFulkPoint p1,FordFulkPoint p2,double w)
+ { x=p1.point().x*(1-w)+p2.point().x*w; y=p1.point().y*(1-w)+p2.point().y*w; }
+ public FordFulkPoint(FordFulkPoint p1,FordFulkPoint p2) //arit. avg
+ { x=(p1.x+p2.x)/2; y=(p1.y+p2.y)/2; }
+ public void sub(FordFulkPoint p)
+ { x-=p.x; y-=p.y; }
+ public void sub(Point p)
+ { sub(new FordFulkPoint(p)); }
+ public Point point()
+ { return new Point((int)x,(int)y); }
+ public Dimension dimension()
+ { return new Dimension((int)x,(int)y); }
+ public void translate(double _x,double _y)
+ { x+=_x; y+=_y; }
+ public void translate(FordFulkPoint p)
+ { translate(p.x,p.y); }
+ public void rotplus90()
+ { double t=x; x=-y; y=t; }
+ public void rotminus90()
+ { double t=x; x=y; y=-t; }
+ public double length()
+ { return Math.sqrt(x*x+y*y); }
+ public void multiply(double c)
+ { x*=c; y*=c; }
+ public void normalize(double len)
+ { multiply(len/length()); }
+ public void negate()
+ { x=-x; y=-y; }
+ public String toString()
+ { return "FFP(x="+x+",y="+y+")"; }
+}
+
+interface FordFulkTargetable
+{
+ public FordFulkPoint center();
+ public FordFulkPoint ffpSize();
+}
+
+class FordFulkWire implements FordFulkTargetable
+{
+FordFulk main;
+int i,j;
+int C,T=0;
+Color flgforw=null,flgback=null;
+
+FordFulkPoint p1,p2;
+
+ public FordFulkWire(FordFulk _main,int _i,int _j,int _C)
+ { main=_main; i=_i; j=_j; C=_C; }
+ public void setup12(int shift)
+ {
+FordFulkPoint rln;
+ p1=main.net.A[i].center();
+ p2=main.net.A[j].center();
+ rln=new FordFulkPoint(p2);
+ rln.sub(p1);
+ rln.rotplus90();
+ rln.normalize(shift);
+ p1.translate(rln); p2.translate(rln);
+ }
+ public synchronized void drawArrow(Graphics g,int shift)
+ {
+ setup12(shift);
+ anyArrow(main,g,p1,p2,main.net.nodeSize/2);
+ }
+
+ public static void anyArrow(FordFulk main,Graphics g,FordFulkPoint p1,FordFulkPoint p2,double shorten)
+ {
+FordFulkPoint arrdir,arrwing,efix;
+
+ arrdir=new FordFulkPoint(p2);
+ arrdir.sub(p1);
+ efix=new FordFulkPoint(arrdir);
+ efix.normalize(-(shorten-1));
+ p2.translate(efix);
+ FordFulk.drawLine(g,p1.point(),p2.point());
+ arrdir.normalize(main.WIREARROW);
+ arrwing=new FordFulkPoint(arrdir);
+ arrwing.rotplus90();
+ arrdir=new FordFulkPoint(arrdir,arrwing);
+ arrdir.negate();
+ arrwing=new FordFulkPoint(p2); arrwing.translate(arrdir);
+ FordFulk.drawLine(g,p2.point(),arrwing.point());
+ arrdir.rotminus90();
+ arrwing=new FordFulkPoint(p2); arrwing.translate(arrdir);
+ FordFulk.drawLine(g,p2.point(),arrwing.point());
+ efix.negate();
+ p1.translate(efix);
+ }
+
+ public synchronized FordFulkPoint center()
+ {
+ setup12(main.WIRESHIFT);
+ return new FordFulkPoint(p1,p2);
+ }
+ public FordFulkPoint ffpSize()
+ { return new FordFulkPoint(1,1); }
+
+ public synchronized void paint(Graphics g)
+ {
+ if (main==null) return;
+ g.setColor(main.wirecolor);
+ drawArrow(g,main.WIRESHIFT);
+
+ g.setColor(main.wiretextfgcolor);
+ FordFulk.drawString(g,T+"/"+C,
+ new FordFulkPoint(p1,p2,main.WIRECAPBALANCE),
+ main.wiretextbgcolor,true,main.WIREFONTSCALE);
+ if (flgforw!=null)
+ FordFulk.fillCircleColor(g,
+ new FordFulkPoint(p1,p2,main.WIREFLGBALANCE).point(),
+ main.WIREFLGRADIUS,flgforw);
+ if (flgback!=null)
+ FordFulk.fillCircleColor(g,
+ new FordFulkPoint(p1,p2,1-main.WIREFLGBALANCE).point(),
+ main.WIREFLGRADIUS,flgback);
+ }
+}
+
+class FordFulkNode implements FordFulkTargetable
+{
+FordFulk main;
+int no; String no_s;
+Color state=null;
+int back=-1;
+boolean backused;
+Point pxy;
+
+ public FordFulkNode(FordFulk _main,int _no,Point _pxy)
+ {
+ main=_main; pxy=_pxy;
+ no_s=new Integer(no=_no).toString();
+ if (no==main.net.iniS) no_s+="s";
+ if (no==main.net.iniD) no_s+="d";
+ }
+
+ public FordFulkPoint ffpSize()
+ { return new FordFulkPoint(main.net.nodeSize,main.net.nodeSize); }
+ public Dimension size()
+ { return ffpSize().dimension(); }
+ public FordFulkPoint ffpLocation()
+ { return new FordFulkPoint(
+ main.net.unitShift.x+main.net.unitSize.x*pxy.x,
+ main.net.unitShift.y+main.net.unitSize.y*pxy.y);
+ }
+ public Point location()
+ { return ffpLocation().point(); }
+ public Rectangle bounds()
+ { return new Rectangle(location(),size()); }
+
+ public void justBack(Graphics g)
+ {
+ if (no<0 || back<0) return;
+ FordFulkWire ffw=new FordFulkWire(main,no,back,0);
+ g.setColor(main.wirebackcolor);
+ ffw.drawArrow(g,0);
+ }
+
+ public void paint(Graphics g)
+ {
+ if (no<0) return;
+ Rectangle me=bounds();
+ g.setColor(main.net.getBackground());
+ g.fillOval(me.x,me.y,me.width,me.height);
+ g.setColor(main.net.getForeground());
+ g.drawOval(me.x,me.y,me.width,me.height);
+ g.setColor(state);
+ FordFulk.drawString(g,no_s,center(),null,true,main.NODEFONTSCALE);
+ }
+
+ public FordFulkPoint center()
+ {
+ FordFulkPoint xy=ffpLocation(),wh=ffpSize();
+ return new FordFulkPoint(xy.x+wh.x/2,xy.y+wh.y/2);
+ }
+}
+
+class FordFulkNet extends Panel
+{
+FordFulk main;
+int nodes;
+FordFulkNode A[];
+Hashtable W=new Hashtable();
+int iniS,iniD;
+Vector blind=new Vector();
+int nodesx=1,nodesy=1;
+double nodeSize;
+FordFulkPoint unitShift,unitSize;
+
+String tgts[]={"i","Eij","Eji","j","s","Est","t",null};
+FordFulkTargetable tgta[]=new FordFulkTargetable[7];
+
+ public FordFulkNet(FordFulk _main)
+ { main=_main; }
+ public void setup(Vector pnts,Vector wires,Vector inis)
+ {
+ setBackground(Color.white);
+ nodes=pnts.size()/2;
+ iniS=((Integer)inis.elementAt(0)).intValue();
+ iniD=((Integer)inis.elementAt(1)).intValue();
+ Hashtable ndh=new Hashtable();
+ for (int i=0;i<nodes;i++) {
+ int y=((Integer)pnts.elementAt(i*2 )).intValue(),
+ x=((Integer)pnts.elementAt(i*2+1)).intValue();
+ nodesy=Math.max(nodesy,y+1);
+ nodesx=Math.max(nodesx,x+1);
+ ndh.put(new Point(x,y),new Integer(i));
+ }
+ A=new FordFulkNode[nodes];
+ for (int i=0;i<7;i++) tgta[i]=null;
+ for (int y=0;y<nodesy;y++)
+ for (int x=0;x<nodesx;x++) {
+ Integer ii;
+ Point pxy=new Point(x,y);
+ if ((ii=(Integer)ndh.get(pxy))==null)
+ blind.addElement(new FordFulkNode(main,-1,pxy));
+ else
+ A[ii.intValue()]=new FordFulkNode(main,ii.intValue(),pxy);
+ }
+ int wirecnt=wires.size()/3;
+ for (int i=0;i<wirecnt;i++) addWire(
+ ((Integer)wires.elementAt(i*3 )).intValue(),
+ ((Integer)wires.elementAt(i*3+1)).intValue(),
+ ((Integer)wires.elementAt(i*3+2)).intValue());
+ }
+ public void remWire(int i,int j)
+ { W.remove(new Point(i,j)); repaint(); }
+ public void addWire(int i,int j,int C)
+ { W.put(new Point(i,j),new FordFulkWire(main,i,j,C)); repaint(); }
+
+ public synchronized void tgtsetD(String d)
+ { tgts[7]=(d==null?null:"+"+d); }
+ public synchronized void tgtseta(int i,FordFulkTargetable tgt)
+ { tgta[i]=tgt; }
+ public synchronized void paint(Graphics gg)
+ {
+ if (A==null) return;
+ Dimension sz=size();
+ Image img=createImage(sz.width,sz.height);
+ Graphics g=img.getGraphics();
+
+ unitSize=new FordFulkPoint(
+ sz.width /(nodesx+1-main.NODEGAPSCALE),
+ sz.height/(nodesy+1-main.NODEGAPSCALE));
+ nodeSize=Math.min(unitSize.x,unitSize.y);
+ unitShift=new FordFulkPoint(
+ unitSize.x*(1-main.NODEGAPSCALE)+(unitSize.x-nodeSize)/2,
+ unitSize.y*(1-main.NODEGAPSCALE)+(unitSize.y-nodeSize)/2);
+ nodeSize*=main.NODEGAPSCALE;
+ //System.out.println("nodeSize="+nodeSize+",unitShift="+unitShift+",unitSize="+unitSize+",nodesx="+nodesx+",nodesy="+nodesy);
+
+ Enumeration e=W.elements();
+ while (e.hasMoreElements()) ((FordFulkWire)e.nextElement()).paint(g);
+ for (int i=0;i<nodes;i++) A[i].justBack(g);
+ for (int i=0;i<nodes;i++) A[i].paint(g);
+
+ double dist=sz.width/9.;
+ FontMetrics m=g.getFontMetrics();
+ int fny=sz.height-2*m.getLeading()-(m.getAscent()+m.getDescent())/2;
+ for (int i=0;i<7;i++) {
+ if (tgta[i]==null) continue;
+ double fnx=(i+1)*dist;
+ g.setColor(main.tgttextfgcolor);
+ FordFulk.drawString(g," "+tgts[i]+" ",new FordFulkPoint(fnx,(double)fny),main.tgttextbgcolor,true,1.);
+ g.setColor(main.tgtarrowcolor);
+ FordFulkWire.anyArrow(main,g,new FordFulkPoint(fnx,(double)(sz.height-m.getHeight()-1)),tgta[i].center(),tgta[i].ffpSize().x/4);
+ }
+ if (tgts[7]!=null) {
+ g.setColor(main.tgttextfgcolor);
+ FordFulk.drawString(g," d="+tgts[7]+" ",new FordFulkPoint(8*dist,(double)(fny-1)),main.tgttextbgcolor,true,1.);
+ }
+ gg.drawImage(img,0,0,this);
+ }
+ public void update(Graphics gg)
+ { paint(gg); }
+}
--- /dev/null
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2//EN">
+<HTML><HEAD><TITLE>Ford-Fulkenson Algorithm</TITLE></HEAD><BODY>
+<DIV ALIGN=CENTER><APPLET CODE="FordFulk.class" ARCHIVE="FordFulk.jar" WIDTH=900 HEIGHT=600 ALT="FordFulk Java Applet">
+<PARAM NAME="DataFile" VALUE="FordFulk.data">
+<H1>Please use Java-capable browser or Sun's AppletViewer for access!</H1>
+</APPLET></DIV>
+
+<HR>
+
+<H1>Ford-Fulkenson Algorithm</H1>
+
+ Here is the <A HREF="FordFulk.zip"><B>complete ZIP file</B></A> (50KB) with the source included. Please read
+the license terms:
+
+<H2>Release comments:</H2>
+
+<P>This software is provided "AS IS" without warranty of any kind. Redistribution
+permitted under the terms of <A HREF="ftp://prep.ai.mit.edu/pub/gnu/GPL">GNU General Public License version 2</A>.</P>
+<P>Whole packaged was assembled under time press and without previous deeper
+knowledge of Java language. You'll probably find many ineffective and stupid
+things I do. Please <A HREF="mailto:short@ucw.cz">give me a mail</A> if you
+want but send no flames, please.</P>
+
+<P>Graphical design is very ugly. I use only standard windowing toolkit
+supplied from Sun in JDK named AWT which is not much nifty and comfortable.
+On the other hand at least this demo tries to be as much compatible as possible.</P>
+
+<P>Proudly developed using
+<A HREF="http://www.sun.com/" ><IMG SRC="http://java.sun.com/images/buttons/lgsun.gif" WIDTH=64 HEIGHT=30 BORDER=0 ALIGN=ABSCENTER ALT="Sun"></A>
+<A HREF="http://java.sun.com/" ><IMG SRC="http://java.sun.com/images/logos/javalogo.gif" WIDTH=52 HEIGHT=88 BORDER=0 ALIGN=ABSCENTER ALT="Java"></A> and
+<A HREF="http://www.linuxnow.com/"><IMG SRC="http://www.linuxnow.com/pics/linuxnow.gif" WIDTH=88 HEIGHT=31 BORDER=0 ALIGN=ABSCENTER ALT="GNU/Linux"></A>
+[<A HREF="http://www.sun.com/">Sun</A> <A HREF="http://java.sun.com/">Java</A> and <A HREF="http://www.linuxnow.com/">GNU/Linux</A>].</P>
+
+<H2>Currently implemented workarounds of browser bugs:</H2>
+<UL>
+<LI><A HREF="http://www.microsoft.com/">MS</A> <A HREF="http://www.microsoft.com/ie/">Internet Explorer 4.01</A> bug with non-overridable
+TextArea() paint() method is now workarounded. Unfortunately as a result of using such crappy browser the line breaking algorithm of the
+guide (lower right) window is not functioning properly.
+<LI><A HREF="http://home.netscape.com/">Netscape Communicator</A> bug with non-functioning Thread suspend() is workarounded. Disadvantage of this
+workaround is some CPU consumption when the applet is ran under this browser. Latest version of <A HREF="http://home.netscape.com/">Netscape Communicator</A>
+for <A HREF="http://www.linuxnow.com/">GNU/Linux</A> doesn't exhibit this errorneous behaviour, although Communicator still displays warning messages to the
+Java log.
+</UL>
+
+<H2>C version of program:</H2>
+<P>I've added raw algorithm implementation written in ANSI C, can be found in
+"<A HREF="FordFulk.c">FordFulk.c</A>" source file. Please check it as
+there is likely a lot of bugs. Testing input data are in file
+"<A HREF="FordFulk.in">FordFulk.in</A>", it's graphical representation is in
+"<A HREF="FordFulk.in.gif">FordFulk.in.gif</A>". This sample network including
+the picture is provided by the courtesy of
+<A HREF="mailto:mcaceres@entelsa.entelnet.bo">Mauricio Caceres</A>. Correct
+resulting maximal flow of this network is <B>14</B>.</P>
+
+<H2>Author:</H2>
+
+<P>
+<A HREF="http://vellum.cz/~short/">Jan Kratochvil</A>,
+e-mail: <A HREF="mailto:short@ucw.cz">short@ucw.cz</A>,
+phone: <A HREF="http://www.paegas.cz/">+420 603 431329</A>.
+</P>
+
+</BODY></HTML>
--- /dev/null
+BASE=FordFulk
+JAVAC=javac -O
+JAR=jar
+CLASSES=$(shell grep '^class\|^interface' $(BASE).java|awk '{print $$2}')
+CLASSESS=$(addsuffix .class,$(CLASSES))
+TARGET=$(BASE).zip $(BASE)
+CFLAGS=-O2 -Wall -ggdb -lefence -ansi -pedantic
+HAVE_JAR=$(shell which jar &>/dev/null;echo $$?)
+ifeq ($(HAVE_JAR),0)
+JARTARG=$(BASE).jar
+endif
+
+.PHONY: all app clean
+
+all: $(TARGET)
+
+$(CLASSESS): $(BASE).java
+ $(RM) $(basename $<)*.class
+ $(JAVAC) $<
+
+$(BASE).jar: $(CLASSESS)
+ $(JAR) -cf $@ $^
+
+$(BASE).zip: $(JARTARG) $(CLASSESS) $(addprefix $(BASE).,data html java c in in.gif) Makefile .htaccess
+ rm -f $@
+ zip -9 $@ $^
+ifeq ($(HAVE_JAR),0)
+else
+ @echo "No 'jar' tool found, no speed-up archive created (use JDK 1.1+)."
+endif
+
+app: $(BASE).html $(CLASSESS) $(JARTARG) $(BASE).data
+ appletviewer $(basename $<).html
+
+clean:
+ $(RM) *.class $(BASE).{zip,jar}
--- /dev/null
+#! /usr/bin/perl
+#
+# $Id$
+# Definition of 'My::Project::FordFulk' for list.cgi.pl
+# Copyright (C) 2003 Jan Kratochvil <project-www.jankratochvil.net@jankratochvil.net>
+#
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; exactly version 2 of June 1991 is required
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write to the Free Software
+# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+
+
+package My::Project::FordFulk;
+require 5.6.0; # at least 'use warnings;' but we need some 5.6.0+ modules anyway
+use vars qw($VERSION $CVS_ID);
+$VERSION=do { my @r=(q$Revision$=~/\d+/g); sprintf "%d.".("%03d"x$#r),@r; };
+$CVS_ID=q$Id$;
+use strict;
+use warnings;
+
+
+our %ListItem=(
+ "name"=>"Ford-Fulkenson Algorithm Demonstration",
+ "download"=>"FordFulk/FordFulk.zip",
+ "online-demo"=>"FordFulk/",
+ "summary"=>"Web applet",
+ "license"=>"PD",
+ "maintenance"=>"finished",
+ "language"=>"Java 1.0.2",
+ "description"=>""
+ .'<p>Java applet to demonstrate the internals of Ford-Fulkerson network algorithm.</p>'
+ );
+
+1;
--- /dev/null
+# $Id$
+# automake source for the Makefile of project/FordFulk/ subdir
+# Copyright (C) 2003 Jan Kratochvil <project-www.jankratochvil.net@jankratochvil.net>
+#
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; exactly version 2 of June 1991 is required
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write to the Free Software
+# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+
+
+include $(top_srcdir)/Makefile-head.am
+
+EXTRA_DIST+= \
+ ListItem.pm \
+ index.html.pl
+
+noinst_DATA+= \
+ index.html
--- /dev/null
+#! /usr/bin/perl
+#
+# $Id$
+# Main page of 'My::Project::FordFulk'
+# Copyright (C) 2003 Jan Kratochvil <project-www.jankratochvil.net@jankratochvil.net>
+#
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; exactly version 2 of June 1991 is required
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write to the Free Software
+# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+
+
+require 5.6.0; # at least 'use warnings;' but we need some 5.6.0+ modules anyway
+use vars qw($VERSION $CVS_ID);
+$VERSION=do { my @r=(q$Revision$=~/\d+/g); sprintf "%d.".("%03d"x$#r),@r; };
+$CVS_ID=q$Id$;
+use strict;
+use warnings;
+
+use My::Web;
+use project::FordFulk::ListItem;
+
+
+My::Web->init_project(
+ "ListItem"=>\%My::Project::FordFulk::ListItem,
+ );
+
+My::Web->footer();
--- /dev/null
+DirectoryIndex Heat.shtml
--- /dev/null
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2//EN">
+<HTML><HEAD><TITLE>Heat distribution Algorithm</TITLE></HEAD><BODY>
+<DIV ALIGN=CENTER><APPLET CODE="JavaDraw.class" ARCHIVE="Heat.jar" WIDTH=200 HEIGHT=200 ALT="Heat Java Applet">
+<PARAM NAME="DataFile" VALUE="Heat.data">
+<H1>Please use Java-capable browser or Sun's AppletViewer for access!</H1>
+</APPLET></DIV>
+
+<HR>
+
+<H1>Heat distribution Algorithm</H1>
+
+ Here is the <A HREF="Heat.zip"><B>complete ZIP file</B></A> (76KB) with (my) source included. Please read
+the license terms:
+
+<H2>Release comments:</H2>
+
+<P>This software is provided "AS IS" without warranty of any kind. My changes are provided
+as diff and are under terms of public-domain software.</P>
+
+<P>Graphical design is very ugly. I use only standard windowing toolkit
+supplied from Sun in JDK named AWT which is not much nifty and comfortable.
+On the other hand at least this demo tries to be as much compatible as possible.</P>
+
+<P>Proudly developed using
+<A HREF="http://www.sun.com/" ><IMG SRC="http://java.sun.com/images/buttons/lgsun.gif" WIDTH=64 HEIGHT=30 BORDER=0 ALIGN=ABSCENTER ALT="Sun"></A>
+<A HREF="http://java.sun.com/" ><IMG SRC="http://java.sun.com/images/logos/javalogo.gif" WIDTH=52 HEIGHT=88 BORDER=0 ALIGN=ABSCENTER ALT="Java"></A> and
+<A HREF="http://www.linuxnow.com/"><IMG SRC="http://www.linuxnow.com/pics/linuxnow.gif" WIDTH=88 HEIGHT=31 BORDER=0 ALIGN=ABSCENTER ALT="GNU/Linux"></A>
+[<A HREF="http://www.sun.com/">Sun</A> <A HREF="http://java.sun.com/">Java</A> and <A HREF="http://www.linuxnow.com/">GNU/Linux</A>].</P>
+
+<H2>Currently known browser bugs:</H2>
+<OL>
+<LI><A HREF="http://www.microsoft.com/">MS</A> <A HREF="http://www.microsoft.com/ie/">Internet Explorer 5.0</A> has a bug
+with mismatching color values from PixelGrabber. Instead of direct use of getRGBdefault() I'm calibrating on internally
+generated image with full temperature range. Despite this fact this browser is recommended due to its fast JVM implementation.
+<LI><A HREF="http://java.sun.com/">Sun JDK</A> was tested on <A HREF="http://www.linuxnow.com/">GNU/Linux</A> successfuly
+in version 1.1.7a from <A HREF="http://www.blackdown.org/">BlackDown</A>, although JIT (Just-In-Time) compiler is missing
+and so the resulting speed is almost unusable.
+<LI><A HREF="http://home.netscape.com/">Netscape Communicator</A> 4.61 on <A HREF="http://www.linuxnow.com/">GNU/Linux</A>
+is compatible although it also doesn't provide JIT and so the result is similiar to JDK noted above.
+<LI><A HREF="http://home.netscape.com/">Netscape Communicator</A> 4.61 on Win32 is not able to correctly provide PixelGrabber
+at all so the function of this program is very limited on this platform.
+</OL>
+
+<H2>Author:</H2>
+
+<P>Original <A HREF="http://javaboutique.internet.com/JavaDraw/">JavaDraw</A> was written by
+<A HREF="mailto:zimmerma@nctech.fr">Vincent Zimmermann</A>, I've only modified it to provide heat-distribution
+functionality. Thanks to <A HREF="http://atrey.karlin.mff.cuni.cz/~ghort/">Tomas Bures</A> for some
+helpful ideas and algorithms. Contact to me follows:</P>
+<P><A HREF="http://vellum.cz/~short/">Jan Kratochvil</A>,
+e-mail: <A HREF="mailto:short@ucw.cz">short@ucw.cz</A>,
+phone: <A HREF="http://www.eurotel.cz/">+420 602 431329</A> / <A HREF="http://www.paegas.cz/">+420 603 431329</A>.</P>
+
+</BODY></HTML>
--- /dev/null
+#! /usr/bin/perl
+#
+# $Id$
+# Definition of 'My::Project::Heat' for list.cgi.pl
+# Copyright (C) 2003 Jan Kratochvil <project-www.jankratochvil.net@jankratochvil.net>
+#
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; exactly version 2 of June 1991 is required
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write to the Free Software
+# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+
+
+package My::Project::Heat;
+require 5.6.0; # at least 'use warnings;' but we need some 5.6.0+ modules anyway
+use vars qw($VERSION $CVS_ID);
+$VERSION=do { my @r=(q$Revision$=~/\d+/g); sprintf "%d.".("%03d"x$#r),@r; };
+$CVS_ID=q$Id$;
+use strict;
+use warnings;
+
+
+our %ListItem=(
+ "name"=>"Heat Distribution Simulation",
+ "download"=>"Heat/Heat.zip",
+ "online-demo"=>"Heat/",
+ "summary"=>"Web applet",
+ "license"=>"PD",
+ "maintenance"=>"finished",
+ "language"=>"Java 1.0.2",
+ "description"=>""
+ .'<p>Java applet to demonstrate distribution of heat in time.</p>'
+ );
+
+1;
--- /dev/null
+# $Id$
+# automake source for the Makefile of project/Heat/ subdir
+# Copyright (C) 2003 Jan Kratochvil <project-www.jankratochvil.net@jankratochvil.net>
+#
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; exactly version 2 of June 1991 is required
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write to the Free Software
+# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+
+
+include $(top_srcdir)/Makefile-head.am
+
+EXTRA_DIST+= \
+ ListItem.pm \
+ index.html.pl
+
+noinst_DATA+= \
+ index.html
--- /dev/null
+#! /usr/bin/perl
+#
+# $Id$
+# Main page of 'My::Project::Heat'
+# Copyright (C) 2003 Jan Kratochvil <project-www.jankratochvil.net@jankratochvil.net>
+#
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; exactly version 2 of June 1991 is required
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write to the Free Software
+# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+
+
+require 5.6.0; # at least 'use warnings;' but we need some 5.6.0+ modules anyway
+use vars qw($VERSION $CVS_ID);
+$VERSION=do { my @r=(q$Revision$=~/\d+/g); sprintf "%d.".("%03d"x$#r),@r; };
+$CVS_ID=q$Id$;
+use strict;
+use warnings;
+
+use My::Web;
+use project::Heat::ListItem;
+
+
+My::Web->init_project(
+ "ListItem"=>\%My::Project::Heat::ListItem,
+ );
+
+My::Web->footer();
--- /dev/null
+DirectoryIndex Islet.shtml
--- /dev/null
+/*
+ * Islet ICP'98 demonstation
+ * Redistribution permitted under the terms of GNU General Public License version 2
+ * "ftp://prep.ai.mit.edu/pub/gnu/GPL"
+ * Author: Jan Kratochvil <short@ucw.cz> (no flames for this piece of crap, please)
+ */
+
+import java.applet.*;
+import java.awt.*;
+import java.awt.event.*;
+import java.awt.image.*;
+import java.util.*;
+
+public class Islet extends Applet
+{
+Applet app=this;
+
+ private interface ImageLoader
+ { public Image load(String name); }
+
+ static private class CmdLoader implements ImageLoader
+ {
+ Toolkit kit;
+ public CmdLoader(Toolkit _kit) { kit=_kit; }
+ public Image load(String name) { return(kit.getImage(name)); }
+ }
+
+ private class AppLoader implements ImageLoader
+ { public Image load(String name) { return(app.getImage(app.getCodeBase(),name)); } }
+
+ private class AppListener extends MouseAdapter implements MouseListener
+ {
+ public void mouseClicked(MouseEvent e)
+ { new IsletThread(false,new AppLoader()); }
+ }
+
+ public void paint(Graphics g)
+ {
+ super.paint(g);
+ g.setColor(new Color(100,255,100));
+ g.fill3DRect(0,0,getSize().width-1,getSize().height-1,true);
+ g.setColor(Color.black);
+ g.setFont(new Font("Courier",Font.BOLD,getSize().height*8/10));
+ g.drawString("Open demo window",getSize().height*2/10,getSize().height*8/10);
+ }
+
+ public void update(Graphics g)
+ { paint(g); } //Leave background garbaged
+
+ public void init()
+ { addMouseListener(new AppListener()); }
+
+ public String getAppletInfo()
+ {
+ return(
+ "Islet by Jan Kratochvil <short@ucw.cz> in 1998. Created for purposes of ICP'98 competition.\n"+
+ "Redistribution permitted under GNU General Public License (AKA GPL) version 2 (exactly) found on ftp://prep.ai.mit.edu/pub/gnu/GPL."
+ );
+ }
+
+ static public void main(String[] args)
+ { new IsletThread(true,new CmdLoader(Toolkit.getDefaultToolkit())); }
+
+static private class IntBugCheck extends Thread
+{
+Thread t;
+
+ public IntBugCheck(Thread _t)
+ {
+ t=_t;
+ setDaemon(true);
+ start();
+ }
+
+ public void run()
+ {
+ try { sleep(30); }
+ catch (InterruptedException e) {}
+ t.interrupt();
+ }
+}
+
+//! Indentation violation:
+static private class IsletThread extends Thread
+{
+boolean doexit;
+Frame fview,fcontrol;
+Imager img;
+View view;
+ScrollPane viewpane;
+FieldWater water;
+boolean prepared=false;
+Point mousefld=new Point(-1,-1);
+boolean mousefldok=false;
+byte tool;
+ToolBox tools[];
+ImageLoader imageloader;
+TimerQ timerq=new TimerQ();
+static final int deltax[]={0,1,0,-1},deltay[]={-1,0,1,0};
+boolean running=false;
+ERandom rnd=new ERandom();
+int fldcnt[];
+Vector fld=new Vector(); //synchronized inside View!
+final long buggywait=200;
+
+ private Vector getfld(int y)
+ { return((Vector)fld.elementAt(y)); }
+ private Field getfld(Point pt)
+ { return((Field)(getfld(pt.y).elementAt(pt.x))); }
+ private Field getfld(int x,int y)
+ { return(getfld(new Point(x,y))); }
+ private void setfld(int y,Vector v)
+ { fld.setElementAt(v,y); }
+ private void setfld(Point pt,Field f)
+ { getfld(pt.y).setElementAt(f,pt.x); }
+ private void setfld(int x,int y,Field f)
+ { setfld(new Point(x,y),f); }
+
+ private class ERandom extends Random
+ {
+ public int nextUInt()
+ { return(Math.abs(nextInt())); }
+ }
+
+ private class Timer
+ {
+ public long when;
+ public Field trig;
+
+ public Timer(long ms,Field _trig)
+ {
+ when=System.currentTimeMillis()+ms;
+ trig=_trig;
+ timerq.add(this);
+ }
+ }
+
+ private class TimerQ
+ {
+ Vector q=new Vector();
+
+ synchronized public void add(Timer tm)
+ {
+ int i;
+ for (i=0;i<q.size();i++)
+ if (((Timer)q.elementAt(i)).when>=tm.when) break;
+ q.insertElementAt(tm,i);
+ interrupt();
+ }
+
+ public void runday()
+ { new Timer(1000,null); }
+
+ synchronized public long getMin()
+ {
+ while (!q.isEmpty()) {
+ Timer t=(Timer)q.firstElement();
+ if (t.when>System.currentTimeMillis()) break;
+ Field f=t.trig;
+ q.removeElementAt(0);
+ if (f!=null) {
+ view.kickRobotAss(f);
+ continue;
+ }
+ runday();
+ if (daytime.val+1<daytime.getMax()) {
+ daytime.inc();
+ continue;
+ }
+ daybox.setState(pertp);
+ dayboxdog.itemStateChanged(null);
+ }
+ if (q.isEmpty()) return(Long.MAX_VALUE);
+ return(Math.max(0,((Timer)q.firstElement()).when-System.currentTimeMillis()));
+ }
+
+ synchronized public void clear()
+ { q.removeAllElements(); }
+ }
+
+ private class Rotator extends ImageFilter
+ {// "Insipired" by Sun's RotateFilter
+ int imgh;
+
+ public void setDimensions(int width,int height)
+ { consumer.setDimensions((imgh=height),width); }
+
+ public void setProperties(Hashtable p)
+ {
+ p=(Hashtable)p.clone();
+ Object s=p.get("filters");
+ if (s==null) p.put("filters",toString());
+ else if (s instanceof String)
+ p.put("filters",((String)s)+toString());
+ consumer.setProperties(p);
+ }
+
+ public void setHints(int flg)
+ { consumer.setHints(flg&(SINGLEFRAME|SINGLEPASS)); } //RANDOMPIXELORDER?
+
+ public void setPixels(int x1,int y1,int w,int h,ColorModel model,byte pixels[],int off,int scansize)
+ {
+ byte out[]=new byte[w*h];
+ int dst=0;
+ for (int y=0;y<h;y++) {
+ for (int x=0;x<w;x++)
+ out[x*h+h-1-y]=pixels[off++];
+ off+=scansize-w;
+ }
+ consumer.setPixels(imgh-y1-h,x1,h,w,model,out,0,h);
+ }
+
+ public void setPixels(int x1,int y1,int w,int h,ColorModel model,int pixels[],int off,int scansize)
+ {
+ int out[]=new int[w*h];
+ int dst=0;
+ for (int y=0;y<h;y++) {
+ for (int x=0;x<w;x++)
+ out[x*h+h-1-y]=pixels[off++];
+ off+=scansize-w;
+ }
+ consumer.setPixels(imgh-y1-h,x1,h,w,model,out,0,h);
+ }
+ }
+
+ private class Imager
+ {
+ final String names[]={"water","land","wall","food","robotx","roboty"};
+ public final byte WATER =0;
+ public final byte LAND =1;
+ public final byte WALL =2;
+ public final byte FOOD =3;
+ public final byte ROBOTX=4;
+ public final byte ROBOTY=5;
+ public final byte MAXR =(byte)names.length;
+ public final byte MAX =(byte)((int)MAXR+2*3);
+ public final byte sizex=16,sizey=16;
+ public Image a[]=new Image[MAX];
+
+ public Imager(ImageLoader loader)
+ {
+ tool=LAND;
+ tools=new ToolBox[MAXR];
+ fldcnt=new int[MAX];
+ water=new FieldWater(0,0);
+ for (byte i=0;i<MAXR;i++) {
+ a[i]=loader.load(names[i]+".gif");
+ (tools[i]=new ToolBox(i)).addMouseListener(tools[i]);
+ }
+ Rotator rotator=new Rotator();
+ Toolkit kit=Toolkit.getDefaultToolkit();
+ for (byte i=2;i<=6;i+=2)
+ for (byte j=0;j<=1;j++)
+ a[ROBOTX+i+j]=kit.createImage(new FilteredImageSource(a[ROBOTX+i-2+j].getSource(),rotator));
+ }
+ public void draw(Graphics g,byte tp,Point pt,Color col,ImageObserver obs)
+ {
+ g.drawImage(a[tp],pt.x,pt.y,sizex,sizey,obs);
+ if (col!=null) {
+ g.setColor(col);
+ g.draw3DRect(pt.x,pt.y,sizex-1,sizey-1,true);
+ }
+ }
+ }
+
+ private abstract class Field
+ {
+ public Point pt;
+ protected byte tp;
+
+ public Field(Point _pt)
+ {
+ pt=new Point(_pt);
+ }
+ private void shiftBy(int how)
+ {
+ fldcnt[tp]+=how;
+ switch (tp) {
+ case img.FOOD: foodcnt.setCount(fldcnt[tp]); break;
+ case img.ROBOTX: sidex .setCount(fldcnt[tp]); break;
+ case img.ROBOTY: sidey .setCount(fldcnt[tp]); break;
+ }
+ }
+ public void setup(byte _tp)
+ {
+ tp=_tp;
+ shiftBy(+1);
+ if (running) addTimer();
+ }
+
+ public Point cellPt(Point _pt)
+ { return(new Point(_pt.x*img.sizex,_pt.y*img.sizey)); }
+ public Point cellPt(int x,int y)
+ { return(cellPt(new Point(x,y))); }
+ public Point cellPt()
+ { return(cellPt(pt)); }
+ public Rectangle cellRect()
+ { Point npt=cellPt();
+ return(new Rectangle(npt.x,npt.y,img.sizex,img.sizey));
+ }
+
+ public Point whichCell(Point _pt)
+ {
+ Point p=new Point(_pt);
+ p.x/=img.sizex;
+ p.y/=img.sizey;
+ if (!view.validateFld(p)) return(new Point(-1,-1));
+ return(p);
+ }
+
+ public void paint()
+ {
+ Rectangle r=cellRect();
+ view.repaint(r.x,r.y,r.width,r.height);
+ }
+
+ public void moveYourAss() {}
+ public void addTimer() {}
+ public void dispose()
+ { shiftBy(-1); pt=null; }
+ public byte getValue() { return(tp); }
+ public byte getImgValue() { return(getValue()); }
+ public boolean isRobot() { return(tp==img.ROBOTX || tp==img.ROBOTY); }
+ public Field create(Point _pt,byte _tp)
+ {
+ switch (_tp) {
+ case img.WATER: return(new FieldWater (_pt));
+ case img.LAND: return(new FieldLand (_pt));
+ case img.WALL: return(new FieldWall (_pt));
+ case img.FOOD: return(new FieldFood (_pt));
+ case img.ROBOTX: return(new FieldRobotX(_pt));
+ case img.ROBOTY: return(new FieldRobotY(_pt));
+ default: return(null);
+ }
+ }
+ public Field create(int x,int y,byte _tp)
+ { return(create(new Point(x,y),_tp)); }
+ }
+
+ private class FieldWater extends Field
+ { public FieldWater (Point _pt) { super(_pt); setup(img.WATER); } public FieldWater (int x,int y) { this(new Point(x,y)); } }
+ private class FieldLand extends Field
+ { public FieldLand (Point _pt) { super(_pt); setup(img.LAND); } public FieldLand (int x,int y) { this(new Point(x,y)); } }
+ private class FieldWall extends Field
+ { public FieldWall (Point _pt) { super(_pt); setup(img.WALL); } public FieldWall (int x,int y) { this(new Point(x,y)); } }
+ private class FieldFood extends Field
+ { public FieldFood (Point _pt) { super(_pt); setup(img.FOOD); } public FieldFood (int x,int y) { this(new Point(x,y)); } }
+
+ private class FieldRobot extends Field
+ {
+ byte orient;
+ Side side;
+ float weight;
+
+ private void reorient(boolean full)
+ {
+ byte oo=orient;
+ orient=(byte)(rnd.nextUInt()%(full?4:3));
+ if (full) return;
+ if (orient==oo) orient=3;
+ this.paint();
+ }
+ private void reorient() { reorient(false); }
+ public FieldRobot(Point _pt,boolean wh)
+ {
+ super(_pt);
+ weight=1;
+ reorient(true);
+ side=(wh?sidey:sidex);
+ }
+
+ private void spawn(FieldRobot r)
+ {
+ Field f;
+ if (r.weight<2) f=new FieldLand(pt);
+ else {
+ if (r.side.wh) f=new FieldRobotY(pt);
+ else f=new FieldRobotX(pt);
+ ((FieldRobot)f).orient=orient;
+ r.weight-=1;
+ }
+ setfld(pt,f); f.paint();
+ }
+
+ public byte getImgValue() { return((byte)(getValue()+2*orient)); }
+ public void addTimer()
+ {
+ new Timer(10000/Math.max(1,side.speed.val),this);
+ }
+ public void moveYourAss()
+ {
+ if (pt==null || (pertp && !side.wh)) return;
+ addTimer();
+ Point npt=new Point(pt.x+deltax[orient],pt.y+deltay[orient]);
+ if (!view.validateFld(npt)) { reorient(); return; }
+ Field f=getfld(npt);
+ switch (f.getValue()) {
+ case img.WATER:
+ case img.WALL:
+ reorient(); return;
+ case img.LAND:
+ break;
+ case img.FOOD:
+ weight+=((float)foodwght.val)/100;
+ break;
+ case img.ROBOTX:
+ case img.ROBOTY:
+ FieldRobot r=(FieldRobot)f;
+ if (r.side.wh==side.wh) { reorient(); return; }
+ if (((pertp?fightnight.val:fightday.val)>(rnd.nextUInt()%100))==side.wh) { //we won
+ weight+=r.weight;
+ break;
+ }
+ r.weight+=weight;
+ r.orient=(byte)(orient^2);
+ r.paint();
+ spawn(r);
+ dispose();
+ return;
+ }
+ setfld(npt,this);
+ f.dispose();
+ spawn(this);
+ pt=npt;
+ this.paint();
+ }
+ }
+ private class FieldRobotX extends FieldRobot
+ { public FieldRobotX(Point _pt) { super(_pt,false); setup(img.ROBOTX); } public FieldRobotX(int x,int y) { this(new Point(x,y)); } }
+ private class FieldRobotY extends FieldRobot
+ { public FieldRobotY(Point _pt) { super(_pt,true ); setup(img.ROBOTY); } public FieldRobotY(int x,int y) { this(new Point(x,y)); } }
+
+ public IsletThread(boolean _doexit,ImageLoader _imageloader)
+ {
+ doexit=_doexit;
+ imageloader=_imageloader;
+ start();
+ }
+
+ private class View extends Panel implements MouseListener,MouseMotionListener,AdjustmentListener
+ {
+ synchronized public void paint(Graphics g)
+ {
+ if (!prepared) return;
+ Rectangle r=g.getClipBounds();
+ Point pt;
+ view.validateFld(pt=new Point(r.x/img.sizex,r.y/img.sizey));
+ int x=pt.x,y=pt.y;
+ view.validateFld(pt=new Point((r.x+r.width -1)/img.sizex,(r.y+r.height-1)/img.sizey));
+ int xm=pt.x,ym=pt.y;
+ for (;y<=ym;y++) {
+ Vector v=getfld(y);
+ for (int xw=x;xw<=xm;xw++) {
+ Field f=(Field)v.elementAt(xw);
+ img.draw(g,f.getImgValue(),f.cellPt(),(xw==mousefld.x && y==mousefld.y?Color.black:null),this);
+ }
+ }
+ }
+ public void update(Graphics g)
+ { paint(g); } //Leave background garbaged
+
+ synchronized public void kickRobotAss(Field f)
+ { f.moveYourAss(); }
+
+ public boolean validateFld(Point pt)
+ {
+ boolean v=true;
+ if (pt.x>=sizex.val) { pt.x=sizex.val-1; v=false; }
+ if (pt.y>=sizey.val) { pt.y=sizey.val-1; v=false; }
+ if (pt.x<0) { pt.x=0; v=false; }
+ if (pt.y<0) { pt.y=0; v=false; }
+ return(v);
+ }
+
+ synchronized public Point getAnyFld(byte tp)
+ {
+ if (fldcnt[tp]<=0) return(null);
+ int skip=rnd.nextUInt()%fldcnt[tp],x=0,y=0;
+ while (skip>=0 && y<sizey.val) {
+ Vector v=getfld(y);
+ while (x<sizex.val) {
+ Field f=(Field)v.elementAt(x);
+ if (f.getValue()==tp)
+ if (--skip<=0) break;
+ x++;
+ }
+ if (x>=sizex.val) { x=0; y++; }
+ }
+ if (skip>0) return(null); //Shouldn't happen!
+ return(new Point(x,y));
+ }
+
+ synchronized public void mousePressed (MouseEvent e)
+ {
+ mouseMoved(e);
+ if (!mousefldok) return;
+ Field f=getfld(mousefld),fnew;
+ if (f.getValue()==tool) return;
+ setfld(mousefld,(fnew=water.create(mousefld,tool)));
+ f.dispose();
+ fnew.paint();
+ }
+
+ synchronized public void paintAt(Point pt)
+ {
+ if (mousefldok)
+ getfld(mousefld).paint();
+ }
+
+ synchronized public void fldupdate(Point pt)
+ {
+ if (pt.equals(mousefld)) return;
+ paintAt(mousefld);
+ mousefld=pt;
+ mousefldok=view.validateFld(new Point(mousefld));
+ paintAt(mousefld);
+ }
+
+ public void mouseClicked (MouseEvent e) {}
+ public void mouseEntered (MouseEvent e) {}
+ public void mouseReleased(MouseEvent e) {}
+ public void mouseExited (MouseEvent e)
+ { fldupdate(new Point(-1,-1)); }
+ public void mouseDragged (MouseEvent e)
+ { mousePressed(e); }
+ public void mouseMoved (MouseEvent e)
+ { fldupdate(water.whichCell(e.getPoint())); }
+
+ public Dimension getPreferredSize()
+ { Point pt=water.cellPt(sizex.val,sizey.val);
+ return(new Dimension(pt.x,pt.y));
+ }
+ public Dimension getMinimumSize()
+ { return(getPreferredSize()); }
+
+ synchronized public void adjustmentValueChanged(AdjustmentEvent e)
+ {
+ int x,y,xval,xnewval,yval,ynewval;
+
+ if (sizex==null || sizey==null) return;
+ xval=sizex.val; xnewval=sizex.newval;
+ yval=sizey.val; ynewval=sizey.newval;
+ if (xval>xnewval) sizex.val=xnewval;
+ if (yval>ynewval) sizey.val=ynewval;
+ if (xval>xnewval)
+ for (y=0;y<yval;y++) {
+ for (x=xnewval;x<xval;x++)
+ getfld(x,y).dispose();
+ getfld(y).setSize(xnewval);
+ }
+ else if (xval<xnewval)
+ for (y=0;y<yval;y++) {
+ getfld(y).setSize(xnewval);
+ for (x=xval;x<xnewval;x++)
+ setfld(x,y,new FieldWater(x,y));
+ }
+ if (yval>ynewval) {
+ for (y=ynewval;y<yval;y++)
+ for (x=0;x<xnewval;x++)
+ getfld(x,y).dispose();
+ fld.setSize(ynewval);
+ }
+ else if (yval<ynewval) {
+ fld.setSize(ynewval);
+ for (y=yval;y<ynewval;y++) {
+ setfld(y,new Vector(xnewval));
+ getfld(y).setSize(xnewval);
+ for (x=0;x<xnewval;x++)
+ setfld(x,y,new FieldWater(x,y));
+ }
+ }
+ sizex.val=xnewval;
+ sizey.val=ynewval;
+ Point pt2=water.cellPt(xnewval,ynewval);
+ if (xval<xnewval) {
+ Point pt1=water.cellPt(xval,0);
+ view.repaint(pt1.x,pt1.y,pt2.x-pt1.x,pt2.y-pt1.y);
+ }
+ if (yval<ynewval) {
+ Point pt1=water.cellPt(0,yval);
+ view.repaint(pt1.x,pt1.y,pt2.x-pt1.x,pt2.y-pt1.y);
+ }
+ //viewpane.setSize(pt2.x,pt2.y);
+ fview.pack();
+ }
+
+ synchronized public void addTimers(byte tp)
+ {
+ for (int y=0;y<sizey.val;y++) {
+ Vector v=getfld(y);
+ for (int x=0;x<sizex.val;x++) {
+ Field f=(Field)v.elementAt(x);
+ if (tp==img.MAX || tp==f.getValue())
+ f.addTimer();
+ }
+ }
+ }
+
+ public void addAllTimers()
+ { addTimers(img.MAX); }
+
+ synchronized boolean putFieldToField(byte tpd,byte tps)
+ {
+ Point pt;
+ if ((pt=view.getAnyFld(tps))==null) return(true);
+ Field f=getfld(pt),newf;
+ setfld(pt,(newf=water.create(pt,tpd)));
+ f.dispose(); newf.paint();
+ return(false);
+ }
+ }
+
+ private class ToolBox extends Panel implements MouseListener
+ {
+ byte tp;
+
+ public ToolBox(byte _tp)
+ {
+ tp=_tp;
+ }
+ public void paint(Graphics g)
+ { img.draw(g,tp,new Point(0,0),(tp==tool?Color.black:null),this); }
+ public void update(Graphics g)
+ { paint(g); }
+ public void mouseClicked (MouseEvent e) {}
+ public void mouseEntered (MouseEvent e) {}
+ public void mouseReleased(MouseEvent e) {}
+ public void mouseExited (MouseEvent e) {}
+ public void mousePressed (MouseEvent e)
+ {
+ if (tool==tp) return;
+ tools[tool].repaint();
+ tool=tp;
+ repaint();
+ }
+ public Dimension getPreferredSize()
+ { return(new Dimension(img.sizex,img.sizey)); }
+ public Dimension getMinimumSize()
+ { return(getPreferredSize()); }
+ }
+
+ private void shutdown()
+ {
+ fview.dispose(); fcontrol.dispose();
+ if (doexit) System.exit(0);
+ stop();
+ }
+
+ private class WindowClose implements WindowListener
+ {
+ public void windowOpened (WindowEvent e) {}
+ public void windowClosed (WindowEvent e) {}
+ public void windowIconified (WindowEvent e) {}
+ public void windowDeiconified(WindowEvent e) {}
+ public void windowActivated (WindowEvent e) {}
+ public void windowDeactivated(WindowEvent e) {}
+ public void windowClosing (WindowEvent e)
+ { shutdown(); }
+ }
+
+ private class ButtonQuit implements ActionListener
+ {
+ public void actionPerformed(ActionEvent e)
+ { shutdown(); }
+ }
+
+ private class ButtonStartStop implements ActionListener
+ {
+ Button b;
+
+ public ButtonStartStop(Button _b)
+ { b=_b; }
+
+ public void actionPerformed(ActionEvent e)
+ {
+ running=!running;
+ if (!running) {
+ timerq.clear();
+ b.setLabel("Start");
+ return;
+ }
+ b.setLabel("Stop");
+ timerq.runday();
+ view.addAllTimers();
+ }
+ }
+
+ private class EScrollbar extends Scrollbar
+ {
+ public EScrollbar(int i1,int i2,int i3,int i4,int i5)
+ { super(i1,i2,i3,i4,i5); }
+ public Dimension getPreferredSize()
+ { return(new Dimension(100,super.getPreferredSize().height)); }
+ }
+
+ private class ScrollBarVal implements AdjustmentListener
+ {
+ public int val,newval;
+ public Panel panel;
+
+ Scrollbar bar;
+ Label prelab,lab;
+ protected int visible=2; //divisor!
+ AdjustmentListener listener;
+ String suffix="";
+
+ private int getVis(int val)
+ { return(Math.max(1,val/visible)); }
+
+ public ScrollBarVal(String lval,int _val,int min,int max,AdjustmentListener _listener)
+ {
+ val=0;
+ listener=_listener;
+ panel=new Panel();
+ panel.add(prelab=new Label(lval+":"));
+ panel.add(bar=new EScrollbar(EScrollbar.HORIZONTAL,0,getVis(max),min,max+getVis(max)));
+ bar.setSize(300,bar.getSize().height);
+ panel.add(lab=new Label(Integer.toString(val)));
+ bar.addAdjustmentListener(this);
+ setValue(_val);
+ }
+
+ synchronized public void adjustmentValueChanged(AdjustmentEvent e)
+ {
+ newval=bar.getValue();
+ lab.setText(Integer.toString(newval)+suffix);
+ if (newval==val) return;
+ if (listener!=null)
+ listener.adjustmentValueChanged(e);
+ val=newval;
+ }
+
+ public void setValue(int _val)
+ { bar.setValue(_val); adjustmentValueChanged(null); }
+ public void dec()
+ { if (val>0) setValue(val-1); }
+ public void inc()
+ { if (val<bar.getMaximum()+visible) setValue(val+1); }
+ public void setMax(int _val)
+ { bar.setVisibleAmount(getVis(_val)); bar.setMaximum(_val+bar.getVisibleAmount()); adjustmentValueChanged(null); }
+ public int getMax()
+ { return(bar.getMaximum()-bar.getVisibleAmount()); }
+
+ public void setSuffix(String s)
+ { suffix=s; adjustmentValueChanged(null); }
+ }
+
+ private abstract class Controller implements AdjustmentListener
+ {
+ protected ScrollBarVal cnt;
+ byte tp;
+ boolean silent=false;
+
+ public void setup(byte _tp,String s)
+ {
+ tp=_tp;
+ cnt=new ScrollBarVal(s,0,0,200,this);
+ }
+ public void setCount(int _cnt)
+ { if (!silent) cnt.setValue(_cnt); }
+
+ public void adjustmentValueChanged(AdjustmentEvent e)
+ { //cnt
+ Point pt;
+ if (cnt==null) return;
+ if (cnt.newval==fldcnt[tp]) return;
+ silent=true;
+ while (cnt.newval<fldcnt[tp])
+ if (view.putFieldToField(img.LAND,tp)) break;
+ while (cnt.newval>fldcnt[tp])
+ if (view.putFieldToField(tp,img.LAND)) break;
+ silent=false;
+ setCount(fldcnt[tp]);
+ }
+ }
+
+ private class Side extends Controller implements AdjustmentListener
+ {
+ ScrollBarVal speed;
+ boolean wh;
+ public Panel control;
+
+ public String toString() { return(wh?"Y":"X"); }
+ public Side(boolean _wh,int _speed)
+ {
+ setup((_wh?img.ROBOTY:img.ROBOTX),"Count");
+ wh=_wh;
+ control=new Panel();
+ control.setBackground(Color.gray);
+ control.setLayout(new GridLayout(0,1));
+ control.add(new Label(toString()+" control:"));
+ control.add(cnt.panel);
+ control.add((speed=new ScrollBarVal("Speed",_speed,1,100,null)).panel);
+ }
+ }
+
+ private class FoodCnt extends Controller implements AdjustmentListener
+ { public FoodCnt() { setup(img.FOOD,"Food count"); } }
+
+Side sidex,sidey;
+ScrollBarVal sizex,sizey,lenx,leny,fightday,fightnight,daytime,foodwght;
+boolean pertp;
+ItemListener dayboxdog;
+Checkbox daybox;
+FoodCnt foodcnt;
+
+ private class DayLengther implements AdjustmentListener,ItemListener
+ {
+ boolean b;
+
+ public DayLengther(boolean _b)
+ { b=_b; }
+
+ public void adjustmentValueChanged(AdjustmentEvent e)
+ {
+ if (b==pertp && daytime!=null)
+ daytime.setMax((b?leny:lenx).newval-1);
+ }
+
+ public void itemStateChanged(ItemEvent e)
+ {
+ if (pertp==!daybox.getState()) return;
+ pertp=!pertp;
+ daytime.prelab.setText(pertp?"Night time:":"Day time:");
+ daytime.setMax((pertp?leny:lenx).newval-1);
+ daytime.setValue(0);
+ if (!pertp) view.addTimers(img.ROBOTX);
+ }
+ }
+
+ public void run()
+ {
+ img=new Imager(imageloader);
+ Frame fr;
+ fr=fview=new Frame("Islet Island View");
+ fr.addWindowListener(new WindowClose());
+ //viewpane=new ScrollPane(ScrollPane.SCROLLBARS_ALWAYS);
+ //viewpane.add(view=new View());
+ //fr.add(viewpane);
+ fr.add(view=new View());
+ view.addMouseListener(view);
+ view.addMouseMotionListener(view);
+ fr=fcontrol=new Frame("Islet Control Panel");
+ fview.setLocation(300,10);
+ fcontrol.setLocation(10,10);
+ fcontrol.setSize(280,660);
+ fr.addWindowListener(new WindowClose());
+ fr.setLayout(new FlowLayout());
+ { Panel p=new Panel();
+ p.setBackground(Color.gray);
+ p.setLayout(new GridLayout(0,1));
+ p.add((sizex=new ScrollBarVal("Isle width" ,0,0,100,view)).panel);
+ p.add((sizey=new ScrollBarVal("Isle height",0,0,100,view)).panel);
+ fr.add(p);
+ }
+ { Panel p=new Panel();
+ p.setBackground(Color.gray);
+ p.add(new Label("Tools:"));
+ for (byte i=0;i<tools.length;i++)
+ p.add(tools[i]);
+ fr.add(p);
+ }
+ { Panel p=new Panel();
+ p.setBackground(Color.gray);
+ p.setLayout(new GridLayout(0,1));
+ p.add((lenx=new ScrollBarVal("Day length" ,20,1,200,new DayLengther(false))).panel);
+ p.add((leny=new ScrollBarVal("Night length",20,1,200,new DayLengther(true ))).panel);
+ { Panel q=new Panel();
+ q.add(daybox=new Checkbox("Day?",true));
+ p.add(q);
+ }
+ daybox.addItemListener(dayboxdog=new DayLengther(false));
+ p.add((daytime=new ScrollBarVal("Day time" ,0,0,20,null)).panel);
+ fr.add(p);
+ }
+ { Panel p=new Panel();
+ p.setBackground(Color.gray);
+ p.setLayout(new GridLayout(0,1));
+ p.add((fightday=new ScrollBarVal("X<day>Y",20,0,100,null)).panel);
+ p.add((fightnight=new ScrollBarVal("X<night>Y",80,0,100,null)).panel);
+ fr.add(p);
+ }
+ { Panel p=new Panel();
+ p.setBackground(Color.gray);
+ p.setLayout(new GridLayout(0,1));
+ p.add((foodwght=new ScrollBarVal("Food weight",50,0,200,null)).panel);
+ foodwght.setSuffix("%");
+ p.add((foodcnt=new FoodCnt()).cnt.panel);
+ fr.add(p);
+ }
+ fr.add((sidex=new Side(false,15)).control);
+ fr.add((sidey=new Side(true ,10)).control);
+ { Panel p=new Panel();
+ p.setBackground(Color.gray);
+ { Button b=new Button("Start");
+ b.addActionListener(new ButtonStartStop(b));
+ p.add(b);
+ }
+ { Button b=new Button("Quit");
+ b.addActionListener(new ButtonQuit());
+ p.add(b);
+ }
+ fr.add(p);
+ }
+ sizex.setValue(20);
+ sizey.setValue(20);
+ sizex.bar.setMinimum(1);
+ sizey.bar.setMinimum(1);
+ prepared=true; view.repaint();
+ fview.show(); fcontrol.show();
+
+ new IntBugCheck(this);
+ boolean buggy=true;
+ try { sleep(100); }
+ catch (InterruptedException e) { buggy=false; }
+ System.out.println(toString()+" - check for Netscape Communicator 4.05 Preview Release 1 (AWT 1.1.5) interrupt() bug: "
+ +(buggy?"FOUND, workarounding it.":"none, OK"));
+
+ for (;;) {
+ try {
+ long l=timerq.getMin();
+ if (l>buggywait && buggy) l=buggywait;
+ sleep(l);
+ }
+ catch (InterruptedException e) {}
+ }
+ }
+}//IsletThread
+}//Islet
--- /dev/null
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2 Final//EN">
+<HTML><HEAD><TITLE>Islet demonstration</TITLE></HEAD><BODY>
+<H1>Islet <A HREF="http://www.stv.cz/icp/">ICP</A>'98 demonstration:</H1>
+
+<H2>Inlined applet version:</H2>
+
+<P>The following applet should be usable under any Java version 1.1.5 compatible browser.
+<B>Most browsers don't actually support Java 1.1!</B> Try Sun's HotJava or preview
+release of <A HREF="http://developer.netscape.com/software/jdk/download.html">Netscape Communicator 4.05 with Java 1.1</A>.
+Unfortunately at the moment there is a bug in this version of Communicator which Islet
+tries to detect and workaround. Despite this detection you should check your Java console
+whether this check matches your system.</P>
+
+<DIV ALIGN=CENTER><APPLET CODE="Islet.class" ARCHIVE="Islet.jar" WIDTH=200 HEIGHT=20 ALT="Islet.class">
+<H1>Please use Java-capable browser or Sun's AppletViewer for access!</H1>
+</APPLET></DIV>
+
+<P><FONT COLOR="RED">Please be patient after the click on previous applet.
+It may take a while until it opens the window so click only <B>ONCE</B>, please.</FONT></P>
+
+<HR>
+
+<H2>Invocation and download:</H2>
+
+<OL><LI><P>You may use Sun's AppletViewer from <A HREF="http://java.sun.com/products/jdk/1.1/jre/">Java Runtime
+Environment version 1.1.5</A> or higher (tested even 1.1.6). For this method of run, you will need to download
+<A HREF="Islet.html"><B>this page</B></A> and the <A HREF="Islet.jar"><B>JAR archive</B></A>:</P>
+<P>UNIX: <TT>appletviewer Islet.html</TT></P>
+<P>Windows (& UNIX): <TT>jre sun.applet.AppletViewer Islet.html</TT></P>
+
+<LI><P>Preferred method which unfortunately requires separate download of images
+(probably bug/misfeature of Java AWT Toolkit)
+is to run this demo as a standalone Java application. If you see only a blank
+places in place of the images please recheck if these GIFs are downloaded
+correctly and located in current directory. You will need to download
+the <A HREF="Islet.jar"><B>JAR archive</B></A> and those 6 GIF images (
+<A HREF="food.gif" ><IMG SRC="food.gif" WIDTH=16 HEIGHT=16 BORDER=0 ALIGN=ABSCENTER ALT="Food" ></A>
+<A HREF="land.gif" ><IMG SRC="land.gif" WIDTH=16 HEIGHT=16 BORDER=0 ALIGN=ABSCENTER ALT="Land" ></A>
+<A HREF="robotx.gif"><IMG SRC="robotx.gif" WIDTH=16 HEIGHT=16 BORDER=0 ALIGN=ABSCENTER ALT="RobotX"></A>
+<A HREF="roboty.gif"><IMG SRC="roboty.gif" WIDTH=16 HEIGHT=16 BORDER=0 ALIGN=ABSCENTER ALT="RobotY"></A>
+<A HREF="wall.gif" ><IMG SRC="wall.gif" WIDTH=16 HEIGHT=16 BORDER=0 ALIGN=ABSCENTER ALT="Wall" ></A>
+<A HREF="water.gif" ><IMG SRC="water.gif" WIDTH=16 HEIGHT=16 BORDER=0 ALIGN=ABSCENTER ALT="Water" ></A>
+). Invocation is easier:</P>
+<P>UNIX & Windows: <TT>jre -cp Islet.jar Islet</TT></P>
+</OL>
+
+ And finally here is the <A HREF="Islet.zip"><B>complete pack</B></A> with sources included.
+
+<HR>
+
+<H2>Release comments:</H2>
+
+<P>This software is provided "AS IS" without warranty of any kind. Redistribution
+permitted under the terms of <A HREF="ftp://prep.ai.mit.edu/pub/gnu/GPL">GNU General Public License version 2</A>.</P>
+<P>Whole packaged was assembled under time press and without previous deeper
+knowledge of Java language. You'll probably find many ineffective and stupid
+things I do. Please <A HREF="mailto:short@ucw.cz">give me a mail</A> if you
+want but send no flames, please.</P>
+
+<P>Graphical design is very ugly. I use only standard windowing toolkit
+supplied from Sun in JDK named AWT which is not much nifty and comfortable.
+On the other hand at least this demo tries to be as much compatible as possible.</P>
+
+<P>Some rendering (=speed) optimizations have been done but with a large number
+(>50) faster moving robots it's still not ideal.</P>
+
+<P>Proudly developed using
+<A HREF="http://www.sun.com/" ><IMG SRC="http://java.sun.com/images/buttons/lgsun.gif" WIDTH=64 HEIGHT=30 BORDER=0 ALIGN=ABSCENTER ALT="Sun"></A>
+<A HREF="http://java.sun.com/" ><IMG SRC="http://java.sun.com/images/logos/javalogo.gif" WIDTH=52 HEIGHT=88 BORDER=0 ALIGN=ABSCENTER ALT="Java"></A>
+<A HREF="http://java.sun.com/products/jdk/1.1/" ><IMG SRC="http://java.sun.com/docs/books/tutorial/images/jdk1_1.gif" WIDTH=40 HEIGHT=40 BORDER=0 ALIGN=ABSCENTER ALT="JDK 1.1.5"></A>,
+<A HREF="http://www.linuxnow.com/"><IMG SRC="http://www.linuxnow.com/pics/linuxnow.gif" WIDTH=88 HEIGHT=31 BORDER=0 ALIGN=ABSCENTER ALT="GNU/Linux"></A> and
+<A HREF="http://www.gimp.org/" ><IMG SRC="http://www.gimp.org/icons/gfx_by_gimp.gif" WIDTH=90 HEIGHT=36 BORDER=0 ALIGN=ABSCENTER ALT="GIMP"></A>
+[<A HREF="http://www.sun.com/">Sun</A> <A HREF="http://java.sun.com/">Java</A> <A HREF="http://java.sun.com/products/jdk/1.1/">JDK 1.1.5</A>,
+<A HREF="http://www.linuxnow.com/">GNU/Linux</A> and <A HREF="http://www.gimp.org/">GIMP</A>].</P>
+
+<P>Known bugs/limitations (the most severe):</P><UL>
+<LI>Saving/loading of area map not implemented
+<LI>Putting fields is possible only one-by-one (annoying!)
+<LI>Sounds not included (would be applet-only restricted anyway, possible from JDK1.2 upwards)
+</UL>
+
+<HR>
+
+<H2>Author:</H2>
+
+<TABLE BORDER=0>
+<TR><TD><TD><A HREF="http://vellum.cz/~short/">Jan Kratochvil</A>
+<TR><TD><TD>e-Mail: <A HREF="mailto:short@ucw.cz">short@ucw.cz</A>
+<TR><TD><TD>Phone: <A HREF="http://www.eurotel.cz/">+420 602 431329</A>
+<TR><TD><TD>RC: 790420/0392
+<TR><TD><TD>Adress:
+<TR><TD><TD><A HREF="http://www.mapy.cz/demo/AWallD.exe?IMap+TargetList+Windows+1+%22K+ovcinu%25%22+0+1555">K ovcinu 44</A>
+<TR><TD>182 00<TD>Praha 8 - Kobylisy
+</TABLE>
+
+</BODY></HTML>
--- /dev/null
+JAVAC=javac -O
+JAR=jar
+TARGET=Islet.zip
+DATA=$(addsuffix .gif,food land robotx roboty wall water)
+
+.PHONY: all jre app clean
+
+all: $(TARGET)
+
+Islet.jar: Islet.java $(DATA)
+ $(RM) $(basename $<)*.class
+ $(JAVAC) $<
+ $(JAR) -cf $@ $(basename $<)*.class $(DATA)
+ $(RM) $(basename $<)*.class
+
+Islet.zip: Islet.html Islet.jar Islet.java Makefile $(DATA)
+ rm -f $@
+ zip -9 $@ $^
+
+jre: Islet.jar
+ jre -cp $< $(basename $<)
+
+app: Islet.jar
+ appletviewer $(basename $<).html
+
+clean:
+ $(RM) *.class Islet.jar Islet.zip
--- /dev/null
+#! /usr/bin/perl
+#
+# $Id$
+# Definition of 'My::Project::icp' for list.cgi.pl
+# Copyright (C) 2003 Jan Kratochvil <project-www.jankratochvil.net@jankratochvil.net>
+#
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; exactly version 2 of June 1991 is required
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write to the Free Software
+# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+
+
+package My::Project::icp;
+require 5.6.0; # at least 'use warnings;' but we need some 5.6.0+ modules anyway
+use vars qw($VERSION $CVS_ID);
+$VERSION=do { my @r=(q$Revision$=~/\d+/g); sprintf "%d.".("%03d"x$#r),@r; };
+$CVS_ID=q$Id$;
+use strict;
+use warnings;
+
+
+our %ListItem=(
+ "name"=>'<a href="http://www.stv.cz/icp/">ICP 1998</a> Competition Software',
+ "download"=>"Islet/Islet.zip",
+ "online-demo"=>"Islet/",
+ "summary"=>"Web game applet",
+ "license"=>"PD",
+ "maintenance"=>"finished",
+ "language"=>"Java 1.1",
+ "description"=>""
+ .'<p>Simple game. Written for the purpose of'
+ .' a <a href="http://www.stv.cz/icp/">programming competition</a>.</p>'
+ );
+
+1;
--- /dev/null
+# $Id$
+# automake source for the Makefile of project/icp/ subdir
+# Copyright (C) 2003 Jan Kratochvil <project-www.jankratochvil.net@jankratochvil.net>
+#
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; exactly version 2 of June 1991 is required
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write to the Free Software
+# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+
+
+include $(top_srcdir)/Makefile-head.am
+
+EXTRA_DIST+= \
+ ListItem.pm \
+ index.html.pl
+
+noinst_DATA+= \
+ index.html
--- /dev/null
+#! /usr/bin/perl
+#
+# $Id$
+# Main page of 'My::Project::icp'
+# Copyright (C) 2003 Jan Kratochvil <project-www.jankratochvil.net@jankratochvil.net>
+#
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; exactly version 2 of June 1991 is required
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write to the Free Software
+# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+
+
+require 5.6.0; # at least 'use warnings;' but we need some 5.6.0+ modules anyway
+use vars qw($VERSION $CVS_ID);
+$VERSION=do { my @r=(q$Revision$=~/\d+/g); sprintf "%d.".("%03d"x$#r),@r; };
+$CVS_ID=q$Id$;
+use strict;
+use warnings;
+
+use My::Web;
+use project::icp::ListItem;
+
+
+My::Web->init_project(
+ "ListItem"=>\%My::Project::icp::ListItem,
+ );
+
+print '<table border="0"><tr><td align="center">'.My::Web::img("Islet.png","Applet demo screen").'</td></tr></table>'."\n";
+
+My::Web->footer();
--- /dev/null
+# $Id$
+# automake source for the Makefile of project/ subdir
+# Copyright (C) 2003 Jan Kratochvil <project-www.jankratochvil.net@jankratochvil.net>
+#
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; exactly version 2 of June 1991 is required
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write to the Free Software
+# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+
+
+include $(top_srcdir)/Makefile-head.am
+
+SUBDIRS= \
+ step \
+ icp \
+ FordFulk \
+ Heat \
+ kix \
+ patchd2 \
+ doswatch \
+ oslik \
+ pipebuf \
+ smbfs \
+ tcpdump \
+ kware \
+ mdsms \
+ xbill \
+ mot2as \
+ vblib \
+ wllib \
+ tcp_rto \
+ redirector_ad \
+ timeplan \
+ fixhtml \
+ winvnc \
+ Nokia61 \
+ tac_plus \
+ badblock_guess \
+ d1xnet \
+ netstat \
+ ircon \
+ sshpatch \
+ mod_auth_tacacs \
+ surprise
+
+EXTRA_DIST+= \
+ list.cgi.pl
+
+#noinst_DATA+= \
+# index.html
--- /dev/null
+#! /usr/bin/perl
+#
+# $Id$
+# Definition of 'My::Project::Nokia61' for list.cgi.pl
+# Copyright (C) 2003 Jan Kratochvil <project-www.jankratochvil.net@jankratochvil.net>
+#
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; exactly version 2 of June 1991 is required
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write to the Free Software
+# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+
+
+package My::Project::Nokia61;
+require 5.6.0; # at least 'use warnings;' but we need some 5.6.0+ modules anyway
+use vars qw($VERSION $CVS_ID);
+$VERSION=do { my @r=(q$Revision$=~/\d+/g); sprintf "%d.".("%03d"x$#r),@r; };
+$CVS_ID=q$Id$;
+use strict;
+use warnings;
+
+
+our %ListItem=(
+ "name"=>"Nokia Game "Rotation"",
+ "download"=>"Nokia61.c",
+ "summary"=>"Logical game solver",
+ "license"=>"PD",
+ "maintenance"=>"finished",
+ "language"=>"C, PHP",
+ "description"=>""
+ .'<p>At least Nokia 3210 offers game <b>Rotation</b>, this little software will'
+ .' tell you the optimal solution steps for the given game board situation.'
+ .' The goal is to get board with'
+ .' <b>1 2 3</b>, <b>4 5 6</b>, <b>7 8 9</b>,'
+ .' in rows.</p>'
+ );
+
+1;
--- /dev/null
+# $Id$
+# automake source for the Makefile of project/Nokia61/ subdir
+# Copyright (C) 2003 Jan Kratochvil <project-www.jankratochvil.net@jankratochvil.net>
+#
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; exactly version 2 of June 1991 is required
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write to the Free Software
+# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+
+
+include $(top_srcdir)/Makefile-head.am
+
+EXTRA_DIST+= \
+ ListItem.pm \
+ index.html.pl
+
+noinst_DATA+= \
+ index.html \
+ Nokia61
+
+Nokia61: Nokia61.c
+ gcc -Wall -ggdb3 -o $@ $<
--- /dev/null
+#define SIZE_EDGE (3)
+#define SIZE_ROT (2)
+#define PROGRESS 5000
+#define ROT_ONEKEY 1
+/*
+#define DEBUG 1
+ */
+#define NDEBUG 1
+
+#include <stdio.h>
+#include <string.h>
+#include <stdlib.h>
+#include <time.h>
+#include <unistd.h>
+#include <assert.h>
+
+#define SIZE_TOT (SIZE_EDGE*SIZE_EDGE)
+
+typedef unsigned char num;
+typedef unsigned int pos;
+typedef num field[SIZE_TOT];
+
+#define INVALID_POS ((pos)-1)
+
+#define RC_ENTRY(x,y) ((y)*SIZE_EDGE+(x))
+
+#if SIZE_EDGE==3
+#define STATES_TOT (362880)
+#define FILENAME_23 "Nokia61_23.cache"
+#define ROUNDCYCLE_TOT (sizeof(roundcycle)/sizeof(*roundcycle))
+static const unsigned char roundcycle[]={
+ RC_ENTRY(0,0),
+ RC_ENTRY(1,0),
+ RC_ENTRY(1,1),
+ RC_ENTRY(0,1),
+ };
+#else
+#error "STATES_TOT not known!"
+#endif
+
+struct state {
+ pos todo_next;
+ pos parent;
+ pos depth;
+ } states[STATES_TOT];
+pos todo=INVALID_POS;
+pos *todo_tail=&todo;
+
+#ifdef PROGRESS
+pos states_touched=0,states_retouched=0,states_done=0;
+pos maxdepth=0;
+#endif
+
+static const num ascending[25]={0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24};
+
+static int check_field(const field fld)
+{
+unsigned char used[SIZE_TOT];
+int i;
+
+ memset(used,0,sizeof(used));
+ for (i=0;i<SIZE_TOT;i++) {
+ if (fld[i]>=SIZE_TOT || used[fld[i]])
+ return(0);
+ used[fld[i]]=1;
+ }
+ return(1);
+}
+
+#define assert_field(fld) assert(check_field(fld))
+
+static void dump_field(const field fld)
+{
+unsigned char y,x;
+
+ for (y=0;y<SIZE_EDGE;y++) {
+ fputs(" ",stdout);
+ for (x=0;x<SIZE_EDGE;x++)
+ printf(" %2u",fld[y*SIZE_EDGE+x]+1);
+ putchar('\n');
+ }
+}
+
+static pos field_to_pos(const field fld)
+{
+num points[SIZE_TOT],remains;
+pos r=0;
+
+#ifdef DEBUG
+ puts("field_to_pos(");
+ dump_field(fld);
+#endif
+
+ assert_field(fld);
+ memcpy(points,ascending,sizeof(points));
+ for (remains=SIZE_TOT;remains;remains--) {
+num n=*fld++;
+
+ n=(num *)memchr(points,n,remains)-points;
+ r*=remains;
+ r+=n;
+ memmove(points+n,points+n+1,remains-n-1);
+ }
+
+#ifdef DEBUG
+ printf(" )=%u\n",r);
+#endif
+
+ return(r);
+}
+
+static void pos_to_field(field fld,pos p)
+{
+num points[SIZE_TOT],expanded[SIZE_TOT],remains;
+#if defined(DEBUG) || !defined(NDEBUG)
+num *fld_orig=fld;
+#endif
+#ifndef NDEBUG
+pos p_orig=p;
+#endif
+
+#ifdef DEBUG
+ printf("pos_to_field(%u)=\n",p);
+#endif
+
+ for (remains=1;remains<=SIZE_TOT;remains++) {
+num n=p%remains;
+
+ p/=remains;
+ expanded[SIZE_TOT-remains]=n;
+ }
+ memcpy(points,ascending,sizeof(points));
+ for (remains=SIZE_TOT;remains;remains--) {
+num n=expanded[SIZE_TOT-remains];
+
+ p/=remains;
+ *fld++=points[n];
+ memmove(points+n,points+n+1,remains-n-1);
+ }
+
+#ifdef DEBUG
+ dump_field(fld_orig);
+#endif
+
+ assert(!p);
+ assert(p_orig==field_to_pos(fld_orig));
+}
+
+static void mark(pos p,pos parent,pos depth)
+{
+struct state *state;
+
+ assert(p>=0 && p<STATES_TOT);
+ state=states+p;
+ if (!(state->parent==INVALID_POS || state->depth>depth))
+ return;
+#ifdef PROGRESS
+ if (maxdepth<depth)
+ maxdepth=depth;
+#endif
+ state->parent=parent;
+ state->depth=depth;
+ if (state->todo_next==INVALID_POS) {
+ *todo_tail=p;
+ todo_tail=&state->todo_next;
+#ifdef PROGRESS
+ states_touched++;
+#endif
+ }
+ else {
+#ifdef PROGRESS
+ states_retouched++;
+#endif
+ }
+}
+
+static void progress_dump(void)
+{
+#ifdef PROGRESS
+ printf("TOUCHED=%6u (RETOUCHED %6u), DONE=%6u, KNOWN TODO=%6u, UNTOUCHED=%6u, MAXDEPTH=%6u\n",
+ states_touched,states_retouched,states_done,states_touched-states_done,STATES_TOT-states_touched,maxdepth);
+#endif
+}
+
+#ifdef PROGRESS
+static void states_progress(void)
+{
+static unsigned period=0;
+static time_t time_last=0;
+time_t time_new;
+
+ if (period++<PROGRESS)
+ return;
+ period=0;
+ if (time(&time_new)<5+time_last)
+ return;
+ time_last=time_new;
+ progress_dump();
+}
+#endif
+
+static void cycle(void)
+{
+pos p;
+
+ while ((p=todo)!=INVALID_POS) {
+struct state *state=states+p;
+field fld;
+unsigned char y,x,cyc;
+
+ pos_to_field(fld,p);
+#ifdef DEBUG
+ printf("START: %u\n",p);
+#endif
+ for (y=0;y<=SIZE_EDGE-SIZE_ROT;y++)
+ for (x=0;x<=SIZE_EDGE-SIZE_ROT;x++)
+ for (cyc=0;cyc<ROUNDCYCLE_TOT;cyc++) {
+num swap,*base;
+unsigned char cyci;
+
+ base=fld+y*SIZE_EDGE+x;
+ for (cyci=0;cyci<ROUNDCYCLE_TOT-1;cyci++) {
+ swap=base[roundcycle[cyci]];
+ base[roundcycle[cyci]]=base[roundcycle[cyci+1]];
+ base[roundcycle[cyci+1]]=swap;
+ }
+#ifdef ROT_ONEKEY
+ if (!(cyc&1))
+#endif
+ mark(field_to_pos(fld),p,state->depth+1);
+ }
+ todo=state->todo_next;
+ state->todo_next=INVALID_POS;
+#ifdef PROGRESS
+ states_done++;
+ states_progress();
+#endif
+ }
+}
+
+static void final(void)
+{
+#ifdef PROGRESS
+pos *maxes,p;
+int maxi;
+#endif
+
+ puts("FINAL:");
+ progress_dump();
+#ifdef PROGRESS
+ fputs("Depth distribution:",stdout);
+ maxes=malloc(sizeof(*maxes)*(maxdepth+1));
+ memset(maxes,0,sizeof(maxes));
+ for (p=0;p<STATES_TOT;p++)
+ maxes[states[p].depth]++;
+ for (maxi=0;maxi<=maxdepth;maxi++)
+ printf(" %d(=%d)",maxi,maxes[maxi]);
+ free(maxes);
+ putchar('\n');
+#endif
+ putchar('\n');
+}
+
+#if SIZE_EDGE==3
+
+static struct item_23 {
+ unsigned char a[3];
+ } *states_23;
+#define STATES_23_SIZEOF (sizeof(*states_23)*STATES_TOT)
+
+static int read_23(void)
+{
+FILE *f;
+pos p;
+unsigned char eof_mark;
+
+ if (!(f=fopen(FILENAME_23,"rb")))
+ return(1);
+ if (!(states_23=malloc(STATES_23_SIZEOF))) {
+fail_fclose:
+ fclose(f);
+ return(1);
+ }
+ if (fread(states_23,1,STATES_23_SIZEOF,f)!=STATES_23_SIZEOF) {
+fail_free:
+ free(states_23);
+ goto fail_fclose;
+ }
+ if (fread(&eof_mark,1,1,f))
+ goto fail_free;
+ for (p=0;p<STATES_TOT;p++) {
+ states[p].depth=0;
+ states[p].parent=(states_23[p].a[0]<<16)
+ | (states_23[p].a[1]<< 8)
+ | (states_23[p].a[2]<< 0);
+ }
+ fclose(f);
+ free(states_23);
+#ifdef PROGRESS
+ printf("Cache read from \"%s\".\n",FILENAME_23);
+#endif
+ return(0);
+}
+
+static void write_23(void)
+{
+FILE *f;
+pos p;
+
+ if (!(f=fopen(FILENAME_23,"wb"))) {
+fail:
+#ifdef PROGRESS
+ printf("Failed to write cache to \"%s\"!\n",FILENAME_23);
+#endif
+ return;
+ }
+ if (!(states_23=malloc(STATES_23_SIZEOF))) {
+fail_unlink:
+ fclose(f);
+ unlink(FILENAME_23);
+ goto fail;
+ }
+ for (p=0;p<STATES_TOT;p++) {
+ states_23[p].a[0]=(states[p].parent>>16);
+ states_23[p].a[1]=(states[p].parent>> 8);
+ states_23[p].a[2]=(states[p].parent>> 0);
+ }
+ if (fwrite(states_23,1,STATES_23_SIZEOF,f)!=STATES_23_SIZEOF) {
+fail_free:
+ free(states_23);
+ goto fail_unlink;
+ }
+ if (fclose(f))
+ goto fail_free;
+ free(states_23);
+#ifdef PROGRESS
+ printf("Cache written to \"%s\".\n",FILENAME_23);
+#endif
+}
+
+#endif /* SIZE_EDGE==3 */
+
+static void input(void)
+{
+field fld;
+int x,y,i;
+pos p;
+struct state *state;
+
+ for (;;) {
+restart:
+ for (y=0;y<SIZE_EDGE;y++) {
+ printf("Enter line #%d/%d: ",y+1,SIZE_EDGE); fflush(stdout);
+ for (x=0;x<SIZE_EDGE;x++) {
+ if (1!=scanf("%d",&i)) {
+ if (!y && !x)
+ return;
+ puts("Error reading input, restarting!");
+ goto restart;
+ }
+ fld[y*SIZE_EDGE+x]=i-1;
+ }
+ }
+ if (!check_field(fld)) {
+ puts("Field not valid!");
+ continue;
+ }
+ puts("-->");
+ p=field_to_pos(fld);
+ do {
+ state=states+p;
+ printf("STATE %6u: DEPTH=%6u, PARENT=%6u\n",p,state->depth,state->parent);
+ pos_to_field(fld,p);
+ dump_field(fld);
+ puts("----------");
+ p=state->parent;
+ } while (state!=states+0);
+ putchar('\n');
+ }
+}
+
+int main(void)
+{
+#if SIZE_EDGE==3
+ if (read_23())
+#endif
+ {
+ memset(states,-1,sizeof(states));
+ mark(0,0,0);
+ cycle();
+ final();
+#if SIZE_EDGE==3
+ write_23();
+#endif
+ }
+ input();
+ return(EXIT_SUCCESS);
+}
--- /dev/null
+<?php
+ if (!$HTTP_GET_VARS["nohtml"]) {
+ ?>
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN" "http://www.w3.org/TR/REC-html40/loose.dtd">
+<HTML>
+<HEAD>
+<TITLE>Nokia61</TITLE>
+<LINK REV=MADE HREF="mailto:short@ucw.cz">
+</HEAD><BODY>
+ <?php
+ }
+
+$tables_per_row=4;
+$bgcolor_head="#D0D0D0";
+$bgcolor_body="#F0F0F0";
+
+function table($array,$rw=0)
+{
+global $tables,$bgcolor_head,$bgcolor_body,$HTTP_GET_VARS;
+
+ print "<FORM METHOD=GET ACTION=\"".$HTTP_GET_VARS["base"]."Nokia61.php\"><TABLE BORDER=1 RULES=NONE>\n";
+ print "<TR><TD COLSPAN=3 BGCOLOR=\"".$bgcolor_head."\">";
+ if ($rw)
+ print "Input:";
+ else
+ printf("Step #%d",$tables+1);
+ print "</TD></TR>\n";
+ for ($row=0;$row<3;$row++) {
+ print "<TR>";
+ for ($col=0;$col<3;$col++) {
+ $idx=$row*3+$col;
+ printf("<TD BGCOLOR=\"".$bgcolor_body."\"><INPUT NAME=\"%d\"",$idx);
+ if (isset($array[$idx]))
+ printf(" VALUE=\"%d\"",$array[$idx]);
+ if (!$rw)
+ print " READONLY";
+ print " TYPE=STRING SIZE=2 MAXLENGTH=2></TD>";
+ }
+ print "</TR>\n";
+ }
+ if ($rw)
+ print "<TR><TD COLSPAN=3 ALIGN=CENTER><INPUT TYPE=SUBMIT VALUE=\"Solve!\"></TD></TR>\n";
+ print "</TABLE></FORM>\n";
+ $tables++;
+}
+
+ $input=array();
+ $used=array();
+ $filled=0;
+ $tables=0;
+
+ for ($idx=0;$idx<9;$idx++) {
+ $s=$HTTP_GET_VARS[sprintf("%d",$idx)];
+ if (!strlen($s))
+ continue;
+ $x=ord($s)-ord("0");
+ if (strlen($s)!=1 || $x<1 || $x>9 || isset($used[$x])) {
+ printf("<H1>WARNING: Digit at row %d, column %d was %s, erased!</H1>\n",1+$idx/3,1+$idx%3,
+ ($used[$x] ? "repeated" : "invalid"));
+ continue;
+ }
+ $input[$idx]=$x;
+ $used[$x]=1;
+ $filled++;
+ }
+ if ($filled==9) {
+ print "<TABLE BORDER=0><TR>";
+ $cmd="echo -n -e '";
+ for ($row=0;$row<3;$row++) {
+ for ($col=0;$col<3;$col++) {
+ if ($col)
+ $cmd.=" ";
+ $cmd.=sprintf("%d",$input[$row*3+$col]);
+ }
+ $cmd.="\\n";
+ }
+ $cmd.="' | ./Nokia61";
+ $cmd=popen($cmd,"r");
+ $idx=0;
+ $output=array();
+ while (!feof($cmd)) {
+ if (3!=fscanf($cmd,"\n %d%d%d",&$output[$idx+0],&$output[$idx+1],&$output[$idx+2]))
+ continue;
+ $idx+=3;
+ if ($idx<9)
+ continue;
+ print "<TD>";
+ table($output);
+ print "</TD><TD> </TD>";
+ if (!($tables%$tables_per_row))
+ print "</TR><TR>";
+ $idx=0;
+ }
+ pclose($cmd);
+ print "</TR></TABLE>\n";
+ print "<HR>\n";
+ $input=array();
+ }
+ table($input,1);
+
+ if (!$HTTP_GET_VARS["nohtml"]) {
+ ?>
+</BODY></HTML>
+<?php
+ }
+?>
--- /dev/null
+#! /usr/bin/perl
+#
+# $Id$
+# Main page of 'My::Project::Nokia61'
+# Copyright (C) 2003 Jan Kratochvil <project-www.jankratochvil.net@jankratochvil.net>
+#
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; exactly version 2 of June 1991 is required
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write to the Free Software
+# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+
+
+require 5.6.0; # at least 'use warnings;' but we need some 5.6.0+ modules anyway
+use vars qw($VERSION $CVS_ID);
+$VERSION=do { my @r=(q$Revision$=~/\d+/g); sprintf "%d.".("%03d"x$#r),@r; };
+$CVS_ID=q$Id$;
+use strict;
+use warnings;
+
+use My::Web;
+use project::Nokia61::ListItem;
+
+
+My::Web->init_project(
+ "ListItem"=>\%My::Project::Nokia61::ListItem,
+ );
+
+print <<'HERE';
+<iframe src="Nokia61.php?base=.%2F" width="90%" height="500" />
+<a href="Nokia61.php?base=.%2F">Program on-line</a>.
+</iframe>
+HERE
+
+My::Web->footer();
--- /dev/null
+<Files "badblock-guess">
+ <IfModule mod_csacek.c>
+ csacekEngine Off
+ </IfModule>
+ ForceType application/octet-stream
+</Files>
--- /dev/null
+#! /usr/bin/perl
+#
+# $Id$
+# Definition of 'My::Project::badblock_guess' for list.cgi.pl
+# Copyright (C) 2003 Jan Kratochvil <project-www.jankratochvil.net@jankratochvil.net>
+#
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; exactly version 2 of June 1991 is required
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write to the Free Software
+# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+
+
+package My::Project::badblock_guess;
+require 5.6.0; # at least 'use warnings;' but we need some 5.6.0+ modules anyway
+use vars qw($VERSION $CVS_ID);
+$VERSION=do { my @r=(q$Revision$=~/\d+/g); sprintf "%d.".("%03d"x$#r),@r; };
+$CVS_ID=q$Id$;
+use strict;
+use warnings;
+
+
+our %ListItem=(
+ "name"=>"Recovery of Data from a Damaged Disk",
+ "download-compiled static binary"=>"badblock-guess",
+ "download-gzipped compiled static binary"=>"badblock-guess.gz",
+ "link-CVS repository"=>"http://cvs.jankratochvil.net/viewcvs/badblock-guess/",
+ "download-CVS snapshot"=>"http://cvs.jankratochvil.net/viewcvs/badblock-guess/badblock-guess.tar.gz?tarball=1",
+ "link-README"=>"http://cvs.jankratochvil.net/viewcvs/*checkout*/badblock-guess/README?rev=HEAD",
+ "summary"=>"Data recovery",
+ "license"=>"GPL",
+ "maintenance"=>"finished",
+ "language"=>"C",
+ "description"=>""
+ .'<p>badblock-guess will try to find all readable sectors of the disk in minimal time.</p>'
+ );
+
+1;
--- /dev/null
+# $Id$
+# automake source for the Makefile of project/badblock_guess/ subdir
+# Copyright (C) 2003 Jan Kratochvil <project-www.jankratochvil.net@jankratochvil.net>
+#
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; exactly version 2 of June 1991 is required
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write to the Free Software
+# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+
+
+include $(top_srcdir)/Makefile-head.am
+
+EXTRA_DIST+= \
+ ListItem.pm \
+ index.html.pl
+
+noinst_DATA+= \
+ index.html
--- /dev/null
+#! /usr/bin/perl
+#
+# $Id$
+# Main page of 'My::Project::badblock_guess'
+# Copyright (C) 2003 Jan Kratochvil <project-www.jankratochvil.net@jankratochvil.net>
+#
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; exactly version 2 of June 1991 is required
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write to the Free Software
+# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+
+
+require 5.6.0; # at least 'use warnings;' but we need some 5.6.0+ modules anyway
+use vars qw($VERSION $CVS_ID);
+$VERSION=do { my @r=(q$Revision$=~/\d+/g); sprintf "%d.".("%03d"x$#r),@r; };
+$CVS_ID=q$Id$;
+use strict;
+use warnings;
+
+use My::Web;
+use project::badblock_guess::ListItem;
+
+
+My::Web->init_project(
+ "ListItem"=>\%My::Project::badblock_guess::ListItem,
+ );
+
+print <<'HERE';
+<p>It is similiar to:</p>
+<blockquote><code>
+dd if=<src_dev> of=<dst_dev> bs=512 conv=noerror,sync
+</code></blockquote>
+<p>but <code>dd(1)</code> solution can last for many weeks/months on heavily
+corrupted disk.</p>
+<p>This program will not recover data of any sector with failing read command.
+If <code>dd(1)</code> command above finishes for you in a reasonable time, you
+do not need this program.</p>
+HERE
+
+My::Web->footer();
--- /dev/null
+#! /usr/bin/perl
+#
+# $Id$
+# Definition of 'My::Project::d1xnet' for list.cgi.pl
+# Copyright (C) 2003 Jan Kratochvil <project-www.jankratochvil.net@jankratochvil.net>
+#
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; exactly version 2 of June 1991 is required
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write to the Free Software
+# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+
+
+package My::Project::d1xnet;
+require 5.6.0; # at least 'use warnings;' but we need some 5.6.0+ modules anyway
+use vars qw($VERSION $CVS_ID);
+$VERSION=do { my @r=(q$Revision$=~/\d+/g); sprintf "%d.".("%03d"x$#r),@r; };
+$CVS_ID=q$Id$;
+use strict;
+use warnings;
+
+
+our %ListItem=(
+ "name"=>"<a href=\"http://d1x.warpcore.org/\">D1X</a> native TCP/IP support patch",
+ "download"=>"d1x-tcpip-0.99.1.diff.gz",
+ "summary"=>"Network patch",
+ "license"=>"PD",
+ "maintenance"=>"accepted",
+ "language"=>"C module",
+ "description"=>""
+ .'<p>No further mess with <a href="ftp://linux.kali.net/outgoing/kalinix/">KaliNix</a>,'
+ .' KIX or any other IPX layer convertor. This patch adds true TCP/IP networking'
+ .' capability to <a href="http://d1x.warpcore.org/">D1X</a> version 1.30.</p>'
+ );
+
+1;
--- /dev/null
+# $Id$
+# automake source for the Makefile of project/d1xnet/ subdir
+# Copyright (C) 2003 Jan Kratochvil <project-www.jankratochvil.net@jankratochvil.net>
+#
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; exactly version 2 of June 1991 is required
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write to the Free Software
+# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+
+
+include $(top_srcdir)/Makefile-head.am
+
+EXTRA_DIST+= \
+ ListItem.pm \
+ index.html.pl
+
+noinst_DATA+= \
+ index.html
--- /dev/null
+#! /usr/bin/perl
+#
+# $Id$
+# Main page of 'My::Project::d1xnet'
+# Copyright (C) 2003 Jan Kratochvil <project-www.jankratochvil.net@jankratochvil.net>
+#
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; exactly version 2 of June 1991 is required
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write to the Free Software
+# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+
+
+require 5.6.0; # at least 'use warnings;' but we need some 5.6.0+ modules anyway
+use vars qw($VERSION $CVS_ID);
+$VERSION=do { my @r=(q$Revision$=~/\d+/g); sprintf "%d.".("%03d"x$#r),@r; };
+$CVS_ID=q$Id$;
+use strict;
+use warnings;
+
+use My::Web;
+use project::d1xnet::ListItem;
+
+
+My::Web->init_project(
+ "ListItem"=>\%My::Project::d1xnet::ListItem,
+ );
+
+My::Web->footer();
--- /dev/null
+#! /usr/bin/perl
+#
+# $Id$
+# Definition of 'My::Project::doswatch' for list.cgi.pl
+# Copyright (C) 2003 Jan Kratochvil <project-www.jankratochvil.net@jankratochvil.net>
+#
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; exactly version 2 of June 1991 is required
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write to the Free Software
+# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+
+
+package My::Project::doswatch;
+require 5.6.0; # at least 'use warnings;' but we need some 5.6.0+ modules anyway
+use vars qw($VERSION $CVS_ID);
+$VERSION=do { my @r=(q$Revision$=~/\d+/g); sprintf "%d.".("%03d"x$#r),@r; };
+$CVS_ID=q$Id$;
+use strict;
+use warnings;
+
+
+our %ListItem=(
+ "name"=>"DOSWatcher - DOS File Access Snooper",
+ "download"=>"doswatch.zip",
+ "summary"=>"DOS files snooper",
+ "license"=>"PD",
+ "maintenance"=>"finished",
+ "language"=>"i386 asm",
+ "description"=>""
+ .'<p>Resident program which displays all the file (and other) DOS function'
+ .' calls access on the secondary console. Useful for many failure discoveries'
+ .' for weird software packages with broken file/directory access.</p>'
+ .' <ul>'
+ .' <li>Requires MDA/Hercules secondary adapter to be usable'
+ .' <li>Contains also MDABIOS, generic secondary adapter display layer'
+ .' <li>Can be run on primary-only VGA (with not much comfort, indeed)'
+ .' </ul>'
+ );
+
+1;
--- /dev/null
+# $Id$
+# automake source for the Makefile of project/doswatch/ subdir
+# Copyright (C) 2003 Jan Kratochvil <project-www.jankratochvil.net@jankratochvil.net>
+#
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; exactly version 2 of June 1991 is required
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write to the Free Software
+# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+
+
+include $(top_srcdir)/Makefile-head.am
+
+EXTRA_DIST+= \
+ ListItem.pm \
+ index.html.pl
+
+noinst_DATA+= \
+ index.html
--- /dev/null
+#! /usr/bin/perl
+#
+# $Id$
+# Main page of 'My::Project::doswatch'
+# Copyright (C) 2003 Jan Kratochvil <project-www.jankratochvil.net@jankratochvil.net>
+#
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; exactly version 2 of June 1991 is required
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write to the Free Software
+# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+
+
+require 5.6.0; # at least 'use warnings;' but we need some 5.6.0+ modules anyway
+use vars qw($VERSION $CVS_ID);
+$VERSION=do { my @r=(q$Revision$=~/\d+/g); sprintf "%d.".("%03d"x$#r),@r; };
+$CVS_ID=q$Id$;
+use strict;
+use warnings;
+
+use My::Web;
+use project::doswatch::ListItem;
+
+
+My::Web->init_project(
+ "ListItem"=>\%My::Project::doswatch::ListItem,
+ );
+
+My::Web->footer();
--- /dev/null
+#! /usr/bin/perl
+#
+# $Id$
+# Definition of 'My::Project::fixhtml' for list.cgi.pl
+# Copyright (C) 2003 Jan Kratochvil <project-www.jankratochvil.net@jankratochvil.net>
+#
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; exactly version 2 of June 1991 is required
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write to the Free Software
+# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+
+
+package My::Project::fixhtml;
+require 5.6.0; # at least 'use warnings;' but we need some 5.6.0+ modules anyway
+use vars qw($VERSION $CVS_ID);
+$VERSION=do { my @r=(q$Revision$=~/\d+/g); sprintf "%d.".("%03d"x$#r),@r; };
+$CVS_ID=q$Id$;
+use strict;
+use warnings;
+
+
+our %ListItem=(
+ "name"=>"Converter of HTML Files URLs to Relative",
+ "download"=>"fixhtml.pl",
+ "summary"=>"HTML converter",
+ "license"=>"PD",
+ "maintenance"=>"finished",
+ "language"=>"Perl",
+ "description"=>""
+ .'<p>If you download/grab the whole (or its part) of some web site (for example'
+ .' by <b>WebCopy</b> tool), you will'
+ .' probably want to browse it locally on your computer offline. Unfortunately'
+ .' the authors are usually using server-name protocol reference or absolute'
+ .' path referration which will broke on your local machine.</p>'
+ .' <p>This software is derived from <b>WebCopy</b> and initially it was only'
+ .' its extension. I separated it afterwards - you really do not want to do'
+ .' the opposite, think twice before trying to integrate it back.</p>'
+ );
+
+1;
--- /dev/null
+# $Id$
+# automake source for the Makefile of project/fixhtml/ subdir
+# Copyright (C) 2003 Jan Kratochvil <project-www.jankratochvil.net@jankratochvil.net>
+#
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; exactly version 2 of June 1991 is required
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write to the Free Software
+# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+
+
+include $(top_srcdir)/Makefile-head.am
+
+EXTRA_DIST+= \
+ ListItem.pm \
+ index.html.pl
+
+noinst_DATA+= \
+ index.html
--- /dev/null
+#!/bin/perl -- # -*- perl -*-
+eval 'exec /bin/perl -S $0 "$*"'
+ if undef;
+#
+# FixHTML v1.02 2001/01/07
+#
+# Copyright (C) 1994, 1995, 1996 by Victor Parada (vparada@inf.utfsm.cl)
+# Copyright (C) 1997, ..., 2001 by Jan Kratochvil <short@ucw.cz>
+#
+# Fix broken paths in downloaded HTML trees.
+#
+# Syntax: fixhtml path host;
+#
+# Please read this "License Agreement and Lack of Warranty":
+# - The author of this program is Jan Kratochvil <short@k332.feld.cvut.cz>.
+# - This program is "Freeware", not "Public Domain".
+# - This program must be distributed for free, and cannot be included in
+# commercial packages without prior written permisson from the autor.
+# - This program cannot be distributed if modified in any way.
+# - This program can be used by anyone if the copyright and this notice
+# remains intact in every file.
+# - If you modify this program, please e-mail patches to the the author.
+# - This is a Beta version of the program. You have been warned!
+# - This program is provided ``AS IS'', without any warranty.
+# - This program can cause huge file transfers and all the related effects.
+# - This program can fill data disks without notice.
+# - Neither the author nor UTFSM are responsible for the use of this program.
+# - Bug reports, comments, questions and suggestions are welcome! But
+# please check first that you have the latest version!
+# - The latest version of this program is available at:
+# <URL:--->
+#
+# If you use this program, please send e-mail to the author.
+# He will try to notify you of any updates made to it.
+#
+
+# Setup perl defaults
+#
+$fixhtml=$0;
+$0=~s![^/]*/!!g;
+$|=1;
+$[=0;
+
+# Configurable defaults
+#
+$tmpfile="W$$.tmp"; # temp.
+$port=80;
+
+dump QUICKSTART if $ARGV[0] eq "--dump";
+QUICKSTART:
+
+# Process options in command line
+#
+while ($_=$ARGV[0],/^-/) {
+ shift;
+ /h|\?/ && ($help=1, next);
+ die "$0: Invalid option $_\n";
+}
+
+exit &about if $help;
+
+$path=shift || die "Path not specified\n";
+$host=shift || die "Host not specified\n";
+
+chdir $path || die "Cannot find specified path $path!\n";
+
+open(FEED,"find -type f|") or die "No files found";
+
+FLSKIP: while (<FEED>) {
+ s/\n//g;
+ $curfile=$_;
+ print "$curfile - ";
+ open(I,$curfile) or die "Cannot open $curfile!\n";
+ IDENT: while (<I>) {
+ last IDENT if (m/[^ \t\r\n]/);
+ }
+ $line=$_;
+ if ($line!~/^[ -~\r]*$/ || $line!~/\<\s*[!\w]+/i) { #.*\>
+ close(I);
+ print "not HTML\n";
+ next FLSKIP;
+ }
+ print "fixing ... ";
+ seek I,0,SEEK_SET;
+ open(F,">".$tmpfile) or die "Cannot create $tmpfile!\n";
+ $line="";
+ $pth=$curfile;
+ $pth=~s/^.\///;
+ $pth=~s![^/]*$!!;
+ while (<I>) {
+ $line.=$_;
+ while ($line=~/\<([^\<\>]*)([\<\>])(.*)$/s) {
+#print "TAG=$1\n";
+ $line=($2 eq "<"?"<":"").$3;
+ $endoftag=$2;
+ print F $`."<";
+ $fulltag=$1; if ($fulltag=~/^!/)
+ { print F $fulltag; }
+ else {
+ $fulltag=$1; $origtag=$fulltag;
+ $fulltag=~tr/\n\t\r/ /;
+ ($tag,%args)=&split_tag($fulltag);
+ for (sort keys %args) {
+ $x=$y=$z=$args{$_};
+ if (defined($za=rindex($z,"/")))
+ { $zb=substr($z,0,$za+1); $zc=substr($z,$za+1); }
+ else { $zb=""; $zc=$z }
+ ($zc,$zd)=$zc=~m!^([^\?\#]*)(.*)$!;
+ ($h,$n,$p,$f,$e)=(($y=~/^\w+:/)?
+ &split_url($x):("localhost",$port,$zb,$zc,$zd));
+#print "par=\"$x\", h=\"$h\", n=\"$n\", p=\"$p\", f=\"$f\", e=\"$e\",
+# host=\"$host\", port=\"$port\"\n";
+ $minone=($e=~s/\?/%3F/g);
+ if (($h eq "localhost" || $h eq $host) && $n eq $port) {
+ @new=split('/',$pth);
+ @nwa=split('/',$p);
+ splice(@nwa,0,1) if (@nwa[0] eq "");
+ splice(@new,0,1) if (@new[0] eq "");
+ @nwb=@new;
+ if (substr($p,0,1) eq "/") {
+ @new=();
+ }
+ foreach $dir (@nwa) {
+ if ($dir eq "..")
+ { pop(@new); }
+ elsif ($dir ne "." && $dir ne "")
+ { push(@new,$dir); }
+ }
+ while (defined(@new[0]) && @new[0] eq @nwb[0]) {
+ splice(@new,0,1);
+ splice(@nwb,0,1);
+ }
+ $newone=join('/',(map("..",@nwb),@new,$f)).$e;
+ if ($newone ne $args{$_}) {
+ $args{$_}=$newone;
+ $minone=1;
+ }
+ }
+ }
+#print "minone=".$minone."\n";
+ if ($minone) {
+ print F $tag;
+ for (sort keys %args)
+ { print F " ".$_.($args{$_} eq ""?"":"=\"$args{$_}\""); }
+ }
+ else {
+ print F $origtag
+ }
+ }
+ print F ">" if ($endoftag eq ">");
+ }
+ }
+ print F $line;
+ print F "\n" if ($line!~/\n$/);
+ close(I);
+ close(F);
+ rename($tmpfile,$curfile) || die "Cannot rename $tmpfile to $curfile ($!)!\n";
+#&set_date($file,$update);
+ print "done\n";
+ }
+close(FEED);
+exit;
+
+sub split_tag {
+ local($fulltag)=@_;
+ local($tagname,$etc,$var,$quote,$arg,$value,@tagargs);
+ undef $etc;
+ ($tagname,$etc)=$fulltag=~/\s*(\S+)\s*(.*)$/;
+ while ($etc!~/^\s*$/) {
+ ($arg,$var,$value,$etc)=$etc=~/\s*([^=\s]+)\s*(=)?\s*(\S+)?(.*)$/;
+ ($value,$etc)=((undef),$value.$etc) unless $var=~/^=$/;
+ ($quote)=$value=~/^([\"\'])/;
+ if ($quote) {
+ if ($value!~/.$quote$/) {
+ ($_,$etc)=$etc=~/^([^$quote]*)$quote?(.*)$/;
+ $value.=$_.$quote;
+ }
+ $value=~s/$quote\s*(.*)\s*$quote$/$1/;
+ $value=~s/\s*$//;
+ }
+ $arg="\U$arg\E";
+ push(@tagargs,$arg,$value);
+ }
+ $tagname="\U$tagname\E";
+ ($tagname,@tagargs);
+}
+
+sub split_url {
+ local($url)=@_;
+ local($host,$port,$path,$file,$extra,$v);
+ ($url,$extra)=$url=~m!^([^\?\#]*)(.*)$!;
+ $v=$url=~m!^http:(//([^:/]*)(:(\d*))?)?((/([^/]+/)*)?([^/]*))?$!;
+ return () unless $v;
+ ($host,$port,$path,$file)=(($2?$2:"localhost"),($4?$4:80),$6,$8);
+ ($host,$port,$path,$file,$extra);
+}
+
+sub about {
+ print <<EOH;
+
+FixHTML v1.02 2001/01/07 (C) 2001 by Jan Kratochvil <short\@ucw.cz>
+
+Fix broken paths in downloaded HTML trees.
+
+Usage: $0 path host
+
+EOH
+ undef;
+}
+
+__END__
--- /dev/null
+#! /usr/bin/perl
+#
+# $Id$
+# Main page of 'My::Project::fixhtml'
+# Copyright (C) 2003 Jan Kratochvil <project-www.jankratochvil.net@jankratochvil.net>
+#
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; exactly version 2 of June 1991 is required
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write to the Free Software
+# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+
+
+require 5.6.0; # at least 'use warnings;' but we need some 5.6.0+ modules anyway
+use vars qw($VERSION $CVS_ID);
+$VERSION=do { my @r=(q$Revision$=~/\d+/g); sprintf "%d.".("%03d"x$#r),@r; };
+$CVS_ID=q$Id$;
+use strict;
+use warnings;
+
+use My::Web;
+use project::fixhtml::ListItem;
+
+
+My::Web->init_project(
+ "ListItem"=>\%My::Project::fixhtml::ListItem,
+ );
+
+My::Web->footer();
--- /dev/null
+#! /usr/bin/perl
+#
+# $Id$
+# Definition of 'My::Project::ircon' for list.cgi.pl
+# Copyright (C) 2003 Jan Kratochvil <project-www.jankratochvil.net@jankratochvil.net>
+#
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; exactly version 2 of June 1991 is required
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write to the Free Software
+# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+
+
+package My::Project::ircon;
+require 5.6.0; # at least 'use warnings;' but we need some 5.6.0+ modules anyway
+use vars qw($VERSION $CVS_ID);
+$VERSION=do { my @r=(q$Revision$=~/\d+/g); sprintf "%d.".("%03d"x$#r),@r; };
+$CVS_ID=q$Id$;
+use strict;
+use warnings;
+
+
+our %ListItem=(
+ "name"=>"IRCon - Infrared Remote Control",
+ "download"=>"ircon.tar.gz",
+ "link-index of scanned images"=>"ircon-img/",
+ "download-all scanned images"=>"ircon-img.tar",
+ "summary"=>"InfraRed control",
+ "license"=>"PD",
+ "maintenance"=>"obsolete",
+ "obsoleted"=>"Linux kernel driver no longer maintained. Superseded by <a href=\"http://www.lirc.org/\">LIRC</a>",
+ "language"=>"C, Java",
+ "description"=>""
+ .'<p>Software package for custom simple hardware connected to PC parallel port'
+ .' and transmitting infrared singals to fake real remote TV/video controllers. Hardware'
+ .' is also equipped with receiver which is only used during development to grab and decode'
+ .' original signals.</p>'
+ );
+
+1;
--- /dev/null
+# $Id$
+# automake source for the Makefile of project/ircon/ subdir
+# Copyright (C) 2003 Jan Kratochvil <project-www.jankratochvil.net@jankratochvil.net>
+#
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; exactly version 2 of June 1991 is required
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write to the Free Software
+# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+
+
+include $(top_srcdir)/Makefile-head.am
+
+EXTRA_DIST+= \
+ ListItem.pm \
+ index.html.pl
+
+noinst_DATA+= \
+ index.html
--- /dev/null
+#! /usr/bin/perl
+#
+# $Id$
+# Main page of 'My::Project::ircon'
+# Copyright (C) 2003 Jan Kratochvil <project-www.jankratochvil.net@jankratochvil.net>
+#
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; exactly version 2 of June 1991 is required
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write to the Free Software
+# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+
+
+require 5.6.0; # at least 'use warnings;' but we need some 5.6.0+ modules anyway
+use vars qw($VERSION $CVS_ID);
+$VERSION=do { my @r=(q$Revision$=~/\d+/g); sprintf "%d.".("%03d"x$#r),@r; };
+$CVS_ID=q$Id$;
+use strict;
+use warnings;
+
+use My::Web;
+use project::ircon::ListItem;
+
+
+My::Web->init_project(
+ "ListItem"=>\%My::Project::ircon::ListItem,
+ );
+
+print <<'HERE';
+<p>Package consists of:</p>
+<ul>
+<li>Linux kernel module implementing <code>/dev/ircon</code> device as hardware interface</li>
+<li>Daemon to provide service for easy remote use over network</li>
+<li>Multifunction decoder for singal analysis</li>
+<li>Database of all the buttons (<strong>including some secret!</strong>) for supported devices</li>
+<lI>Set of CGIs for WWW interface operation support</li>
+<li>Java 1.0 applet for more comforable WWW control from remote (not required, static HTML used if Java not available)</lI>
+<li>Software for complete tune-up of Maspro SRE-100R as set in text database (not useful, see last notice)</li>
+</ul>
+<p>Currently supported/decoded devices:</p>
+<ul>
+<li><a href="ircon-img/Panasonic-NV-HD650EE-1.png">Panasonic NV-HD650EE video</a>
+ <a href="ircon-img/Panasonic-NV-HD650EE-2.png">(in opened state)</a></li>
+<li><a href="ircon-img/Korting-TV.png">Korting television</a></li>
+<li><a href="ircon-img/AIWA-PX-E80.png">AIWA PX-E80 audio tower(?)</a></li>
+<li><a href="ircon-img/Maspro-SRE-100R-SAC-90.png">Maspro SRE-100R satellite receiver/SAC-90 positioner</a></li>
+<li><a href="ircon-img/Toshiba-V-800SZ.png">Toshiba V-800SZ video</a></li>
+<li><a href="ircon-img/Sharp-VL-N1S.png">Sharp VL-N1S handy video camera</a></li>
+</ul>
+<P>Last code touches were done in summer 1997 and it's not in use for now. In fact the hardware
+should be more intelligent and generate the signal itself as PC hardware simply is too slow to keep up strictly
+with the original frequencies and so in about 1 of 30 button presses it misses. Due to this the automatic Maspro
+tuning software (generating hundreds of button presses) is not usable.</p>
+HERE
+
+My::Web->footer();
--- /dev/null
+#! /usr/bin/perl
+#
+# $Id$
+# Definition of 'My::Project::kix' for list.cgi.pl
+# Copyright (C) 2003 Jan Kratochvil <project-www.jankratochvil.net@jankratochvil.net>
+#
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; exactly version 2 of June 1991 is required
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write to the Free Software
+# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+
+
+package My::Project::kix;
+require 5.6.0; # at least 'use warnings;' but we need some 5.6.0+ modules anyway
+use vars qw($VERSION $CVS_ID);
+$VERSION=do { my @r=(q$Revision$=~/\d+/g); sprintf "%d.".("%03d"x$#r),@r; };
+$CVS_ID=q$Id$;
+use strict;
+use warnings;
+
+
+our %ListItem=(
+ "name"=>"KIX - KaliNix Replacement",
+ "download"=>"kix.c",
+ "summary"=>"Network game server",
+ "license"=>"PD",
+ "maintenance"=>"finished",
+ "language"=>"C",
+ "description"=>""
+ .'<p>Server which can be used on GNU/Linux as a replacement of'
+ .' <a href="ftp://linux.kali.net/outgoing/kalinix/">KaliNix</a>'
+ .' and thus no need to run some foreign binaries on your system and connection'
+ .' to remote/slow real <a href="http://www.kali.net/">Kali</a> server'
+ .' and/or subscribing various papers to get (again binary-only) your'
+ .' own Kali server. Unfortunaly you cannot interconnect a game established'
+ .' by using KIX with any other software (Kali, native IPX etc.).</p>'
+ .' <p>Just compile, run and then add "-kali" option to your'
+ .' <a href="http://d1x.warpcore.org/">D1X</a> to get it running. You'
+ .' do not need IPX support anywhere (kernel, D1X, ...).</p>'
+ );
+
+1;
--- /dev/null
+# $Id$
+# automake source for the Makefile of project/kix/ subdir
+# Copyright (C) 2003 Jan Kratochvil <project-www.jankratochvil.net@jankratochvil.net>
+#
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; exactly version 2 of June 1991 is required
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write to the Free Software
+# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+
+
+include $(top_srcdir)/Makefile-head.am
+
+EXTRA_DIST+= \
+ ListItem.pm \
+ index.html.pl
+
+noinst_DATA+= \
+ index.html
--- /dev/null
+#! /usr/bin/perl
+#
+# $Id$
+# Main page of 'My::Project::kix'
+# Copyright (C) 2003 Jan Kratochvil <project-www.jankratochvil.net@jankratochvil.net>
+#
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; exactly version 2 of June 1991 is required
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write to the Free Software
+# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+
+
+require 5.6.0; # at least 'use warnings;' but we need some 5.6.0+ modules anyway
+use vars qw($VERSION $CVS_ID);
+$VERSION=do { my @r=(q$Revision$=~/\d+/g); sprintf "%d.".("%03d"x$#r),@r; };
+$CVS_ID=q$Id$;
+use strict;
+use warnings;
+
+use My::Web;
+use project::kix::ListItem;
+
+
+My::Web->init_project(
+ "ListItem"=>\%My::Project::kix::ListItem,
+ );
+
+My::Web->footer();
--- /dev/null
+#/*
+# KIX server version 0.99.3
+# To compile run: sh kix.c
+# Help is then available: ./kix -h
+
+# Network configuration options background:
+# -----------------------------------------
+# Each argument on command-line specifies the net adress of the peer
+# where to send all the packets to. In the simplest configuration
+# where you have only two hosts (with arbitrary network between them):
+#
+# BOX_A <-> .. {some TCP/IP network} .. <-> BOX_B
+#
+# There will be the following configuration:
+# On BOX_A: ./kix BOX_B
+# On BOX_B: ./kix BOX_A
+
+# You can also specify the network broadcast address - in network
+# 192.168.1.xxx you have the netmask 255.255.255.0:
+#
+# BOX_A (192.168.1.1) BOX_B (192.168.1.2) BOX_C (192.168.1.10)
+# | | |
+# \------{Ethernet}------+------{Ethernet}-------/
+#
+# There will be the following configuration:
+# On BOX_A, BOX_B and BOX_C: ./kix 192.168.1.255
+
+# Advanced networking - packet forwarding:
+#
+# !!! NOT TESTED YET !!! - Please send me <short@ucw.cz> some
+# success/failure report.
+#
+# !!! Warning: You can very easily configure packet loops by using
+# forwarding options (':' sign). You have been warned.
+#
+# To optimize broadcasting behaviour you can direct some of KIX servers
+# to forward the packets to distant/firewalled hosts. The standard
+# behaviour of KIX when it receives the remote data broadcast packet
+# is to distribute it to all its LOCAL clients but to never pass it
+# further. Bu specifying some host(s) after the colon (':'):
+#
+# HOST_TO_FORWARD_TO:SOURCE_HOST(S)
+#
+# This line says: When I receive packet from SOURCE_HOST, I should
+# pass it to HOST_TO_FORWARD_TO. Some example:
+#
+# BOX_X <-> .. {some TCP/IP network} <-> BOX_A (192.168.1.1)
+# |
+# /-{Ethernet}-+-{Ethernet}-\
+# | |
+# BOX_B (192.168.1.2) BOX_C (192.168.1.10)
+#
+# Setup with direct TCP/IP broadcasting through the network (recommended):
+# On BOX_X : ./kix 192.168.1.255
+# On BOX_A : ./kix BOX_X:196.168.1.0/24
+# On BOX_B/C: ./kix 192.168.1.255
+#
+# Setup with KIX-manual forwaring (more interesting but unneeded/wasteful):
+# On BOX_X : ./kix BOX_A
+# On BOX_A : ./kix 192.168.1.255:KIX_A KIX_X:192.168.1.0/24
+# On BOX_B/C: ./kix 192.168.1.255
+
+
+# Copyright (C) 1998 Jan Kratochvil <short@ucw.cz>
+# Special thanks to Vojtech Pavlik <vojtech@ucw.cz>
+# for testing and suggestions.
+#
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; you must use exactly version 2.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+# You may download a copy of the GNU General Public License from URL
+# http://www.opensource.org/gpl-license.html
+# If not, write to the Free Software Foundation,
+# Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
+
+echo "Compiling KIX server..."
+a="cc"
+b="-s -Wall -O6 -fexpensive-optimizations -fomit-frame-pointer"
+c="-o `basename "$0" .c` $0"
+echo "$a $b $c"
+if $a $b $c;then echo -n
+else echo "$a $c"
+ if $a $c;then echo -n
+ else echo "Failed - please check the output.";exit
+ fi
+fi
+echo "done."
+exit
+*/
+
+#define MULTI_LOCAL
+/* MULTI_LOCAL: Support multiple localhost clients & PID detection
+ *
+ * - needed to be able to run multiple clients on this single host
+ * communicating each other
+ *
+ * - probably supported only under Linux (/proc needed to be mounted!)
+ * (see kaddrmapper(): UDP port -> PID mapping function)
+ *
+ * - requires "root" permissions for this KIX server to use this feature
+ * (under normal-user will KIX behave as w/o this feature compiled in)
+ *
+ * - isn't 100% rock solid as w/D1X it has to complete the search under 100ms!
+ */
+
+#define QUIET_PIDFAIL
+/* QUIET_PIDFAIL: Don't report errors on PID detection
+ *
+ * - don't report errors if the requested process couldn't be found
+ * - probably good to be enabled as error dumping will slowdown KIX and
+ * the search will so much more fail during the next attempted search
+ */
+
+#define IDLE_TIMEOUT 30*60
+/* IDLE_TIMEOUT: Idle time in seconds to terminate if run from inetd
+ */
+
+#define SYSLOG_NAMES 1
+#define _GNU_SOURCE 1
+
+#include <stdio.h>
+#include <stdlib.h>
+#include <sys/types.h>
+#include <sys/socket.h>
+#include <netinet/in.h>
+#include <stdarg.h>
+#include <ctype.h>
+#include <errno.h>
+#include <string.h>
+#include <netdb.h>
+#include <unistd.h>
+#include <fcntl.h>
+#include <stddef.h>
+#include <sys/resource.h>
+#include <setjmp.h>
+#include <dirent.h>
+#include <signal.h>
+#include <syslog.h>
+#include <getopt.h>
+#include <limits.h>
+
+/* #define DEBUG */
+#define VERSION "0.99.3"
+#define SERVICE_PORT 4213
+#define BUFSIZE 4096
+#define HOSTNAME_RESOLVE
+#define SETPRIORITY -50
+#define INETD_SOCKET 0
+#define PATH_PROC "/proc"
+#define PATH_PROC_NET_UDP PATH_PROC "/net/udp"
+#define PATH_PROC_X_FD PATH_PROC "/%s/fd"
+/* NOT working as of glibc-2.0.7: */
+#undef DIRENT_HAVE_D_TYPE_WORKS
+
+#ifndef DEBUG
+#define NDEBUG
+#endif
+#include <assert.h>
+
+#ifdef DEBUG
+#define dbg(x) x
+#else
+#define dbg(x)
+#endif
+
+
+#ifndef __NORETURN
+#if __GNUC__ >= 2
+#define __NORETURN __attribute__((__noreturn__))
+#else
+#define __NORETURN
+#endif
+#endif
+
+#ifndef LINE_MAX
+#define LINE_MAX 4096
+#endif
+
+#define TOSTRING(x) #x
+#define ARRSIZE(x) (sizeof((x))/sizeof(*(x)))
+
+int mainudp,bufl,peerstot,sendoffs;
+unsigned remaddrl;
+unsigned char buf[BUFSIZE];
+const int val_one=1;
+
+typedef struct {
+ unsigned char a[6];
+ } kaddrt;
+
+kaddrt mykaddr,remkaddr,*shipaddr=&remkaddr;
+
+struct peer {
+ kaddrt dst;
+ unsigned cnt;
+ struct peersrc {
+ unsigned a,m; /* host byte-order! */
+ } src[1];
+ } **peers;
+
+struct logf {
+ struct logf *next;
+ FILE *f;
+ } *logfs,**logfsp=&logfs;
+
+const kaddrt kbroad={{0xFF,0xFF,0xFF,0xFF,0xFF,0xFF}};
+long setprio=
+#ifdef SETPRIORITY
+ SETPRIORITY
+#else
+ LONG_MAX
+#endif
+ ;
+char noresolve=
+#ifdef HOSTNAME_RESOLVE
+ 0
+#else
+ 1
+#endif
+ ;
+char quiet=0,debug=0,mapperfail=0,noportprint=0,logsyslog=0,logfsdone=0;
+
+struct cli {
+ struct cli *next;
+ kaddrt kaddr; /* [0..3]=IN addr, [4..5]=XORed PID */
+ kaddrt gwaddr; /* remote gateway w/SERVICE_PORT or "mykaddr" w/current UDP port */
+ unsigned short kport; /* KIX socket */
+ pid_t clpid; /* PID */
+ char *clname; /* process name */
+ char opened; /* bool, informational */
+ } *clis,*cli,**clip;
+
+const char *pname;
+const unsigned char iKIX[3]={'K','I','X'};
+
+void (*errouth)(void);
+
+char msg[LINE_MAX];
+size_t msgi;
+#define MSGSIZECHK() do { if (msgi>=sizeof(msg)-2) return; } while (0)
+
+#define minit() msgi=0
+
+static void moutf(FILE *f)
+{ fprintf(f,"%s: %s\n",pname,msg); }
+
+static void mout(int level)
+{
+struct logf *lf;
+
+ if (!msgi) return;
+ MSGSIZECHK();
+ msg[msgi]='\0';
+ if (!logfsdone || (!logfs && !logsyslog)) moutf(stdout);
+ else {
+ for (lf=logfs;lf;lf=lf->next) moutf(lf->f);
+ if (logsyslog) syslog(level,"%s",msg);
+ }
+}
+
+static void mvprintf(const char *fmt,va_list ap) __attribute__((format(printf,1,0)));
+static void mvprintf(const char *fmt,va_list ap)
+{
+int i;
+ MSGSIZECHK();
+ if ((i=vsnprintf(msg+msgi,sizeof(msg)-1-msgi,fmt,ap))>=0) msgi+=i;
+}
+static void mprintf(const char *fmt,...) __attribute__((format(printf,1,2)));
+static void mprintf(const char *fmt,...)
+{ va_list ap; va_start(ap,fmt); mvprintf(fmt,ap); va_end(ap); }
+
+static void mputchar(char c)
+{ MSGSIZECHK(); msg[msgi++]=c; }
+
+static void verrout(const char *fmt,va_list ap) __attribute__((format(printf,1,0)));
+static void verrout(const char *fmt,va_list ap)
+{
+char fatal=0,showerr=0;
+int waserr=0;
+
+ if (*fmt=='^') { fatal =1; fmt++; }
+ if (!fatal && quiet) return;
+ if (*fmt=='&') { showerr=1; fmt++; waserr=errno; }
+ minit();
+ if (fatal) mprintf("FATAL: ");
+ if (errouth) errouth();
+ mvprintf(fmt,ap);
+ if (showerr) mprintf(" (%s)",strerror(waserr));
+ if (fatal) mputchar('!');
+ mout(LOG_ERR);
+ if (fatal) exit(EXIT_FAILURE);
+}
+
+static void errout(const char *fmt,...)
+{
+va_list ap;
+ va_start(ap,fmt);
+ verrout(fmt,ap);
+ va_end(ap);
+}
+
+static void chk(void *p)
+{
+ if (p) return;
+ errout("^Out of memory");
+}
+#define chknew(a) chk((a)=malloc(sizeof(*(a))))
+
+static void addrdump(const kaddrt *kap)
+{
+ if (quiet) return;
+ if (!noresolve) {
+struct hostent *he;
+ he=gethostbyaddr((char *)(kap->a+0),4,AF_INET);
+ if (he) mprintf("%s",he->h_name);
+ }
+ mprintf("[%u.%u.%u.%u]",kap->a[0],kap->a[1],kap->a[2],kap->a[3]);
+ if (!noportprint) mprintf(":%u",ntohs(*(unsigned short *)(kap->a+4)));
+}
+
+static void pkterrh(void)
+{
+char sep;
+unsigned i;
+
+ mprintf("PKT<");
+ addrdump(shipaddr);
+ mputchar('>');
+ if (bufl-sendoffs) {
+ mprintf("%d/",bufl-sendoffs);
+ sep='[';
+ for (i=sendoffs;i<bufl;i++) {
+ mprintf("%c%02X",sep,buf[i]);
+ sep=' ';
+ }
+ mputchar('=');
+ for (i=sendoffs;i<bufl;i++) {
+ if (isprint(buf[i])) mputchar(buf[i]);
+ else mputchar('.');
+ }
+ mputchar(']');
+ }
+ mprintf(": ");
+}
+
+static void pkterr(char *fmt,...)
+{
+va_list ap;
+ if (quiet) return;
+ va_start(ap,fmt);
+ errouth=pkterrh;
+ verrout(fmt,ap);
+ errouth=NULL;
+ va_end(ap);
+}
+
+#define addreq(a,b) ((a).sin_port==(b).sin_port&&(a).sin_addr.s_addr==(b).sin_addr.s_addr)
+
+#define getclipk(k) getclipoffs((k),offsetof(struct cli, kaddr))
+#define getclipgw(k) getclipoffs((k),offsetof(struct cli,gwaddr))
+static struct cli **getclipoffs(const kaddrt *kap,size_t offs)
+{
+struct cli **clip,*cli;
+ for (clip=&clis;(cli=*clip);clip=&cli->next)
+ if (!memcmp(kap,((char *)cli)+offs,6)) break;
+ return clip;
+}
+
+static void shipout(void)
+{
+int got;
+struct sockaddr_in sin;
+
+ if (debug) pkterr("Sending...");
+ sin.sin_family=AF_INET;
+ if (!memcmp(shipaddr->a+0,mykaddr.a+0,4))
+ sin.sin_addr.s_addr=htonl(INADDR_LOOPBACK);
+ else memcpy(&sin.sin_addr,shipaddr->a+0,4);
+ memcpy(&sin.sin_port,shipaddr->a+4,2);
+ if (fcntl(mainudp,F_SETFL,O_NONBLOCK)) errout("&fcntl(mainudp,O_NONBLOCK)");
+ if ((got=sendto(mainudp,buf+sendoffs,bufl-sendoffs,0,(struct sockaddr *)&sin,sizeof(sin)))!=bufl-sendoffs)
+ if (errno!=ECONNREFUSED) pkterr("&sendto(%d) error, wrote %d",bufl-sendoffs,got);
+ if (fcntl(mainudp,F_SETFL,0 )) errout("&fcntl(mainudp,0)" );
+}
+
+static void fillhost(const char *hname,kaddrt *kap)
+{
+struct hostent *he;
+ if (!(he=gethostbyname(hname))) errout("^&gethostbyname(\"%s\")",hname);
+ if (he->h_addrtype!=AF_INET || he->h_length!=4)
+ errout("^\"%s\": addrtype!=AF_INET || length!=4",hname);
+ if (!*he->h_addr_list)
+ errout("^\"%s\": empty address list",hname);
+ assert(sizeof(*kap)==6);
+ memcpy(kap->a+0,*he->h_addr_list,4);
+ *((unsigned short *)(kap->a+4))=htons(SERVICE_PORT);
+}
+
+static void kaddrdump(const kaddrt *kap)
+{
+unsigned char i;
+
+ if (quiet) return;
+ mprintf("KIX[0x");
+ for (i=0;i<6;i++) mprintf("%02X",kap->a[i]);
+ mputchar(']');
+}
+
+static void clistate(struct cli *cli,const char *fmt,...)
+{
+char local;
+va_list ap;
+
+ if (quiet) return;
+ minit();
+ va_start(ap,fmt); mvprintf(fmt,ap); va_end(ap);
+ mprintf(": ");
+ dbg(mprintf("(cli=%p) ",cli));
+ if ((local=!memcmp(&cli->gwaddr,mykaddr.a+0,4))) mprintf("local ");
+ mprintf("client ");
+ kaddrdump(&cli->kaddr);
+ if (!local) { mprintf(" via "); addrdump(&cli->gwaddr); }
+ mprintf(", kixport %u, process \"%s\"/%lu, %sed",ntohs(cli->kport),cli->clname,(unsigned long)ntohl(cli->clpid),
+ (cli->opened?"open":"clos"));
+ mout(LOG_INFO);
+}
+
+static void iKIXregister(void)
+{/* KIXrDDDDDDkpPID_[NAME] */
+struct cli **clip,*cli;
+struct sockaddr_in addr;
+char ost;
+
+ addr.sin_family=AF_INET;
+ if (!(cli=*(clip=getclipk((kaddrt *)(buf+4))))) {
+ chknew(cli); *clip=cli;
+ cli->next=NULL;
+ cli->kaddr=*(kaddrt *)(buf+4);
+ ost=-1;
+ }
+ else {
+ ost=cli->opened;
+ free(cli->clname);
+ }
+ cli->gwaddr=remkaddr;
+ memcpy(&cli->kport,buf+10,2);
+ memcpy(&cli->clpid,buf+12,4);
+ chk(cli->clname=malloc(bufl-16+1));
+ memcpy(cli->clname,buf+16,bufl-16);
+ cli->clname[bufl-16]='\0';
+ cli->opened=1;
+ clistate(cli,"iKIXregister%s%s ",
+ (ost==1?",socket opened again" :""),
+ (ost==0?",socket opened after being closed":""));
+}
+
+static void iKIXunregister(void)
+{
+struct cli **clip,*cli;
+
+ for (clip=&clis;(cli=*clip);clip=&cli->next) {
+ if (memcmp(&cli->kaddr,buf+4,6)) continue;
+ clistate(cli,"iKIXunregister%s",
+ (!cli->opened?",already closed!":""));
+ cli->opened=0;
+ }
+}
+
+static void iKIXdata(void)
+{/* KIXdDDDDDDssssssDKskDATA... */
+struct cli *tocli;
+char isbroad=!memcmp(buf+4,&kbroad,6);
+unsigned char obyte=buf[9];
+
+ sendoffs=9;
+ buf[9]=0x03; /* net data */
+ for (tocli=clis;tocli;tocli=tocli->next) {
+ if (tocli==cli) continue; /* Do not echo packets back */
+ if (memcmp(tocli->gwaddr.a+0,mykaddr.a+0,4)) continue;
+ if (memcmp(&tocli->kport,buf+16,2)) continue;
+ if (!isbroad &&
+ (memcmp(tocli->kaddr.a+0,buf+4 ,5) || tocli->kaddr.a[5]!=obyte)) continue;
+ shipaddr=&tocli->gwaddr;
+ shipout();
+ }
+ sendoffs=0;
+ buf[9]=obyte;
+ shipaddr=&remkaddr;
+}
+
+static void iKIXforward(void)
+{
+int i,j;
+unsigned remha=(unsigned)ntohl(*(unsigned long *)(remkaddr.a+0));
+
+ for (i=0;i<peerstot;i++) {
+struct peersrc *ps=peers[i]->src;
+ for (j=0;j<peers[i]->cnt;ps++,j++)
+ if (ps->a==(remha&ps->m)) {
+ shipaddr=&peers[i]->dst;
+ shipout();
+ break;
+ }
+ }
+ shipaddr=&remkaddr;
+}
+
+static void shippeers(void)
+{
+int i;
+
+ for (i=0;i<peerstot;i++) {
+ shipaddr=&peers[i]->dst;
+ shipout();
+ }
+ shipaddr=&remkaddr;
+}
+
+static void sigalarm(int signo)
+{
+ if (!quiet) {
+ minit();
+ mprintf("Exiting due to communications inactivity.");
+ mout(LOG_INFO);
+ }
+ exit(EXIT_SUCCESS);
+}
+
+#ifdef MULTI_LOCAL
+
+#define KAM_LOCAL_ADDRESS "local_address"
+#define KAM_INODE "inode"
+#define KAM_SOCKET_X "socket:[%s]"
+
+static pid_t kaddrmapper(const kaddrt *kap)
+{
+FILE *f;
+char line[LINE_MAX];
+int procfdlen,findsklen;
+char c,*s,*s2,*serr,*ixla,*ixin;
+jmp_buf jmp;
+char findla[14],findsk[20],cmpsk[sizeof(findsk)];
+long pidn;
+const char *kamfailerr;
+DIR *dirproc=NULL,*dirfd=NULL;
+struct dirent *direproc,*direfd;
+
+ __NORETURN void kamfail(const char *why)
+ { errout(kamfailerr+(*why!='&'),why+(*why=='&')); mapperfail=1; longjmp(jmp,1); }
+ void cleanup(void)
+ {
+ if (dirproc) { if (closedir(dirproc)) errout("&closedir(\"" PATH_PROC "\")"); dirproc=NULL; }
+ if (dirfd ) { if (closedir(dirfd )) errout("&closedir(\"" PATH_PROC_X_FD "\")","<unknown>"); dirfd =NULL; }
+ }
+ char nextline(void)
+ {
+ char r;
+ errno=0;
+ r=!fgets(line,sizeof(line),f);
+ if (errno) kamfail("&fgets");
+ return(r);
+ }
+ void walkerinit(void) { c=*(s2=line); }
+ char walker(void)
+ {
+ *(s=s2)=c;
+ while (*s!='\n'&&isspace(*s)) s++;
+ for (s2=s;!isspace(*s2)&&*s2&&*s2!='\n';s2++);
+ if (!(c=*s2)) kamfail("No EOL NL");
+ if (c=='\n') return(1);
+ *s2='\0';
+ return(0);
+ }
+
+ if (mapperfail) return(-1);
+ if (setjmp(jmp)) {
+ cleanup();
+ return(-1);
+ }
+ kamfailerr="&%s(\"" PATH_PROC_NET_UDP "\",r/o) (multi-local disabled)";
+ if (snprintf(findla,14,"%08lX:%04X",
+ *(unsigned long *)(kap->a+0) , /* !ntohl() is IMHO kernel bug */
+ (unsigned short)ntohs(*(unsigned short *)(kap->a+4)))!=13)
+ kamfail("Internal - snprintf()");
+ if (!(f=fopen(PATH_PROC_NET_UDP,"rt"))) kamfail("&fopen");
+ if (nextline()) kamfail("No header line");
+ ixla=NULL; ixin=NULL;
+ walkerinit();
+ for (;;) {
+ if (walker()) break;
+ if (!ixla && !strcmp(s,KAM_LOCAL_ADDRESS)) ixla=s;
+ if (!ixin && !strcmp(s,KAM_INODE )) ixin=s;
+ }
+ if (!ixla) kamfail("\"" KAM_LOCAL_ADDRESS "\" not found");
+ if (!ixin) kamfail("\"" KAM_INODE "\" not found");
+ findsklen=-1;
+ while (!nextline()) {
+ walkerinit();
+ while (s2<=ixla || s2<=ixin) {
+ if (walker()) kamfail("Not enough columns");
+ if (ixla==s && strcmp(s,findla)) { findsklen=-1; break; }
+ if (ixin==s) {
+ findsklen=snprintf(findsk,sizeof(findsk),KAM_SOCKET_X,s);
+ if (findsklen<=0 || findsklen>=sizeof(findsk)-1) kamfail("&\"" KAM_INODE "\" parse error");
+ break;
+ }
+ }
+ if (findsklen>=0) break;
+ }
+ if (findsklen<0) strcpy(findsk,"<unknown>");
+ else {
+ kamfailerr="&%s(\"" PATH_PROC "\" scanning) (multi-local disabled)";
+ if (!(dirproc=opendir(PATH_PROC))) kamfail("&opendir");
+ while (errno=0,direproc=readdir(dirproc)) {
+#ifdef DIRENT_HAVE_D_TYPE_WORKS
+ if (direproc->d_type!=DT_DIR) continue;
+#endif
+ pidn=strtol(direproc->d_name,&serr,10);
+ if (pidn<=0 || pidn>=LONG_MAX || *serr) continue;
+ procfdlen=snprintf(line,sizeof(line),PATH_PROC_X_FD,direproc->d_name);
+ if (procfdlen<=0 || procfdlen>=sizeof(line)-5) continue;
+ errno=0;
+ if (!(dirfd=opendir(line))) {
+ if (errno==EPERM || errno==EACCES) kamfail("&opendir");
+ continue;
+ }
+ line[procfdlen]='/';
+ while ((direfd=readdir(dirfd))) {
+#ifdef DIRENT_HAVE_D_TYPE_WORKS
+ if (direfd->d_type!=DT_LNK) continue;
+#endif
+ if (procfdlen+1+strlen(direfd->d_name)+1>sizeof(line)) continue;
+ strcpy(line+procfdlen+1,direfd->d_name);
+ if (readlink(line,cmpsk,findsklen+1)!=findsklen) continue;
+ if (memcmp(findsk,cmpsk,findsklen)) continue;
+ cleanup();
+ return(pidn);
+ }
+ closedir(dirfd);
+ }
+ if (!direproc && errno) kamfail("&readdir");
+ }
+#ifndef QUIET_PIDFAIL
+ if (!quiet) {
+ minit();
+ mprintf("Process PID not found for ");
+ addrdump(kap);
+ mprintf(" (la=\"%s\", sk=\"%s\")!",findla,findsk);
+ mout(LOG_NOTICE);
+ }
+#endif
+ return(-2);
+}
+
+/* MULTI_LOCAL: */
+#endif
+
+static void doversion(void)
+{
+ puts("\
+I'm KIX, version " VERSION " compiled on \""__DATE__" "__TIME__"\" from \""__FILE__"\" by \""__VERSION__"\"\n\
+Copyright (C) 1998 Jan Kratochvil <short@ucw.cz>\n\
+This is free software with ABSOLUTELY NO WARRANTY. See the sources for details:\n\
+http://atrey.karlin.mff.cuni.cz/~short/sw/kix.c.gz\n\
+");
+}
+
+const char *longdesc[]={
+"display this help and exit",
+"display just version number and exit",
+"only serious errors are reported",
+"send all the messages (also) to this file\n\
+" "defaults to stdout (\"-\"), multiple occurences allowed",
+"send all the messages to syslog as the specified facility\n\
+" "see openlog(3): \"daemon\", \"user\", \"local0\", ...",
+"dump all the packets being communicated",
+#ifdef MULTI_LOCAL
+"disable support of multiple localhost clients",
+#endif
+"don't resolve hostnames",
+"set such process priority (x<0 runs faster!)\n\
+" "value \"-\" will leave the priority untouched",
+"terminate when such seconds idle, defaults to:\n\
+" "infinity(=0) if as standalone, IDLE_TIMEOUT if from inetd",
+};
+
+const struct option longopts[]={
+{"help" ,0,0,'h'},
+{"version",0,0,'V'},
+{"quiet" ,0,0,'q'},
+{"logfile",1,0,'l'},
+{"syslog" ,1,0,'s'},
+{"debug" ,0,0,'d'},
+#ifdef MULTI_LOCAL
+{"single" ,0,0,'1'},
+#endif
+{"numeric",0,0,'n'},
+{"pri" ,1,0,'p'},
+{"timeout",1,0,'t'},
+};
+
+static __NORETURN void dohelp(void)
+{
+int i;
+
+ doversion();
+ puts("\
+Syntax: kix [-h] [-V] [-q] [-l <filename>] [-s <facility>]\n\
+ [-d]"
+#ifdef MULTI_LOCAL
+" [-1]"
+#endif
+" [-n] [-p <pri>] [-t <timeout>]\n\
+ [<to peer>[{:|,}<from peer>[/{netbits|netmask}]]...]...\n\
+");
+ for (i=0;i<ARRSIZE(longopts);i++) {
+const char *cs,*cse;
+ printf(" -%c,--%-7s ",longopts[i].val,longopts[i].name);
+ for (cs=longdesc[i];;cs=cse+1)
+ if (!(cse=strchr(cs,'\n'))) {
+ puts(cs);
+ break;
+ }
+ else {
+char fbuf[32];
+ snprintf(fbuf,sizeof(fbuf),"%%.%ds\n%%16s",cse-cs);
+ printf(fbuf,cs,"");
+ }
+ }
+ puts("\
+ <to peer> host to also send all the packets to\n\
+ <from peer> forward packets if received from this peer\n\
+ packets are forwarded to the <to peer>\n\
+ netmask \"255.255.255.0\" equals netbits \"24\"\n\
+\n\
+ inetd - For automatic run add the next line to /etc/inetd.conf:\n\
+4213 dgram udp wait root /usr/bin/kix kix -s daemon PEER_ARGUMENTS\n\
+");
+ exit(EXIT_FAILURE);
+}
+
+int main(int argc,char **argv)
+{
+int i,j,optc,sot;
+unsigned sotl=sizeof(sot);
+char localaddr,remremote;
+struct sockaddr_in anyaddr,remaddr;
+long idletmout=0;
+char setidletmout=0;
+
+ assert(sizeof(remkaddr)==6);
+ assert(sizeof(unsigned)==4);
+ pname=*argv;
+ setlinebuf(stdout);
+ setlinebuf(stderr);
+
+ if (gethostname((char *)buf,sizeof(buf))) errout("^&gethostname()");
+ fillhost((char *)buf,&mykaddr);
+
+ while ((optc=getopt_long(argc,argv,"hVql:s:d"
+#ifdef MULTI_LOCAL
+"1"
+#endif
+ "np:t:",longopts,NULL))!=EOF) switch (optc) {
+ case 'V': doversion(); exit(EXIT_FAILURE);
+ case 'q': quiet=1; break;
+ case 'l': {
+struct logf *lf;
+ chknew(lf);
+ if (!(lf->f=fopen(optarg,"at"))) errout("^&fopen(\"%s\",append)",optarg);
+ lf->next=NULL;
+ *logfsp=lf;
+ logfsp=&lf->next;
+ break; }
+ case 's': {
+int i;
+ for (i=0;i<ARRSIZE(facilitynames);i++)
+ if (!strcasecmp(optarg,facilitynames[i].c_name)) break;
+ if (i>=ARRSIZE(facilitynames)) errout("^Unknown syslog facility \"%s\"",optarg);
+ openlog("kix",LOG_PID,facilitynames[i].c_val);
+ logsyslog=1;
+ break; }
+ case 'd': debug=1; break;
+#ifdef MULTI_LOCAL
+ case '1': mapperfail=1; break;
+#endif
+ case 'n': noresolve=1; break;
+#define NUMPARSE_ERR "^\"-%c\" number \"%s\" parse error, offending: %s"
+ case 'p': {
+char *serr;
+ if (!strcmp(optarg,"-")) { setprio=LONG_MAX; break; }
+ setprio=strtol(optarg,&serr,10);
+ if (setprio<=INT_MIN || setprio >=INT_MAX || *serr) errout(NUMPARSE_ERR,'p',optarg,serr);
+ break; }
+ case 't': {
+char *serr;
+ idletmout=strtol(optarg,&serr,10);
+ if (idletmout<0 || idletmout>=INT_MAX || *serr) errout(NUMPARSE_ERR,'t',optarg,serr);
+ break; }
+ default: /* also 'h' */
+ dohelp();
+ }
+ logfsdone=1;
+ if ((peerstot=(argc-optind))) {
+ chk(peers=malloc(sizeof(*peers)*(argc-optind)));
+ for (i=0;i<peerstot;i++) {
+char *s,*s2;
+int comps=0;
+ chk(s=strdup(argv[optind+i]));
+ for (s2=s;*s2;s2++) if (*s2==':' || *s2==',') { *s2='\0'; comps++; }
+ chk(peers[i]=malloc(sizeof(**peers)+sizeof(struct peersrc)*(comps-1)));
+ fillhost(s,&peers[i]->dst);
+ if ((peers[i]->cnt=comps)) {
+struct peersrc *ps=peers[i]->src;
+unsigned mask;
+kaddrt fakehost;
+ while (comps--) {
+ while (*s) s++; s++;
+ mask=-1;
+ for (s2=s;*s2;s2++) if (*s2=='/') { mask=0; *s2++='\0'; break; }
+ fillhost(s,&fakehost);
+ ps->a=(unsigned)ntohl(*(unsigned long *)(fakehost.a+0));
+ if (!mask) {
+char *serr;
+long ll;
+ ll=strtol(s2,&serr,10);
+ if (ll>=0 && ll<=32) while (ll--) mask=(mask>>1U)|(1U<<31U);
+ else {
+ fillhost(s2,&fakehost);
+ mask=(unsigned)ntohl(*(unsigned long *)(fakehost.a+0));
+ }
+ }
+ ps->m=mask;
+ ps->a&=mask;
+ while (mask&(1U<<31U)) mask<<=1U;
+ if (mask) errout("^Specified netmask (0x%08X) is invalid",ps->m);
+ ps++;
+ }
+ }
+ free(s);
+ }
+ }
+ assert(peerstot>=0);
+
+ errno=0;
+ getsockopt(INETD_SOCKET,SOL_SOCKET,SO_TYPE,&sot,&sotl);
+ if (errno && errno!=ENOTSOCK) errout("&getsockopt(" TOSTRING(INETD_SOCKET) ",SO_TYPE)");
+ if (!errno && sotl==sizeof(sot) && sot==SOCK_DGRAM) mainudp=INETD_SOCKET;
+ else {
+ mainudp=socket(AF_INET,SOCK_DGRAM,IPPROTO_UDP);
+ if (mainudp==-1 || mainudp==INETD_SOCKET) errout("^&socket()");
+
+ anyaddr.sin_family=AF_INET;
+ anyaddr.sin_addr.s_addr=htonl(INADDR_ANY);
+ anyaddr.sin_port=htons(SERVICE_PORT);
+ if (bind(mainudp,(struct sockaddr *)&anyaddr,sizeof(anyaddr))) errout("^&bind(%d)",SERVICE_PORT);
+ }
+ if (!setidletmout) idletmout=(mainudp==INETD_SOCKET?IDLE_TIMEOUT:0);
+ if (!quiet) {
+ minit();
+ mprintf("KIX v" VERSION " on ");
+ addrdump(&mykaddr);
+ mprintf(", pri %d",getpriority(PRIO_PROCESS,0));
+ }
+ if (setprio!=LONG_MAX) {
+ if (setpriority(PRIO_PROCESS,0,SETPRIORITY))
+ { if (!quiet) mprintf(" left - %s",strerror(errno)); }
+ else if (!quiet) mprintf(" -> %d",getpriority(PRIO_PROCESS,0));
+ }
+ if (!quiet) {
+int rtm;
+ mprintf(", %s, ",(mainudp==INETD_SOCKET?"inetd":"standalone"));
+ if ((rtm=idletmout)) {
+ mprintf("timeout is");
+ if (rtm>=3600) { mprintf(" %dhrs",rtm/3600); rtm%=3600; }
+ if (rtm>= 60) { mprintf(" %dmin",rtm/ 60); rtm%= 60; }
+ if (rtm>= 1) mprintf(" %dsec",rtm );
+ }
+ else mprintf("no timeout");
+ mout(LOG_INFO);
+
+ if (peerstot) {
+ noportprint=1;
+ minit();
+ mprintf("InterKIX to<from>:");
+ for (i=0;i<peerstot;i++) {
+struct peersrc *ps=peers[i]->src;
+ mputchar(' ');
+ addrdump(&peers[i]->dst);
+ for (j=0;j<peers[i]->cnt;ps++,j++) {
+unsigned mcnt,mask;
+kaddrt fakehost;
+ mputchar(j?',':'<');
+ *(unsigned long *)(fakehost.a+0)=(unsigned long)htonl(ps->a);
+ addrdump(&fakehost);
+ if ((mask=ps->m)==-1) continue;
+ for (mcnt=0;mask;mcnt++) mask<<=1U;
+ mprintf("/%u",mcnt);
+ }
+ if (j) mputchar('>');
+ }
+ mout(LOG_INFO);
+ noportprint=0;
+ }
+ }
+ if (setsockopt(mainudp,SOL_SOCKET,SO_BROADCAST,&val_one,sizeof(val_one)))
+ errout("&setsockopt(mainudp,SO_BROADCAST)");
+ signal(SIGALRM,sigalarm);
+
+ for (;;) {
+pktfail:
+ remaddrl=sizeof(remaddr);
+ alarm(idletmout);
+ bufl=recvfrom(mainudp,&buf,sizeof(buf),0,(struct sockaddr *)&remaddr,&remaddrl);
+ alarm(0);
+ if (bufl==-1) { if (errno!=ECONNREFUSED) errout("&recvfrom: bufl=-1"); goto pktfail; }
+ if (remaddr.sin_family!=AF_INET)
+ { errout("recvfrom: sin_family %u!=AF_INET (%u)",remaddr.sin_family,AF_INET); goto pktfail; }
+ localaddr=(ntohl(remaddr.sin_addr.s_addr)==INADDR_LOOPBACK || !memcmp(&remaddr.sin_addr,mykaddr.a+0,4));
+ remremote=(ntohs(remaddr.sin_port)==SERVICE_PORT);
+ if (localaddr && remremote) goto pktfail; /* Talking to yourself, Graham? */
+ if (!localaddr && !remremote) { errout("Alien packet discarded"); goto pktfail; }
+ memcpy(remkaddr.a+0,(remremote?(void *)&remaddr.sin_addr:(void *)(mykaddr.a+0)),4);
+ memcpy(remkaddr.a+4,&remaddr.sin_port,2);
+ if (debug) pkterr("received.");
+ if (!bufl) { pkterr("Empty!"); goto pktfail; }
+ if (bufl>=4 && !memcmp(buf,iKIX,3)) {
+ if (!remremote) { errout("InterKIX packets not allowed from localhost"); goto pktfail; }
+ switch (buf[3]) {
+ case 'r': /* register: KIXrDDDDDDkpPID_[NAME] */
+ if (bufl<16) { pkterr("InterKIX Register len < 16"); goto pktfail; }
+ iKIXregister();
+ iKIXforward();
+ break;
+ case 'u': /* unregister: KIXuDDDDDD */
+ if (bufl!=10) { pkterr("InterKIX Unregister len != 10"); goto pktfail; }
+ iKIXunregister();
+ iKIXforward();
+ break;
+ case 'd': /* data: KIXdDDDDDDssssssDKskDATA... */
+ if (bufl <21) { pkterr("InterKIX Data" " len < 21" ); goto pktfail; }
+ cli=NULL;
+ iKIXdata();
+ iKIXforward();
+ break;
+ default:
+ pkterr("Unrecognized InterKIX command code 0x%02X",buf[3]);
+ goto pktfail;
+ }
+ goto pktfail;
+ }
+ if (remremote) { errout("LocalKIX packets not allowed from remote"); goto pktfail; }
+ switch (buf[0]) {
+ case 0x01: /* open socket */
+ if (bufl<7) { pkterr("OpenSocket len < 7!"); goto pktfail; }
+{ unsigned char *us;
+ us=memchr(buf+7,0,bufl-7);
+ bufl+=-1+10-(us?(buf+bufl)-us:0);
+}
+ memmove(buf+10,buf+1,bufl-10);
+ memcpy(buf+4,mykaddr.a+0,4);
+ *(unsigned short *)(buf+8)=
+#ifdef MULTI_LOCAL
+ (mapperfail?0:(*(unsigned short *)(buf+12))^(*(unsigned short *)(buf+14)))
+#else
+ 0
+#endif
+ ;
+ iKIXregister();
+
+ if (peerstot) {
+ memcpy(buf,iKIX,3); buf[3]='r';
+ shippeers();
+ }
+
+ buf[0]=0x06; /* open response */
+ memset(buf+1,0,2); /* ??? g_LastPort */
+ bufl=3;
+ shipout();
+ break;
+ case 0x02: /* close socket */
+ if (bufl<3) { pkterr("Close socket len <3!"); goto pktfail; }
+ cli=*getclipgw(&remkaddr);
+ if (!cli) { pkterr("Unregister() but before Register()!"); goto pktfail; }
+ memcpy(buf+4,&cli->kaddr,6);
+ iKIXunregister();
+
+ if (peerstot) {
+ memcpy(buf,iKIX,3); buf[3]='u';
+ bufl=10;
+ shippeers();
+ }
+
+ buf[0]=0x07; /* close response */
+ memset(buf+1,0,2); /* ??? g_LastPort */
+ bufl=3;
+ shipout();
+ break;
+ case 0x03: /* net data: 3ddddddDK??DATA... -> KIXdDDDDDDssssssDKskDATA... */
+ if (bufl<11) { pkterr("Net data len < 11!"); goto pktfail; }
+ if (!(cli=*(clip=getclipgw(&remkaddr))))
+ { pkterr("Got net data before socket open!"); goto pktfail; }
+ memmove(buf+20,buf+11,bufl-1);
+ bufl+=9;
+ memcpy(buf+18,&cli->kport,2); /* sport */
+ memcpy(buf+16,buf+7 ,2); /* dport */
+ memcpy(buf+10,&cli->kaddr,6); /* saddr */
+ memmove(buf+4,buf+1 ,6); /* daddr */
+ memcpy(buf,iKIX,3); buf[3]='d';
+ iKIXdata();
+ if (!memcmp(buf+4,&kbroad,6)) shippeers();
+ else if (memcmp(buf+4,mykaddr.a+0,4)) /* not local */
+ for (cli=clis;cli;cli=cli->next) {
+ if (memcmp(&cli->kaddr,buf+4,6)) continue;
+ shipaddr=&cli->gwaddr;
+ shipout();
+ }
+ shipaddr=&remkaddr;
+ break;
+ case 0x05: /* Get Address */
+ buf[0]=0x04; /* myipxaddress */
+#ifdef MULTI_LOCAL
+{ pid_t rempid; kaddrt mapkaddr;
+ *(unsigned long *)(mapkaddr.a+0)=(unsigned long)htonl(INADDR_LOOPBACK);
+ memcpy(mapkaddr.a+4,remkaddr.a+4,2);
+ if ((rempid=kaddrmapper(&mapkaddr))==-2) {
+#ifndef QUIET_PIDFAIL
+ pkterr("GetAddress: no PID!");
+#endif
+ goto pktfail; }
+ *(unsigned short *)(buf+5)=(rempid==-1?0:htons(rempid^(rempid>>16)));
+#else
+ memset(buf+5,0,2);
+#endif
+ memcpy(buf+1,mykaddr.a+0,4);
+ if (!quiet) {
+ minit();
+ mprintf("GetAddress: For ");
+ addrdump(&remkaddr);
+ mprintf(" set ");
+ kaddrdump((kaddrt *)(buf+1));
+#ifdef MULTI_LOCAL
+ mprintf(", PID");
+ if (rempid==-1) mprintf(" detection failed");
+ else mprintf("=%d",rempid);
+#endif
+ mout(LOG_INFO);
+ }
+ bufl=7;
+ shipout();
+ break;
+#ifdef MULTI_LOCAL
+}
+#endif
+ default:
+ pkterr("Unrecognized command code 0x%02X",buf[0]);
+ goto pktfail;
+ }
+ }
+ return(EXIT_SUCCESS);
+}
--- /dev/null
+#! /usr/bin/perl
+#
+# $Id$
+# Definition of 'My::Project::kware' for list.cgi.pl
+# Copyright (C) 2003 Jan Kratochvil <project-www.jankratochvil.net@jankratochvil.net>
+#
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; exactly version 2 of June 1991 is required
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write to the Free Software
+# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+
+
+package My::Project::kware;
+require 5.6.0; # at least 'use warnings;' but we need some 5.6.0+ modules anyway
+use vars qw($VERSION $CVS_ID);
+$VERSION=do { my @r=(q$Revision$=~/\d+/g); sprintf "%d.".("%03d"x$#r),@r; };
+$CVS_ID=q$Id$;
+use strict;
+use warnings;
+
+
+our %ListItem=(
+ "name"=>"KernelWare, Linux Kernel Drivers in Userland",
+ "download"=>"kware.tar.gz",
+ "summary"=>"Drivers debugging",
+ "license"=>"PD",
+ "maintenance"=>"obsolete",
+ "obsoleted"=>"<a href=\"http://user-mode-linux.sourceforge.net/\">The User-mode Linux Kernel</a>",
+ "language"=>"C",
+ "description"=>""
+ .'<p>Do you also find debugging of Linux kernel drivers a nightmare? Would you'
+ .' like to be able to run them as normal userland process including fancy'
+ .' <code>gdb</code> debugging and <code>SIGSEGV</code>-guarded operation?'
+ .' Here you are!</p>'
+ .' <p>KernelWare provides stub-style emulation of core kernel functions and'
+ .' is able to link with already pre-compiled modules. No special compilation'
+ .' flags needed, just link the <code>.o</code> module of the driver with'
+ .' KernelWare and you will get standard executable.</p>'
+ .' <p>Currently only a few functions are implemented and the code is rather'
+ .' an ugly hack than professional solution. I do not expect to ever develop'
+ .' it into some clean software, take it as it is, improve it or let it be.</p>'
+ );
+
+1;
--- /dev/null
+# $Id$
+# automake source for the Makefile of project/kware/ subdir
+# Copyright (C) 2003 Jan Kratochvil <project-www.jankratochvil.net@jankratochvil.net>
+#
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; exactly version 2 of June 1991 is required
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write to the Free Software
+# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+
+
+include $(top_srcdir)/Makefile-head.am
+
+EXTRA_DIST+= \
+ ListItem.pm \
+ index.html.pl
+
+noinst_DATA+= \
+ index.html
--- /dev/null
+#! /usr/bin/perl
+#
+# $Id$
+# Main page of 'My::Project::kware'
+# Copyright (C) 2003 Jan Kratochvil <project-www.jankratochvil.net@jankratochvil.net>
+#
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; exactly version 2 of June 1991 is required
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write to the Free Software
+# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+
+
+require 5.6.0; # at least 'use warnings;' but we need some 5.6.0+ modules anyway
+use vars qw($VERSION $CVS_ID);
+$VERSION=do { my @r=(q$Revision$=~/\d+/g); sprintf "%d.".("%03d"x$#r),@r; };
+$CVS_ID=q$Id$;
+use strict;
+use warnings;
+
+use My::Web;
+use project::kware::ListItem;
+
+
+My::Web->init_project(
+ "ListItem"=>\%My::Project::kware::ListItem,
+ );
+
+My::Web->footer();
--- /dev/null
+#! /usr/bin/perl
+#
+# $Id$
+# List of projects Perl template.
+# Copyright (C) 2003 Jan Kratochvil <project-www.jankratochvil.net@jankratochvil.net>
+#
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; exactly version 2 of June 1991 is required
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write to the Free Software
+# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+
+
+require 5.6.0; # at least 'use warnings;' but we need some 5.6.0+ modules anyway
+use vars qw($VERSION $CVS_ID);
+$VERSION=do { my @r=(q$Revision$=~/\d+/g); sprintf "%d.".("%03d"x$#r),@r; };
+$CVS_ID=q$Id$;
+use strict;
+use warnings;
+
+use lib "../";
+use My::Web;
+require CGI;
+
+use constant ENTRIES=>"CVS/Entries";
+use constant ENTRIES_LOG=>"CVS/Entries.Log";
+
+
+My::Web->init(
+ "title"=>'Project List',
+ );
+My::Web->heading();
+
+my $CGI=CGI->new();
+
+print <<'HERE';
+<h1>Project List of <a href="mailto:web-www.jankratochvil.net@jankratochvil.net">Jan Kratochvil</a></h1>
+
+<p><form action="list.cgi.pl" method="GET">
+<select name="description_opt" onchange="this.form.submit();">
+HERE
+print '<option value="0"'.(!$CGI->param("description_opt") ? ' selected="selected"' : '').'>only list</option>'."\n";
+print '<option value="1"'.( $CGI->param("description_opt") ? ' selected="selected"' : '').'>incl. descriptions</option>'."\n";
+print <<'HERE';
+</select>
+<input type="submit" value="Update" />
+</form></p>
+HERE
+
+my %dirs;
+for my $ENTRIES (ENTRIES,ENTRIES_LOG) {
+ local *E;
+ if (!open E,$ENTRIES) {
+ die "File \"".$ENTRIES."\" cannot be opened";
+ }
+ while (<E>) {
+ chomp;
+ do { $dirs{$1}=1; next; } if m#^(?:A )?D/([^/]*)/#;
+ next if m#^/([^/]*)/# ;
+ next if /^D$/;
+ warn "File $ENTRIES contains invalid line \"$_\": $!";
+ }
+ close E;
+ }
+
+my %item;
+for my $dir (keys(%dirs)) {
+ require "$dir/ListItem.pm";
+ my $item=eval('\%My::Project::'.$dir.'::ListItem');
+ do { warn "Broken $dir/List.pm"; next; } if !defined %$item;
+ $item{$dir}=$item;
+ }
+
+# $col{"name"}{"show"}=1
+# $col{"name"}{"format"}=sub { "<".$_[0].">"; }
+# $col{"name"}{""}="Project name";
+# @col_order
+
+my @row_order;
+my @col_order=qw(name summary license maintenance language);
+my %col;
+
+sub format_url ($) { return (!$_[0] ? "" : '<a href="'.$_[0].'">X</a>'); }
+
+$col{"name"}{"format"}=sub {
+ $_[0]=~s#<a\s[^>]*>([^<]*)</a>#$1#g;
+ return "<a href=\"".$_[1]."/\">".$_[0]."</a>";
+ };
+
+$col{"license"}{"format"}=sub {
+ my %known=(
+ "PD"=>"<a href=\"http://www.gnu.org/philosophy/categories.html#PublicDomainSoftware\">PD</a>",
+ "GPL"=>"<a href=\"http://www.gnu.org/licenses/gpl.html\">GPL</a>",
+ "LGPL"=>"<a href=\"http://www.gnu.org/licenses/lgpl.html\">LGPL</a>",
+ );
+ return $known{$_[0]} if $known{$_[0]};
+ return $_[0];
+ };
+
+$col{"online-demo"}{"format"}=\&format_url;
+$col{"download"}{"format"}=\&format_url;
+$col{"name"}{""}="Project Name";
+$col{"summary"}{""}="Abstract";
+$col{"license"}{""}="Copying";
+$col{"maintenance"}{""}="State";
+$col{"language"}{""}="Language";
+
+# Fill in cols not contained in @col_order
+if (0) {
+ my %col_order=map(($_=>1),@col_order);
+ push @col_order,map({ ($col_order{$_} ? () : $_); } keys(%{{ map(($_=>1),map((keys(%{$item{$_}})),keys(%item)))}}));
+ }
+
+print '<table border="1">'."\n";
+ print '<tr>';
+ for my $col (@col_order) {
+ next if defined $col{$col}{"show"} && !$col{$col}{"show"};
+ print '<th>'.($col{$col}{""} || "[$col]").'</th>';
+ }
+ print '</tr>'."\n";
+ my @rows_ordered=sort {
+ for my $order_by (@row_order,"name") {
+ my $r=($item{$a}{$order_by} cmp $item{$b}{$order_by});
+ return $r if $r;
+ }
+ return 0;
+ } keys(%item);
+ for my $row (@rows_ordered) {
+ print '<tr>';
+ for my $col (@col_order) {
+ next if defined $col{$col}{"show"} && !$col{$col}{"show"};
+ print '<td>';
+ if (!$col{$col}{"format"}) {
+ print(($item{$row}{$col} || ""));
+ }
+ else {
+ print(&{$col{$col}{"format"}}($item{$row}{$col},$row));
+ }
+ print '</td>';
+ }
+ print '</tr>'."\n";
+ if ($CGI->param("description_opt")) {
+ print '<tr><td style="border: none;"></td>';
+ print '<td colspan="'.(scalar(@col_order)-1).'"><blockquote>'.$item{$row}{"description"}.'</blockquote></td>';
+ print '</tr>'."\n";
+ print '<tr><td style="border: none;" colspan="'.scalar(@col_order).'"> </td></tr>'."\n";
+ }
+ }
+print '</table>'."\n";
+
+My::Web->footer();
--- /dev/null
+#! /usr/bin/perl
+#
+# $Id$
+# Definition of 'My::Project::mdsms' for list.cgi.pl
+# Copyright (C) 2003 Jan Kratochvil <project-www.jankratochvil.net@jankratochvil.net>
+#
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; exactly version 2 of June 1991 is required
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write to the Free Software
+# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+
+
+package My::Project::mdsms;
+require 5.6.0; # at least 'use warnings;' but we need some 5.6.0+ modules anyway
+use vars qw($VERSION $CVS_ID);
+$VERSION=do { my @r=(q$Revision$=~/\d+/g); sprintf "%d.".("%03d"x$#r),@r; };
+$CVS_ID=q$Id$;
+use strict;
+use warnings;
+
+
+our %ListItem=(
+ "name"=>"Mobile Device SMS Tool",
+ "download-sources .tar.gz"=>"mdsms-1.5.2.tar.gz",
+ "download-sources .tar.Z"=>"mdsms-1.5.2.tar.Z",
+ "download-i386 RPM package"=>"mdsms-1.5.2-0.i386.rpm",
+ "download-sources RPM package"=>"mdsms-1.5.2-0.src.rpm",
+ "download-logos from KESSLER Wireless Design"=>"http://www.kessler-design.com/wireless/samples.php3",
+ "summary"=>"Mobile communication",
+ "license"=>"GPL",
+ "maintenance"=>"finished",
+ "language"=>"C",
+ "description"=>""
+ .'<p>Sends NOL or NGG files as operator logo or group graphics through'
+ .' <a href="http://www.nokia.com/">Nokia</a> <a href="http://www.communicator.org/">Communicator</a>'
+ .' <b>9110</b> (9000/9000i is definitively <b>not</b> compatible). Usually you need'
+ .' to have either infra-red port in your computer or special FBUS cable to be able'
+ .' to use conventional logo-uploading tools (<a href="http://www.gnokii.org/">GNokii</a>'
+ .' or one from <a href="http://www.kessler-design.com/wireless/operatorlogo.php3">KESSLER'
+ .' Wireless Design</a>). This program uses only standard modem cable and integrated'
+ .' FaxModem capability of 9110.</p>'
+ .' <p>This software should be general-UNIX compatible. Please wait a minute when'
+ .' you run it, under various UNIXes it may take some time to finish.</p>'
+ .' <p><b>GSM network codes: </b>GSM network code needs to be given as parameter during'
+ .' sending of operator logo. Nice list of the codes you will find'
+ .' <a href="http://kbs.cs.tu-berlin.de/~jutta/gsm/gsm-list.html">here</a>.'
+ );
+
+1;
--- /dev/null
+# $Id$
+# automake source for the Makefile of project/mdsms/ subdir
+# Copyright (C) 2003 Jan Kratochvil <project-www.jankratochvil.net@jankratochvil.net>
+#
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; exactly version 2 of June 1991 is required
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write to the Free Software
+# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+
+
+include $(top_srcdir)/Makefile-head.am
+
+EXTRA_DIST+= \
+ ListItem.pm \
+ index.html.pl
+
+noinst_DATA+= \
+ index.html
--- /dev/null
+#! /usr/bin/perl
+#
+# $Id$
+# Main page of 'My::Project::mdsms'
+# Copyright (C) 2003 Jan Kratochvil <project-www.jankratochvil.net@jankratochvil.net>
+#
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; exactly version 2 of June 1991 is required
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write to the Free Software
+# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+
+
+require 5.6.0; # at least 'use warnings;' but we need some 5.6.0+ modules anyway
+use vars qw($VERSION $CVS_ID);
+$VERSION=do { my @r=(q$Revision$=~/\d+/g); sprintf "%d.".("%03d"x$#r),@r; };
+$CVS_ID=q$Id$;
+use strict;
+use warnings;
+
+use My::Web;
+use project::mdsms::ListItem;
+
+
+My::Web->init_project(
+ "ListItem"=>\%My::Project::mdsms::ListItem,
+ );
+
+My::Web->footer();
--- /dev/null
+#! /usr/bin/perl
+#
+# $Id$
+# Definition of 'My::Project::mod_auth_tacacs' for list.cgi.pl
+# Copyright (C) 2003 Jan Kratochvil <project-www.jankratochvil.net@jankratochvil.net>
+#
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; exactly version 2 of June 1991 is required
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write to the Free Software
+# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+
+
+package My::Project::mod_auth_tacacs;
+require 5.6.0; # at least 'use warnings;' but we need some 5.6.0+ modules anyway
+use vars qw($VERSION $CVS_ID);
+$VERSION=do { my @r=(q$Revision$=~/\d+/g); sprintf "%d.".("%03d"x$#r),@r; };
+$CVS_ID=q$Id$;
+use strict;
+use warnings;
+
+
+our %ListItem=(
+ "name"=>"<a href=\"http://sourceforge.net/projects/mod-auth-tacacs/\">mod_auth_tacacs</a> TACACS+ test client",
+ "download"=>"mod_auth_tacacs-2.0.2-gts1-checkout.diff.gz",
+ "link-mod_auth_tacacs homepage"=>"http://sourceforge.net/projects/mod-auth-tacacs/",
+ "summary"=>"Network server security",
+ "license"=>"PD",
+ "maintenance"=>"accepted",
+ "language"=>"C patch",
+ "description"=>""
+ .'Patch implements: command-line client, <code>dropped Makefile.in</code>'
+ .' in favor of <code>Makefile.am</code>, <code>--with-apache</code> works now'
+ .' (whole <code>configure.in</code> rewritten)'
+ );
+
+1;
--- /dev/null
+# $Id$
+# automake source for the Makefile of project/mod_auth_tacacs/ subdir
+# Copyright (C) 2003 Jan Kratochvil <project-www.jankratochvil.net@jankratochvil.net>
+#
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; exactly version 2 of June 1991 is required
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write to the Free Software
+# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+
+
+include $(top_srcdir)/Makefile-head.am
+
+EXTRA_DIST+= \
+ ListItem.pm \
+ index.html.pl
+
+noinst_DATA+= \
+ index.html
--- /dev/null
+#! /usr/bin/perl
+#
+# $Id$
+# Main page of 'My::Project::mod_auth_tacacs'
+# Copyright (C) 2003 Jan Kratochvil <project-www.jankratochvil.net@jankratochvil.net>
+#
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; exactly version 2 of June 1991 is required
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write to the Free Software
+# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+
+
+require 5.6.0; # at least 'use warnings;' but we need some 5.6.0+ modules anyway
+use vars qw($VERSION $CVS_ID);
+$VERSION=do { my @r=(q$Revision$=~/\d+/g); sprintf "%d.".("%03d"x$#r),@r; };
+$CVS_ID=q$Id$;
+use strict;
+use warnings;
+
+use My::Web;
+use project::mod_auth_tacacs::ListItem;
+
+
+My::Web->init_project(
+ "ListItem"=>\%My::Project::mod_auth_tacacs::ListItem,
+ );
+
+My::Web->footer();
--- /dev/null
+#! /usr/bin/perl
+#
+# $Id$
+# Definition of 'My::Project::mot2as' for list.cgi.pl
+# Copyright (C) 2003 Jan Kratochvil <project-www.jankratochvil.net@jankratochvil.net>
+#
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; exactly version 2 of June 1991 is required
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write to the Free Software
+# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+
+
+package My::Project::mot2as;
+require 5.6.0; # at least 'use warnings;' but we need some 5.6.0+ modules anyway
+use vars qw($VERSION $CVS_ID);
+$VERSION=do { my @r=(q$Revision$=~/\d+/g); sprintf "%d.".("%03d"x$#r),@r; };
+$CVS_ID=q$Id$;
+use strict;
+use warnings;
+
+
+our %ListItem=(
+ "name"=>"Motorola to AT&T/GNU Assembler Syntax Converter",
+ "download"=>"mot2as.c",
+ "summary"=>"Asm syntax converter",
+ "license"=>"PD",
+ "maintenance"=>"finished",
+ "language"=>"C",
+ "sponsorship"=>"<a href=\"http://www.princip.cz/\">Princip, a.s.</a>",
+ "description"=>""
+ .'<p>Do you need to compile under UNIX assembly sources for Motorola 68k family'
+ .' of processors? You have probably already found out that original Motorola'
+ .' syntax is not suitable for GNU assembler which uses a bit different (AT&T'
+ .' style) syntax. Using this very simple program you can convert between these two.</p>'
+ .' <p>Specifically it will care about: <code>equ</code> operation, <code>dc.b</code> strings,'
+ .' <code>;</code> comments, <code>$</code> for hex-radix, <code>%</code> for bin-radix,'
+ .' local labels, <code>:</code> for label termination.</p>'
+ );
+
+1;
--- /dev/null
+# $Id$
+# automake source for the Makefile of project/mot2as/ subdir
+# Copyright (C) 2003 Jan Kratochvil <project-www.jankratochvil.net@jankratochvil.net>
+#
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; exactly version 2 of June 1991 is required
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write to the Free Software
+# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+
+
+include $(top_srcdir)/Makefile-head.am
+
+EXTRA_DIST+= \
+ ListItem.pm \
+ index.html.pl
+
+noinst_DATA+= \
+ index.html
--- /dev/null
+#! /usr/bin/perl
+#
+# $Id$
+# Main page of 'My::Project::mot2as'
+# Copyright (C) 2003 Jan Kratochvil <project-www.jankratochvil.net@jankratochvil.net>
+#
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; exactly version 2 of June 1991 is required
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write to the Free Software
+# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+
+
+require 5.6.0; # at least 'use warnings;' but we need some 5.6.0+ modules anyway
+use vars qw($VERSION $CVS_ID);
+$VERSION=do { my @r=(q$Revision$=~/\d+/g); sprintf "%d.".("%03d"x$#r),@r; };
+$CVS_ID=q$Id$;
+use strict;
+use warnings;
+
+use My::Web;
+use project::mot2as::ListItem;
+
+
+My::Web->init_project(
+ "ListItem"=>\%My::Project::mot2as::ListItem,
+ );
+
+My::Web->footer();
--- /dev/null
+/*
+ * Motorola to AT&T/GNU ASsembler syntax convertor
+ */
+#ifndef lint
+static char rcsid[] = "$Id$";
+#endif
+
+static char helptext[] =
+ "Motorola to AT&T/GNU ASsembler syntax convertor\n"
+ "Version: %s\n"
+ "Written in 1999 by Jan Kratochvil for Princip, a.s.\n"
+ " - released under GPL version 2 license, see http://www.gnu.org for details\n"
+ "\n"
+ "for compilation of foo.s use the following command:\n"
+ "./mot2as <foo.s|as --bitwise-or --register-prefix-optional -o foo.o\n"
+ "\n";
+
+#include <stdio.h>
+#include <stdlib.h>
+#include <assert.h>
+#include <limits.h>
+#include <stdarg.h>
+#include <string.h>
+#include <ctype.h>
+
+typedef unsigned char muchar;
+
+enum fatality { WARN,ERR,FATAL };
+
+#ifndef LINE_MAX
+#define LINE_MAX 16384
+#endif
+
+char buf[LINE_MAX];
+unsigned lino=0;
+char waserror;
+
+static void log(enum fatality fat,const char *fmt,...) __attribute__((format(printf,2,3)));
+static void log(enum fatality fat,const char *fmt,...)
+{
+va_list ap;
+ va_start(ap,fmt);
+ fprintf(stderr,"mot2as: %u: ",lino);
+ switch (fat) {
+ case WARN : fputs("Warning: ",stderr); break;
+ case ERR : fputs("Error : ",stderr); waserror=1; break;
+ case FATAL: fputs("Fatal : ",stderr); break;
+ default : assert(0);
+ }
+ vfprintf(stderr,fmt,ap);
+ va_end(ap);
+ fputs("!\n",stderr);
+ if (fat==FATAL) exit(EXIT_FAILURE);
+}
+
+int main(int argc,char **argv)
+{
+char fld,defbyte,*s;
+int i;
+
+ if (argc!=1) {
+ fprintf(stderr,helptext,rcsid);
+ return(EXIT_FAILURE);
+ }
+ while (lino++,fgets(buf,sizeof(buf),stdin)) {
+ if (!(s=strchr(buf,'\n')))
+ log(ERR,"Line too long (>%u), cut",sizeof(buf)-2);
+ else {
+ assert(!s[1]);
+ *s='\0';
+ }
+ fld=0;
+ defbyte=0;
+ if (buf[0]=='l' && buf[1]=='b') buf[0]='L';
+ else if (buf[0]=='L') buf[0]='l';
+ for (s=buf;*s;s++)
+ switch (*s) {
+ case ' ':
+ case '\t': {
+char *s2=s,eq=0;
+skip:
+ fld++;
+ while (s[1]==' ' || s[1]=='\t') s++;
+ *s2='\0';
+ if (fld==1 && !strncasecmp(s+1,"equ",3) && (s[1+3]==' ' || s[1+3]=='\t')) {
+ fputs("\t.equ\t",stdout);
+ fputs(buf,stdout); putchar(',');
+ s+=4;
+ eq=1;
+ goto skip;
+ }
+ if (fld==1) fputs(buf,stdout);
+ if (s2>buf && fld==1) putchar(':'); //label
+ if (!eq) putchar('\t');
+ defbyte|=(fld==1 && !strncasecmp(s+1,"dc.b",4) && (s[1+4]==' ' || s[1+4]=='\t'));
+ if (fld==1 && !strncasecmp(s+1,"opt",3) && (s[1+3]==' ' || s[1+3]=='\t')) putchar('|');
+ break; }
+ case ';': //comment
+#ifdef PASS_THRU_COMMENTS
+ putchar('|');
+ fputs(s+1,stdout);
+#endif PASS_THRU_COMMENTS
+ s+=strlen(s)-1;
+ fld=1;
+ break;
+ case '"':
+ do {
+ if (s[0]=='\\' && s[1]) putchar(*s++);
+ putchar(*s++);
+ } while (*s && *s!='"');
+ putchar(*s);
+ break;
+ case '\'': { //string
+char *d,*str;
+ for (str=d=++s;*s;*d++=*s++) {
+ if (s[0]=='\'') {
+ if (s[1]=='\'') s++;
+ else break;
+ }
+ }
+ if (!*s) {
+ log(ERR,"String ('...) not terminated on this line");
+ s--;
+ }
+ if (!defbyte) {
+ if (d-str!=1 && d-str!=2 && d-str!=4)
+ log(ERR,"String ('...') in NOT-defbyte instruction is not of length 1, 2 or 4");
+ else {
+ fputs("0x",stdout);
+ while (str<d) printf("%02X",(muchar)*str++);
+ }
+ break;
+ }
+ while (str<d) {
+ printf("%u",(muchar)*str++);
+ if (str<d) putchar(',');
+ }
+ break; }
+ case '$':
+ fputs("0x",stdout);
+ break;
+ case '%':
+ fputs("0b",stdout);
+ break;
+ case 'l':
+ if (s>buf && !isalnum(s[-1]) && s[-1]!='_' && s[1]=='b' && s[2]!='_') *s='L';
+ goto out;
+ case 'L':
+ if (s>buf && !isalnum(s[-1]) && s[-1]!='_') *s='l';
+ goto out;
+ case '!':
+ *s='|';
+ /* FALLTHRU */
+ default:
+out:
+ if (fld) putchar(*s);
+ }
+ if (!fld && *buf) { fputs(buf,stdout); putchar(':'); }
+ putchar('\n');
+ }
+ return(waserror);
+}
--- /dev/null
+#! /usr/bin/perl
+#
+# $Id$
+# Definition of 'My::Project::netstat' for list.cgi.pl
+# Copyright (C) 2003 Jan Kratochvil <project-www.jankratochvil.net@jankratochvil.net>
+#
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; exactly version 2 of June 1991 is required
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write to the Free Software
+# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+
+
+package My::Project::netstat;
+require 5.6.0; # at least 'use warnings;' but we need some 5.6.0+ modules anyway
+use vars qw($VERSION $CVS_ID);
+$VERSION=do { my @r=(q$Revision$=~/\d+/g); sprintf "%d.".("%03d"x$#r),@r; };
+$CVS_ID=q$Id$;
+use strict;
+use warnings;
+
+
+our %ListItem=(
+ "name"=>"Program name display for <a href=\"http://www.inka.de/sites/lina/linux/NetTools/\">net-tools-1.50</a>/netstat",
+ "download"=>"net-tools-1.50-progname.diff.gz",
+ "summary"=>"Network tool enhancement",
+ "license"=>"PD",
+ "maintenance"=>"accepted",
+ "language"=>"C patch",
+ "description"=>""
+ .'<p>After answering several questions on the mailing lists and several from'
+ .' my friends personally, I decided that there is missing some tool for GNU/Linux'
+ .' which would display PID (or simply the process) of the owner of some socket,'
+ .' either listening or communicating.</p>'
+ );
+
+1;
--- /dev/null
+# $Id$
+# automake source for the Makefile of project/netstat/ subdir
+# Copyright (C) 2003 Jan Kratochvil <project-www.jankratochvil.net@jankratochvil.net>
+#
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; exactly version 2 of June 1991 is required
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write to the Free Software
+# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+
+
+include $(top_srcdir)/Makefile-head.am
+
+EXTRA_DIST+= \
+ ListItem.pm \
+ index.html.pl
+
+noinst_DATA+= \
+ index.html
--- /dev/null
+#! /usr/bin/perl
+#
+# $Id$
+# Main page of 'My::Project::netstat'
+# Copyright (C) 2003 Jan Kratochvil <project-www.jankratochvil.net@jankratochvil.net>
+#
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; exactly version 2 of June 1991 is required
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write to the Free Software
+# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+
+
+require 5.6.0; # at least 'use warnings;' but we need some 5.6.0+ modules anyway
+use vars qw($VERSION $CVS_ID);
+$VERSION=do { my @r=(q$Revision$=~/\d+/g); sprintf "%d.".("%03d"x$#r),@r; };
+$CVS_ID=q$Id$;
+use strict;
+use warnings;
+
+use My::Web;
+use project::netstat::ListItem;
+
+
+My::Web->init_project(
+ "ListItem"=>\%My::Project::netstat::ListItem,
+ );
+
+print <<'HERE';
+<p>The typical problem is that some port
+is allocated and no one knows which program is holding it. Output of the
+new 'netstat' with the added option "-p" follows:</p>
+
+<pre>
+Active Internet connections (servers and established)
+Proto Recv-Q Send-Q Local Address Foreign Address State PID/Program name
+tcp 0 0 lemming.ericsson.c:1022 atrey.karlin.mff.cun:22 ESTABLISHED 11940/ssh
+tcp 0 0 *:3064 *:* LISTEN 31208/proxyper
+tcp 0 0 *:2064 *:* LISTEN 31208/proxyper
+tcp 0 0 lemming.ericsson:domain *:* LISTEN 11601/named
+</pre>
+HERE
+
+My::Web->footer();
--- /dev/null
+#! /usr/bin/perl
+#
+# $Id$
+# Definition of 'My::Project::oslik' for list.cgi.pl
+# Copyright (C) 2003 Jan Kratochvil <project-www.jankratochvil.net@jankratochvil.net>
+#
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; exactly version 2 of June 1991 is required
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write to the Free Software
+# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+
+
+package My::Project::oslik;
+require 5.6.0; # at least 'use warnings;' but we need some 5.6.0+ modules anyway
+use vars qw($VERSION $CVS_ID);
+$VERSION=do { my @r=(q$Revision$=~/\d+/g); sprintf "%d.".("%03d"x$#r),@r; };
+$CVS_ID=q$Id$;
+use strict;
+use warnings;
+
+
+our %ListItem=(
+ "name"=>"Logical Puzzle in Prolog",
+ "download"=>"oslik/oslik.zip",
+ "summary"=>"Prolog example",
+ "license"=>"PD",
+ "maintenance"=>"finished",
+ "language"=>"Prolog",
+ "description"=>""
+ .'<p>This is no game, just solution of one specific mathematical problem'
+ .' consisting of simple state search. Software is written equivalentnly'
+ .' both in <strong>C</strong> and <strong>Prolog</strong> for comparation.</p>'
+ );
+
+1;
--- /dev/null
+# $Id$
+# automake source for the Makefile of project/oslik/ subdir
+# Copyright (C) 2003 Jan Kratochvil <project-www.jankratochvil.net@jankratochvil.net>
+#
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; exactly version 2 of June 1991 is required
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write to the Free Software
+# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+
+
+include $(top_srcdir)/Makefile-head.am
+
+EXTRA_DIST+= \
+ ListItem.pm \
+ index.html.pl
+
+noinst_DATA+= \
+ index.html
--- /dev/null
+#! /usr/bin/perl
+#
+# $Id$
+# Main page of 'My::Project::oslik'
+# Copyright (C) 2003 Jan Kratochvil <project-www.jankratochvil.net@jankratochvil.net>
+#
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; exactly version 2 of June 1991 is required
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write to the Free Software
+# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+
+
+require 5.6.0; # at least 'use warnings;' but we need some 5.6.0+ modules anyway
+use vars qw($VERSION $CVS_ID);
+$VERSION=do { my @r=(q$Revision$=~/\d+/g); sprintf "%d.".("%03d"x$#r),@r; };
+$CVS_ID=q$Id$;
+use strict;
+use warnings;
+
+use My::Web;
+use project::oslik::ListItem;
+
+
+My::Web->init_project(
+ "ListItem"=>\%My::Project::oslik::ListItem,
+ );
+
+print <<"HERE";
+<p>Currently <a href="oslik/">the documentation</a> is written only in Czech language.</p>
+HERE
+
+My::Web->footer();
--- /dev/null
+DirectoryIndex index.shtml
+#SourceCzechCodePageLocal CISO8859-2
--- /dev/null
+:- consult('oslik-assert.pl').
+%:- go.
+%:- profile('go','plain',40).
--- /dev/null
+TARGET=oslik.zip oslik minsol.txt
+
+all: $(TARGET)
+
+CFLAGS=-Wall -DNDEBUG
+CFLAGS+=-O9 -fexpensive-optimizations
+
+pipe:
+ mknod -m600 pipe p
+
+test: pipe do oslik
+ @echo
+ @echo 'Checking C vs. Prolog consistency...'
+ @echo ' You need approx 150MB of free memory.'
+ @free
+ @echo
+ ./do >pipe 2>/dev/null&./oslik|diff -u - pipe|tee errs
+ @$(RM) pipe
+ @if [ -s errs ];then echo 'Consistency check FAILED - see screen/file "errs" for details!';false;fi
+ @$(RM) errs
+ @echo Consistency check passed.
+
+minsol.txt: oslik
+ (./oslik 2>/dev/null|tail +2|awk '/^\*/{exit}{print}'|todos >minsol.txt;true) 2>/dev/null
+
+out-c: oslik
+ time ./oslik >$@
+
+out-pla: do oslik-assert.pl
+ ./do oslik-assert.pl >$@
+
+out-plh: do oslik-hash.pl
+ ./do oslik-hash.pl >$@
+
+oslik.zip: index.html minsol.txt GNUmakefile do oslik.c oslik-assert.pl oslik-hash.pl .plrc pl-3.1.2.diff .htaccess
+ $(RM) $@
+ zip -9 $@ $^
+
+.PHONY: fine clean
+
+fine:
+ $(RM) *.o *_.pl errs out* core gmon.out
+
+clean: fine
+ $(RM) $(TARGET)
--- /dev/null
+#!/bin/sh
+f="`echo "$1"|sed 's/^\(.*\)\.pl$/\1/'`"
+if [ "$1" != "$f.pl" ];then echo "$0: *.pl [profile]";exit;fi
+sed -e 's/^dbg_ln(M):.*$//' -e 's/dbg_ln([^)]*),//g' -e 's/,dbg_ln([^)]*)\././g' -e 's/:-dbg_ln([^)]*)\././g' <"$1" >"${f}_.pl"
+if [ $# = 1 ];then x="go"
+ else x="profile('go','plain',40)"
+fi
+time pl -f none -O -t "consult('${f}_.pl'),$x" -L200M -G200M -T200M
--- /dev/null
+<HTML><HEAD><TITLE>Úloha oslÃka</TITLE></HEAD>
+<BODY>
+<H1 ALIGN=CENTER>OslÃk:</H1>
+
+<HR>
+<A NAME="soft"><H2>Pou¾itý software:</H2></A>
+<P>Jako interpretr prologu jsem pou¾il
+<STRONG><A HREF="http://www.swi.psy.uva.nl/usr/jan/SWI-Prolog.html">SWI-Prolog</A></STRONG>,
+který je dodáván s vcelku pøijatelnými licenènÃmi podmÃnkami
+(a zdrojové kódy jsou souèástÃ). Pøikládám <A HREF="pl-3.1.2.diff">krátký patch</A>, aby
+<STRONG><A HREF="http://www.swi.psy.uva.nl/usr/jan/SWI-Prolog.html">SWI-Prolog</A></STRONG>
+nepoèÃtal percentuálnà podÃly funkcà pøi profilovánà a vypnutà automatického
+<I>garbage collector</I>u.</P><UL>
+<LI>Profiling se mi hroutil dÃky nezablokovánà v¹ech signálù pøi volánà <CODE>sigblock()</CODE>,
+ale mù¾e to být jen problém mé instalace
+<LI><I>Garbage collector</I> se spou¹tìl na mùj vkus pøÃli¹ èasto, jeho automatické spou¹tìnÃ
+jsem tedy vypnul a volám jej explicitnì z Prologu
+</UL>
+<P>Aèkoliv by oba programy (obì <STRONG>Prolog</STRONG> a jedna <STRONG>C</STRONG> verze)
+mìly být spustitelné na jakékoliv platformì, uvádÃm testované/vývojové prostøedÃ:</P><UL>
+<LI><A HREF="http://www.linux.org/">GNU/Linux</A>, èásteènì <A HREF="http://www.redhat.com/">RedHat 5.0</A>
+systém,
+<A HREF="http://www.kernel.org/pub/linux/kernel/v2.1/linux-2.1.132.tar.bz2">kernel Linus-2.1.132</A>,
+glibc-2.0.7-980507, gcc version pgcc-2.91.57 19980901 (egcs-1.1 release),
+GNU Make version 3.76.1, GNU textutils 1.22.
+<LI><A HREF="http://www.swi.psy.uva.nl/usr/jan/SWI-Prolog.html">SWI-Prolog</A> verze 3.1.2.
+</UL>
+<P>DÃval jsem se také na
+<A HREF="http://www.binnetcorp.com/BinProlog/">BinProlog</A>, ale zdrojové
+kódy nebyly vùbec k dispozici, a tudþ nepøipadl v úvahu.</P>
+
+<HR>
+<H2>Øe¹enà úlohy:</H2>
+<P>ZadánÃm bylo pøevést hracà plochu ze vstupnÃho tvaru:</P>
+<PRE>
+ /-------\
+ | {}{}# |
+ | AB^#+ |
+ | CDv#+ |
+ | {}{}# |
+ \-------/
+</PRE>
+<P>postupným pøesouvánÃm kostek do tvaru:</P>
+<PRE>
+ /-------\
+ | ????? |
+ | ???AB |
+ | ???CD |
+ | ????? |
+ \-------/
+</PRE>
+<P>kde znaky "<STRONG>?</STRONG>" samozøejmì pøedstavujà polÃèka,
+na kterých nezále¾Ã. Pro popis jednotlivých znaku bude lep¹à následujÃcÃ
+legenda:</P>
+<TABLE ALIGN=CENTER BORDER=1>
+<TR><TD ALIGN=LEFT VALIGN=BOTTOM><FONT COLOR="BLUE"><CODE>AB<BR>CD</CODE ></FONT> - 2x2</TD>
+ <TD ALIGN=LEFT VALIGN=BOTTOM><FONT COLOR="BLUE"><CODE>{}</CODE ></FONT> - 2x1</TD>
+ <TD ALIGN=LEFT VALIGN=BOTTOM><FONT COLOR="BLUE"><CODE>^<BR>v</CODE ></FONT> - 1x2</TD>
+ <TD ALIGN=LEFT VALIGN=BOTTOM><FONT COLOR="BLUE"><CODE>#</CODE ></FONT> - 1x1</TD>
+ <TD ALIGN=LEFT VALIGN=BOTTOM>-volno-<FONT COLOR="BLUE"><BR><CODE>+</CODE></FONT> - 1x1</TD>
+</TABLE>
+<P>Postupné stavy hracà plochy pøi jednotlivých krocÃch minimálnÃho (nejkrat¹Ãho)
+øe¹enà jsou v souboru "<A HREF="minsol.txt">minsol.txt</A>". Rozbor
+øe¹enà úlohy je sumarizován zde:</P>
+<TABLE ALIGN=CENTER BORDER=1>
+<TR><TD>Velikost stavového prostoru <TD><STRONG>25955</STRONG></TD></TR>
+<TR><TD>Poèet rùzných øe¹enà <TD><STRONG>482 (+sym.)</STRONG></TD></TR>
+<TR><TD>Poèet tahù nejkrat¹Ãho øe¹enà <TD><STRONG>116</STRONG></TD></TR>
+<TR><TD>Poèet rùzných nejkrat¹Ãch øe¹enà <TD><STRONG>1 (+sym.)</STRONG></TD></TR>
+<TR><TD>Poèet tahù nejdel¹Ãho øe¹enà <TD><STRONG>158</STRONG></TD></TR>
+<TR><TD>Poèet rùzných nejdel¹Ãch øe¹enà <TD><STRONG>7 (+sym.)</STRONG></TD></TR>
+<TR><TD>Maximálnà poèet tahù bez opakovánÃ<TD><STRONG>167</STRONG></TD></TR>
+</TABLE>
+<P>V¹echny tyto výsledky lze zÃskat ze v¹ech verzÃ
+ (<STRONG>Prolog</STRONG> <A HREF="oslik-assert.pl">assert</A>
+/ <STRONG>Prolog</STRONG> <A HREF="oslik-hash.pl" >hash</A >
+/ <A HREF="oslik.c">C</A>),
+z rychlostnÃch dùvodù ov¹em doporuèuji pou¾Ãt <STRONG>C</STRONG> verzi. Pro nìkteré výsledky je
+tøeba zapnout ladÃcà výpisy (v obou verzÃch se zapÃnajà rùznì a nezdokumentovanì).</P>
+<P>Poznámka "<STRONG>(+sym.)</STRONG>" znamená, ¾e takových øe¹enÃ
+je ve skuteènosti dvojnásobný poèet ne¾ je uvedeno, ale tato zbylá øe¹enÃ
+jsou symetrická dle X-ové osy. To vyplývá ze symetriènosti zadánà dle osy X
+a tomu, ¾e v¹echny povolené tahy ¾ádným zpùsobem neupøednostòujà èi neomezujÃ
+smìr pohybu.</P>
+
+<HR>
+<A NAME="cost"><H2>Nároènost øe¹enÃ:</H2></A>
+<TABLE ALIGN=CENTER BORDER=1>
+<TR><TD>kategorie <STRONG>\</STRONG> verze<TD><A HREF="oslik-assert.pl">Prolog assert</A><TD><A HREF="oslik-hash.pl">Prolog hash</A><TD><A HREF="oslik.c">C</A></TD></TR>
+<TR><TD>doba bìhu bez výstupu<TD><STRONG>1m:55s=115s</STRONG><TD><STRONG>4m:27s=267s</STRONG><TD><STRONG>0m:0.22s=~1s</STRONG></TD></TR>
+<TR><TD>doba bìhu s výstupem<TD><STRONG>4m:29s=269s</STRONG><TD><STRONG>6m:19s=379s</STRONG><TD><STRONG>0m:1.90s=~2s</STRONG></TD></TR>
+<TR><TD>pamì»ová nároènost<TD><STRONG>cca 50MB</STRONG><TD><STRONG>cca 150MB (!)</STRONG><TD><STRONG>cca 1MB</STRONG></TD></TR>
+<CAPTION ALIGN=BOTTOM>Konfigurace:
+<A HREF="http://www.amd.com/">AMD</A>-<A HREF="http://www.amd.com/products/cpg/k623d/">K6-2</A> 350MHz,
+256MB SDRAM, 100MHz FSB</CAPTION>
+</TABLE>
+<P>V <STRONG>Prologu assert</STRONG> se vyu¾Ãvá funkcà <STRONG>assert</STRONG> a <STRONG>flag</STRONG>.
+Toto øe¹enà je rychlej¹à i pøehlednìj¹à ne¾ následujÃcÃ, ale neodpovÃdá duchu Prologovského programovánÃ.</P>
+<P>V <STRONG>Prologu hash</STRONG> pou¾Ãvám hashovánà s velikostà tabulky 150 polo¾ek (deklarace
+"<STRONG>geths(150).</STRONG>", èÃm¾ se sna¾Ãm
+pøevést stavový prostor do ètvercového tvaru, aby Prolog lineárnì procházel
+hash index i hash link-list celkovì minimálnà èas.</P>
+<P><U>VarovánÃ:</U> Pøi standardnÃm spu¹tìnà (pøes SWI-Prolog) OslÃka budou obì Prologovské verze dumpovat
+velké mno¾stvà ladÃcÃch informacÃ. Pro "production" pou¾ità slou¾à <I>bash</I> skript
+"<A HREF="do">do</A>", který tyto ladÃcà informace ve zdrojovém kódu zru¹à a spustà automaticky prolog.
+Pøi spu¹tìnà bez parametrù vypùe tento skript help. Nadefinovánà prázdného termu jako funkce pro ladÃcÃ
+výpis mìlo bohu¾el drtivý dopad na rychlost interpretace.</P>
+<P>Obì Prologovské verze vÃceménì neobsahujà ¾ádné komentáøe, doporuèuji si pøÃpadnì k nim otevøÃt verzi
+v <A HREF="oslik.c">C</A>, kde je v¹e zøejmé.</P>
+
+<HR>
+<H2>Prùbìh vývoje:</H2>
+<H3>Velikost výpoètu</H3>
+Pùvodnì jsem byl varován, ¾e výpoèet bude trvat pøÃli¹ dlouho
+a pravdìpodobnì nedobìhne. Èekal jsem tedy poèet stavù prostoru minimálnì v øádu milonù, v hor¹Ãm pøÃpadì miliard.
+Nynìj¹à "<A HREF="oslik.c">oslik.c</A>"
+se pùvodnì jmenoval "stategen.c" a mìl opravdu slou¾it pouze k pøedgenerovánà v¹ech mo¾ných stavù a jejich
+oèÃslovánà (mìlo by se vejÃt do 32-bitù, jinak by to stejnì asi nemìlo smysl prohlédávat bez
+<A HREF="http://www.distributed.net/">distributed.net</A> for my pleasure). Byl jsem ¹okován, kdy¾ program ihned dobìhl
+(tj. i mì) s celkovým poètem 25955 stavù. Proto je také kód pro sledovánà prùbìhu výpoètu
+(makro "<CODE>STSTEP</CODE>")
+nynà jaksi nadbyteèný a pùsobà spùe humorným dojmem. Celý kód jsem se také sna¾il hned napoprvé napsat co mo¾ná nejrychlej¹Ã.
+Pro mno¾inu stavù mám konstantnà hashovacà pole, seznam doposud nezpracovaných stavù i zpìtné reference pro vypisovánÃ
+výsledku (tj. z kterého stavu jsme se do aktuálnÃho dostali).
+<H3>Struktura stavu</H3>
+Stav se ukládá jako 20-ti (5x4) znakové pole, neukládám
+tedy polohu jednotlivých velkých kostek, ale naopak mám pro ka¾dé polÃèko hracà plochu uveden druh/èást kostky na nìm le¾ÃcÃ
+("oslÃk" je tedy ze 4 èástà a tyto èásti mùsà v ka¾dém korektnÃm stavu le¾et ve správném poøadà u sebe).
+Výchozà stav je tedy vyjádøen øetìzcem "<CODE>{}{}#AB^#+CDv#+{}{}#</CODE>".
+<H3>Struktura mno¾iny stavù</H3>
+ÚstøednÃm problémem OslÃka
+je udr¾ovánà mno¾iny stavù, které jsme ji¾ prohledali èi jsme je ji¾ objevili, ale je¹tì nám zbývá je zpracovat.
+V "<A HREF="oslik-hash.pl">oslik-hash.pl</A>" verzi (prvnà v Prologu)
+to byl úplnì nejdøÃve lineárnà seznam, co¾ ov¹em bylo èasovì neúnosné. Profiler mi potvrdil dùvodné podezøenÃ
+na kvadratickou èasovou slo¾itost programu dÃky tomuto seznamu, musel jsem ho tedy vymìnit. Pro jednoduchost implementace
+jsem zvolil hash tabulku jako v <A HREF="oslik.c">C verzi</A>, kterou jsem ov¹em byl nucen implementovat jako lineárnà seznam
+jenotlivých polÃèek a obsahem ka¾dého
+prvku seznamu byl vnoøený seznam v¹ech stavù, které majà stejnou hash hodnotu, a patøà tedy k sobì. Bohu¾el v takovémto
+uspoøádánà neplatà obecné pravidlo hashù, ¾e èÃm vìt¹Ã, tÃm rychlej¹à (samozøejmì a¾ na úplnì extrémnà pøÃpady dÃky
+inicializaci a efektu memory cache). Pøi pøÃli¹ velké hash tabulce by bylo bohu¾el pøÃli¹ èasovì nároèné dotraverzovat
+k pøÃpadnému prvku na konci hash tabulky (a tedy i na konci hash seznamu). Vzhledem k tomu, ¾e jsem ji¾
+z <A HREF="oslik.c">C verze</A> znal velikost úlohy, nastavil jsem velikost hash tabulky tak, aby
+byla pøibli¾nì stejná jako prùmìrný poèet prvkù v jednom hash polÃèku. Ve skuteènosti tedy vytvoøà taková tabulka ètverec
+a velikost hash tabulky (tj. jeho jedna strana) by mìla být odmocninou z celkového poètu prvkù. Zvolil jsem 150 prvkù
+(ideálnì pro 22500 stavù).
+<H3>Konverze stavu</H3>
+Vyjádøenà stavu zùstalo jako 20-ti znakový øetìzec (jako v <A HREF="oslik.c">C verzi</A>),
+je-li tøeba, doèasnì jej konvertuji do seznamu a nazpìt (predikát "string_to_list"). Øetìzec by mìl být
+pamì»ovì efektivnìj¹à pro ukládánà do mno¾iny stavù, jemné (v <STRONG>assert</STRONG> verzi dle profileru bohu¾el hlavnÃ)
+zpomalenà dÃky dvojitým konverzÃm je pravdìpodobnì levnìj¹à ne¾ zvý¹ené pamì»ové nároky (i kdy¾ jsem to reálnì nezkou¹el).
+<H3>Pøepsánà do Prologu</H3>
+Co se týèe celkové implementace, pøiznám se, ¾e jsem vÃceménì pøepsal tu
+<A HREF="oslik.c">C verzi</A> s tÃm, ¾e jsem nìkteré cykly pøepsal na rekurzi. Hlavnà kontrolnà dvourozmìrná
+smyèka pro kontrolu korektnosti pohybu a smyèka pro pøesun kostek zùstaly implementovány pøes "forall", nebo»
+se vyu¾Ãvá èÃselných hodnot øÃdÃcÃch promìnných pro adresaci polà stavu. Jména promìnných v predikátu "chkpos"
+zùstala zachována z <A HREF="oslik.c">C verze</A>, lze ji tedy pou¾Ãt jako pomocný text, nebo» je IMHO mnohem
+prùhlednìj¹à a ilustrativnìj¹Ã.
+<H3>Verze s assert/flag</H3>
+Pøepsánà pøedchozà prologovské verze za vyu¾itÃ
+"assert" a "flag" pro uchovánà mno¾iny stavù mÃsto pøedchozà hash table emulované dvojitým seznamem
+je v "<A HREF="oslik-assert.pl">oslik-assert.pl</A>".
+Scope "assert"-u i "flag"-u je globálnà a odpadlo tedy velké mno¾stvà nechutného tahánà hash tabulky
+s sebou parametrem v¹ech funkcà a¾ dovnitø (jednou jako vstupnÃ, podruhé jako výstupnÃ) jako
+<A HREF="http://dm.cobaltmicro.com/~ninka/kotypic/koty.html">koèka ko»ata</A>. Výsledkem bylo kromì velkého zpøehlednìnÃ
+a zjednodu¹enà kódu také výrazné zlep¹enà rychlosti i pamì»ové nároènosti (vÃce viz <A HREF="#cost">nároènost øe¹enÃ</A>).
+Urèitì bych to byl býval psal tÃmto zpùsobem rovnou, bohu¾el jsem se o "assert"-u a "flag"-u dozvìdìl
+a¾ po napsánà pøedchozà verze.
+<H3>Atomizace</H3>
+<P>V Prologu jsem se pùvodnì potýkal s problémem nefungujÃcà unifikace nezatomizovaných øetìzcù, ale poté, co jsem objevil
+predikát "string_to_atom" ji¾ SWI Prolog unifikoval jak mìl.</P>
+
+<HR>
+<H2>Dodané soubory:</H2>
+<TABLE ALIGN=CENTER BORDER=1>
+<TR><TD><A HREF="oslik.zip" >oslik.zip</A ><TD>celý package (vèetnì Makefile-u apod.)</TD></TR>
+<TR><TD><A HREF="oslik-assert.pl">oslik-assert.pl</A><TD>oslÃk v SWI-Prologu, <STRONG>assert</STRONG> verze</TD></TR>
+<TR><TD><A HREF="oslik-hash.pl" >oslik-hash.pl</A ><TD>oslÃk v SWI-Prologu, <STRONG>hash</STRONG> verze</TD></TR>
+<TR><TD><A HREF="do" >do</A ><TD><I>bash</I> skript pro spu¹tìnà pøedchozÃch dvou programù</TD></TR>
+<TR><TD><A HREF="oslik.c" >oslik.c</A ><TD>oslÃk v ANSI C (+<A HREF="http://www.bsd.org/">BSD</A> extenze)</TD></TR>
+<TR><TD><A HREF="minsol.txt" >minsol.txt</A ><TD>minimálnà øe¹enà (CR/LF)</TD></TR>
+<TR><TD><A HREF="pl-3.1.2.diff" >pl-3.1.2.diff</A ><TD>patch pro SWI-Prolog 3.1.2 (viz <A HREF="#soft">vý¹e</A>)</TD></TR>
+</TABLE>
+
+<HR>
+<H2>Autor:</H2>
+<TABLE ALIGN=CENTER BORDER=1>
+<TR><TD>Datum:<TD ALIGN=CENTER>30. 12. 1998</TD></TR>
+<TR><TD>Autor:<TD ALIGN=CENTER>Jan KratochvÃl</TD></TR>
+<TR><TD>Kontakt:<TD ALIGN=CENTER>e-mail <A HREF="mailto:short@ucw.cz">short@ucw.cz</A></TD></TR>
+<TR><TD>Licence:<TD ALIGN=CENTER>Public domain</TD></TR>
+</TABLE>
+<P>Tento software je poskytnut bez jakýchkoliv záruk a autor nenese ¾ádnou zodpovìdnost
+za ¹kody zpùsobené jeho pou¾ÃvánÃm. Autor se také vzdává jakýchkoliv práv, ale i závazkù,
+dle smyslu <I>public domain</I> licence.</P>
+
+</BODY></HTML>
--- /dev/null
+> /-------\ forwardtrace: level=0\r
+ | {}{}# |\r
+ | AB^#+ |\r
+ | CDv#+ |\r
+ | {}{}# |\r
+ \-------/\r
+> /-------\ forwardtrace: level=1\r
+ | {}{}+ |\r
+ | AB^## |\r
+ | CDv#+ |\r
+ | {}{}# |\r
+ \-------/\r
+> /-------\ forwardtrace: level=2\r
+ | {}+{} |\r
+ | AB^## |\r
+ | CDv#+ |\r
+ | {}{}# |\r
+ \-------/\r
+> /-------\ forwardtrace: level=3\r
+ | {}^{} |\r
+ | ABv## |\r
+ | CD+#+ |\r
+ | {}{}# |\r
+ \-------/\r
+> /-------\ forwardtrace: level=4\r
+ | {}^{} |\r
+ | ABv## |\r
+ | CD#++ |\r
+ | {}{}# |\r
+ \-------/\r
+> /-------\ forwardtrace: level=5\r
+ | {}^{} |\r
+ | ABv## |\r
+ | CD#+# |\r
+ | {}{}+ |\r
+ \-------/\r
+> /-------\ forwardtrace: level=6\r
+ | {}^{} |\r
+ | ABv## |\r
+ | CD#+# |\r
+ | {}+{} |\r
+ \-------/\r
+> /-------\ forwardtrace: level=7\r
+ | {}^{} |\r
+ | ABv## |\r
+ | CD++# |\r
+ | {}#{} |\r
+ \-------/\r
+> /-------\ forwardtrace: level=8\r
+ | {}+{} |\r
+ | AB^## |\r
+ | CDv+# |\r
+ | {}#{} |\r
+ \-------/\r
+> /-------\ forwardtrace: level=9\r
+ | {}{}+ |\r
+ | AB^## |\r
+ | CDv+# |\r
+ | {}#{} |\r
+ \-------/\r
+> /-------\ forwardtrace: level=10\r
+ | {}{}# |\r
+ | AB^#+ |\r
+ | CDv+# |\r
+ | {}#{} |\r
+ \-------/\r
+> /-------\ forwardtrace: level=11\r
+ | {}{}# |\r
+ | AB^## |\r
+ | CDv++ |\r
+ | {}#{} |\r
+ \-------/\r
+> /-------\ forwardtrace: level=12\r
+ | {}{}# |\r
+ | AB^## |\r
+ | CDv{} |\r
+ | {}#++ |\r
+ \-------/\r
+> /-------\ forwardtrace: level=13\r
+ | {}{}# |\r
+ | AB^## |\r
+ | CDv{} |\r
+ | {}+#+ |\r
+ \-------/\r
+> /-------\ forwardtrace: level=14\r
+ | {}{}# |\r
+ | AB+## |\r
+ | CD^{} |\r
+ | {}v#+ |\r
+ \-------/\r
+> /-------\ forwardtrace: level=15\r
+ | {}{}# |\r
+ | AB#+# |\r
+ | CD^{} |\r
+ | {}v#+ |\r
+ \-------/\r
+> /-------\ forwardtrace: level=16\r
+ | {}{}# |\r
+ | AB##+ |\r
+ | CD^{} |\r
+ | {}v#+ |\r
+ \-------/\r
+> /-------\ forwardtrace: level=17\r
+ | {}{}+ |\r
+ | AB### |\r
+ | CD^{} |\r
+ | {}v#+ |\r
+ \-------/\r
+> /-------\ forwardtrace: level=18\r
+ | {}+{} |\r
+ | AB### |\r
+ | CD^{} |\r
+ | {}v#+ |\r
+ \-------/\r
+> /-------\ forwardtrace: level=19\r
+ | {}#{} |\r
+ | AB+## |\r
+ | CD^{} |\r
+ | {}v#+ |\r
+ \-------/\r
+> /-------\ forwardtrace: level=20\r
+ | {}#{} |\r
+ | AB^## |\r
+ | CDv{} |\r
+ | {}+#+ |\r
+ \-------/\r
+> /-------\ forwardtrace: level=21\r
+ | {}#{} |\r
+ | AB^## |\r
+ | CDv{} |\r
+ | +{}#+ |\r
+ \-------/\r
+> /-------\ forwardtrace: level=22\r
+ | {}#{} |\r
+ | AB^## |\r
+ | CDv{} |\r
+ | +{}+# |\r
+ \-------/\r
+> /-------\ forwardtrace: level=23\r
+ | {}#{} |\r
+ | AB^## |\r
+ | CDv{} |\r
+ | ++{}# |\r
+ \-------/\r
+> /-------\ forwardtrace: level=24\r
+ | {}#{} |\r
+ | ++^## |\r
+ | ABv{} |\r
+ | CD{}# |\r
+ \-------/\r
+> /-------\ forwardtrace: level=25\r
+ | ++#{} |\r
+ | {}^## |\r
+ | ABv{} |\r
+ | CD{}# |\r
+ \-------/\r
+> /-------\ forwardtrace: level=26\r
+ | +#+{} |\r
+ | {}^## |\r
+ | ABv{} |\r
+ | CD{}# |\r
+ \-------/\r
+> /-------\ forwardtrace: level=27\r
+ | #++{} |\r
+ | {}^## |\r
+ | ABv{} |\r
+ | CD{}# |\r
+ \-------/\r
+> /-------\ forwardtrace: level=28\r
+ | #+{}+ |\r
+ | {}^## |\r
+ | ABv{} |\r
+ | CD{}# |\r
+ \-------/\r
+> /-------\ forwardtrace: level=29\r
+ | #{}++ |\r
+ | {}^## |\r
+ | ABv{} |\r
+ | CD{}# |\r
+ \-------/\r
+> /-------\ forwardtrace: level=30\r
+ | #{}#+ |\r
+ | {}^+# |\r
+ | ABv{} |\r
+ | CD{}# |\r
+ \-------/\r
+> /-------\ forwardtrace: level=31\r
+ | #{}## |\r
+ | {}^++ |\r
+ | ABv{} |\r
+ | CD{}# |\r
+ \-------/\r
+> /-------\ forwardtrace: level=32\r
+ | #{}## |\r
+ | {}^{} |\r
+ | ABv++ |\r
+ | CD{}# |\r
+ \-------/\r
+> /-------\ forwardtrace: level=33\r
+ | #{}## |\r
+ | {}^{} |\r
+ | ABv+# |\r
+ | CD{}+ |\r
+ \-------/\r
+> /-------\ forwardtrace: level=34\r
+ | #{}## |\r
+ | {}^{} |\r
+ | ABv#+ |\r
+ | CD{}+ |\r
+ \-------/\r
+> /-------\ forwardtrace: level=35\r
+ | #{}## |\r
+ | {}^{} |\r
+ | ABv#+ |\r
+ | CD+{} |\r
+ \-------/\r
+> /-------\ forwardtrace: level=36\r
+ | #{}## |\r
+ | {}+{} |\r
+ | AB^#+ |\r
+ | CDv{} |\r
+ \-------/\r
+> /-------\ forwardtrace: level=37\r
+ | #{}## |\r
+ | {}{}+ |\r
+ | AB^#+ |\r
+ | CDv{} |\r
+ \-------/\r
+> /-------\ forwardtrace: level=38\r
+ | #{}#+ |\r
+ | {}{}# |\r
+ | AB^#+ |\r
+ | CDv{} |\r
+ \-------/\r
+> /-------\ forwardtrace: level=39\r
+ | #{}#+ |\r
+ | {}{}+ |\r
+ | AB^## |\r
+ | CDv{} |\r
+ \-------/\r
+> /-------\ forwardtrace: level=40\r
+ | #{}#+ |\r
+ | {}+{} |\r
+ | AB^## |\r
+ | CDv{} |\r
+ \-------/\r
+> /-------\ forwardtrace: level=41\r
+ | #{}#+ |\r
+ | +{}{} |\r
+ | AB^## |\r
+ | CDv{} |\r
+ \-------/\r
+> /-------\ forwardtrace: level=42\r
+ | +{}#+ |\r
+ | #{}{} |\r
+ | AB^## |\r
+ | CDv{} |\r
+ \-------/\r
+> /-------\ forwardtrace: level=43\r
+ | {}+#+ |\r
+ | #{}{} |\r
+ | AB^## |\r
+ | CDv{} |\r
+ \-------/\r
+> /-------\ forwardtrace: level=44\r
+ | {}#++ |\r
+ | #{}{} |\r
+ | AB^## |\r
+ | CDv{} |\r
+ \-------/\r
+> /-------\ forwardtrace: level=45\r
+ | {}#{} |\r
+ | #{}++ |\r
+ | AB^## |\r
+ | CDv{} |\r
+ \-------/\r
+> /-------\ forwardtrace: level=46\r
+ | {}#{} |\r
+ | #+{}+ |\r
+ | AB^## |\r
+ | CDv{} |\r
+ \-------/\r
+> /-------\ forwardtrace: level=47\r
+ | {}#{} |\r
+ | #++{} |\r
+ | AB^## |\r
+ | CDv{} |\r
+ \-------/\r
+> /-------\ forwardtrace: level=48\r
+ | {}+{} |\r
+ | #+#{} |\r
+ | AB^## |\r
+ | CDv{} |\r
+ \-------/\r
+> /-------\ forwardtrace: level=49\r
+ | {}+{} |\r
+ | ##+{} |\r
+ | AB^## |\r
+ | CDv{} |\r
+ \-------/\r
+> /-------\ forwardtrace: level=50\r
+ | {}+{} |\r
+ | ##^{} |\r
+ | ABv## |\r
+ | CD+{} |\r
+ \-------/\r
+> /-------\ forwardtrace: level=51\r
+ | {}^{} |\r
+ | ##v{} |\r
+ | AB+## |\r
+ | CD+{} |\r
+ \-------/\r
+> /-------\ forwardtrace: level=52\r
+ | {}^{} |\r
+ | ##v{} |\r
+ | AB+## |\r
+ | CD{}+ |\r
+ \-------/\r
+> /-------\ forwardtrace: level=53\r
+ | {}^{} |\r
+ | ##v{} |\r
+ | AB+#+ |\r
+ | CD{}# |\r
+ \-------/\r
+> /-------\ forwardtrace: level=54\r
+ | {}^{} |\r
+ | ##v{} |\r
+ | AB++# |\r
+ | CD{}# |\r
+ \-------/\r
+> /-------\ forwardtrace: level=55\r
+ | {}^{} |\r
+ | ##v{} |\r
+ | AB{}# |\r
+ | CD++# |\r
+ \-------/\r
+> /-------\ forwardtrace: level=56\r
+ | {}^{} |\r
+ | ##v{} |\r
+ | AB{}# |\r
+ | CD+#+ |\r
+ \-------/\r
+> /-------\ forwardtrace: level=57\r
+ | {}^{} |\r
+ | ##v{} |\r
+ | AB{}+ |\r
+ | CD+## |\r
+ \-------/\r
+> /-------\ forwardtrace: level=58\r
+ | {}^{} |\r
+ | ##v{} |\r
+ | AB+{} |\r
+ | CD+## |\r
+ \-------/\r
+> /-------\ forwardtrace: level=59\r
+ | {}+{} |\r
+ | ##^{} |\r
+ | ABv{} |\r
+ | CD+## |\r
+ \-------/\r
+> /-------\ forwardtrace: level=60\r
+ | +{}{} |\r
+ | ##^{} |\r
+ | ABv{} |\r
+ | CD+## |\r
+ \-------/\r
+> /-------\ forwardtrace: level=61\r
+ | #{}{} |\r
+ | +#^{} |\r
+ | ABv{} |\r
+ | CD+## |\r
+ \-------/\r
+> /-------\ forwardtrace: level=62\r
+ | #{}{} |\r
+ | #+^{} |\r
+ | ABv{} |\r
+ | CD+## |\r
+ \-------/\r
+> /-------\ forwardtrace: level=63\r
+ | #{}{} |\r
+ | #++{} |\r
+ | AB^{} |\r
+ | CDv## |\r
+ \-------/\r
+> /-------\ forwardtrace: level=64\r
+ | #{}{} |\r
+ | #+{}+ |\r
+ | AB^{} |\r
+ | CDv## |\r
+ \-------/\r
+> /-------\ forwardtrace: level=65\r
+ | #{}{} |\r
+ | #{}++ |\r
+ | AB^{} |\r
+ | CDv## |\r
+ \-------/\r
+> /-------\ forwardtrace: level=66\r
+ | #{}{} |\r
+ | #{}{} |\r
+ | AB^++ |\r
+ | CDv## |\r
+ \-------/\r
+> /-------\ forwardtrace: level=67\r
+ | #{}{} |\r
+ | #{}{} |\r
+ | AB^#+ |\r
+ | CDv+# |\r
+ \-------/\r
+> /-------\ forwardtrace: level=68\r
+ | #{}{} |\r
+ | #{}{} |\r
+ | AB^+# |\r
+ | CDv+# |\r
+ \-------/\r
+> /-------\ forwardtrace: level=69\r
+ | #{}{} |\r
+ | #{}{} |\r
+ | AB+^# |\r
+ | CD+v# |\r
+ \-------/\r
+> /-------\ forwardtrace: level=70\r
+ | #{}{} |\r
+ | #{}{} |\r
+ | +AB^# |\r
+ | +CDv# |\r
+ \-------/\r
+> /-------\ forwardtrace: level=71\r
+ | #{}{} |\r
+ | +{}{} |\r
+ | #AB^# |\r
+ | +CDv# |\r
+ \-------/\r
+> /-------\ forwardtrace: level=72\r
+ | +{}{} |\r
+ | #{}{} |\r
+ | #AB^# |\r
+ | +CDv# |\r
+ \-------/\r
+> /-------\ forwardtrace: level=73\r
+ | {}+{} |\r
+ | #{}{} |\r
+ | #AB^# |\r
+ | +CDv# |\r
+ \-------/\r
+> /-------\ forwardtrace: level=74\r
+ | {}{}+ |\r
+ | #{}{} |\r
+ | #AB^# |\r
+ | +CDv# |\r
+ \-------/\r
+> /-------\ forwardtrace: level=75\r
+ | {}{}+ |\r
+ | #{}{} |\r
+ | +AB^# |\r
+ | #CDv# |\r
+ \-------/\r
+> /-------\ forwardtrace: level=76\r
+ | {}{}+ |\r
+ | +{}{} |\r
+ | #AB^# |\r
+ | #CDv# |\r
+ \-------/\r
+> /-------\ forwardtrace: level=77\r
+ | {}{}+ |\r
+ | {}+{} |\r
+ | #AB^# |\r
+ | #CDv# |\r
+ \-------/\r
+> /-------\ forwardtrace: level=78\r
+ | {}{}+ |\r
+ | {}{}+ |\r
+ | #AB^# |\r
+ | #CDv# |\r
+ \-------/\r
+> /-------\ forwardtrace: level=79\r
+ | {}{}+ |\r
+ | {}{}# |\r
+ | #AB^+ |\r
+ | #CDv# |\r
+ \-------/\r
+> /-------\ forwardtrace: level=80\r
+ | {}{}# |\r
+ | {}{}+ |\r
+ | #AB^+ |\r
+ | #CDv# |\r
+ \-------/\r
+> /-------\ forwardtrace: level=81\r
+ | {}{}# |\r
+ | {}{}+ |\r
+ | #AB^# |\r
+ | #CDv+ |\r
+ \-------/\r
+> /-------\ forwardtrace: level=82\r
+ | {}{}# |\r
+ | {}{}# |\r
+ | #AB^+ |\r
+ | #CDv+ |\r
+ \-------/\r
+> /-------\ forwardtrace: level=83\r
+ | {}{}# |\r
+ | {}{}# |\r
+ | #AB+^ |\r
+ | #CD+v |\r
+ \-------/\r
+> /-------\ forwardtrace: level=84\r
+ | {}{}# |\r
+ | {}{}# |\r
+ | #+AB^ |\r
+ | #+CDv |\r
+ \-------/\r
+> /-------\ forwardtrace: level=85\r
+ | {}{}# |\r
+ | {}{}# |\r
+ | +#AB^ |\r
+ | #+CDv |\r
+ \-------/\r
+> /-------\ forwardtrace: level=86\r
+ | {}{}# |\r
+ | {}{}# |\r
+ | ++AB^ |\r
+ | ##CDv |\r
+ \-------/\r
+> /-------\ forwardtrace: level=87\r
+ | {}{}# |\r
+ | ++{}# |\r
+ | {}AB^ |\r
+ | ##CDv |\r
+ \-------/\r
+> /-------\ forwardtrace: level=88\r
+ | {}{}# |\r
+ | +{}+# |\r
+ | {}AB^ |\r
+ | ##CDv |\r
+ \-------/\r
+> /-------\ forwardtrace: level=89\r
+ | {}{}# |\r
+ | {}++# |\r
+ | {}AB^ |\r
+ | ##CDv |\r
+ \-------/\r
+> /-------\ forwardtrace: level=90\r
+ | {}{}# |\r
+ | {}AB# |\r
+ | {}CD^ |\r
+ | ##++v |\r
+ \-------/\r
+> /-------\ forwardtrace: level=91\r
+ | {}{}# |\r
+ | {}AB# |\r
+ | {}CD^ |\r
+ | #+#+v |\r
+ \-------/\r
+> /-------\ forwardtrace: level=92\r
+ | {}{}# |\r
+ | {}AB# |\r
+ | {}CD^ |\r
+ | +##+v |\r
+ \-------/\r
+> /-------\ forwardtrace: level=93\r
+ | {}{}# |\r
+ | {}AB# |\r
+ | {}CD^ |\r
+ | +#+#v |\r
+ \-------/\r
+> /-------\ forwardtrace: level=94\r
+ | {}{}# |\r
+ | {}AB# |\r
+ | {}CD^ |\r
+ | ++##v |\r
+ \-------/\r
+> /-------\ forwardtrace: level=95\r
+ | {}{}# |\r
+ | {}AB# |\r
+ | ++CD^ |\r
+ | {}##v |\r
+ \-------/\r
+> /-------\ forwardtrace: level=96\r
+ | {}{}# |\r
+ | ++AB# |\r
+ | {}CD^ |\r
+ | {}##v |\r
+ \-------/\r
+> /-------\ forwardtrace: level=97\r
+ | ++{}# |\r
+ | {}AB# |\r
+ | {}CD^ |\r
+ | {}##v |\r
+ \-------/\r
+> /-------\ forwardtrace: level=98\r
+ | +{}+# |\r
+ | {}AB# |\r
+ | {}CD^ |\r
+ | {}##v |\r
+ \-------/\r
+> /-------\ forwardtrace: level=99\r
+ | {}++# |\r
+ | {}AB# |\r
+ | {}CD^ |\r
+ | {}##v |\r
+ \-------/\r
+> /-------\ forwardtrace: level=100\r
+ | {}AB# |\r
+ | {}CD# |\r
+ | {}++^ |\r
+ | {}##v |\r
+ \-------/\r
+> /-------\ forwardtrace: level=101\r
+ | {}AB# |\r
+ | {}CD# |\r
+ | {}#+^ |\r
+ | {}+#v |\r
+ \-------/\r
+> /-------\ forwardtrace: level=102\r
+ | {}AB# |\r
+ | {}CD# |\r
+ | {}#+^ |\r
+ | {}#+v |\r
+ \-------/\r
+> /-------\ forwardtrace: level=103\r
+ | {}AB# |\r
+ | {}CD# |\r
+ | {}#^+ |\r
+ | {}#v+ |\r
+ \-------/\r
+> /-------\ forwardtrace: level=104\r
+ | {}AB# |\r
+ | {}CD+ |\r
+ | {}#^# |\r
+ | {}#v+ |\r
+ \-------/\r
+> /-------\ forwardtrace: level=105\r
+ | {}AB+ |\r
+ | {}CD# |\r
+ | {}#^# |\r
+ | {}#v+ |\r
+ \-------/\r
+> /-------\ forwardtrace: level=106\r
+ | {}AB+ |\r
+ | {}CD# |\r
+ | {}#^+ |\r
+ | {}#v# |\r
+ \-------/\r
+> /-------\ forwardtrace: level=107\r
+ | {}AB+ |\r
+ | {}CD+ |\r
+ | {}#^# |\r
+ | {}#v# |\r
+ \-------/\r
+> /-------\ forwardtrace: level=108\r
+ | {}+AB |\r
+ | {}+CD |\r
+ | {}#^# |\r
+ | {}#v# |\r
+ \-------/\r
+> /-------\ forwardtrace: level=109\r
+ | {}+AB |\r
+ | {}#CD |\r
+ | {}+^# |\r
+ | {}#v# |\r
+ \-------/\r
+> /-------\ forwardtrace: level=110\r
+ | {}#AB |\r
+ | {}+CD |\r
+ | {}+^# |\r
+ | {}#v# |\r
+ \-------/\r
+> /-------\ forwardtrace: level=111\r
+ | {}#AB |\r
+ | {}+CD |\r
+ | {}#^# |\r
+ | {}+v# |\r
+ \-------/\r
+> /-------\ forwardtrace: level=112\r
+ | {}#AB |\r
+ | {}#CD |\r
+ | {}+^# |\r
+ | {}+v# |\r
+ \-------/\r
+> /-------\ forwardtrace: level=113\r
+ | {}#AB |\r
+ | {}#CD |\r
+ | {}^+# |\r
+ | {}v+# |\r
+ \-------/\r
+> /-------\ forwardtrace: level=114\r
+ | {}#AB |\r
+ | {}#CD |\r
+ | {}^#+ |\r
+ | {}v+# |\r
+ \-------/\r
+> /-------\ forwardtrace: level=115\r
+ | {}#AB |\r
+ | {}#CD |\r
+ | {}^++ |\r
+ | {}v## |\r
+ \-------/\r
+> /-------\ forwardtrace: level=116\r
+ | {}#++ |\r
+ | {}#AB |\r
+ | {}^CD |\r
+ | {}v## |\r
+ \-------/\r
--- /dev/null
+/* OSLIK
+ * In 1998 by Jan Kratochvil <short@ucw.cz>
+ * This software is public domain.
+ * Prolog investigator had to be retarded and strongly suffered
+ * from progressive form of brain demency.
+ */
+
+dbg_ln(M):-write_ln(M).
+%dbg_ln(_).
+
+% Utility:
+
+map(_,[]).
+map(F,[H|T]):-call(F,H),map(F,T).
+
+% l2ll/chop provided by the courtesy of Ghort
+l2ll([],_,[]).
+l2ll(BL,LEN,[LLh|LLt]):-chop(BL,LEN,LLh,BLr),l2ll(BLr,LEN,LLt).
+
+chop(L,0,[],L):-!.
+chop([],_,[],[]).
+chop([X|BLt],LEN,[X|Lt],Lr):-LEN1 is LEN-1,chop(BLt,LEN1,Lt,Lr).
+
+reversen(I,N,O):-reversen(I,N,[],O).
+reversen([],_,D,D).
+reversen(I,N,M,O):-chop(I,N,CHUNK,REST),append(CHUNK,M,BIGRED),reversen(REST,N,BIGRED,O).
+
+dbgxy(X,I,_,O):-O is I+1,write_ln(['dbgxy:',X,'=',I,'->',O]).
+
+forallc(Y,Y,_,_,_,D,_,D).
+forallc(Y,Y1,Yr,X,F,I,D,O):-forall(Yr,[Y|X],F,I,D,M),Yi is Y+1,forallc(Yi,Y1,Yr,X,F,M,D,O).
+forall([],X,F,I,D,O):-call(F,X,I,D,O).
+forall([Y0,Y1|Yr],X,F,I,D,O):-Y1i is Y1+1,forallc(Y0,Y1i,Yr,X,F,I,D,O).
+forall(Y,F,I,D,O):-reversen(Y,2,Yx),forall(Yx,[],F,I,D,O).
+
+split(I,N,A,B):-split(I,N,[],A,B).
+split(I,0,J,Jx,I):-reverse(J,Jx).
+split([Ih|It],N,Aa,A,B):-
+ Nd is N-1,split(It,Nd,[Ih|Aa],A,B).
+
+replace(I,N,X,O):-
+ split(I,N,Ia,[_|Ic]),append(Ia,[X|Ic],O).
+
+% Oslik:
+
+saLX(I,X):-X is I mod 5.
+saLY(I,Y):-Y is floor(I/5).
+saLXY(I,X,Y):-saLX(I,X),saLY(I,Y).
+saXYL(X,Y,I):-I is Y*5+X.
+getXY(STl,X,Y,C):-saXYL(X,Y,L),nth0(L,STl,C).
+
+foryi(I,I,_):-dbg_ln(['foryi-final: I=',I]).
+foryi(Vyi,Vys,[Vxi,Vxs,Vdx,Vdy,STl,Vsx,Vsy,Vbx,Vby]):-
+ dbg_ln(['foryi entered,Vxi=',Vxi,',Vyi=',Vyi,',Vsy=',Vsy,',Vys=',Vys,',Vxs=',Vxs]),
+ ((Vxi-Vsx>(-1),Vxi-Vsx<Vxs,Vyi-Vsy>(-1),Vyi-Vsy<Vys)->true
+ ;Gx is Vbx-Vdx+Vxi,Gy is Vby-Vdy+Vyi,
+ getXY(STl,Gx,Gy,C),
+ string_to_list('+',[C])),
+ dbg_ln(['foryi middle,Vxi=',Vxi,',Vyi=',Vyi,',Vsy=',Vsy,',Vys=',Vys,',Vxs=',Vxs]),
+ Vyi1 is Vyi+1,foryi(Vyi1,Vys,[Vxi,Vxs,Vdx,Vdy,STl,Vsx,Vsy,Vbx,Vby])
+ ,dbg_ln(['foryi leave, success,Vxi=',Vxi,',Vyi=',Vyi,',Vsy=',Vsy,',Vys=',Vys,',Vxs=',Vxs]).
+
+forxi(I,I,_):-dbg_ln(['forxi-final: I=',I]).
+forxi(Vxi,Vxs,[Vys|D]):-
+ dbg_ln(['forxi enter, Vxi=',Vxi,',Vxs=',Vxs]),
+ foryi(0,Vys,[Vxi,Vxs|D]),
+ dbg_ln(['forxi middle, Vxi=',Vxi,',Vxs=',Vxs]),
+ Vxi1 is Vxi+1,forxi(Vxi1,Vxs,[Vys|D])
+ ,dbg_ln(['forxi leave, success, Vxi=',Vxi,',Vxs=',Vxs]).
+
+fillass([X,Y],STl,C,STlN):-
+ saXYL(X,Y,L),replace(STl,L,C,STlN).
+
+moveass([X,Y],STl,[STlO,Vsx,Vsy],STlN):-
+ dbg_ln(['INSIDE moveass:',X,Y,Vsx,Vsy]),
+ NX is X-Vsx,NY is Y-Vsy,
+ saXYL(NX,NY,NL),saXYL(X,Y,L),
+ nth0(L,STlO,C),replace(STl,NL,C,STlN)
+ ,dbg_ln(['FINISH moveass:C=',C]).
+
+dumpit([],-1).
+dumpit(ST,LEV):-
+ dbg_ln(['DUMP_IT!:ST=',ST]),
+ hash(ST,STo),
+ dbg_ln(['DUMP_IT got STo=',STo]),
+ dumpit(STo,LEVd),
+ dbg_ln(['DUMP_IT got LEVd=',LEVd]),
+ LEV is LEVd+1,
+ write('> /-------\\ forwardtrace: level='),write_ln(LEV),
+ dumpst(ST)
+ ,dbg_ln('DUMP_IT finished!').
+dumpit(ST,LEV):-write_ln(['DUMP_IT FAILURE:ST=',ST,',LEV=',LEV]),halt.
+
+final(STl):-
+ string_to_list('A',[AC]),getXY(STl,3,1,AC),
+ string_to_list('B',[BC]),getXY(STl,4,1,BC),
+ string_to_list('C',[CC]),getXY(STl,3,2,CC),
+ string_to_list('D',[DC]),getXY(STl,4,2,DC),
+ string_to_list(ST,STl),string_to_atom(ST,STa)
+ ,write_ln('*** GOAL'),dumpit(STa,_)
+ ,flag('GOALS',GOALS,GOALS+1),(0 is GOALS mod 20->garbage_collect).
+final(_).
+
+addstate(ST,STo):-
+ dbg_ln(['addstate:ST=',ST,',STo=',STo]),
+ \+ hash(ST,_),
+ assert(todo(ST)),flag('TODO',TODO,TODO+1),assert(hash(ST,STo)),flag('TOTAL',TOTAL,TOTAL+1)
+% ,write('***addstate new (HASHo='),write(HASH),write(';ST='),write(ST),write_ln('):'),dumpst(ST),write_ln('+++ was from:'),dumpst(STo)
+% ,write_ln('***addstate:'),dumpst(ST)
+ ,dbg_ln('on addstate end').
+addstate(_,_).
+
+chkpos(Vxs,Vys,Vdx,Vdy,[STl,Vnbx,Vnby,Vsx,Vsy|D]):-
+ dbg_ln(['chkpos entered,Vnbx=',Vnbx,',Vdx=',Vdx]),
+ Vnxb is Vnbx-Vdx,Vnyb is Vnby-Vdy,
+ Vnxb>(-1),Vnxb+Vxs<6,Vnyb>(-1),Vnyb+Vys<6,
+ forxi(0,Vxs,[Vys,Vdx,Vdy,STl,Vsx,Vsy|D]),
+ Vgx is Vnbx-Vdx,Vgy is Vnby-Vdy,
+ Vgxe is Vgx+Vxs-1,Vgye is Vgy+Vys-1,
+ dbg_ln(['HERE IT IS:',Vxs,Vys,Vdx,Vdy,STl,Vnbx,Vnby,D,'Vgx,Vgy=',Vgx,Vgy,',Vgxe,Vgye=',Vgxe,Vgye]),
+ string_to_list('+',[PLUSC]),
+ forall([Vgx,Vgxe,Vgy,Vgye],'fillass',STl,PLUSC,STl1),
+ dbg_ln('AFTER fillass'),
+ forall([Vgx,Vgxe,Vgy,Vgye],'moveass',STl1,[STl,Vsx,Vsy],STl2),
+ dbg_ln('AFTER moveass'),
+% dumpsl(STl2),
+% dbg_ln('AFTER moveass AFTER dumpsl'),
+ string_to_list(ST2,STl2),string_to_atom(ST2,ST2a),
+ dbg_ln('AFTER 1st string_to_list'),
+ string_to_list(ST,STl),string_to_atom(ST,STa),
+ dbg_ln('BEFORE addstate'),
+ addstate(ST2a,STa)
+ ,dbg_ln('On end of chkpos').
+chkpos(_,_,_,_,_).
+
+trymove(C,D):-string_to_list('{',[C]),chkpos(2,1, 0, 0,D).
+trymove(C,D):-string_to_list('}',[C]),chkpos(2,1,+1, 0,D).
+trymove(C,D):-string_to_list('^',[C]),chkpos(1,2, 0, 0,D).
+trymove(C,D):-string_to_list('v',[C]),chkpos(1,2, 0,+1,D).
+trymove(C,D):-string_to_list('#',[C]),chkpos(1,1, 0, 0,D).
+trymove(C,D):-string_to_list('A',[C]),chkpos(2,2, 0, 0,D).
+trymove(C,D):-string_to_list('B',[C]),chkpos(2,2,+1, 0,D).
+trymove(C,D):-string_to_list('C',[C]),chkpos(2,2, 0,+1,D).
+trymove(C,D):-string_to_list('D',[C]),chkpos(2,2,+1,+1,D).
+trymove(_,_).
+
+foroibody(Vsx,Vsy,PLUS2,STl):-
+ dbg_ln('foroibody'),
+ saLXY(PLUS2,Vbx,Vby),Vnbx is Vbx+Vsx,Vnby is Vby+Vsy,
+ Vnbx>(-1),Vnbx<5,Vnby>(-1),Vnby<4,
+ dbg_ln(['Vnbx=',Vnbx,',Vnby=',Vnby]),
+ getXY(STl,Vnbx,Vnby,C),
+ dbg_ln(['trymove{',C,[STl,Vnbx,Vnby,Vbx,Vby],'}']),
+ trymove(C,[STl,Vnbx,Vnby,Vsx,Vsy,Vbx,Vby]).
+foroibody(_,_,_,_).
+
+foroi([],_,_).
+foroi([[Vsx,Vsy]|Voffs],PLUS2,STl):-
+ foroibody(Vsx,Vsy,PLUS2,STl),
+ foroi(Voffs,PLUS2,STl).
+
+oneplus(STl,PLUSi,CNT):-
+ dbg_ln(['CNT=',CNT]),
+ PLUSi1 is PLUSi+1,chop(STl,PLUSi1,_,STlr),string_to_list('+',[PLUSC]),
+ dbg_ln('oneplus search begin'),
+ nth0(PLUS2x,STlr,PLUSC),
+ dbg_ln('oneplus search passed'),
+ PLUS2 is PLUSi1+PLUS2x,
+ foroi([[0,-1],[+1,0],[0,+1],[-1,0]],PLUS2,STl),
+ CNT1 is CNT+1,oneplus(STl,PLUS2,CNT1).
+oneplus(_,_,2).
+oneplus(STl,_,CNT):-write_ln(['ONEPLUS FAILURE:CNT=',CNT]),dumpsl(STl),halt.
+
+process(ST):-dbg_ln(['process:ST=',ST]),string_to_list(ST,STl),final(STl),oneplus(STl,-1,0).
+%runi(T):-T>1000.
+runi(T):-0 is T mod 2000,garbage_collect,fail.
+runi(_):-run.
+run:-
+ flag('TODO',TODO,TODO),flag('TOTAL',TOTAL,TOTAL),GONE is TOTAL-TODO,
+% (GONE>0,0 is GONE mod 100->format('~t~d~5|+~t~d~11|=~t~d~17|~n',[GONE,TODO,TOTAL]);true),
+ TODO>0,todo(ST),retract(todo(ST)),flag('TODO',TODO,TODO-1),process(ST),!,runi(GONE).
+run.
+
+st2ll(ST,LL):-string_to_list(ST,BL),l2ll(BL,5,LL).
+
+dumpc(C):-string_to_list(S,[C]),write(S).
+dumpl(L):-write(' | '),map('dumpc',L),write_ln(' |').
+dumpst(ST):-
+ st2ll(ST,LL),dumpll(LL).
+dumpll(LL):-map('dumpl',LL),write_ln(' \\-------/').
+dumpsl(BL):-l2ll(BL,5,LL),dumpll(LL).
+
+runinit(ST):-assert(hash(ST,[])),flag('TOTAL',_,1),flag('TODO',_,1),assert(todo(ST)),run.
+go:-flag('GOALS',_,0),runinit('{}{}#AB^#+CDv#+{}{}#').
--- /dev/null
+/* OSLIK
+ * In 1998 by Jan Kratochvil <short@ucw.cz>
+ * This software is public domain.
+ * Prolog investigator had to be retarded and strongly suffered
+ * from progressive form of brain demency.
+ */
+
+dbg_ln(M):-write_ln(M).
+%dbg_ln(_).
+
+geths(150).
+
+% Utility:
+
+map(_,[]).
+map(F,[H|T]):-call(F,H),map(F,T).
+
+% l2ll/chop provided by the courtesy of Ghort
+l2ll([],_,[]).
+l2ll(BL,LEN,[LLh|LLt]):-chop(BL,LEN,LLh,BLr),l2ll(BLr,LEN,LLt).
+
+chop(L,0,[],L):-!.
+chop([],_,[],[]).
+chop([X|BLt],LEN,[X|Lt],Lr):-LEN1 is LEN-1,chop(BLt,LEN1,Lt,Lr).
+
+reversen(I,N,O):-reversen(I,N,[],O).
+reversen([],_,D,D).
+reversen(I,N,M,O):-chop(I,N,CHUNK,REST),append(CHUNK,M,BIGRED),reversen(REST,N,BIGRED,O).
+
+dbgxy(X,I,_,O):-O is I+1,write_ln(['dbgxy:',X,'=',I,'->',O]).
+
+forallc(Y,Y,_,_,_,D,_,D).
+forallc(Y,Y1,Yr,X,F,I,D,O):-forall(Yr,[Y|X],F,I,D,M),Yi is Y+1,forallc(Yi,Y1,Yr,X,F,M,D,O).
+forall([],X,F,I,D,O):-call(F,X,I,D,O).
+forall([Y0,Y1|Yr],X,F,I,D,O):-Y1i is Y1+1,forallc(Y0,Y1i,Yr,X,F,I,D,O).
+forall(Y,F,I,D,O):-reversen(Y,2,Yx),forall(Yx,[],F,I,D,O).
+
+split(I,N,A,B):-split(I,N,[],A,B).
+split(I,0,J,Jx,I):-reverse(J,Jx).
+split([Ih|It],N,Aa,A,B):-
+ Nd is N-1,split(It,Nd,[Ih|Aa],A,B).
+
+replace(I,N,X,O):-
+ split(I,N,Ia,[_|Ic]),append(Ia,[X|Ic],O).
+
+prependn(I,N,[X1,X2],O):-
+ split(I,N,Ia,[Ib|Ic]),dbg_ln(['Ia=',Ia,',Ib=',Ib,',Ic=',Ic]),append(Ia,[[X1,X2|Ib]|Ic],O).
+
+hashval(ST,SThv):-
+ concat('(',ST,STterm),hash_term(STterm,SThvr),
+ geths(HS),SThv is SThvr mod HS.
+
+addst(HASH,ST,STo,HASHn):-
+ hashval(ST,SThv),prependn(HASH,SThv,[ST,STo],HASHn).
+getst(HASH,ST,STo):-
+ hashval(ST,SThv),nth0(SThv,HASH,PL),getkey(PL,ST,STo).
+
+getkey([C,V|_],C,V):-dbg_ln(['getkey-final:C=',C,',V=',V]).
+getkey([LhC,LhV|Lt],C,V):-dbg_ln(['getkey-iterate:C=',C,',V=',V,',LhC=',LhC,',LhV=',LhV,',Lt=',Lt]),getkey(Lt,C,V).
+
+replist(_,0,[]).
+replist(V,N,[V|Lt]):-Nd is N-1,replist(V,Nd,Lt).
+
+hashsize([],0).
+hashsize([Hh|Ht],N):-
+ dbg_ln(['HASHSIZE:Hh=',Hh,',Ht=',Ht,',N=',N]),
+ length(Hh,A),hashsize(Ht,B),N is A+B.
+
+% Oslik:
+
+saLX(I,X):-X is I mod 5.
+saLY(I,Y):-Y is floor(I/5).
+saLXY(I,X,Y):-saLX(I,X),saLY(I,Y).
+saXYL(X,Y,I):-I is Y*5+X.
+getXY(STl,X,Y,C):-saXYL(X,Y,L),nth0(L,STl,C).
+
+foryi(I,I,_):-dbg_ln(['foryi-final: I=',I]).
+foryi(Vyi,Vys,[Vxi,Vxs,Vdx,Vdy,STl,Vsx,Vsy,Vbx,Vby]):-
+ dbg_ln(['foryi entered,Vxi=',Vxi,',Vyi=',Vyi,',Vsy=',Vsy,',Vys=',Vys,',Vxs=',Vxs]),
+ ((Vxi-Vsx>(-1),Vxi-Vsx<Vxs,Vyi-Vsy>(-1),Vyi-Vsy<Vys)->true
+ ;Gx is Vbx-Vdx+Vxi,Gy is Vby-Vdy+Vyi,
+ getXY(STl,Gx,Gy,C),
+ string_to_list('+',[C])),
+ dbg_ln(['foryi middle,Vxi=',Vxi,',Vyi=',Vyi,',Vsy=',Vsy,',Vys=',Vys,',Vxs=',Vxs]),
+ Vyi1 is Vyi+1,foryi(Vyi1,Vys,[Vxi,Vxs,Vdx,Vdy,STl,Vsx,Vsy,Vbx,Vby])
+ ,dbg_ln(['foryi leave, success,Vxi=',Vxi,',Vyi=',Vyi,',Vsy=',Vsy,',Vys=',Vys,',Vxs=',Vxs]).
+
+forxi(I,I,_):-dbg_ln(['forxi-final: I=',I]).
+forxi(Vxi,Vxs,[Vys|D]):-
+ dbg_ln(['forxi enter, Vxi=',Vxi,',Vxs=',Vxs]),
+ foryi(0,Vys,[Vxi,Vxs|D]),
+ dbg_ln(['forxi middle, Vxi=',Vxi,',Vxs=',Vxs]),
+ Vxi1 is Vxi+1,forxi(Vxi1,Vxs,[Vys|D])
+ ,dbg_ln(['forxi leave, success, Vxi=',Vxi,',Vxs=',Vxs]).
+
+fillass([X,Y],STl,C,STlN):-
+ saXYL(X,Y,L),replace(STl,L,C,STlN).
+
+moveass([X,Y],STl,[STlO,Vsx,Vsy],STlN):-
+ dbg_ln(['INSIDE moveass:',X,Y,Vsx,Vsy]),
+ NX is X-Vsx,NY is Y-Vsy,
+ saXYL(NX,NY,NL),saXYL(X,Y,L),
+ nth0(L,STlO,C),replace(STl,NL,C,STlN)
+ ,dbg_ln(['FINISH moveass:C=',C]).
+
+dumpit(_,[],-1).
+dumpit(HASH,ST,LEV):-
+ dbg_ln(['DUMP_IT!:HASH=',HASH,',ST=',ST]),
+ getst(HASH,ST,STo),
+ dbg_ln(['DUMP_IT got STo=',STo]),
+ dumpit(HASH,STo,LEVd),
+ dbg_ln(['DUMP_IT got LEVd=',LEVd]),
+ LEV is LEVd+1,
+ write('> /-------\\ forwardtrace: level='),write_ln(LEV),
+ dumpst(ST)
+ ,dbg_ln('DUMP_IT finished!').
+dumpit(HASH,ST,LEV):-write_ln(['DUMP_IT FAILURE:HASH=',HASH,',ST=',ST,',LEV=',LEV]),halt.
+
+final(STl,HASH):-
+ string_to_list('A',[AC]),getXY(STl,3,1,AC),
+ string_to_list('B',[BC]),getXY(STl,4,1,BC),
+ string_to_list('C',[CC]),getXY(STl,3,2,CC),
+ string_to_list('D',[DC]),getXY(STl,4,2,DC),
+ string_to_list(ST,STl),string_to_atom(ST,STa)
+ ,write_ln('*** GOAL'),dumpit(HASH,STa,_)
+ .
+final(_,_).
+
+addstate(ST,STo,[[HASH,DOo],[HASHn,DOn]]):-
+ dbg_ln(['addstate:ST=',ST,',STo=',STo,',HASH=',HASH,',DOo=',DOo,',DOn=',DOn]),
+ \+ getst(HASH,ST,_),
+ append(DOo,[ST],DOn),
+ addst(HASH,ST,STo,HASHn)
+% ,write('***addstate new (HASHo='),write(HASH),write(';ST='),write(ST),write_ln('):'),dumpst(ST),write_ln('+++ was from:'),dumpst(STo)
+% ,write_ln('***addstate:'),dumpst(ST)
+ ,dbg_ln(['on addstate end, DOn=',DOn]).
+addstate(_,_,[H,H]).
+
+chkpos(Vxs,Vys,Vdx,Vdy,[STl,HIST,Vnbx,Vnby,Vsx,Vsy|D]):-
+ dbg_ln(['chkpos entered,Vnbx=',Vnbx,',Vdx=',Vdx,',HIST=',HIST]),
+ Vnxb is Vnbx-Vdx,Vnyb is Vnby-Vdy,
+ Vnxb>(-1),Vnxb+Vxs<6,Vnyb>(-1),Vnyb+Vys<6,
+ forxi(0,Vxs,[Vys,Vdx,Vdy,STl,Vsx,Vsy|D]),
+ Vgx is Vnbx-Vdx,Vgy is Vnby-Vdy,
+ Vgxe is Vgx+Vxs-1,Vgye is Vgy+Vys-1,
+ dbg_ln(['HERE IT IS:',Vxs,Vys,Vdx,Vdy,STl,HIST,Vnbx,Vnby,D,'Vgx,Vgy=',Vgx,Vgy,',Vgxe,Vgye=',Vgxe,Vgye]),
+ string_to_list('+',[PLUSC]),
+ forall([Vgx,Vgxe,Vgy,Vgye],'fillass',STl,PLUSC,STl1),
+ dbg_ln('AFTER fillass'),
+ forall([Vgx,Vgxe,Vgy,Vgye],'moveass',STl1,[STl,Vsx,Vsy],STl2),
+ dbg_ln('AFTER moveass'),
+% dumpsl(STl2),
+% dbg_ln('AFTER moveass AFTER dumpsl'),
+ string_to_list(ST2,STl2),string_to_atom(ST2,ST2a),
+ dbg_ln('AFTER 1st string_to_list'),
+ string_to_list(ST,STl),string_to_atom(ST,STa),
+ dbg_ln(['BEFORE addstate:HIST=',HIST]),
+ addstate(ST2a,STa,HIST)
+ ,dbg_ln(['On end of chkpos,HIST=',HIST]).
+chkpos(_,_,_,_,[_,[H,H]|_]).
+
+trymove(C,D):-string_to_list('{',[C]),chkpos(2,1, 0, 0,D).
+trymove(C,D):-string_to_list('}',[C]),chkpos(2,1,+1, 0,D).
+trymove(C,D):-string_to_list('^',[C]),chkpos(1,2, 0, 0,D).
+trymove(C,D):-string_to_list('v',[C]),chkpos(1,2, 0,+1,D).
+trymove(C,D):-string_to_list('#',[C]),chkpos(1,1, 0, 0,D).
+trymove(C,D):-string_to_list('A',[C]),chkpos(2,2, 0, 0,D).
+trymove(C,D):-string_to_list('B',[C]),chkpos(2,2,+1, 0,D).
+trymove(C,D):-string_to_list('C',[C]),chkpos(2,2, 0,+1,D).
+trymove(C,D):-string_to_list('D',[C]),chkpos(2,2,+1,+1,D).
+trymove(_,[_,[H,H]|_]).
+
+foroibody(Vsx,Vsy,PLUS2,STl,HIST):-
+ dbg_ln(['foroibody:HIST=',HIST]),
+ saLXY(PLUS2,Vbx,Vby),Vnbx is Vbx+Vsx,Vnby is Vby+Vsy,
+ Vnbx>(-1),Vnbx<5,Vnby>(-1),Vnby<4,
+ dbg_ln(['Vnbx=',Vnbx,',Vnby=',Vnby]),
+ getXY(STl,Vnbx,Vnby,C),
+ dbg_ln(['trymove{',C,[STl,HIST,Vnbx,Vnby,Vbx,Vby],'}']),
+ trymove(C,[STl,HIST,Vnbx,Vnby,Vsx,Vsy,Vbx,Vby]).
+foroibody(_,_,_,_,[H,H]).
+
+foroi([],_,_,[H,H]).
+foroi([[Vsx,Vsy]|Voffs],PLUS2,STl,[HISTo,HISTn]):-
+ foroibody(Vsx,Vsy,PLUS2,STl,[HISTo,HISTm]),
+ foroi(Voffs,PLUS2,STl,[HISTm,HISTn]).
+
+oneplus(STl,[HISTo,HISTn],PLUSi,CNT):-
+ dbg_ln(['CNT=',CNT,',HISTo=',HISTo,',HISTn=',HISTn]),
+ PLUSi1 is PLUSi+1,chop(STl,PLUSi1,_,STlr),string_to_list('+',[PLUSC]),nth0(PLUS2x,STlr,PLUSC),PLUS2 is PLUSi1+PLUS2x,
+ foroi([[0,-1],[+1,0],[0,+1],[-1,0]],PLUS2,STl,[HISTo,HISTm]),
+ CNT1 is CNT+1,oneplus(STl,[HISTm,HISTn],PLUS2,CNT1).
+oneplus(_,[H,H],_,2).
+oneplus(STl,[H,H],_,CNT):-write_ln(['ONEPLUS FAILURE:CNT=',CNT]),dumpsl(STl),halt.
+
+process(ST,[[HASHo,DOo],HISTn]):-string_to_list(ST,STl),final(STl,HASHo),oneplus(STl,[[HASHo,DOo],HISTn],-1,0).
+%runi(T,_):-T>1000.
+runi(T,_):-0 is T mod 2000,garbage_collect,fail.
+runi(_,D):-run(D).
+run([_,[]]).
+run([HASH,[DOh|DOt]]):-
+ process(DOh,[[HASH,DOt],[HASHn,DOn]]),
+ hashsize(HASHn,TOTAL2),TOTAL is floor(TOTAL2/2),length(DOn,TODO),GONE is TOTAL-TODO,
+% (0 is GONE mod 100->format('~t~d~5|+~t~d~11|=~t~d~17|~n',[GONE,TODO,TOTAL]);true),
+ !,
+ runi(GONE,[HASHn,DOn]).
+
+st2ll(ST,LL):-string_to_list(ST,BL),l2ll(BL,5,LL).
+
+dumpc(C):-string_to_list(S,[C]),write(S).
+dumpl(L):-write(' | '),map('dumpc',L),write_ln(' |').
+dumpst(ST):-
+ st2ll(ST,LL),dumpll(LL).
+dumpll(LL):-map('dumpl',LL),write_ln(' \\-------/').
+dumpsl(BL):-l2ll(BL,5,LL),dumpll(LL).
+
+runinit(ST):-string_to_atom(ST,STa),geths(HS),replist([],HS,HASHi),addst(HASHi,STa,[],HASH),run([HASH,[STa]]).
+%HIST <=> [[[StrState,ParentStrState]...],[Todo..]]
+go:-runinit('{}{}#AB^#+CDv#+{}{}#').
--- /dev/null
+/* Sorry, BSD for alloca(). */
+
+#define _BSD_SOURCE
+
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+#include <assert.h>
+
+#define HTAB_SIZE 56783
+
+/* #define STSTEP 100 */
+/* #undef NDEBUG */
+/* #define BENCHMARK */
+
+typedef char stt[20];
+#define SaXYL(x,y) ((x)+(y)*5)
+#define SaLX(l) ((l)%5)
+#define SaLY(l) ((l)/5)
+#define SaLXY(l,x,y) do { (x)=SaLX((l)); (y)=SaLY((l)); } while (0)
+
+unsigned total=0,solutions=0;
+#ifdef STSTEP
+unsigned gone=0;
+#endif
+
+stt init=
+ "{}{}#"
+ "AB^#+"
+ "CDv#+"
+ "{}{}#";
+
+struct st {
+ struct st *nexttogo,*nextinchain,*ost;
+ stt data;
+ } *togo,**togop=&togo,*togonow,*htab[HTAB_SIZE];
+int level=-1;
+
+static void chk(void *p)
+{
+ if (p) return;
+ fprintf(stderr,"Virtual memory exhausted!\n");
+ exit(EXIT_FAILURE);
+}
+#define chknew(a) chk((a)=malloc(sizeof(*(a))))
+
+static unsigned hash(const char *st)
+{
+unsigned r=7;
+unsigned char i;
+
+ for (i=0;i<20;i++)
+ r=r*13+(*st++);
+ return r%HTAB_SIZE;
+}
+
+static struct st **findhash(const char *st,unsigned hval)
+{
+struct st **r;
+ for (r=&htab[hval];*r;r=&(*r)->nextinchain)
+ if (!memcmp((*r)->data,st,20)) break;
+ return r;
+}
+
+static void dumpst(const char *st)
+{
+unsigned char yi;
+
+ for (yi=0;yi<4;yi++)
+ printf(" | %.5s |\n",st+SaXYL(0,yi));
+ puts(" \\-------/");
+}
+
+static void addstate(const char *st,struct st *ost)
+{
+struct st *now,**nowp;
+unsigned hval;
+
+ hval=hash(st);
+ if (*(nowp=findhash(st,hval))) return;
+#ifndef NDEBUG
+ if (ost) {
+ puts("***addstate:");
+ dumpst(st);
+ }
+#endif
+ chk(now=malloc(sizeof(*now)));
+ *togop=now;togop=&now->nexttogo; now->nexttogo=NULL;
+ now->nextinchain=NULL; *nowp=now;
+ memcpy(now->data,st,20);
+ now->ost=ost;
+ total++;
+}
+
+static char isdest(const char *st)
+{
+ return (st[SaXYL(3,1)]=='A' && st[SaXYL(4,1)]=='B'
+ &&st[SaXYL(3,2)]=='C' && st[SaXYL(4,2)]=='D');
+}
+
+static void trymoves(struct st *sts)
+{
+char *st=sts->data;
+stt nst;
+int blk[2],bli,oi,nbp;
+static const char offs[4][2]={{0,-1},{+1,0},{0,+1},{-1,0}};
+char bx,by,nbx,nby,gx=0,gy=0,gxs=0,gys=0,sx,sy,xi,yi;
+
+#if 0
+/*ndef NDEBUG*/
+ printf("Entered trymoves()\n");
+ dumpst(st);
+#endif
+ if (isdest(st)) {
+struct st *o;
+int lev=0;
+struct back {
+ struct back *next;
+ struct st *st;
+ } *back=NULL,*b;
+ for (o=sts;o;o=o->ost) {
+ chk(b=alloca(sizeof(*b)));
+ b->next=back;
+ back=b;
+ b->st=o;
+ }
+
+ solutions++;
+#ifndef BENCHMARK
+#if 1
+ puts("*** GOAL");
+#else
+ printf("*** GOAL: level=%d\n",level);
+#endif
+#endif
+ while (back) {
+#ifndef BENCHMARK
+ printf("> /-------\\ forwardtrace: level=%d\n",lev++);
+ dumpst(back->st->data);
+#endif
+ back=back->next;
+ }
+ }
+ blk[0]=((char *)memchr(st ,'+',20 ))-((char *)st); assert(blk[0]<20);
+ blk[1]=((char *)memchr(st+(blk[0]+1),'+',20-(blk[0]+1)))-((char *)st); assert(blk[1]<20);
+ assert(!memchr(st+(blk[1]+1),'+',20-(blk[1]+1)));
+ for (bli=0;bli<2;bli++) {
+ SaLXY(blk[bli],bx,by);
+ for (oi=0;oi<4;oi++) {
+ nbx=bx+(sx=offs[oi][0]);
+ nby=by+(sy=offs[oi][1]);
+ if (nbx<0 || nbx>=5 || nby<0 || nby>=4) {
+failed: continue;
+ }
+
+#define CHKPOS(xs,ys,dx,dy) do { char nxb=nbx-dx,nyb=nby-dy; \
+ if (nxb<0 || nxb+xs>5 || nyb<0 || nyb+ys>5) goto failed; \
+ for (xi=0;xi<(xs);xi++) for (yi=0;yi<(ys);yi++) { \
+ if (xi-sx>=0&&xi-sx<xs&&yi-sy>=0&&yi-sy<ys) continue; \
+ if (st[SaXYL(bx-dx+xi,by-dy+yi) ]!='+') goto failed; \
+ } \
+ gx=nbx-dx; gy=nby-dy; gxs=xs; gys=ys; \
+ } while (0)
+
+ nbp=SaXYL(nbx,nby);
+ switch (st[nbp]) {
+ case '{': CHKPOS(2,1, 0, 0); break;
+ case '}': CHKPOS(2,1,+1, 0); break;
+ case '^': CHKPOS(1,2, 0, 0); break;
+ case 'v': CHKPOS(1,2, 0,+1); break;
+ case '#': CHKPOS(1,1, 0, 0); break;
+ case 'A': CHKPOS(2,2, 0, 0); break;
+ case 'B': CHKPOS(2,2,+1, 0); break;
+ case 'C': CHKPOS(2,2, 0,+1); break;
+ case 'D': CHKPOS(2,2,+1,+1); break;
+ case '+': goto failed;
+ default: assert(0);
+ }
+#undef CHKPOS
+
+ memcpy(nst,st,20);
+ for (yi=gy;yi<gy+gys;yi++) memset(nst+SaXYL(gx,yi),'+',gxs);
+ for (yi=gy;yi<gy+gys;yi++) memcpy(nst+SaXYL(gx-sx,yi-sy),st+SaXYL(gx,yi),gxs);
+#if 0
+/*ndef NDEBUG*/
+ printf("Moving: g=(%d,%d)[%d,%d] by (%d,%d)\n",gx,gy,gxs,gys,-sx,-sy);
+ dumpst(nst);
+#endif
+ addstate(nst,sts);
+ }
+ }
+}
+
+static void swtogo(void)
+{
+ assert(!togonow);
+ togonow=togo;
+ togo=NULL;
+ togop=&togo;
+ level++;
+}
+
+int main(void)
+{
+struct st *now;
+#ifdef STSTEP
+unsigned ststep=0;
+#endif
+
+ addstate(init,NULL);
+ while (togo) {
+ swtogo();
+ while ((now=togonow)) {
+ togonow=now->nexttogo;
+ trymoves(now);
+#ifdef STSTEP
+ gone++;
+#if 1
+ if (!(gone%STSTEP)) printf("%5u+%5u=%5u\n",gone,total-gone,total);
+#else
+ if (++ststep==STSTEP || !togo) {
+ printf("%5u+%5u=%5u, level=%3d\n",gone,total-gone,total,level);
+ ststep=0;
+ }
+#endif
+#endif
+ }
+ }
+#if 0
+ printf("total=%u, maxlevel=%d, solutions=%d\n",total,level,solutions);
+#endif
+ return(EXIT_SUCCESS);
+}
--- /dev/null
+diff -ruN pl-3.1.2-orig/src/pl-prof.c pl-3.1.2/src/pl-prof.c
+--- pl-3.1.2-orig/src/pl-prof.c Thu Aug 6 15:27:22 1998
++++ pl-3.1.2/src/pl-prof.c Sat Dec 26 15:14:00 1998
+@@ -28,7 +28,7 @@
+
+ static bool
+ startProfiler(int how)
+-{ set_sighandler(SIGPROF, profile);
++{/* set_sighandler(SIGPROF, profile); * HACK<short@ucw.cz>: sigblock() not working! */
+
+ value.it_interval.tv_sec = 0;
+ value.it_interval.tv_usec = 1;
+diff -ruN pl-3.1.2-orig/src/pl-wam.c pl-3.1.2/src/pl-wam.c
+--- pl-3.1.2-orig/src/pl-wam.c Mon Nov 30 16:14:59 1998
++++ pl-3.1.2/src/pl-wam.c Sat Dec 26 16:00:07 1998
+@@ -3139,6 +3139,9 @@
+ if ( false(DEF, SYSTEM) )
+ clear(FR, FR_NODEBUG);
+
++/* HACK<short@ucw.cz>: Disable automatic garbage collection, use on-demand */
++#define garbageCollect(FR)
++
+ #if O_DYNAMIC_STACKS
+ if ( gc_status.requested )
+ { lTop = (LocalFrame) argFrameP(FR, DEF->functor->arity);
--- /dev/null
+#! /usr/bin/perl
+#
+# $Id$
+# Definition of 'My::Project::patchd2' for list.cgi.pl
+# Copyright (C) 2003 Jan Kratochvil <project-www.jankratochvil.net@jankratochvil.net>
+#
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; exactly version 2 of June 1991 is required
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write to the Free Software
+# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+
+
+package My::Project::patchd2;
+require 5.6.0; # at least 'use warnings;' but we need some 5.6.0+ modules anyway
+use vars qw($VERSION $CVS_ID);
+$VERSION=do { my @r=(q$Revision$=~/\d+/g); sprintf "%d.".("%03d"x$#r),@r; };
+$CVS_ID=q$Id$;
+use strict;
+use warnings;
+
+
+our %ListItem=(
+ "name"=>"Patch <a href=\"http://www.descent2.com/\">Descent 2</a> to Avoid CD-ROM",
+ "download"=>"patchd2.zip",
+ "summary"=>"Patch for no-CD",
+ "license"=>"PD",
+ "maintenance"=>"finished",
+ "language"=>"i386 asm patch",
+ "description"=>""
+ .'<p>Use this <a href="http://www.calderathin.com/products/drdos/">DOS</a>'
+ .' program to patch/unpatch Descent 2 to not require CD-ROM to'
+ .' run. I need this as I have no CD-ROM installed in my computer. The exact'
+ .' bytes sequences needed was investigated by some-else hacker.</p>'
+ );
+
+1;
--- /dev/null
+# $Id$
+# automake source for the Makefile of project/patchd2/ subdir
+# Copyright (C) 2003 Jan Kratochvil <project-www.jankratochvil.net@jankratochvil.net>
+#
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; exactly version 2 of June 1991 is required
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write to the Free Software
+# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+
+
+include $(top_srcdir)/Makefile-head.am
+
+EXTRA_DIST+= \
+ ListItem.pm \
+ index.html.pl
+
+noinst_DATA+= \
+ index.html
--- /dev/null
+#! /usr/bin/perl
+#
+# $Id$
+# Main page of 'My::Project::patchd2'
+# Copyright (C) 2003 Jan Kratochvil <project-www.jankratochvil.net@jankratochvil.net>
+#
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; exactly version 2 of June 1991 is required
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write to the Free Software
+# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+
+
+require 5.6.0; # at least 'use warnings;' but we need some 5.6.0+ modules anyway
+use vars qw($VERSION $CVS_ID);
+$VERSION=do { my @r=(q$Revision$=~/\d+/g); sprintf "%d.".("%03d"x$#r),@r; };
+$CVS_ID=q$Id$;
+use strict;
+use warnings;
+
+use My::Web;
+use project::patchd2::ListItem;
+
+
+My::Web->init_project(
+ "ListItem"=>\%My::Project::patchd2::ListItem,
+ );
+
+My::Web->footer();
--- /dev/null
+#! /usr/bin/perl
+#
+# $Id$
+# Definition of 'My::Project::pipebuf' for list.cgi.pl
+# Copyright (C) 2003 Jan Kratochvil <project-www.jankratochvil.net@jankratochvil.net>
+#
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; exactly version 2 of June 1991 is required
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write to the Free Software
+# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+
+
+package My::Project::pipebuf;
+require 5.6.0; # at least 'use warnings;' but we need some 5.6.0+ modules anyway
+use vars qw($VERSION $CVS_ID);
+$VERSION=do { my @r=(q$Revision$=~/\d+/g); sprintf "%d.".("%03d"x$#r),@r; };
+$CVS_ID=q$Id$;
+use strict;
+use warnings;
+
+
+our %ListItem=(
+ "name"=>"PipeBuf - Data Buffering Tool",
+ "download"=>"pipebuf.c",
+ "summary"=>"Pipe buffer",
+ "license"=>"PD",
+ "maintenance"=>"finished",
+ "language"=>"C",
+ "description"=>""
+ .'<p>You can do a buffering of realtime data such as audio stream by inserting this program'
+ .' with traditional "UNIX filter" behaviour. It reads as fast as possible into'
+ .' its cache and also in the same time writes as fast as possible to the output. In fact'
+ .' it is implemented as two processes (no threads - no pthread libraries needed, only IPC'
+ .' communication used). Features custom buffer sizes, prefill (start writing of the first byte'
+ .' only after the WHOLE buffer has beel filled up) and warning messages when buffer is getting'
+ .' emptied.</p>'
+ );
+
+1;
--- /dev/null
+# $Id$
+# automake source for the Makefile of project/pipebuf/ subdir
+# Copyright (C) 2003 Jan Kratochvil <project-www.jankratochvil.net@jankratochvil.net>
+#
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; exactly version 2 of June 1991 is required
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write to the Free Software
+# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+
+
+include $(top_srcdir)/Makefile-head.am
+
+EXTRA_DIST+= \
+ ListItem.pm \
+ index.html.pl
+
+noinst_DATA+= \
+ index.html
--- /dev/null
+#! /usr/bin/perl
+#
+# $Id$
+# Main page of 'My::Project::pipebuf'
+# Copyright (C) 2003 Jan Kratochvil <project-www.jankratochvil.net@jankratochvil.net>
+#
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; exactly version 2 of June 1991 is required
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write to the Free Software
+# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+
+
+require 5.6.0; # at least 'use warnings;' but we need some 5.6.0+ modules anyway
+use vars qw($VERSION $CVS_ID);
+$VERSION=do { my @r=(q$Revision$=~/\d+/g); sprintf "%d.".("%03d"x$#r),@r; };
+$CVS_ID=q$Id$;
+use strict;
+use warnings;
+
+use My::Web;
+use project::pipebuf::ListItem;
+
+
+My::Web->init_project(
+ "ListItem"=>\%My::Project::pipebuf::ListItem,
+ );
+
+My::Web->footer();
--- /dev/null
+#/*
+# PipeBuf version 1.2
+# To compile run: sh pipebuf.c
+# Help is then available: ./pipebuf -h
+
+# Copyright (C) 1998 Jan Kratochvil <short@ucw.cz>
+#
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; you must use exactly version 2.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+# You may download a copy of the GNU General Public License from URL
+# http://www.opensource.org/gpl-license.html
+# If not, write to the Free Software Foundation,
+# Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
+
+echo "Compiling PipeBuf..."
+a="cc"
+b="-s -Wall -O6 -fexpensive-optimizations -fomit-frame-pointer -D_GNU_SOURCE=1"
+c="-o `basename "$0" .c` $0"
+echo "$a $b $c"
+if $a $b $c;then echo -n
+else echo "$a $c"
+ if $a $c;then echo -n
+ else echo "Failed - please check the output.";exit
+ fi
+fi
+echo "done."
+exit
+*/
+
+#include <stdio.h>
+#include <stdlib.h>
+#include <sys/time.h>
+#include <sys/types.h>
+#include <sys/wait.h>
+#include <sys/mman.h>
+#include <signal.h>
+#include <unistd.h>
+#include <fcntl.h>
+#include <string.h>
+#include <limits.h>
+#include <sys/ipc.h>
+#include <sys/shm.h>
+#include <sys/msg.h>
+#include <getopt.h>
+#include <errno.h>
+#include <time.h>
+
+#define BUFSZ (12<<10) /* in KB */
+#define BUFWARN (80) /* in percents */
+#define WARNTIM (5) /* in seconds */
+#define MAX_XFER (PIPE_BUF)
+#undef DEBUG
+
+#ifndef SHMMAX
+#define SHMMAX 0x2000000
+#endif
+
+#ifndef __NORETURN
+#if __GNUC__ >= 2
+#define __NORETURN __attribute__((__noreturn__))
+#else
+#define __NORETURN
+#endif
+#endif
+
+#define RDID (0)
+#define WRID (1)
+
+#ifndef DEBUG
+#define dbg(cmd)
+#else
+#define dbg(cmd) cmd
+#endif
+#define PNAME_LEN (16)
+#define bufw(n) ((n)==bufsz?0:(n))
+#define failf(name) do { fprintf(stderr,"%s: ",pname); perror(name"()"); exit(EXIT_FAILURE); } while (0)
+#ifndef max
+#define max(a,b) ((a)>=(b)?(a):(b))
+#endif
+#ifndef min
+#define min(a,b) ((a)<=(b)?(a):(b))
+#endif
+
+const char version[]="This is PipeBuf, version 1.2\n";
+
+long bufsz=BUFSZ<<10,bufwarn=BUFWARN;
+int prefill,quiet,verbose;
+
+char *pname;
+int shmid=-1,dis_cleanup=0,myself;
+pid_t other=-1;
+volatile struct {
+ long rp,wp;
+ int eof;
+ time_t up;
+ struct {
+ char sent;
+ int msqid;
+ } p[2];
+ } *comm;
+struct msgbuf smsgbuf={1,{0}};
+struct msgbuf rmsgbuf;
+
+static void cleanup(void)
+{
+ dbg(fprintf(stderr,"%s: cleanup()\n",pname));
+ if (dis_cleanup) return;
+ if (other!=-1) kill(other,SIGTERM);
+ shmctl(shmid,IPC_RMID,NULL);
+ if (comm) {
+ dbg(fprintf(stderr,"%s: msgctl(%d,IPC_RMID), myself=%d\n",pname,comm->p[ myself].msqid, myself));
+ msgctl(comm->p[ myself].msqid,IPC_RMID,NULL);
+ dbg(fprintf(stderr,"%s: msgctl(%d,IPC_RMID),!myself=%d\n",pname,comm->p[!myself].msqid,!myself));
+ msgctl(comm->p[!myself].msqid,IPC_RMID,NULL);
+ }
+ dis_cleanup=1;
+ exit(EXIT_FAILURE);
+}
+
+static void wake(void)
+{
+ dbg(fprintf(stderr,"%s: waking (sent=%d)...\n",pname,comm->p[myself].sent));
+ if (comm->p[myself].sent) return;
+ dbg(fprintf(stderr,"%s: msgsnd(msqid=%d), myself=%d\n",pname,comm->p[!myself].msqid,myself));
+/* dbg(fprintf(stderr,"%s: sleeping 5 sec...\n",pname));
+ sleep(5);
+ dbg(fprintf(stderr,"%s: sleeping 5 sec done\n",pname));*/
+ if (msgsnd(comm->p[!myself].msqid,(struct msgbuf *)&smsgbuf,0,IPC_NOWAIT)) if (errno!=EAGAIN) failf("msgsnd");
+ comm->p[myself].sent++;
+ dbg(fprintf(stderr,"%s: waked (sent=%d)\n",pname,comm->p[myself].sent));
+}
+
+static void shake(void)
+{
+ wake();
+ dbg(fprintf(stderr,"%s: waiting (sent=%d)...\n",pname,comm->p[myself].sent));
+ if (comm->eof) dbg(fprintf(stderr,"%s: EOF => breaking out of shake()!\n",pname));
+ else {
+ dbg(fprintf(stderr,"%s: msgrcv(msqid=%d),myself=%d\n",pname,comm->p[myself].msqid,myself));
+/* dbg(fprintf(stderr,"%s: sleeping 5 sec...\n",pname));
+ sleep(5);
+ dbg(fprintf(stderr,"%s: sleeping 5 sec done\n",pname));*/
+ if (msgrcv(comm->p[myself].msqid,&rmsgbuf,0,0,0)) failf("msgrcv");
+ }
+ comm->p[!myself].sent--;
+ dbg(if (comm->p[!myself].sent<0) {
+ fprintf(stderr,"%s: FATAL - .sent=%d (<0)!\n",pname,comm->p[!myself].sent);
+ exit(EXIT_FAILURE);
+ });
+ dbg(fprintf(stderr,"%s: wait returned (sent=%d)\n",pname,comm->p[myself].sent));
+}
+
+static void warnbuf(void)
+{
+long crp,cwp,bufused,cup;
+float percused;
+char *tim;
+ if (!comm->up||quiet||comm->eof||time(NULL)-comm->up<WARNTIM) return;
+ comm->up=cup=time(NULL);
+ crp=comm->rp; cwp=comm->wp;
+ bufused=crp-cwp+bufsz*!(crp>cwp);
+ if ((percused=(float)bufused*100/bufsz)>=bufwarn) return;
+ tim=ctime(&cup);
+ *strchr(tim,'\n')='\0';
+ fprintf(stderr,"%s: %s: WARNING - Low buffer fill-up: %8ld of %8ld (%2.1f%%)\n",
+ pname,tim,bufused,bufsz,percused);
+}
+
+static __NORETURN void usage(void)
+{
+ fprintf(stderr,"\
+%s\
+This command offers the pipe buffering:\n\
+\n\
+Usage: pipebuf [-b|--buffer <size in KB>] [-p|--prefill] [-w|--warning <percent>]\n\
+ [-q|--quiet] [-v|--verbose] [-h|--help] [-V|--version]\n\
+\n\
+ -b, --buffer <size in KB>\tSpecify buffer size (1-%dKB, def=%dKB)\n\
+ -p, --prefill\t\t\tFill the buffer before first write\n\
+ -w, --warning <percent>\tNo-buffer-data warnings threshold (0-100%%, def=%d%%)\n\
+ -q, --quiet\t\t\tDon't print warnings\n\
+ -v, --verbose\t\t\tInform about phases of transfer\n\
+ -h, --help\t\t\tPrint a summary of the options\n\
+ -V, --version\t\t\tPrint the version number\n\
+",version,(SHMMAX>>10)-1,BUFSZ,BUFWARN);
+ exit(EXIT_FAILURE);
+}
+
+const struct option longopts[]={
+{"buffer" ,1,0,'b'},
+{"prefill",0,0,'p'},
+{"warning",1,0,'w'},
+{"quiet" ,0,0,'q'},
+{"verbose",0,0,'v'},
+{"help" ,0,0,'h'},
+{"version",0,0,'V'}};
+
+int main(int argc,char **argv)
+{
+long cfp;
+int r,optc;
+caddr_t buf;
+char *s;
+
+ pname=*argv;
+ atexit(cleanup);
+ signal(SIGTERM,(void (*)(int))cleanup);
+ signal(SIGQUIT,(void (*)(int))cleanup);
+ signal(SIGINT ,(void (*)(int))cleanup);
+ signal(SIGHUP ,(void (*)(int))cleanup);
+ while ((optc=getopt_long(argc,argv,"b:pw:qvhV",longopts,NULL))!=EOF) switch (optc) {
+ case 'b':
+ errno=EINVAL;
+ bufsz=strtol(optarg,&s,0);
+ if (*s!='\0'||bufsz<1||bufsz<<10>=SHMMAX) { perror(optarg); usage(); }
+ bufsz<<=10;
+ break;
+ case 'p':
+ prefill=1;
+ break;
+ case 'w':
+ errno=EINVAL;
+ bufwarn=strtol(optarg,&s,0);
+ if (*s!='\0'||bufwarn<0||bufwarn>100) { perror(optarg); usage(); }
+ break;
+ case 'q':
+ quiet=1;
+ verbose=0;
+ break;
+ case 'v':
+ verbose=1;
+ quiet=0;
+ break;
+ case 'V':
+ fprintf(stderr,version);
+ exit(EXIT_FAILURE);
+ default: /* also 'h' */
+ usage();
+ break;
+ }
+ if ((shmid=shmget(IPC_PRIVATE,bufsz+sizeof(*comm),0600|IPC_CREAT|IPC_EXCL))==-1) failf("shmget");
+ if ((int)(buf=shmat(shmid,0,0))==-1) failf("shmat");
+ comm=(void *)buf+bufsz;
+ bzero((void *)comm,sizeof(*comm));
+ if ((comm->p[RDID].msqid=msgget(IPC_PRIVATE,0777|IPC_CREAT|IPC_EXCL))==-1) failf("msgget");
+ if ((comm->p[WRID].msqid=msgget(IPC_PRIVATE,0777|IPC_CREAT|IPC_EXCL))==-1) failf("msgget");
+ if (!prefill) comm->up=time(NULL);
+ other=fork();
+ if (other) {
+ /* Read process */
+ dbg(fprintf(stderr,"%s: started rd\n",pname));
+ myself=RDID;
+ strncat(pname,"-rd",max(PNAME_LEN-strlen(pname)-1,0));
+ if (close(STDOUT_FILENO)) failf("close");
+ if (verbose) fprintf(stderr,"%s: Using buffer %ldKB%s...\n",pname,bufsz>>10,(prefill?", filling":""));
+ dbg(fprintf(stderr,"%s: pname check rd\n",pname));
+ for (;;) {
+ if (bufw(comm->rp+1)==comm->wp) {
+ if (!comm->up) {
+ comm->up=time(NULL);
+ if (verbose) fprintf(stderr,"%s: Buffer filled-up, starting transfer...\n",pname);
+ }
+ shake();
+ continue;
+ }
+ warnbuf();
+ cfp=comm->wp;
+ dbg(fprintf(stderr,"%s: rp=%ld, wp=%ld",pname,comm->rp,cfp));
+ cfp=(cfp<=comm->rp?bufsz-comm->rp-!cfp:cfp-1-comm->rp);
+ dbg(fprintf(stderr,", read(%d,%08lx,%ld)\n",STDIN_FILENO,(long)&buf[comm->rp],min(cfp,MAX_XFER)));
+ if ((r=read(STDIN_FILENO,&buf[comm->rp],min(cfp,MAX_XFER)))==-1) failf("read");
+ dbg(fprintf(stderr,"%s: rp=%ld, wp=%ld, read=%d\n",pname,bufw(comm->rp+r),comm->wp,r));
+ if (r) comm->rp=bufw(comm->rp+r);
+ else {
+ comm->eof=1;
+ if (!comm->up) {
+ comm->up=time(NULL);
+ if (verbose) fprintf(stderr,"%s: Reached EOF before buffer fill-up, starting transfer...\n",pname);
+ }
+ wake();
+ break;
+ }
+ if (comm->up) wake();
+ }
+ if (verbose) fprintf(stderr,"%s: All input data read, waiting for write completion...\n",pname);
+ if (waitpid(other,NULL,0)!=other) failf("waitpid");
+ }
+ else {
+ /* Write process */
+ dbg(fprintf(stderr,"%s: started wr\n",pname));
+ myself=WRID;
+ strncat(pname,"-wr",max(PNAME_LEN-strlen(pname)-1,0));
+ other=getppid();
+ if (close(STDIN_FILENO)) failf("close");
+ dbg(fprintf(stderr,"%s: pname check wr\n",pname));
+ for (;;) {
+ if (comm->eof&&comm->rp==comm->wp) break;
+ while (!comm->eof&&(!comm->up||comm->rp==comm->wp)) shake();
+ if (comm->eof&&comm->rp==comm->wp) break;
+ cfp=comm->rp;
+ dbg(fprintf(stderr,"%s: rp=%ld, wp=%ld",pname,cfp,comm->wp));
+ cfp=(cfp<=comm->wp?bufsz-comm->wp:cfp-comm->wp);
+ dbg(fprintf(stderr,", write(%d,%08lx,%ld)\n",STDOUT_FILENO,(long)&buf[comm->wp],min(cfp,MAX_XFER)));
+ if ((r=write(STDOUT_FILENO,&buf[comm->wp],min(cfp,MAX_XFER)))==-1) failf("write");
+ dbg(fprintf(stderr,"%s: rp=%ld, wp=%ld, write=%d\n",pname,comm->rp,bufw(comm->wp+r),r));
+ if (!(comm->wp=bufw(comm->wp+r))&&comm->rp) continue;
+ wake();
+ warnbuf();
+ }
+ }
+ if (verbose) fprintf(stderr,"%s: Ending operation (sent=%d).\n",pname,comm->p[myself].sent);
+ return(EXIT_SUCCESS);
+}
--- /dev/null
+#! /usr/bin/perl
+#
+# $Id$
+# Definition of 'My::Project::redirector_ad' for list.cgi.pl
+# Copyright (C) 2003 Jan Kratochvil <project-www.jankratochvil.net@jankratochvil.net>
+#
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; exactly version 2 of June 1991 is required
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write to the Free Software
+# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+
+
+package My::Project::redirector_ad;
+require 5.6.0; # at least 'use warnings;' but we need some 5.6.0+ modules anyway
+use vars qw($VERSION $CVS_ID);
+$VERSION=do { my @r=(q$Revision$=~/\d+/g); sprintf "%d.".("%03d"x$#r),@r; };
+$CVS_ID=q$Id$;
+use strict;
+use warnings;
+
+
+our %ListItem=(
+ "name"=>"Banner Killer as 'squid redirector'",
+ "link-CVS download"=>"http://cvs.jankratochvil.net/viewcvs/redirector-ad/redirector-ad.tar.gz?tarball=1",
+ "summary"=>"Banner killer",
+ "license"=>"PD",
+ "maintenance"=>"finished",
+ "language"=>"Perl",
+ "description"=>""
+ .'<p>Scripts that will simply discard graphical images referenced'
+ .' from web pages. Unlike other such packages it:</p>'
+ .' <ul>'
+ .' <li>Does not need separate administration of another daemon</li>'
+ .' <li>Does not do any page contents filtering (popups will still pass through!)</li>'
+ .' </ul>'
+ );
+
+1;
--- /dev/null
+# $Id$
+# automake source for the Makefile of project/redirector_ad/ subdir
+# Copyright (C) 2003 Jan Kratochvil <project-www.jankratochvil.net@jankratochvil.net>
+#
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; exactly version 2 of June 1991 is required
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write to the Free Software
+# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+
+
+include $(top_srcdir)/Makefile-head.am
+
+EXTRA_DIST+= \
+ ListItem.pm \
+ index.html.pl
+
+noinst_DATA+= \
+ index.html
--- /dev/null
+#! /usr/bin/perl
+#
+# $Id$
+# Main page of 'My::Project::redirector_ad'
+# Copyright (C) 2003 Jan Kratochvil <project-www.jankratochvil.net@jankratochvil.net>
+#
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; exactly version 2 of June 1991 is required
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write to the Free Software
+# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+
+
+require 5.6.0; # at least 'use warnings;' but we need some 5.6.0+ modules anyway
+use vars qw($VERSION $CVS_ID);
+$VERSION=do { my @r=(q$Revision$=~/\d+/g); sprintf "%d.".("%03d"x$#r),@r; };
+$CVS_ID=q$Id$;
+use strict;
+use warnings;
+
+use My::Web;
+use project::redirector_ad::ListItem;
+
+
+My::Web->init_project(
+ "ListItem"=>\%My::Project::redirector_ad::ListItem,
+ );
+
+My::Web->footer();
--- /dev/null
+#! /usr/bin/perl
+#
+# $Id$
+# Definition of 'My::Project::smbfs' for list.cgi.pl
+# Copyright (C) 2003 Jan Kratochvil <project-www.jankratochvil.net@jankratochvil.net>
+#
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; exactly version 2 of June 1991 is required
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write to the Free Software
+# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+
+
+package My::Project::smbfs;
+require 5.6.0; # at least 'use warnings;' but we need some 5.6.0+ modules anyway
+use vars qw($VERSION $CVS_ID);
+$VERSION=do { my @r=(q$Revision$=~/\d+/g); sprintf "%d.".("%03d"x$#r),@r; };
+$CVS_ID=q$Id$;
+use strict;
+use warnings;
+
+
+our %ListItem=(
+ "name"=>"SMB Kernel Filesystem Acceleration",
+ "download"=>"smbfs-2.1.132-blocksize.diff",
+ "summary"=>"SMB acceleration patch",
+ "license"=>"PD",
+ "maintenance"=>"finished",
+ "language"=>"C patch",
+ "description"=>""
+ .'<p>Simple patch to increase virtual block size of SMB filesytem in Linux'
+ .' kernel. For me it improved tranfer rate of <code>cp</code> command almost'
+ .' by a factor of <strong>2</strong> (approx. 700KB -> 1300KB or something'
+ .' like about it). Now <code>cp</code> should be as fast as <code>cat</code>'
+ .' redirected across networked filesystems.</p>'
+ .' <p>Unfortunately the blocksize causes different (4 times smaller) sizes'
+ .' reported by <code>du</code> command as it measures it in <i>blocks</i>'
+ .' and not in <i>kilobytes</i> as some people think.</p>'
+
+ );
+
+1;
--- /dev/null
+# $Id$
+# automake source for the Makefile of project/smbfs/ subdir
+# Copyright (C) 2003 Jan Kratochvil <project-www.jankratochvil.net@jankratochvil.net>
+#
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; exactly version 2 of June 1991 is required
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write to the Free Software
+# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+
+
+include $(top_srcdir)/Makefile-head.am
+
+EXTRA_DIST+= \
+ ListItem.pm \
+ index.html.pl
+
+noinst_DATA+= \
+ index.html
--- /dev/null
+#! /usr/bin/perl
+#
+# $Id$
+# Main page of 'My::Project::smbfs'
+# Copyright (C) 2003 Jan Kratochvil <project-www.jankratochvil.net@jankratochvil.net>
+#
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; exactly version 2 of June 1991 is required
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write to the Free Software
+# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+
+
+require 5.6.0; # at least 'use warnings;' but we need some 5.6.0+ modules anyway
+use vars qw($VERSION $CVS_ID);
+$VERSION=do { my @r=(q$Revision$=~/\d+/g); sprintf "%d.".("%03d"x$#r),@r; };
+$CVS_ID=q$Id$;
+use strict;
+use warnings;
+
+use My::Web;
+use project::smbfs::ListItem;
+
+
+My::Web->init_project(
+ "ListItem"=>\%My::Project::smbfs::ListItem,
+ );
+
+My::Web->footer();
--- /dev/null
+diff -ruN linux-2.1.132-orig/fs/smbfs/proc.c linux-2.1.132c/fs/smbfs/proc.c
+--- linux-2.1.132-orig/fs/smbfs/proc.c Mon Feb 1 23:27:12 1999
++++ linux-2.1.132c/fs/smbfs/proc.c Mon Nov 9 16:47:23 1998
+@@ -25,6 +25,9 @@
+
+ #include <asm/string.h>
+
++#include <asm/page.h>
++#define SMB_ST_BLKSIZE (PAGE_SIZE)
++
+ #define SMBFS_PARANOIA 1
+ /* #define SMBFS_DEBUG_TIMESTAMP 1 */
+ /* #define SMBFS_DEBUG_VERBOSE 1 */
+@@ -1222,7 +1225,7 @@
+ fattr->f_nlink = 1;
+ fattr->f_uid = server->mnt->uid;
+ fattr->f_gid = server->mnt->gid;
+- fattr->f_blksize = 512;
++ fattr->f_blksize = SMB_ST_BLKSIZE;
+ }
+
+ static void
+@@ -1232,7 +1235,7 @@
+ if (fattr->attr & aDIR)
+ {
+ fattr->f_mode = server->mnt->dir_mode;
+- fattr->f_size = 512;
++ fattr->f_size = SMB_ST_BLKSIZE;
+ }
+ /* Check the read-only flag */
+ if (fattr->attr & aRONLY)
--- /dev/null
+#! /usr/bin/perl
+#
+# $Id$
+# Definition of 'My::Project::sshpatch' for list.cgi.pl
+# Copyright (C) 2003 Jan Kratochvil <project-www.jankratochvil.net@jankratochvil.net>
+#
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; exactly version 2 of June 1991 is required
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write to the Free Software
+# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+
+
+package My::Project::sshpatch;
+require 5.6.0; # at least 'use warnings;' but we need some 5.6.0+ modules anyway
+use vars qw($VERSION $CVS_ID);
+$VERSION=do { my @r=(q$Revision$=~/\d+/g); sprintf "%d.".("%03d"x$#r),@r; };
+$CVS_ID=q$Id$;
+use strict;
+use warnings;
+
+
+our %ListItem=(
+ "name"=>"SSH-1 patch for <i>KeepAliveData</i> and <i>OnDemandForward</i>",
+ "download"=>"ssh-1.2.30-kadata+odforw.tar.gz",
+ "download-SSH-1, version 1.2.30, .src.rpm"=>"ftp://ftp.fi.muni.cz/pub/ssh/local-fi.muni.cz/linux/ssh-1.2.30-1i.src.rpm",
+ "download-SSH-1, version 1.2.30, .tar.gz"=>"ftp://ftp.fi.muni.cz/pub/ssh/ssh-1.2.30.tar.gz",
+ "summary"=>"SSH enhancement",
+ "license"=>"PD",
+ "maintenance"=>"update",
+ "update"=>"<a href=\"http://www.openssh.com/\">OpenSSH</a> is now preferred but this patch is not yet migrated.",
+ "language"=>"C patch",
+ "description"=>""
+ .'This patch will protect your mostly idle SSH connection from broken masquerading firewalls'
+ .' and/or it will also provide _on-demand_ tunnelling.'
+ );
+
+1;
--- /dev/null
+# $Id$
+# automake source for the Makefile of project/sshpatch/ subdir
+# Copyright (C) 2003 Jan Kratochvil <project-www.jankratochvil.net@jankratochvil.net>
+#
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; exactly version 2 of June 1991 is required
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write to the Free Software
+# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+
+
+include $(top_srcdir)/Makefile-head.am
+
+EXTRA_DIST+= \
+ ListItem.pm \
+ index.html.pl
+
+noinst_DATA+= \
+ index.html
--- /dev/null
+#! /usr/bin/perl
+#
+# $Id$
+# Main page of 'My::Project::sshpatch'
+# Copyright (C) 2003 Jan Kratochvil <project-www.jankratochvil.net@jankratochvil.net>
+#
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; exactly version 2 of June 1991 is required
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write to the Free Software
+# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+
+
+require 5.6.0; # at least 'use warnings;' but we need some 5.6.0+ modules anyway
+use vars qw($VERSION $CVS_ID);
+$VERSION=do { my @r=(q$Revision$=~/\d+/g); sprintf "%d.".("%03d"x$#r),@r; };
+$CVS_ID=q$Id$;
+use strict;
+use warnings;
+
+use My::Web;
+use project::sshpatch::ListItem;
+
+
+My::Web->init_project(
+ "ListItem"=>\%My::Project::sshpatch::ListItem,
+ );
+
+print <<'HERE';
+<p>This patch will enahance your <tt>SSH</tt> with two new options, their detailed description you will
+find in the updated man pages after you install this offered patch:</p>
+<ul>
+<li><b>KeepAliveData</b>: Some broken hosts potentially gatewaying/masquerading the data (between ssh
+client-server) forget and reject connections with too much idle time. Use this option to
+workaround it.</li>
+<li><b>OnDemandForward</b>: Forces client to wait until the first connection to locally forwarded port is
+made. When user enables this option, SSH client initially only starts listening on specified local ports for
+forwarding. Only after the first connection to such local port is made, SSH will
+start the connection and authentication to the server.</li>
+</ul>
+HERE
+
+My::Web->footer();
--- /dev/null
+#! /usr/bin/perl
+#
+# $Id$
+# Definition of 'My::Project::step' for list.cgi.pl
+# Copyright (C) 2003 Jan Kratochvil <project-www.jankratochvil.net@jankratochvil.net>
+#
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; exactly version 2 of June 1991 is required
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write to the Free Software
+# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+
+
+package My::Project::step;
+require 5.6.0; # at least 'use warnings;' but we need some 5.6.0+ modules anyway
+use vars qw($VERSION $CVS_ID);
+$VERSION=do { my @r=(q$Revision$=~/\d+/g); sprintf "%d.".("%03d"x$#r),@r; };
+$CVS_ID=q$Id$;
+use strict;
+use warnings;
+
+
+our %ListItem=(
+ "name"=>"STEP - Student's Trainee Exchange Programme",
+ "download"=>"step.tar.gz",
+ "summary"=>"Custom web database application",
+ "license"=>"PD",
+ "maintenance"=>"dead",
+ "language"=>"PHP 3.0",
+ "description"=>""
+ .'<p>Preview of a possible future web database solution for some lawyers association.'
+ .' Currently it remains as a source of some web development <a href="http://www.php.net/">PHP 3.0</a>'
+ .' codebase to be reused in other projects.</p>'
+ );
+
+1;
--- /dev/null
+# $Id$
+# automake source for the Makefile of project/step/ subdir
+# Copyright (C) 2003 Jan Kratochvil <project-www.jankratochvil.net@jankratochvil.net>
+#
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; exactly version 2 of June 1991 is required
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write to the Free Software
+# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+
+
+include $(top_srcdir)/Makefile-head.am
+
+EXTRA_DIST+= \
+ ListItem.pm \
+ index.html.pl
+
+noinst_DATA+= \
+ index.html
--- /dev/null
+#! /usr/bin/perl
+#
+# $Id$
+# Main page of 'My::Project::step'
+# Copyright (C) 2003 Jan Kratochvil <project-www.jankratochvil.net@jankratochvil.net>
+#
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; exactly version 2 of June 1991 is required
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write to the Free Software
+# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+
+
+require 5.6.0; # at least 'use warnings;' but we need some 5.6.0+ modules anyway
+use vars qw($VERSION $CVS_ID);
+$VERSION=do { my @r=(q$Revision$=~/\d+/g); sprintf "%d.".("%03d"x$#r),@r; };
+$CVS_ID=q$Id$;
+use strict;
+use warnings;
+
+use My::Web;
+use project::step::ListItem;
+
+
+My::Web->init_project(
+ "ListItem"=>\%My::Project::step::ListItem,
+ );
+
+My::Web->footer();
--- /dev/null
+#! /usr/bin/perl
+#
+# $Id$
+# Definition of 'My::Project::surprise' for list.cgi.pl
+# Copyright (C) 2003 Jan Kratochvil <project-www.jankratochvil.net@jankratochvil.net>
+#
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; exactly version 2 of June 1991 is required
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write to the Free Software
+# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+
+
+package My::Project::surprise;
+require 5.6.0; # at least 'use warnings;' but we need some 5.6.0+ modules anyway
+use vars qw($VERSION $CVS_ID);
+$VERSION=do { my @r=(q$Revision$=~/\d+/g); sprintf "%d.".("%03d"x$#r),@r; };
+$CVS_ID=q$Id$;
+use strict;
+use warnings;
+
+
+our %ListItem=(
+ "name"=>"Partition Surprise",
+ "download-Page on SourceForge.net"=>"http://sourceforge.net/project/showfiles.php?group_id=10546",
+ "download-ISO Image from SourceForge.net"=>"http://surprise.sourceforge.net/download/surprise-rel7.iso.zip",
+ "link-Homepage on SourceForge.net"=>"http://surprise.sourceforge.net/",
+ "link-Project Page on SourceForge.net"=>"http://sourceforge.net/projects/surprise/",
+ "summary"=>"Partiton manager",
+ "license"=>"GPL",
+ "maintenance"=>"update",
+ "ownership"=>"Coauthor; development team of 5 people",
+ "language"=>"C",
+ "description"=>""
+ .'<p>Partition Surprise is a GPL partition managing software for Linux. Partition'
+ .'resizes, moves and conversions is implemented. Limited support of operations on'
+ .'mounted ext2-filesystem included as well.'
+ );
+
+1;
--- /dev/null
+# $Id$
+# automake source for the Makefile of project/surprise/ subdir
+# Copyright (C) 2003 Jan Kratochvil <project-www.jankratochvil.net@jankratochvil.net>
+#
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; exactly version 2 of June 1991 is required
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write to the Free Software
+# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+
+
+include $(top_srcdir)/Makefile-head.am
+
+EXTRA_DIST+= \
+ ListItem.pm \
+ index.html.pl
+
+noinst_DATA+= \
+ index.html
--- /dev/null
+#! /usr/bin/perl
+#
+# $Id$
+# Main page of 'My::Project::surprise'
+# Copyright (C) 2003 Jan Kratochvil <project-www.jankratochvil.net@jankratochvil.net>
+#
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; exactly version 2 of June 1991 is required
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write to the Free Software
+# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+
+
+require 5.6.0; # at least 'use warnings;' but we need some 5.6.0+ modules anyway
+use vars qw($VERSION $CVS_ID);
+$VERSION=do { my @r=(q$Revision$=~/\d+/g); sprintf "%d.".("%03d"x$#r),@r; };
+$CVS_ID=q$Id$;
+use strict;
+use warnings;
+
+use My::Web;
+use project::surprise::ListItem;
+
+
+My::Web->init_project(
+ "ListItem"=>\%My::Project::surprise::ListItem,
+ );
+
+print '<table border="0"><tr><td align="center">'.My::Web::img("surprise-gnome-0.gif","Gnome client").'</td></tr></table>'."\n";
+
+My::Web->footer();
--- /dev/null
+#! /usr/bin/perl
+#
+# $Id$
+# Definition of 'My::Project::tac_plus' for list.cgi.pl
+# Copyright (C) 2003 Jan Kratochvil <project-www.jankratochvil.net@jankratochvil.net>
+#
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; exactly version 2 of June 1991 is required
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write to the Free Software
+# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+
+
+package My::Project::tac_plus;
+require 5.6.0; # at least 'use warnings;' but we need some 5.6.0+ modules anyway
+use vars qw($VERSION $CVS_ID);
+$VERSION=do { my @r=(q$Revision$=~/\d+/g); sprintf "%d.".("%03d"x$#r),@r; };
+$CVS_ID=q$Id$;
+use strict;
+use warnings;
+
+
+our %ListItem=(
+ "name"=>"TACACS+ Server NAS Host Based Authorization",
+ "download-GTS rel.4 diff for TACACS+ v4.0.3"=>"tac_plus-F4.0.3.alpha.8.gts4.diff.gz",
+ "download-TACACS+ v4.0.3, Devrim Seral rel.8"=>"http://www.gazi.edu.tr/tacacs/index.php?page=download",
+ "link-CVS repository for GTS version"=>"http://cvs.jankratochvil.net/viewcvs/tac_plus/",
+ "summary"=>"Network server security",
+ "license"=>"PD",
+ "maintenance"=>"finished",
+ "language"=>"C patch",
+ "sponsor"=>"<a href=\"http://www.gtsgroup.cz/\">GTS</a>",
+ "description"=>""
+ .'<p>Patch provides complete freedom of specifying ANY'
+ .' configuration changes depending on the specific NAS the user is being logged'
+ .' on. This involves different enable password, NAS keys but now also: various'
+ .' specific commands, permitted services etc.</p>'
+ );
+
+1;
--- /dev/null
+# $Id$
+# automake source for the Makefile of project/tac_plus/ subdir
+# Copyright (C) 2003 Jan Kratochvil <project-www.jankratochvil.net@jankratochvil.net>
+#
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; exactly version 2 of June 1991 is required
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write to the Free Software
+# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+
+
+include $(top_srcdir)/Makefile-head.am
+
+EXTRA_DIST+= \
+ ListItem.pm \
+ index.html.pl
+
+noinst_DATA+= \
+ index.html
--- /dev/null
+#! /usr/bin/perl
+#
+# $Id$
+# Main page of 'My::Project::tac_plus'
+# Copyright (C) 2003 Jan Kratochvil <project-www.jankratochvil.net@jankratochvil.net>
+#
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; exactly version 2 of June 1991 is required
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write to the Free Software
+# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+
+
+require 5.6.0; # at least 'use warnings;' but we need some 5.6.0+ modules anyway
+use vars qw($VERSION $CVS_ID);
+$VERSION=do { my @r=(q$Revision$=~/\d+/g); sprintf "%d.".("%03d"x$#r),@r; };
+$CVS_ID=q$Id$;
+use strict;
+use warnings;
+
+use My::Web;
+use project::tac_plus::ListItem;
+
+
+My::Web->init_project(
+ "ListItem"=>\%My::Project::tac_plus::ListItem,
+ );
+
+print <<'HERE';
+<p>Supplied new version is a radical update from the coding view, major updates
+include:</p>
+<ul>
+<li>multiple "<code>member</code>" keyword memberships supported</li>
+<li>"<code>host</code>" entity unified with "<code>user</code>"/"<code>group</code>" entities</li>
+<li>"<code>when</code>" blocks implemented for NAS host based configuration</li>
+<li>all <code><a href="http://cvs.jankratochvil.net/viewcvs/tac_plus/Makefile.in">Makefile.in</a></code> options moved to
+ <code><a href="http://cvs.jankratochvil.net/viewcvs/tac_plus/configure.in">configure.in</a></code></li>
+<li><code><a href="http://cvs.jankratochvil.net/viewcvs/tac_plus/Makefile.in">Makefile.in</a></code> rewritten to
+ <i><a href="http://www.gnu.org/software/automake/automake.html">automake</a></i>
+ <code><a href="http://cvs.jankratochvil.net/viewcvs/tac_plus/Makefile.am">Makefile.am</a></code></li>
+</ul>
+HERE
+
+My::Web->footer();
--- /dev/null
+#! /usr/bin/perl
+#
+# $Id$
+# Definition of 'My::Project::tcp_rto' for list.cgi.pl
+# Copyright (C) 2003 Jan Kratochvil <project-www.jankratochvil.net@jankratochvil.net>
+#
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; exactly version 2 of June 1991 is required
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write to the Free Software
+# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+
+
+package My::Project::tcp_rto;
+require 5.6.0; # at least 'use warnings;' but we need some 5.6.0+ modules anyway
+use vars qw($VERSION $CVS_ID);
+$VERSION=do { my @r=(q$Revision$=~/\d+/g); sprintf "%d.".("%03d"x$#r),@r; };
+$CVS_ID=q$Id$;
+use strict;
+use warnings;
+
+
+our %ListItem=(
+ "name"=>"Linux Kernel Patch for Maximal Round-trip-time",
+ "download-Linux kernel 2.2.17 patch"=>"linux-2.2.17-tcp_rto-1.diff",
+ "download-Linux kernel 2.4.16 patch"=>"linux-2.4.16-tcp_rto-1.diff",
+ "summary"=>"Network workaround",
+ "license"=>"GPL",
+ "maintenance"=>"finished",
+ "language"=>"C patch",
+ "description"=>""
+ .'<p>This patch can solve your problems if you have network connection dropping too much'
+ .' packets. In standard case the Linux kernel will correctly increase our round-trip-time'
+ .' of connection slowing the transfer rate up to the unusable state.</p>'
+ .' <p>After applying this patch you can set your maximal round-trip-time in file'
+ .' "<b>/proc/sys/net/ipv4/tcp_rto_max</b>", it is expressed in <tt>Hz</tt>'
+ .' units (<tt>100-per-second</tt> on <i>x86</i> platform). You may need also to enlarge'
+ .' your maximal retry count in "<b>/proc/sys/net/ipv4/tcp_retries2</b>",'
+ .' otherwise <u>your</u> machine will reject the connection as it will have to retry'
+ .' the packets more than in sane states.</p>'
+ .' <p><font color="red">Please use this feature very carefully! You are violating'
+ .' <tt>RFC</tt> standards and you can get your network administrators to be very angry!</font></p>'
+ );
+
+1;
--- /dev/null
+# $Id$
+# automake source for the Makefile of project/tcp_rto/ subdir
+# Copyright (C) 2003 Jan Kratochvil <project-www.jankratochvil.net@jankratochvil.net>
+#
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; exactly version 2 of June 1991 is required
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write to the Free Software
+# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+
+
+include $(top_srcdir)/Makefile-head.am
+
+EXTRA_DIST+= \
+ ListItem.pm \
+ index.html.pl
+
+noinst_DATA+= \
+ index.html
--- /dev/null
+#! /usr/bin/perl
+#
+# $Id$
+# Main page of 'My::Project::tcp_rto'
+# Copyright (C) 2003 Jan Kratochvil <project-www.jankratochvil.net@jankratochvil.net>
+#
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; exactly version 2 of June 1991 is required
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write to the Free Software
+# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+
+
+require 5.6.0; # at least 'use warnings;' but we need some 5.6.0+ modules anyway
+use vars qw($VERSION $CVS_ID);
+$VERSION=do { my @r=(q$Revision$=~/\d+/g); sprintf "%d.".("%03d"x$#r),@r; };
+$CVS_ID=q$Id$;
+use strict;
+use warnings;
+
+use My::Web;
+use project::tcp_rto::ListItem;
+
+
+My::Web->init_project(
+ "ListItem"=>\%My::Project::tcp_rto::ListItem,
+ );
+
+My::Web->footer();
--- /dev/null
+diff -ru linux-2.2.17-cut-tcp_rto/include/linux/sysctl.h linux-2.2.17c/include/linux/sysctl.h
+--- linux-2.2.17-cut-tcp_rto/include/linux/sysctl.h Sat Jul 22 05:31:27 2000
++++ linux-2.2.17c/include/linux/sysctl.h Fri Sep 22 15:29:18 2000
+@@ -228,7 +228,8 @@
+ NET_IPV4_ICMP_IGNORE_BOGUS_ERROR_RESPONSES=64,
+ NET_IPV4_IGMP_MAX_MEMBERSHIPS=65,
+ NET_IPV4_ALWAYS_DEFRAG=67,
+- NET_IPV4_IP_MASQ_UDP_DLOOSE=68
++ NET_IPV4_IP_MASQ_UDP_DLOOSE=68,
++ NET_TCP_RTO_MAX=69,
+ };
+
+ enum {
+diff -ru linux-2.2.17-cut-tcp_rto/include/net/tcp.h linux-2.2.17c/include/net/tcp.h
+--- linux-2.2.17-cut-tcp_rto/include/net/tcp.h Fri May 5 22:25:17 2000
++++ linux-2.2.17c/include/net/tcp.h Fri Sep 22 16:08:55 2000
+@@ -558,6 +558,10 @@
+ extern __u32 cookie_v4_init_sequence(struct sock *sk, struct sk_buff *skb,
+ __u16 *mss);
+
++/* tcp_input.c */
++
++extern int sysctl_tcp_rto_max;
++
+ /* tcp_output.c */
+
+ extern void tcp_read_wakeup(struct sock *);
+diff -ru linux-2.2.17-cut-tcp_rto/net/ipv4/sysctl_net_ipv4.c linux-2.2.17c/net/ipv4/sysctl_net_ipv4.c
+--- linux-2.2.17-cut-tcp_rto/net/ipv4/sysctl_net_ipv4.c Sat Jul 22 05:31:27 2000
++++ linux-2.2.17c/net/ipv4/sysctl_net_ipv4.c Fri Sep 22 15:33:55 2000
+@@ -207,6 +207,8 @@
+ {NET_IPV4_IGMP_MAX_MEMBERSHIPS, "igmp_max_memberships",
+ &sysctl_igmp_max_memberships, sizeof(int), 0644, NULL, &proc_dointvec},
+ #endif
++ {NET_TCP_RTO_MAX, "tcp_rto_max",
++ &sysctl_tcp_rto_max, sizeof(int), 0644, NULL, &proc_dointvec},
+ {0}
+ };
+
+diff -ru linux-2.2.17-cut-tcp_rto/net/ipv4/tcp_input.c linux-2.2.17c/net/ipv4/tcp_input.c
+--- linux-2.2.17-cut-tcp_rto/net/ipv4/tcp_input.c Fri Sep 22 15:44:20 2000
++++ linux-2.2.17c/net/ipv4/tcp_input.c Fri Sep 22 15:42:44 2000
+@@ -83,6 +83,8 @@
+ int sysctl_tcp_stdurg;
+ int sysctl_tcp_rfc1337;
+
++int sysctl_tcp_rto_max = 120*HZ;
++
+ static int prune_queue(struct sock *sk);
+
+ /* There is something which you must keep in mind when you analyze the
+@@ -204,8 +206,8 @@
+ */
+ static __inline__ void tcp_bound_rto(struct tcp_opt *tp)
+ {
+- if (tp->rto > 120*HZ)
+- tp->rto = 120*HZ;
++ if (tp->rto > sysctl_tcp_rto_max)
++ tp->rto = sysctl_tcp_rto_max;
+ if (tp->rto < HZ/5)
+ tp->rto = HZ/5;
+ }
+@@ -682,7 +684,7 @@
+ tcp_clear_xmit_timer(sk, TIME_PROBE0);
+ } else {
+ tcp_reset_xmit_timer(sk, TIME_PROBE0,
+- min(tp->rto << tp->backoff, 120*HZ));
++ min(tp->rto << tp->backoff, sysctl_tcp_rto_max));
+ }
+ }
+
+diff -ru linux-2.2.17-cut-tcp_rto/net/ipv4/tcp_output.c linux-2.2.17c/net/ipv4/tcp_output.c
+--- linux-2.2.17-cut-tcp_rto/net/ipv4/tcp_output.c Fri Sep 22 15:44:20 2000
++++ linux-2.2.17c/net/ipv4/tcp_output.c Fri Sep 22 15:42:44 2000
+@@ -1174,5 +1174,5 @@
+ tp->backoff++;
+ tp->probes_out++;
+ tcp_reset_xmit_timer (sk, TIME_PROBE0,
+- min(tp->rto << tp->backoff, 120*HZ));
++ min(tp->rto << tp->backoff, sysctl_tcp_rto_max));
+ }
+diff -ru linux-2.2.17-cut-tcp_rto/net/ipv4/tcp_timer.c linux-2.2.17c/net/ipv4/tcp_timer.c
+--- linux-2.2.17-cut-tcp_rto/net/ipv4/tcp_timer.c Sat Jul 22 05:31:27 2000
++++ linux-2.2.17c/net/ipv4/tcp_timer.c Fri Sep 22 15:33:32 2000
+@@ -501,7 +501,7 @@
+ * the 120 second clamps though!
+ */
+ tp->backoff++;
+- tp->rto = min(tp->rto << 1, 120*HZ);
++ tp->rto = min(tp->rto << 1, sysctl_tcp_rto_max);
+ tcp_reset_xmit_timer(sk, TIME_RETRANS, tp->rto);
+
+ tcp_write_timeout(sk);
+@@ -566,7 +566,7 @@
+ #endif
+ timeo = min((TCP_TIMEOUT_INIT
+ << conn->retrans),
+- 120*HZ);
++ sysctl_tcp_rto_max);
+ conn->expires = now + timeo;
+ op = prev->dl_next;
+ tcp_synq_queue(tp, conn);
--- /dev/null
+diff -ru linux-2.4.16-cut-tcp_rto/include/linux/sysctl.h linux-2.4.16c/include/linux/sysctl.h
+--- linux-2.4.16-cut-tcp_rto/include/linux/sysctl.h Mon Dec 3 17:27:26 2001
++++ linux-2.4.16c/include/linux/sysctl.h Tue Nov 27 02:01:14 2001
+@@ -289,7 +289,8 @@
+ NET_TCP_ADV_WIN_SCALE=87,
+ NET_IPV4_NONLOCAL_BIND=88,
+ NET_IPV4_ICMP_RATELIMIT=89,
+- NET_IPV4_ICMP_RATEMASK=90
++ NET_IPV4_ICMP_RATEMASK=90,
++ NET_TCP_RTO_MAX=91,
+ };
+
+ enum {
+diff -ru linux-2.4.16-cut-tcp_rto/include/net/tcp.h linux-2.4.16c/include/net/tcp.h
+--- linux-2.4.16-cut-tcp_rto/include/net/tcp.h Wed Oct 17 21:09:41 2001
++++ linux-2.4.16c/include/net/tcp.h Tue Nov 27 02:12:29 2001
+@@ -331,7 +331,8 @@
+ #define TCP_DELACK_MIN 4U
+ #define TCP_ATO_MIN 4U
+ #endif
+-#define TCP_RTO_MAX ((unsigned)(120*HZ))
++#define TCP_RTO_MAX_init ((unsigned)(120*HZ))
++extern unsigned TCP_RTO_MAX;
+ #define TCP_RTO_MIN ((unsigned)(HZ/5))
+ #define TCP_TIMEOUT_INIT ((unsigned)(3*HZ)) /* RFC 1122 initial RTO value */
+
+diff -ru linux-2.4.16-cut-tcp_rto/net/ipv4/Makefile linux-2.4.16c/net/ipv4/Makefile
+--- linux-2.4.16-cut-tcp_rto/net/ipv4/Makefile Sun Nov 11 17:56:25 2001
++++ linux-2.4.16c/net/ipv4/Makefile Mon Dec 3 17:20:49 2001
+@@ -9,7 +9,7 @@
+
+ O_TARGET := ipv4.o
+
+-export-objs = ipip.o ip_gre.o
++export-objs = ipip.o ip_gre.o tcp_timer.o
+
+ obj-y := utils.o route.o inetpeer.o proc.o protocol.o \
+ ip_input.o ip_fragment.o ip_forward.o ip_options.o \
+diff -ru linux-2.4.16-cut-tcp_rto/net/ipv4/sysctl_net_ipv4.c linux-2.4.16c/net/ipv4/sysctl_net_ipv4.c
+--- linux-2.4.16-cut-tcp_rto/net/ipv4/sysctl_net_ipv4.c Sun Nov 11 17:56:25 2001
++++ linux-2.4.16c/net/ipv4/sysctl_net_ipv4.c Fri Nov 16 23:24:32 2001
+@@ -219,6 +219,8 @@
+ &sysctl_icmp_ratelimit, sizeof(int), 0644, NULL, &proc_dointvec},
+ {NET_IPV4_ICMP_RATEMASK, "icmp_ratemask",
+ &sysctl_icmp_ratemask, sizeof(int), 0644, NULL, &proc_dointvec},
++ {NET_TCP_RTO_MAX, "tcp_rto_max",
++ &TCP_RTO_MAX, sizeof(unsigned), 0644, NULL, &proc_dointvec},
+ {0}
+ };
+
+diff -ru linux-2.4.16-cut-tcp_rto/net/ipv4/tcp_timer.c linux-2.4.16c/net/ipv4/tcp_timer.c
+--- linux-2.4.16-cut-tcp_rto/net/ipv4/tcp_timer.c Wed Oct 17 21:09:42 2001
++++ linux-2.4.16c/net/ipv4/tcp_timer.c Mon Dec 3 17:21:52 2001
+@@ -21,6 +21,7 @@
+ */
+
+ #include <net/tcp.h>
++#include <linux/module.h>
+
+ int sysctl_tcp_syn_retries = TCP_SYN_RETRIES;
+ int sysctl_tcp_synack_retries = TCP_SYNACK_RETRIES;
+@@ -30,6 +31,8 @@
+ int sysctl_tcp_retries1 = TCP_RETR1;
+ int sysctl_tcp_retries2 = TCP_RETR2;
+ int sysctl_tcp_orphan_retries;
++unsigned TCP_RTO_MAX = TCP_RTO_MAX_init;
++EXPORT_SYMBOL(TCP_RTO_MAX);
+
+ static void tcp_write_timer(unsigned long);
+ static void tcp_delack_timer(unsigned long);
--- /dev/null
+#! /usr/bin/perl
+#
+# $Id$
+# Definition of 'My::Project::tcpdump' for list.cgi.pl
+# Copyright (C) 2003 Jan Kratochvil <project-www.jankratochvil.net@jankratochvil.net>
+#
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; exactly version 2 of June 1991 is required
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write to the Free Software
+# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+
+
+package My::Project::tcpdump;
+require 5.6.0; # at least 'use warnings;' but we need some 5.6.0+ modules anyway
+use vars qw($VERSION $CVS_ID);
+$VERSION=do { my @r=(q$Revision$=~/\d+/g); sprintf "%d.".("%03d"x$#r),@r; };
+$CVS_ID=q$Id$;
+use strict;
+use warnings;
+
+
+our %ListItem=(
+ "name"=>"tcpdump ASCII Dump Patch",
+ "download"=>"tcpdump-3.4-ASCIIdump.diff",
+ "download-tcpdump-3.4"=>"ftp://ftp.ee.lbl.gov/tcpdump-3.4.tar.Z",
+ "summary"=>"tcpdump readability patch",
+ "license"=>"PD",
+ "maintenance"=>"finished",
+ "language"=>"C patch",
+ "description"=>""
+ .'<p>Makes the text messages of tcpdump(1) readable when option <code>-x</code> is used.</p>'
+ );
+
+1;
--- /dev/null
+# $Id$
+# automake source for the Makefile of project/tcpdump/ subdir
+# Copyright (C) 2003 Jan Kratochvil <project-www.jankratochvil.net@jankratochvil.net>
+#
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; exactly version 2 of June 1991 is required
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write to the Free Software
+# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+
+
+include $(top_srcdir)/Makefile-head.am
+
+EXTRA_DIST+= \
+ ListItem.pm \
+ index.html.pl
+
+noinst_DATA+= \
+ index.html
--- /dev/null
+#! /usr/bin/perl
+#
+# $Id$
+# Main page of 'My::Project::tcpdump'
+# Copyright (C) 2003 Jan Kratochvil <project-www.jankratochvil.net@jankratochvil.net>
+#
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; exactly version 2 of June 1991 is required
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write to the Free Software
+# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+
+
+require 5.6.0; # at least 'use warnings;' but we need some 5.6.0+ modules anyway
+use vars qw($VERSION $CVS_ID);
+$VERSION=do { my @r=(q$Revision$=~/\d+/g); sprintf "%d.".("%03d"x$#r),@r; };
+$CVS_ID=q$Id$;
+use strict;
+use warnings;
+
+use My::Web;
+use project::tcpdump::ListItem;
+
+
+My::Web->init_project(
+ "ListItem"=>\%My::Project::tcpdump::ListItem,
+ );
+
+print <<'HERE';
+<p>From original raw hex output it now looks as in example:</p>
+
+<pre>
+23:37:18.938498 localhost.telnet > localhost.2000: P 131:163(32) ack 105 win 310
+72 <nop,nop,timestamp 10304399 10304297> (DF)
+ 0=$0000: 45 00 00 54 42 73 40 00 40 06 FA 2E 7F 00 00 01 | E..TBs@.@.......
+ 16=$0010: 7F 00 00 01 00 17 07 D0 CC BD 44 71 CD 68 D7 9E | ..........Dq.h..
+ 32=$0020: 80 18 79 60 6B A2 00 00 01 01 08 0A 00 9D 3B 8F | ..y`k.........;.
+ 48=$0030: 00 9D 3B 29 4C 6F 67 69 6E 20 69 6E 63 6F 72 72 | ..;)Login incorr
+ 64=$0040: 65 63 74 0D 0A 0D 0A 73 68 6F 72 74 20 6C 6F 67 | ect....short log
+ 80=$0050: 69 6E 3A 20 | in:
+</pre>
+HERE
+
+My::Web->footer();
--- /dev/null
+--- tcpdump-3.4a5-orig/tcpdump.c Sat May 30 12:23:33 1998
++++ tcpdump-3.4a5/tcpdump.c Tue Dec 15 15:26:36 1998
+@@ -405,22 +406,31 @@
+ void
+ default_print_unaligned(register const u_char *cp, register u_int length)
+ {
+- register u_int i, s;
+- register int nshorts;
++ register u_int i,offs=0;
+
+- nshorts = (u_int) length / sizeof(u_short);
+- i = 0;
+- while (--nshorts >= 0) {
+- if ((i++ % 8) == 0)
+- (void)printf("\n\t\t\t");
+- s = *cp++;
+- (void)printf(" %02x%02x", s, *cp++);
+- }
+- if (length & 1) {
+- if ((i % 8) == 0)
+- (void)printf("\n\t\t\t");
+- (void)printf(" %02x", *cp);
+- }
++#define prBYTES 16
++
++ while (length) {
++ printf("\n%5u=$%04X: ",offs,offs);
++ for (i=0;i<prBYTES;i++) {
++ if (i<length) printf("%02X ",cp[i]);
++ else fputs(" ",stdout);
++ if ((i&7)==7 && i!=prBYTES-1) putchar(' ');
++ }
++ fputs("| ",stdout);
++ for (i=0;i<prBYTES && i<length;i++)
++ if (cp[i]>=0x20 && cp[i]<0x7F) putchar(cp[i]);
++ else putchar('.');
++ length-=i;
++ cp+=i;
++ offs+=i;
++// For trailing ASCII space padding (too wide!)
++#if 0
++ while (i++<prBYTES) putchar(' ');
++ fputs(" |",stdout);
++#endif
++ }
++#undef prBYTES
+ }
+
+ /*
+@@ -431,27 +441,7 @@
+ void
+ default_print(register const u_char *bp, register u_int length)
+ {
+- register const u_short *sp;
+- register u_int i;
+- register int nshorts;
+-
+- if ((long)bp & 1) {
+- default_print_unaligned(bp, length);
+- return;
+- }
+- sp = (u_short *)bp;
+- nshorts = (u_int) length / sizeof(u_short);
+- i = 0;
+- while (--nshorts >= 0) {
+- if ((i++ % 8) == 0)
+- (void)printf("\n\t\t\t");
+- (void)printf(" %04x", ntohs(*sp++));
+- }
+- if (length & 1) {
+- if ((i % 8) == 0)
+- (void)printf("\n\t\t\t");
+- (void)printf(" %02x", *(u_char *)sp);
+- }
++ default_print_unaligned(bp, length);
+ }
+
+ __dead void
--- /dev/null
+#! /usr/bin/perl
+#
+# $Id$
+# Definition of 'My::Project::timeplan' for list.cgi.pl
+# Copyright (C) 2003 Jan Kratochvil <project-www.jankratochvil.net@jankratochvil.net>
+#
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; exactly version 2 of June 1991 is required
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write to the Free Software
+# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+
+
+package My::Project::timeplan;
+require 5.6.0; # at least 'use warnings;' but we need some 5.6.0+ modules anyway
+use vars qw($VERSION $CVS_ID);
+$VERSION=do { my @r=(q$Revision$=~/\d+/g); sprintf "%d.".("%03d"x$#r),@r; };
+$CVS_ID=q$Id$;
+use strict;
+use warnings;
+
+
+our %ListItem=(
+ "name"=>"Time Log Summarizer",
+ "download"=>"timeplan-1.0.1.tar.gz",
+ "summary"=>"Time management",
+ "license"=>"PD",
+ "maintenance"=>"finished",
+ "language"=>"C",
+ "description"=>""
+ .'<p>Software to do summaries of time log - what have you spent much time on.'
+ .' The greatest effect to me was just the writing of such time log: Consecutively'
+ .' you do not spend such time on useless issues as you would be forced to write'
+ .' such event to your log.</p>'
+ );
+
+1;
--- /dev/null
+# $Id$
+# automake source for the Makefile of project/timeplan/ subdir
+# Copyright (C) 2003 Jan Kratochvil <project-www.jankratochvil.net@jankratochvil.net>
+#
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; exactly version 2 of June 1991 is required
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write to the Free Software
+# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+
+
+include $(top_srcdir)/Makefile-head.am
+
+EXTRA_DIST+= \
+ ListItem.pm \
+ index.html.pl
+
+noinst_DATA+= \
+ index.html
--- /dev/null
+#! /usr/bin/perl
+#
+# $Id$
+# Main page of 'My::Project::timeplan'
+# Copyright (C) 2003 Jan Kratochvil <project-www.jankratochvil.net@jankratochvil.net>
+#
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; exactly version 2 of June 1991 is required
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write to the Free Software
+# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+
+
+require 5.6.0; # at least 'use warnings;' but we need some 5.6.0+ modules anyway
+use vars qw($VERSION $CVS_ID);
+$VERSION=do { my @r=(q$Revision$=~/\d+/g); sprintf "%d.".("%03d"x$#r),@r; };
+$CVS_ID=q$Id$;
+use strict;
+use warnings;
+
+use My::Web;
+use project::timeplan::ListItem;
+
+
+My::Web->init_project(
+ "ListItem"=>\%My::Project::timeplan::ListItem,
+ );
+
+My::Web->footer();
--- /dev/null
+#! /usr/bin/perl
+#
+# $Id$
+# Definition of 'My::Project::vblib' for list.cgi.pl
+# Copyright (C) 2003 Jan Kratochvil <project-www.jankratochvil.net@jankratochvil.net>
+#
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; exactly version 2 of June 1991 is required
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write to the Free Software
+# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+
+
+package My::Project::vblib;
+require 5.6.0; # at least 'use warnings;' but we need some 5.6.0+ modules anyway
+use vars qw($VERSION $CVS_ID);
+$VERSION=do { my @r=(q$Revision$=~/\d+/g); sprintf "%d.".("%03d"x$#r),@r; };
+$CVS_ID=q$Id$;
+use strict;
+use warnings;
+
+
+our %ListItem=(
+ "name"=>"Variable Buffers Library",
+ "download"=>"vblib-1.0.0.tar.gz",
+ "summary"=>"Streams library",
+ "license"=>"PD",
+ "maintenance"=>"finished",
+ "language"=>"C",
+ "sponsorship"=>"<a href=\"http://www.princip.cz/\">Princip, a.s.</a>",
+ "description"=>""
+ .'<p>Enables application to easily do input/output functions (like'
+ .' read/write, printf etc.) with memory streams while using performance effective'
+ .' functions. Simple buffer copying/moving would be possible but it would case a'
+ .' major performance hit if not using algorithms implemented in this library.</p>'
+ );
+
+1;
--- /dev/null
+# $Id$
+# automake source for the Makefile of project/vblib/ subdir
+# Copyright (C) 2003 Jan Kratochvil <project-www.jankratochvil.net@jankratochvil.net>
+#
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; exactly version 2 of June 1991 is required
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write to the Free Software
+# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+
+
+include $(top_srcdir)/Makefile-head.am
+
+EXTRA_DIST+= \
+ ListItem.pm \
+ index.html.pl
+
+noinst_DATA+= \
+ index.html
--- /dev/null
+#! /usr/bin/perl
+#
+# $Id$
+# Main page of 'My::Project::vblib'
+# Copyright (C) 2003 Jan Kratochvil <project-www.jankratochvil.net@jankratochvil.net>
+#
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; exactly version 2 of June 1991 is required
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write to the Free Software
+# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+
+
+require 5.6.0; # at least 'use warnings;' but we need some 5.6.0+ modules anyway
+use vars qw($VERSION $CVS_ID);
+$VERSION=do { my @r=(q$Revision$=~/\d+/g); sprintf "%d.".("%03d"x$#r),@r; };
+$CVS_ID=q$Id$;
+use strict;
+use warnings;
+
+use My::Web;
+use project::vblib::ListItem;
+
+
+My::Web->init_project(
+ "ListItem"=>\%My::Project::vblib::ListItem,
+ );
+
+My::Web->footer();
--- /dev/null
+#! /usr/bin/perl
+#
+# $Id$
+# Definition of 'My::Project::winvnc' for list.cgi.pl
+# Copyright (C) 2003 Jan Kratochvil <project-www.jankratochvil.net@jankratochvil.net>
+#
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; exactly version 2 of June 1991 is required
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write to the Free Software
+# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+
+
+package My::Project::winvnc;
+require 5.6.0; # at least 'use warnings;' but we need some 5.6.0+ modules anyway
+use vars qw($VERSION $CVS_ID);
+$VERSION=do { my @r=(q$Revision$=~/\d+/g); sprintf "%d.".("%03d"x$#r),@r; };
+$CVS_ID=q$Id$;
+use strict;
+use warnings;
+
+
+our %ListItem=(
+ "name"=>"Patch for Secret WinVNC Server Run",
+ "download-already patched version 3.3.3r7"=>"vnc-3.3.3r7_x86_win32-exe-SECRET.zip",
+ "download-original version 3.3.3r7"=>"http://www.uk.research.att.com/vnc/dist/vnc-3.3.3r7_x86_win32.zip",
+ "link-VNC Homepage"=>"http://www.uk.research.att.com/vnc/",
+ "summary"=>"Patch to hide WinVNC",
+ "license"=>"PD",
+ "maintenance"=>"finished",
+ "language"=>"i386 asm patch",
+ "description"=>""
+ .'<p>If you install <i>WinVNC</i> in'
+ .' <a href="http://www.microsoft.com/">MS</a> <a href="http://www.microsoft.com/windows/">Windows</a>'
+ .' environment, you will notice that it creates its own small icon in <i>System Tray</i>.'
+ .' Sometimes you want to get rid of this visible icon and you cannot remove it by any configuration'
+ .' settings.</p>'
+ );
+
+1;
--- /dev/null
+# $Id$
+# automake source for the Makefile of project/winvnc/ subdir
+# Copyright (C) 2003 Jan Kratochvil <project-www.jankratochvil.net@jankratochvil.net>
+#
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; exactly version 2 of June 1991 is required
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write to the Free Software
+# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+
+
+include $(top_srcdir)/Makefile-head.am
+
+EXTRA_DIST+= \
+ ListItem.pm \
+ index.html.pl
+
+noinst_DATA+= \
+ index.html
--- /dev/null
+#! /usr/bin/perl
+#
+# $Id$
+# Main page of 'My::Project::winvnc'
+# Copyright (C) 2003 Jan Kratochvil <project-www.jankratochvil.net@jankratochvil.net>
+#
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; exactly version 2 of June 1991 is required
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write to the Free Software
+# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+
+
+require 5.6.0; # at least 'use warnings;' but we need some 5.6.0+ modules anyway
+use vars qw($VERSION $CVS_ID);
+$VERSION=do { my @r=(q$Revision$=~/\d+/g); sprintf "%d.".("%03d"x$#r),@r; };
+$CVS_ID=q$Id$;
+use strict;
+use warnings;
+
+use My::Web;
+use project::winvnc::ListItem;
+
+
+My::Web->init_project(
+ "ListItem"=>\%My::Project::winvnc::ListItem,
+ );
+
+print <<'HERE';
+<p>Here is the table for bytes to patch in <tt>WinVNC.exe</tt> from <tt>vnc-3.3.3r7_x86_win32.zip</tt>.
+You are not interested in this table if you download the <a href="vnc-3.3.3r7_x86_win32-exe-SECRET.zip">already patched
+.EXE file</a> referenced in the heading.</p>
+<table border="1" align="center">
+<tr><th></th><th>File offset</th><th>Hex bytes</th></tr>
+<tr><td>original</td> <td><tt>0000C9F0</tt></td><td align="right"> 53 55 56 8B F1 57 8B 46 60 C7 46 68 58 00 00 00</td></tr>
+<tr><td>'SECRET' patched</td><td><tt>0000C9F0</tt></td><td align="right"><b>C2 08 00</b> 8B F1 57 8B 46 60 C7 46 68 58 00 00 00</td></tr>
+</table>
+<p>Here you can check whether your patch was successful:</p>
+<table border="1" align="center">
+<tr><th>File from package 3.3.3r7</th><th>MD5 sum</th></tr>
+<tr><td><tt>WinVNC.exe</tt>, original</td> <td><tt>d8d9d04901a4896f278d59a1cdc99aef</tt></td></tr>
+<tr><td><tt>WinVNC.exe</tt>, 'SECRET' patched</td><td><tt>8423b8f9598893b517a4f5eebbf0749b</tt></td></tr>
+</table>
+HERE
+
+My::Web->footer();
--- /dev/null
+#! /usr/bin/perl
+#
+# $Id$
+# Definition of 'My::Project::wllib' for list.cgi.pl
+# Copyright (C) 2003 Jan Kratochvil <project-www.jankratochvil.net@jankratochvil.net>
+#
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; exactly version 2 of June 1991 is required
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write to the Free Software
+# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+
+
+package My::Project::wllib;
+require 5.6.0; # at least 'use warnings;' but we need some 5.6.0+ modules anyway
+use vars qw($VERSION $CVS_ID);
+$VERSION=do { my @r=(q$Revision$=~/\d+/g); sprintf "%d.".("%03d"x$#r),@r; };
+$CVS_ID=q$Id$;
+use strict;
+use warnings;
+
+
+our %ListItem=(
+ "name"=>"Line drawing Crossplatform Library",
+ "download"=>"wllib-1.0.0.tar.gz",
+ "summary"=>"Graphics library",
+ "license"=>"PD",
+ "maintenance"=>"obsolete",
+ "obsoleted"=>"All supported engines no longer being used as they are",
+ "language"=>"C",
+ "description"=>""
+ .'<p>This library should make you generically use line drawing on the following platforms:'
+ .' <a href="http://www.x.org/">UNIX/X Windows System X11</a>,'
+ .' <a href="http://www.svgalib.org/">UNIX/SVGAlib</a> and'
+ .' <a href="http://www.amiga.com/">AmigaOS</a>.</p>'
+ );
+
+1;
--- /dev/null
+# $Id$
+# automake source for the Makefile of project/wllib/ subdir
+# Copyright (C) 2003 Jan Kratochvil <project-www.jankratochvil.net@jankratochvil.net>
+#
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; exactly version 2 of June 1991 is required
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write to the Free Software
+# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+
+
+include $(top_srcdir)/Makefile-head.am
+
+EXTRA_DIST+= \
+ ListItem.pm \
+ index.html.pl
+
+noinst_DATA+= \
+ index.html
--- /dev/null
+#! /usr/bin/perl
+#
+# $Id$
+# Main page of 'My::Project::wllib'
+# Copyright (C) 2003 Jan Kratochvil <project-www.jankratochvil.net@jankratochvil.net>
+#
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; exactly version 2 of June 1991 is required
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write to the Free Software
+# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+
+
+require 5.6.0; # at least 'use warnings;' but we need some 5.6.0+ modules anyway
+use vars qw($VERSION $CVS_ID);
+$VERSION=do { my @r=(q$Revision$=~/\d+/g); sprintf "%d.".("%03d"x$#r),@r; };
+$CVS_ID=q$Id$;
+use strict;
+use warnings;
+
+use My::Web;
+use project::wllib::ListItem;
+
+
+My::Web->init_project(
+ "ListItem"=>\%My::Project::wllib::ListItem,
+ );
+
+My::Web->footer();
--- /dev/null
+#! /usr/bin/perl
+#
+# $Id$
+# Definition of 'My::Project::xbill' for list.cgi.pl
+# Copyright (C) 2003 Jan Kratochvil <project-www.jankratochvil.net@jankratochvil.net>
+#
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; exactly version 2 of June 1991 is required
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write to the Free Software
+# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+
+
+package My::Project::xbill;
+require 5.6.0; # at least 'use warnings;' but we need some 5.6.0+ modules anyway
+use vars qw($VERSION $CVS_ID);
+$VERSION=do { my @r=(q$Revision$=~/\d+/g); sprintf "%d.".("%03d"x$#r),@r; };
+$CVS_ID=q$Id$;
+use strict;
+use warnings;
+
+
+our %ListItem=(
+ "name"=>"Classic xBill game",
+ "link-Download from SourceForge.net"=>"http://sourceforge.net/project/showfiles.php?group_id=10700",
+ "link-Homepage on SourceForge.net"=>"http://xbill.sourceforge.net/",
+ "summary"=>"Graphical game",
+ "license"=>"GPL",
+ "maintenance"=>"finished",
+ "language"=>"C",
+ "description"=>""
+ .'<p>Almost-rewritten <a href="ftp://ftp.x.org/contrib/games/xbill-2.0.tgz">classical xBill game</a>,'
+ .' this project has been moved to <a href="http://sourceforge.net/">SourceForge</a>.'
+ .' Please refer to the <a href="http://xbill.sourceforge.net/">page linked above</a>'
+ .' to have further access to it.</p>'
+ );
+
+1;
--- /dev/null
+# $Id$
+# automake source for the Makefile of project/xbill/ subdir
+# Copyright (C) 2003 Jan Kratochvil <project-www.jankratochvil.net@jankratochvil.net>
+#
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; exactly version 2 of June 1991 is required
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write to the Free Software
+# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+
+
+include $(top_srcdir)/Makefile-head.am
+
+EXTRA_DIST+= \
+ ListItem.pm \
+ index.html.pl
+
+noinst_DATA+= \
+ index.html
--- /dev/null
+#! /usr/bin/perl
+#
+# $Id$
+# Main page of 'My::Project::xbill'
+# Copyright (C) 2003 Jan Kratochvil <project-www.jankratochvil.net@jankratochvil.net>
+#
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; exactly version 2 of June 1991 is required
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write to the Free Software
+# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+
+
+require 5.6.0; # at least 'use warnings;' but we need some 5.6.0+ modules anyway
+use vars qw($VERSION $CVS_ID);
+$VERSION=do { my @r=(q$Revision$=~/\d+/g); sprintf "%d.".("%03d"x$#r),@r; };
+$CVS_ID=q$Id$;
+use strict;
+use warnings;
+
+use My::Web;
+use project::xbill::ListItem;
+
+
+My::Web->init_project(
+ "ListItem"=>\%My::Project::xbill::ListItem,
+ );
+
+My::Web->footer();
--- /dev/null
+User-agent: *
+Disallow: