summaryrefslogtreecommitdiff
path: root/README
blob: 75498f2b0399d4dbdd012fed1a243b26dad25dd1 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
yChat; Homepage: www.yChat.org; Version 0.7.9-RELEASE

Copyright (C) 2003 Paul C. Buetow, Volker Richter
Copyright (C) 2004, 2005 Paul C. Buetow
-----------------------------------------------------------------
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.
-----------------------------------------------------------------

YCHAT TABLE OF CONTENTS: 

0.0.0 ABOUT RELEASES 
0.0.1 YCHAT FEATURES //<<
1.0.0 REQUIREMENTS
1.1.0 TESTED PLATFORMS
1.2.0 IMPORTANT NOTICES
1.3.0 HOW TO OBTAIN YCHAT
1.3.1 INSTALLATION
1.3.2 INSTALLATION QUICK-START
1.3.3 MYSQL SETUP //<<
1.4.0 HOW TO USE SCREEN WITH YCHAT
1.4.1 HOW TO USE SIGNALS WITH YCHAT
1.5.0 CUSTOMIZATION
1.6.0 FILES
1.7.0 WRITING BUG REPORTS
1.8.0 CONTACT
1.9.0 YHTTPD CODE BASE GENERATION //<<
2.0.0 LICENSE

0.0.0 ABOUT RELEASES 

There are several projects involved:

- The chat -
Its a HTTP based chat server written in C++. Clients are normal web browsers 
such as MSIE or Gecko based browsers using only CSS, HTML and JavaScript.

- The httpd -
Its a small http server based on the chat's socket and threading engine.
yhttpd does not have as much features but is easy to use and faster than
apache. yhttpd is a subset of the chat. It can be generated using the
srcipts/yhttpdbase.pl script in the chat's source tree.

- The ycurses -
ycurses is a easy to use and small C++ wrapper of the C ncurses API. The

There are different branches:

- CURRENT - 
The CURRENT branch is unstable, this is the bleeding developing edge with 
all the new experimental features.

A RELEASE of CURRENT can be referred as CURRENTRELEASE.

- STABLE -
The STABLE branch is more stable than CURRENT. This branch may get new
features as well. But those will be more conservative compared to 
CURRENT.

A RELEASE of STABLE can be referred as STABLERELEASE.

- LEGACY -
The LEGACY branch has no real support. This branch may get bugfixes and
updates and might get minor improvements. But there is no garuantee to
be bug free and stable at all. LEGACY versions are of historic meaning. 

- DEVEL -
DEVEL is only a meta name. If a version is labeled with DEVEL, then its
currently undefined if this is a CURRENT, STABLE or LEGACY branch. It
can be everything. Commonly DEVEL versions are CURRENT. 

There are also releases made:

- RELEASE -
There can be RELEASEs made out of each branch. While a branch can get
new features, a RELEASE can not. A RELEASE of a branch is just like
a snapshot. RELEASEs are complete versions to test and use. But keep
in mind, that a RELEASE of the STABLE branch is recommended over a
RELEASE of a CURRENT or a LEGACY branch in a production environment.
RELEASEs of CURRENT are still the bleeding edge and RELEASEs of LEGACY
may be out of date.

//<<*
0.0.1 YCHAT FEATURES

- Its free & portable -
yChat is developed under the GNU general public license and is based on GNU 
tools (gcc, gmake), other open source library stuff (such as libncurses etc.)
and should run on any POSIX capable operating system (such as all Linux based 
systems, FreeBSD, NetBSD, OpenBSD and other BSD-Systems and on UNICES like 
IRIX, HP-UX, Solaris etc.).

- There is no need for special chat clients -
yChat is web based, that means clients may only connect to the chat server 
with an normal web browser such as Microsoft Internet Explorer or any Gecko-
Engine powerd browsers like Mozilla, Firefox, Camino etc.

- It has features of a real HTTP webserver -
yChat runs completely stand alone and does not need another webserver to build
on like Apache and does not need to be run via any kind of CGI. yChat creates 
its own socket on a customized port (standard port: 2000) and seems to be a full
featured HTTP web server to the clients (web browsers). 

