1e8200d2e0d03949a4d46dd1b209ab5d9c54e0a9
[spider.git] / perl / cluster.pl
1 #!/usr/bin/env perl
2 #
3 # This is the DX cluster 'daemon'. It sits in the middle of its little
4 # web of client routines sucking and blowing data where it may.
5 #
6 # Hence the name of 'spider' (although it may become 'dxspider')
7 #
8 # Copyright (c) 1998 Dirk Koopman G1TLH
9 #
10 #
11 #
12
13 package main;
14
15 require 5.10.1;
16 use warnings;
17
18 use vars qw($root $is_win $systime $lockfn @inqueue $starttime $lockfn @outstanding_connects
19                         $zombies @listeners $lang $myalias @debug $userfn $clusteraddr
20                         $clusterport $mycall $decease $routeroot $me $reqreg $bumpexisting
21                         $allowdxby $dbh $dsn $dbuser $dbpass $do_xml $systime_days $systime_daystart
22                         $can_encode $maxconnect_user $maxconnect_node $idle_interval $log_flush_interval
23                         $broadcast_debug 
24                    );
25
26 $lang = 'en';                                   # default language
27 $clusteraddr = '127.0.0.1';             # cluster tcp host address - used for things like console.pl
28 $clusterport = 27754;                   # cluster tcp port
29 $yes = 'Yes';                                   # visual representation of yes
30 $no = 'No';                                             # ditto for no
31 $user_interval = 11*60;                 # the interval between unsolicited prompts if no traffic
32
33 # make sure that modules are searched in the order local then perl
34 BEGIN {
35         umask 002;
36
37         # take into account any local::lib that might be present
38         eval {
39                 require local::lib;
40         };
41         import local::lib unless ($@);
42
43         # root of directory tree for this system
44         $root = "/spider";
45         $root = $ENV{'DXSPIDER_ROOT'} if $ENV{'DXSPIDER_ROOT'};
46
47         unshift @INC, "$root/perl";     # this IS the right way round!
48         unshift @INC, "$root/local";
49
50         # do some validation of the input
51         die "The directory $root doesn't exist, please RTFM" unless -d $root;
52         die "$root/local doesn't exist, please RTFM" unless -d "$root/local";
53         die "$root/local/DXVars.pm doesn't exist, please RTFM" unless -e "$root/local/DXVars.pm";
54
55         # create some directories
56         mkdir "$root/local_cmd", 02774 unless -d "$root/local_cmd";
57
58         # locally stored data lives here
59         my $local_data = "$root/local_data";
60         mkdir $local_data, 02774 unless -d $local_data;
61
62         # try to create and lock a lockfile (this isn't atomic but
63         # should do for now
64         $lockfn = "$root/local_data/cluster.lck";       # lock file name
65         if (-w $lockfn) {
66                 open(CLLOCK, "$lockfn") or die "Can't open Lockfile ($lockfn) $!";
67                 my $pid = <CLLOCK>;
68                 if ($pid) {
69                         chomp $pid;
70                         if (kill 0, $pid) {
71                                 warn "Lockfile ($lockfn) and process $pid exist, another cluster running?\n";
72                                 exit 1;
73                         }
74                 }
75                 unlink $lockfn;
76                 close CLLOCK;
77         }
78         open(CLLOCK, ">$lockfn") or die "Can't open Lockfile ($lockfn) $!";
79         print CLLOCK "$$\n";
80         close CLLOCK;
81
82         $is_win = ($^O =~ /^MS/ || $^O =~ /^OS-2/) ? 1 : 0; # is it Windows?
83         $systime = time;
84         
85 }
86
87 use DXVars;
88 use SysVar;
89
90 use strict;
91
92 use Mojo::IOLoop;
93
94 use DXDebug;
95 use Msg;
96 use IntMsg;
97 use Internet;
98 use Listeners;
99 use ExtMsg;
100 use AGWConnect;
101 use AGWMsg;
102 use DXLog;
103 use DXLogPrint;
104 use DXUtil;
105 use DXChannel;
106 use DXUser;
107 use DXM;
108 use DXCommandmode;
109 use DXProtVars;
110 use DXProtout;
111 use DXProt;
112 use DXMsg;
113 use DXCron;
114 use DXConnect;
115 use DXBearing;
116 use DXDb;
117 use DXHash;
118 use DXDupe;
119 use Script;
120 use Prefix;
121 use Spot;
122 use Bands;
123 use Keps;
124 use Minimuf;
125 use Sun;
126 use Geomag;
127 use CmdAlias;
128 use Filter;
129 use AnnTalk;
130 use BBS;
131 use WCY;
132 use BadWords;
133 use Timer;
134 use Route;
135 use Route::Node;
136 use Route::User;
137 use Editable;
138 use Mrtg;
139 use USDB;
140 use UDPMsg;
141 use QSL;
142 use DXXml;
143 use DXSql;
144 use IsoTime;
145 use BPQMsg;
146
147 use Data::Dumper;
148 use IO::File;
149 use Fcntl ':flock';
150 use POSIX ":sys_wait_h";
151 use Version;
152 use Web;
153
154 use Local;
155
156
157 @inqueue = ();                                  # the main input queue, an array of hashes
158 $systime = 0;                                   # the time now (in seconds)
159 $starttime = 0;                 # the starting time of the cluster
160 @outstanding_connects = ();     # list of outstanding connects
161 @listeners = ();                                # list of listeners
162 $reqreg = 0;                                    # 1 = registration required, 2 = deregister people
163 $bumpexisting = 1;                              # 1 = allow new connection to disconnect old, 0 - don't allow it
164 $allowdxby = 0;                                 # 1 = allow "dx by <othercall>", 0 - don't allow it
165 $maxconnect_user = 3;                   # the maximum no of concurrent connections a user can have at a time
166 $maxconnect_node = 0;                   # Ditto but for nodes. In either case if a new incoming connection
167                                                                 # takes the no of references in the routing table above these numbers
168                                                                 # then the connection is refused. This only affects INCOMING connections.
169 $idle_interval = 0.500;         # the wait between invocations of the main idle loop processing.
170 $log_flush_interval = 2;                # interval to wait between log flushes
171
172 our $ending;                                    # signal that we are ending;
173 our $broadcast_debug;                   # allow broadcasting of debug info down "enhanced" user connections
174 our $clssecs;                                   # the amount of cpu time the DXSpider process have consumed
175 our $cldsecs;                                   # the amount of cpu time any child processes have consumed
176
177
178 # send a message to call on conn and disconnect
179 sub already_conn
180 {
181         my ($conn, $call, $mess) = @_;
182
183         $conn->disable_read(1);
184         dbg("-> D $call $mess\n") if isdbg('chan');
185         $conn->send_now("D$call|$mess");
186         sleep(2);
187         $conn->disconnect;
188 }
189
190 # handle incoming messages
191 sub new_channel
192 {
193         my ($conn, $msg) = @_;
194         my ($sort, $call, $line) = DXChannel::decode_input(0, $msg);
195         return unless defined $sort;
196
197         my ($dxchan, $user);
198         
199         if (is_webcall($call) && $conn->isa('IntMsg')) {
200                 my $newcall = find_next_webcall();
201                 unless ($newcall) {
202                         already_conn($conn, $call, "Maximum no of web connected connects ($Web::maxssid) exceeded");
203                         return;
204                 }
205                 $call = $newcall;
206                 $user = DXUser::get_current($call);
207                 unless ($user) {
208                         $user = DXUser->new($call);
209                         $user->sort('W');
210                         $user->wantbeep(0);
211                         $user->name('web');
212                         $user->qth('on the web');
213                         $user->homenode($main::mycall);
214                         $user->lat($main::mylatitude);
215                         $user->long($main::mylongitude);
216                         $user->qra($main::mylocator);
217                 }
218                 $conn->conns($call);
219                 $dxchan = Web->new($call, $conn, $user);
220                 $dxchan->enhanced(1);
221                 $dxchan->ve7cc(1);
222                 $msg =~ s/^A#WEB|/A$call|/;
223                 $conn->send_now("C$call");
224         } else {
225                 # "Normal" connections
226                 unless (is_callsign($call)) {
227                         already_conn($conn, $call, DXM::msg($lang, "illcall", $call));
228                         return;
229                 }
230
231                 # set up the basic channel info for "Normal" Users
232                 # is there one already connected to me - locally?
233         
234                 $user = DXUser::get_current($call);
235                 $dxchan = DXChannel::get($call);
236                 if ($dxchan) {
237                         if ($user && $user->is_node) {
238                                 already_conn($conn, $call, DXM::msg($lang, 'conother', $call, $main::mycall));
239                                 return;
240                         }
241                         if ($bumpexisting) {
242                                 my $ip = $dxchan->hostname;
243                                 $dxchan->send_now('D', DXM::msg($lang, 'conbump', $call, $ip));
244                                 LogDbg('DXCommand', "$call bumped off by $ip, disconnected");
245                                 $dxchan->disconnect;
246                         } else {
247                                 already_conn($conn, $call, DXM::msg($lang, 'conother', $call, $main::mycall));
248                                 return;
249                         }
250                 }
251                 
252                 # (fairly) politely disconnect people that are connected to too many other places at once
253                 my $r = Route::get($call);
254                 if ($conn->{sort} && $conn->{sort} =~ /^I/ && $r && $user) {
255                         my @n = $r->parents;
256                         my $m = $r->isa('Route::Node') ? $maxconnect_node : $maxconnect_user;
257                         my $c = $user->maxconnect;
258                         my $v;
259                         $v = defined $c ? $c : $m;
260                         if ($v && @n >= $v) {
261                                 my $nodes = join ',', @n;
262                                 LogDbg('DXCommand', "$call has too many connections ($v) at $nodes - disconnected");
263                                 already_conn($conn, $call, DXM::msg($lang, 'contomany', $call, $v, $nodes));
264                                 return;
265                         }
266                 }
267                 
268                 # is he locked out ?
269                 my $basecall = $call;
270                 $basecall =~ s/-\d+$//;
271                 my $baseuser = DXUser::get_current($basecall);
272                 my $lock = $user->lockout if $user;
273                 if ($baseuser && $baseuser->lockout || $lock) {
274                         if (!$user || !defined $lock || $lock) {
275                                 my $host = $conn->peerhost;
276                                 LogDbg('DXCommand', "$call on $host is locked out, disconnected");
277                                 $conn->disconnect;
278                                 return;
279                         }
280                 }
281
282                 if ($user) {
283                         $user->{lang} = $main::lang if !$user->{lang}; # to autoupdate old systems
284                 } else {
285                         $user = DXUser->new($call);
286                 }
287
288                 # create the channel
289                 if ($user->is_node) {
290                         $dxchan = DXProt->new($call, $conn, $user);
291                 } elsif ($user->is_user) {
292                         $dxchan = DXCommandmode->new($call, $conn, $user);
293                 } else {
294                         die "Invalid sort of user on $call = $sort";
295                 }
296                 
297                 # check that the conn has a callsign
298                 $conn->conns($call) if $conn->isa('IntMsg');
299         }
300         
301
302         # set callbacks
303         $conn->set_error(sub {my $err = shift; LogDbg('DXCommand', "Comms error '$err' received for call $dxchan->{call}"); $dxchan->disconnect(1);});
304         $conn->set_on_eof(sub {$dxchan->disconnect});
305         $conn->set_rproc(sub {my ($conn,$msg) = @_; $dxchan->rec($msg);});
306         if ($sort eq 'W') {
307                 $dxchan->enhanced(1);
308                 $dxchan->sort('W');
309         }
310         $dxchan->rec($msg);
311 }
312
313
314 sub login
315 {
316         return \&new_channel;
317 }
318
319 our $ceasing;
320
321 # cease running this program, close down all the connections nicely
322 sub cease
323 {
324         my $dxchan;
325
326         cluck("ceasing") if $ceasing; 
327         
328         return if $ceasing++;
329         
330         unless ($is_win) {
331                 $SIG{'TERM'} = 'IGNORE';
332                 $SIG{'INT'} = 'IGNORE';
333         }
334
335         DXUser::sync;
336
337         if (defined &Local::finish) {
338                 eval {
339                         Local::finish();   # end local processing
340                 };
341                 dbg("Local::finish error $@") if $@;
342         }
343
344
345         # disconnect AGW
346         AGWMsg::finish();
347         BPQMsg::finish();
348
349         # disconnect UDP customers
350         UDPMsg::finish();
351
352         # end everything else
353         DXUser::finish();
354         DXDupe::finish();
355
356         # close all databases
357         DXDb::closeall;
358
359         # close all listeners
360         foreach my $l (@listeners) {
361                 $l->close_server;
362         }
363
364         LogDbg('cluster', "DXSpider V$version, build $build (git: $gitversion) ended");
365         dbg("bye bye everyone - bye bye");
366         dbgclose();
367         Logclose();
368
369         $dbh->finish if $dbh;
370
371         unlink $lockfn;
372 }
373
374 # the reaper of children
375 sub reap
376 {
377         my $cpid;
378         while (($cpid = waitpid(-1, WNOHANG)) > 0) {
379                 dbg("cpid: $cpid") if isdbg('reap');
380 #               Msg->pid_gone($cpid);
381                 $zombies-- if $zombies > 0;
382         }
383         dbg("cpid: $cpid") if isdbg('reap');
384 }
385
386 # this is where the input queue is dealt with and things are dispatched off to other parts of
387 # the cluster
388
389 sub uptime
390 {
391         my $t = $systime - $starttime;
392         my $days = int $t / 86400;
393         $t -= $days * 86400;
394         my $hours = int $t / 3600;
395         $t -= $hours * 3600;
396         my $mins = int $t / 60;
397         return sprintf "%d %02d:%02d", $days, $hours, $mins;
398 }
399
400 sub AGWrestart
401 {
402         AGWMsg::init(\&new_channel);
403 }
404
405
406 sub setup_start
407 {
408
409         #############################################################
410         #
411         # The start of the main line of code
412         #
413         #############################################################
414
415         $starttime = $systime = time;
416         $systime_days = int ($systime / 86400);
417         $systime_daystart = $systime_days * 86400;
418         $lang = 'en' unless $lang;
419
420         unless ($DB::VERSION) {
421                 $SIG{INT} = $SIG{TERM} = \&cease;
422         }
423
424         # open the debug file, set various FHs to be unbuffered
425         dbginit($broadcast_debug ? \&DXCommandmode::broadcast_debug : undef);
426         foreach (@debug) {
427                 dbgadd($_);
428         }
429         STDOUT->autoflush(1);
430
431         
432         # try to load the database
433         if (DXSql::init($dsn)) {
434                 $dbh = DXSql->new($dsn);
435                 $dbh = $dbh->connect($dsn, $dbuser, $dbpass) if $dbh;
436         }
437
438         # try to load Encode and Git
439         {
440                 local $^W = 0;
441                 my $w = $SIG{__DIE__};
442                 $SIG{__DIE__} = 'IGNORE';
443                 eval { require Encode; };
444                 unless ($@) {
445                         import Encode;
446                         $can_encode = 1;
447                 }
448                 eval { require Git; };
449                 unless ($@) {
450                         import Git;
451                 
452                         # determine the real version number
453                         my $repo = Git->repository(Directory => "$root/.git");
454                         if ($repo) {
455                                 my $desc = $repo->command_oneline(['describe', '--long'], STDERR => 0);
456                                 if ($desc) {
457                                         my ($v, $s, $b, $g) = $desc =~ /^([\d.]+)(?:\.(\d+))?-(\d+)-g([0-9a-f]+)/;
458                                         $version = $v;
459                                         $build = $b || 0;
460                                         $gitversion = "$g\[r]";
461                                 }
462                         }
463                 }
464                 $SIG{__DIE__} = $w;
465         }
466
467         # try to load XML::Simple
468         DXXml::init();
469
470         # banner
471         my ($year) = (gmtime)[5];
472         $year += 1900;
473         LogDbg('cluster', "DXSpider V$version, build $build (git: $gitversion) started");
474         dbg("Copyright (c) 1998-$year Dirk Koopman G1TLH");
475
476         # load Prefixes
477         dbg("loading prefixes ...");
478         dbg(USDB::init());
479         my $r = Prefix::init();
480         confess $r if $r;
481
482         # load band data
483         dbg("loading band data ...");
484         Bands::load();
485
486         # initialise User file system
487         dbg("loading user file system ...");
488         DXUser::init(1);
489
490         # look for the sysop and the alias user and complain if they aren't there
491         {
492                 die "\$myalias \& \$mycall are the same ($mycall)!, they must be different (hint: make \$mycall = '${mycall}-2';). Oh and don't forget to rerun create_sysop.pl!" if $mycall eq $myalias;
493                 my $ref = DXUser::get($mycall);
494                 die "$mycall missing, run the create_sysop.pl script and please RTFM" unless $ref && $ref->priv == 9;
495                 my $oldsort = $ref->sort;
496                 if ($oldsort ne 'S') {
497                         $ref->sort('S');
498                         dbg "Resetting node type from $oldsort -> DXSpider ('S')";
499                 }
500                 $ref = DXUser::get($myalias);
501                 die "$myalias missing, run the create_sysop.pl script and please RTFM" unless $ref && $ref->priv == 9;
502                 $oldsort = $ref->sort;
503                 if ($oldsort ne 'U') {
504                         $ref->sort('U');
505                         dbg "Resetting sysop user type from $oldsort -> User ('U')";
506                 }
507         }
508
509         # start listening for incoming messages/connects
510         dbg("starting listeners ...");
511         my $conn = IntMsg->new_server($clusteraddr, $clusterport, \&login);
512         $conn->conns("Server $clusteraddr/$clusterport using IntMsg");
513         push @listeners, $conn;
514         dbg("Internal port: $clusteraddr $clusterport using IntMsg");
515         foreach my $l (@main::listen) {
516                 no strict 'refs';
517                 my $pkg = $l->[2] || 'ExtMsg';
518                 my $login = $l->[3] || 'login';
519
520                 $conn = $pkg->new_server($l->[0], $l->[1], \&{"${pkg}::${login}"});
521                 $conn->conns("Server $l->[0]/$l->[1] using ${pkg}::${login}");
522                 push @listeners, $conn;
523                 dbg("External Port: $l->[0] $l->[1] using ${pkg}::${login}");
524         }
525
526         dbg("AGW Listener") if $AGWMsg::enable;
527         AGWrestart();
528
529         dbg("BPQ Listener") if $BPQMsg::enable;
530         BPQMsg::init(\&new_channel);
531
532         dbg("UDP Listener") if $UDPMsg::enable;
533         UDPMsg::init(\&new_channel);
534
535         # load bad words
536         dbg("load badwords: " . (BadWords::load or "Ok"));
537
538         # prime some signals
539         unless ($DB::VERSION) {
540                 $SIG{INT} = $SIG{TERM} = sub { $ending = 10; };
541         }
542
543         unless ($is_win) {
544                 $SIG{HUP} = 'IGNORE';
545                 $SIG{CHLD} = sub { $zombies++ };
546
547                 $SIG{PIPE} = sub {      dbg("Broken PIPE signal received"); };
548                 $SIG{IO} = sub {        dbg("SIGIO received"); };
549                 $SIG{WINCH} = $SIG{STOP} = $SIG{CONT} = 'IGNORE';
550                 $SIG{KILL} = 'DEFAULT'; # as if it matters....
551
552                 # catch the rest with a hopeful message
553                 for (keys %SIG) {
554                         if (!$SIG{$_}) {
555                                 #               dbg("Catching SIG $_") if isdbg('chan');
556                                 $SIG{$_} = sub { my $sig = shift;       DXDebug::confess("Caught signal $sig");  };
557                         }
558                 }
559         }
560
561         # start dupe system
562         dbg("Starting Dupe system");
563         DXDupe::init();
564
565         # read in system messages
566         dbg("Read in Messages");
567         DXM->init();
568
569         # read in command aliases
570         dbg("Read in Aliases");
571         CmdAlias->init();
572
573         # initialise the Geomagnetic data engine
574         dbg("Start WWV");
575         Geomag->init();
576         dbg("Start WCY");
577         WCY->init();
578
579         # initial the Spot stuff
580         dbg("Starting DX Spot system");
581         Spot->init();
582
583         # initialise the protocol engine
584         dbg("Start Protocol Engines ...");
585         DXProt->init();
586
587         # put in a DXCluster node for us here so we can add users and take them away
588         $routeroot = Route::Node->new($mycall, $version*100+5300, Route::here($main::me->here)|Route::conf($main::me->conf));
589         $routeroot->do_pc9x(1);
590         $routeroot->via_pc92(1);
591
592         # make sure that there is a routing OUTPUT node default file
593         #unless (Filter::read_in('route', 'node_default', 0)) {
594         #       my $dxcc = $main::me->dxcc;
595         #       $Route::filterdef->cmd($main::me, 'route', 'accept', "node_default call $mycall" );
596         #}
597
598         # read in any existing message headers and clean out old crap
599         dbg("reading existing message headers ...");
600         DXMsg->init();
601         DXMsg::clean_old();
602
603         # read in any cron jobs
604         dbg("reading cron jobs ...");
605         DXCron->init();
606
607         # read in database desriptors
608         dbg("reading database descriptors ...");
609         DXDb::load();
610
611         # starting local stuff
612         dbg("doing local initialisation ...");
613         QSL::init(1);
614         if (defined &Local::init) {
615                 eval {
616                         Local::init();
617                 };
618                 dbg("Local::init error $@") if $@;
619         }
620
621
622         # this, such as it is, is the main loop!
623         dbg("orft we jolly well go ...");
624         my $script = new Script "startup";
625         $script->run($main::me) if $script;
626
627         #open(DB::OUT, "|tee /tmp/aa");
628 }
629
630 our $io_disconnected;
631
632 sub idle_loop
633 {
634         BPQMsg::process();
635
636         if (defined &Local::process) {
637                 eval {
638                         Local::process();       # do any localised processing
639                 };
640                 dbg("Local::process error $@") if $@;
641         }
642
643         while ($ending) {
644                 my $dxchan;
645
646                 dbg("DXSpider Ending $ending");
647
648                 unless ($io_disconnected++) {
649
650                         # disconnect users
651                         foreach $dxchan (DXChannel::get_all_users) {
652                                 $dxchan->disconnect;
653                         }
654
655                         # disconnect nodes
656                         foreach $dxchan (DXChannel::get_all_nodes) {
657                                 next if $dxchan == $main::me;
658                                 $dxchan->disconnect(2);
659                         }
660                         $main::me->disconnect;
661                 }
662
663                 Mojo::IOLoop->stop if --$ending <= 0;
664         }
665 }
666
667 sub per_sec
668 {
669         my $timenow = time;
670
671         reap() if $zombies;
672         $systime = $timenow;
673         my $days = int ($systime / 86400);
674         if ($systime_days != $days) {
675                 $systime_days = $days;
676                 $systime_daystart = $days * 86400;
677         }
678         IsoTime::update($systime);
679         DXCron::process();      # do cron jobs
680         DXCommandmode::process(); # process ongoing command mode stuff
681         DXXml::process();
682         DXProt::process();              # process ongoing ak1a pcxx stuff
683         DXConnect::process();
684         DXMsg::process();
685         DXDb::process();
686         DXUser::process();
687         DXDupe::process();
688         DXCron::process();                      # do cron jobs
689         IsoTime::update($systime);
690         DXProt::process();                      # process ongoing ak1a pcxx stuff
691         DXConnect::process();
692         DXUser::process();
693         AGWMsg::process();
694         
695         Timer::handler();
696         DXLog::flushall();
697 }
698
699 sub per_10_sec
700 {
701
702 }
703
704
705 sub per_minute
706 {
707
708 }
709
710 sub per_10_minute
711 {
712
713 }
714
715 sub per_hour
716 {
717
718 }
719
720 sub per_day
721 {
722
723 }
724
725 sub start_node
726 {
727         dbg("Before Web::start_node");
728
729         Mojo::IOLoop->start unless Mojo::IOLoop->is_running;
730
731         dbg("After Web::start_node");
732 }
733
734 setup_start();
735
736 my $main_loop = Mojo::IOLoop->recurring($idle_interval => \&idle_loop);
737 my $log_flush_loop = Mojo::IOLoop->recurring($log_flush_interval => \&DXLog::flushall);
738 my $cpusecs_loop = Mojo::IOLoop->recurring(5 => sub {my @t = times; $clssecs = $t[0]+$t[1]; $cldsecs = $t[2]+$t[3]});
739 my $persec =  Mojo::IOLoop->recurring(1 => \&per_sec);
740 my $per10sec =  Mojo::IOLoop->recurring(10 => \&per_10_sec);
741 my $permin =  Mojo::IOLoop->recurring(60 => \&per_minute);
742 my $per10min =  Mojo::IOLoop->recurring(600 => \&per_10_minute);
743 my $perhour =  Mojo::IOLoop->recurring(3600 => \&per_hour);
744 my $perday =  Mojo::IOLoop->recurring(86400 => \&per_day);
745
746 start_node();
747
748 cease(0);
749
750 exit(0);
751