The yChat code base can be converted to an yhttpd code base automaticaly. yhttpd
is the webserver subset of yChat which runs completely stand alone and provides
normal websites to the net. It also supports Common Gateway Interface (CGI)
scripting.

- Its fast and secure -
yChat is written in C++ which is faster than any Java based Chat-Server or any
server written in a scripting language like PHP, Python or Perl. As the
internal data structures hash maps are used to garuantee searching certain
values in O(1) amount of time. If a hash maps gets full, it will be rehashed.
Currently, yChat has been measured providing over 1000 hits/requests per second 
on a FreeBSD based server box while using less than 2% of CPU usage
on a Athlon XP 1900+. Performance seems to be limited by your bandwith only. 
Also, each user gets its own session id (random string) with a standard length 
of 50 chars to authenticate each logged in user. The length of the session id 
can be redefined as well. Also, the session id will get md5-hashed optionally 
so thats even harder to reverse engineering the session ids of other users.

- Its HTML template based and easy to customize via XML based configuration -
All HTML sites are predefined as HTML-Template files and can be easily modified
to use with an customized web design. Also, a lot of yChat preferences can be
set in the main configuration file (ychat.conf). ychat.conf is completely written
in XML 1.0 which makes it easier to use the configuration options in programs of
3rd persons which may want to write some usefull tools for yChat.
yChat caches all HTML and web images to improve overall performance. If needed, the
cache can be cleared to recache new versions of the template files.

- Its language template based -
The administrator can easily create a new language in which all system messages
appear to the Chat-User. The predefined languages is english but others can be
added easily. The language can be edited in the XML based configuration file.

- MySQL based database -
Registered users are stored in a MySQL database. C++ Programmers may feel free
to replace the database wrapper class (data.h) with another database routines
to use other databases such as PostgreSQL, SQLite or a text based database etc.
If wished, you can disable database support in the pre-compile options.

- It has an administration interface -
yChat includes an ncurses based administration interface which tracks some
interesting statistics and system messages and enables you to do certain
administrative tasks. In addition, you can switch to the CLI (command line
interface) mode of the administration interface in order to be provided with
more available functions (like keeping track of the current system usage etc.).
If you dont like ncurses and/or the CLI you can disable both options in the pre-
compile options. 

- It has logging capabilities -
The logging manager keeps track to all yChat system messages (such as users 
wich log in and out, modules which are loaded, MySQL queries etc.). Also, an
Apache-Style combined log file format is created by yChat (you can parse this
logfile with any Apache logfile parser like awstats etc.). And last but not
least, all public messages of all available rooms will be logged to disk as 
well . To improve performance, you can define the logging puffer (standardly
new logs will be written to disk after each 20 lines). If you want to log
everything immediately, you can reset this option to 1 in ychat.conf.

- Its modular through own command and dynamic HTML engine -
All chat commands are realized through dynamic loadable module files which can
be recompiled and reloaded without restarting the whole yChat server. Also 
HTML-Sites with certain tasks can be compiled as a module like 
mods/html/yc_register.so, mods/html/yc_options.so and mods/html/yc_colors.so
etc. so you can also program your dynamic yChat websites in C++.

- Its multi threaded (POSIX threads) -
There is only one main process which spawns several threads, each for its own
unique task. For example one thread is used to handle the socket manager which
waits for incoming TCP/IP requests, another thread schedules the system timer
which proves if clients are still active or frees not needed memory in certain
time intervals (see also "Garbage collector"). Also, each Chat-User gets it own
thread. There is no need of memory wastage by creating for each task a new
process. All User-Threads are managed by a thread pool to avoid CPU wastage
creating every time a new thread by reusing thread objects which have done its
jobs already and have been readded into the queue of the thread pool. The 
standard sizes of the queue and the total pool size can be set in ychat.conf.

- Its using a smart garbage collection engine -
All users and rooms which dont have to be kept in the main memory (because the
user has logged out or the room has been destroyed because it was empty) will
not be deleted immediately but be placed for about 10 minutes in the yChat
garbage collector. Each time a new room is created the systems checks the
garbage to reuse an inactive room object. If a certain user wants to log in, the
system checks if he is already present in the garbage collector. If yes, he will
be reactivated without wasting expensive database queries to fetch the user's
options. This improves overall performance on heavily loaded yChat servers if a
lot of user and room objects are created and destroyed frequently.
//*>>

1.0.0 REQUIREMENTS: 

- GNU GCC G++  
  The GNU C++ compiler version 3.1 or up.

- GNU make 3.80 (gmake) or higher
  If you dont have a gmake executable but make is gnu make then you need
  to add a symlink or alias from gmake to make.
  yChat Makefiles only have been tested with GNU make and may not work with
  other make versions.

- SGI STL extension 
  Includes ext/hash_map which may be already default on every Linux distro.
  On *BSD you have to install it first before compiling. On FreeBSD
  /usr/ports/devel/stlport is your friend.

//<<*
- mysql-client 4.x (3.x may do too but is not supported)
  Includes libmysqlclient and the mysql.h header files.

//*>>
- ncurses 5.x   
  Includes libncurses and the ncurses.h header files.

- Screen
  Only needed if yChat should run in background with
  ncurses or CLI enabled.

- Perl 5.x
  Is needed for some scripts. Is not needed if you use precompiled binaries.

1.1.0 TESTED PLATFORMS:

The following platforms have been tested with success. If you find out that
a listed platform did not work at all please contact me:

  Operating system (arch)	GNU G++		GNU make
- FreeBSD 5.3-RELEASE (i386)	3.4.2		3.80

  Tested longer time before:
- FreeBSD 5.2.1-RELEASE (i386)	3.3.3 		3.80		
- FreeBSD 4.10-RELEASE (i386)	3.4.1		3.80
- FreeBSD 4.9-RELEASE (i386)	3.3.4		3.80
- Gentoo Linux 2004 (i386)	3.3.2		3.80
- OpenBSD 3.6 SMP (i386)	3.3.2		3.80
- Red Hat Linux 8.0 SMP	(i386)	3.2-7		3.79
- Slackware Linux 10.0 (i386)	3.4.0		3.80 
- SUSE Linux 9.0 (i386)		3.3.1		3.80
- SUSE Linux 8.1 (i386)		3.2		3.79.1

Other platforms like Linux based systems, other BSD-Systems or UNICES
are very likely to work too. 

1.2.0 IMPORTANT NOTICES:

Before you compile the source you have to be sure to use at least GCC
version 3.1 with pthreads enabled. ( Type gcc -v to check it ).
GCC 2.95 and 3.0 did not work while testing and WON'T BE SUPPORTED!
If you like to support yChat, please write us an email and tell what 
you can/like/would help ;-]. Please also take a look at the yChat
homepage which is located at http://www.yChat.org.

1.3.0 HOW TO OBTAIN YCHAT:

yChat can be downloaded as a source package or through CVS. 

The packages are located at http://www.yChat.org -> Sourcecode -> 
Packages or go to http://pub.buetow.org/yChat/CPP-yChat .

For CVS download type:

cvs -d:pserver:anonymous@buetow.org:/usr/home/cvs/cvsroot login
( You will be asked for a password. Use "just enter" ).

vs -z3 -d:pserver:anonymous@buetow.org:/usr/home/cvs/cvsroot co BRANCH
( The sources will be copied into your local folder )

cvs -d:pserver:anonymous@buetow.org:/usr/home/cvs/cvsroot logout
( Logs your CVS session out ).

Now you may continue with the installation.

here are different branches in the CVS:

ychat: This is the latest CURRENT branch of yChat.
ychat-stable: This is the latest STABLE branch of yChat.
ychat-X.Y: This is the branch with the specified version prefix.
yhttpd: This is the latest CURRENT snapshot of yhttpd.

The CURRENT branch of ychat is mostly untested and unstable, so don't 
cry if you get errors.

1.3.1 INSTALLATION:

Invoke "./configure". Afterwards you will get prompted with the before-compile
options of yChat. After choosing those options you are ready to type "gmake"
afterwards. See below what gmake is doing. 

//<<*
If you have choosen MySQL database support, then take a look at section 1.3.2 
how to setup a valid database table. Be also sure to enter the valid MySQL 
accessing data in the yChat configuration file which is normally located in 
the etc/ychat.conf file if not changed by you with the yChat configurator.
//*>>

You may also invoke gmake with the following options (the PREFIX can be set
in the yChat configurator which will be launched by the top configure script
or gmake config):

 gmake or gmake all (compiles everything, also modules and runs "gmake mail")
 gmake base (only compiles the base)
 gmake base_start (only compiles the base and starts the server)
 gmake clean (cleans everything)
 gmake clean_base (only cleans the base obj and rpo files)
 gmake clean_modules (only cleans the modules .so files) 
 gmake confdebug (runs ./configure with enabling debugging)
 gmake config (runs yChat configurator)
 gmake debug (runs gdb on ./ychat.core)
 gmake gpl (shows the GNU General Public License)		
 gmake help (shows all available ychat gmake targets)
 gmake mail (sends a mail to the yChat developers containing build opts.)
 gmake modules (only compiles modules)
 gmake mrproper (same as gmake clean plus removing all temp files) 
 gmake setup (runs all configure scripts and afterwards gmake all)
 gmake stats (generates ychat statistics)
 gmake version (shows the current version of yChat)
//<<*
 gmake yhttpdbase (generates an yhttpd code base)
//*>> (See section 1.9 to read about this marks)

Example: "gmake all install clean" compiles everything, installs it to PREFIX
and cleans the source directories.

Now its time to run the server with ./bin/ychat.

Aferwards point your webbrowser to http://yourip:port !

... have fun :-).

1.3.2 INSTALLATION QUICK START:

If you in hury, then you may just type gmake setup. In the yChat configurator
you may just choose all the default values. If done, yChat will get compiled
and is ready to run with ./bin/ychat! 


//<<*
1.3.3 MYSQL SETUP

If you chose to use MySQL database support you have to create a valid database
to use with yChat.

Create a new MySQL database called 'ychat' and type the following command into
a MySQL command line client of your choice:

USE ychat
CREATE TABLE `user` ( 
  `uid` int(10) NOT NULL auto_increment, 
  `nick` varchar(30) NOT NULL default '', 
  `password` varchar(30) NOT NULL default '', 
  `color1` varchar(30),
  `color2` varchar(30),
  `email` varchar(50) default '-', 
  `registerdate` varchar(30) default '-', 
  `logincounter` varchar(10) default '0', 
  `status` char(1) default '3', 
  PRIMARY KEY  (`uid`), 
  KEY `uid` (`uid`) 
) TYPE=MyISAM;
GRANT ALL PRIVILEGES ON ychat.* to ychat@localhost IDENTIFIED BY "yctest";

This database uses the default MySQL access informations which are stored in the
ychat.conf file.
//*>>

1.4.0 HOW TO USE SCREEN WITH YCHAT:

If you are running yChat in ncurses mode you might want to install
the tool which is called "screen". This will enable you putting the
ncurses interface into the background, closing the terminal session
and reusing the interface later through another terminal. 

Just do:
 
 screen -S ychat ./bin/ychat ( creates a new session and starts yChat in it )
 ctrl+d+a ( will detach the yChat session )
 ( closing the terminal )
 ( opening a new terminal )
 screen -r ychat ( will return you to the yChat process )

Screen will terminate automaticaly if all processes in its sessions are 
terminated.

For a closer look read the screen manual page ( man screen ). 

1.4.1 HOW TO USE SIGNALS WITH YCHAT:

You can send UNIX signals to yChat. This becomes very interesting if you 
don't use the command line interface or the ncurses interface and you 
don't have access to the options below.

Run one of the following commands to send the signal you want: 
($PID is here the process id of the current yChat process)

kill -USR1 $PID # yChat clears the HTML template cache 
kill -USR2 $PID # yChat reloads all dynamic loadable modules //<< 
kill -HUP  $PID # yChat will shutdown savely

1.5.0 CUSTOMIZATION:

If you like to customize the design/layout/language of yChat, you will have 
to edit src/msgs.h and src/glob.h before you compile the sources. Afterwards 
you can change the html-template files which are placed in the html/ 
subdirectory and the language-templates which are placed in the XML config 
file (etc/ychat.conf).

Notice, that you dont have to edit the src/glob.h file by hand any more, its
already done by the top ./configure script for you.

You can edit the etc/ychat.conf to fit your needs. If you dont want to change
the config file, then you also can use ychat start parameters.

Exmpl: ./bin/ychat -o chat.database.password secretpassword

You can also use multiple words for a specific option.

Exmpl: ./bin/ychat -o ychat.version "word1 word2 word3"

will overwrite the default database password value of the ychat.conf. You can
do this with every configuration element by adding several -o option value 
arguments to the start command.

Dynamic loadable modules can be found in the mods/ subdirectory. (chat 
commands are realized through modules too). Sources of modules can be found
in src/mods instead. If you want to create a new module just create a new
.cpp file and run in src/mods the ./configure script again. Next time
you run gmake your new module gets compiled.

All messages defined in the msgs.h file contain server messages only ( a chat
user never wont read them, only the administrator will get to see them ).

1.6.0 FILES:

etc/ychat.conf  - The yChat configuration file
html/*		- The html template files
src/*		- The yChat base sources
src/mods/*	- The dynamic loadable modules sources
scripts/*	- Some nice scripts needed for building & co.

The following is created by building yChat:
obj/*		- The object files of the compiled yChat base 
mods/*		- The compiled dynamic loadable modules
bin/ychat	- The yChat binary (linked by the object files)

Customizable source files (if changed you need to run gmake clean all) 
src/glob.h	- Contains some global building options
src/msgs.h	- Defines some server side messages


1.7 WRITING BUG REPORTS

How to submit a good bug report?

Send them to Bug@yChat.org.

First you should give the following information:
- yChat version, if CVS (or devel. tarball) then which day?
- operating system / distribution and it's version
- when did it crash? did you do something? can you reproduce the crash?

Getting backtrace of the crash also helps a lot, especially if yChat crashes 
randomly. If after crash you see text:

 "segmentation fault (core dumped)" 

It writes a file named "core" or "ychat.core" depending on your OS to directory
where you started yChat. If it doesn't print the "(core dumped)" or you can't
find the core file, you'll have to raise the limit for max. core file size
before running yChat. To do this, say:

 ulimit -c unlimited 

So, if you have the core file and GNU debugger (gdb), you can get the 
backtrace with:

 gdb ./bin/ychat ychat.core 
 bt 

Paste all the lines starting from line having #0 at the beginning.

Here's an example session:

 in reqp::parse(thrd*, std::string, std::map<std::string, std::string, 
 std::less<std::string>, std::allocator<std::pair<std::string const, std::string> > >&) ()
 (gdb) bt
 #0 0x0805c287 in reqp::parse(thrd*, std::string, std::map<std::string, 
 std::string, std::less<std::string>, std::allocator<std::pair<std::string
 const, std::string> > >&) ()
 #1 0x0806060f in sock::read_write(thrd*, int) ()
 #2 0x080612ba in thrd::run() ()
 #3 0x0805a3b8 in pool::run_func(void*) ()
 #4 0x0805a375 in pool::tpool_thread(void*) ()
 #5 0x281d44ae in _thread_start () from /usr/lib/libc_r.so.5
 (gdb) 

If you dont get such a gdb output, you need to recompile the yChat using
debuggig symbols. You can do it this way:

cd ychat
gmake confdebug all run

1.8 CONTACT:

You may contact us through the following addresses:

- Homepage
  The yChat homepage is located at http://www.yChat.org

- E-Mail
  Paul C. Buetow: Snooper at yChat point org ( core developer )
  Volker Richter: Rover at yChat dot org ( core developer )
  Mail at yChat dot org ( reaches everybody of yChat )
 
- ICQ
  Paul C. Buetow: 11655527

- IRC
  #Ychat and #Coding at irc.german-elite.net  

//<<*
1.9.0 YHTTPD CODE BASE GENERATION

See docs/yhttpd.txt
//*>>

2.0.0 LICENSE

		    GNU GENERAL PUBLIC LICENSE
		       Version 2, June 1991

 Copyright (C) 1989, 1991 Free Software Foundation, Inc.
                          675 Mass Ave, Cambridge, MA 02139, 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.

		    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.)

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.

  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.

  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

	Appendix: 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) 19yy  <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., 675 Mass Ave, Cambridge, MA 02139, 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) 19yy 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.