]> git.decadent.org.uk Git - ap-utils.git/blob - lib/stat.c
c3d969ca7ce3b6d3bacc3c995c6d99cb286765d4
[ap-utils.git] / lib / stat.c
1 /*
2  *      stat.c from Access Point SNMP Utils for Linux
3  *
4  * Copyright (c) 2002 Roman Festchook <roma at polesye dot net>
5  *
6  * This program is free software; you can redistribute it and/or modify
7  * it under the terms of the GNU General Public License Version 2 from
8  * June 1991 as published by the Free Software Foundation.
9  *
10  * This program is distributed in the hope that it will be useful, but
11  * WITHOUT ANY WARRANTY; without even the implied warranty of
12  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
13  * GNU General Public License for more details.
14  *
15  * You should have received a copy of the GNU General Public License along
16  * with this program; if not, write to the Free Software Foundation, Inc.,
17  * 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
18  *
19  */
20 #include <unistd.h>
21 #include <stdlib.h>
22 #include <fcntl.h>
23 #include <signal.h>
24 #include <string.h>
25 #include <sys/wait.h>
26 #include "ap-utils.h"
27 #include "ap-curses.h"
28
29 #define ERR_RET_PRESS _("Unable to get data from AP. Press Q to continue.")
30 #define QHELP _("Q - quit to menu.")
31 #define PIPE _("pipe error. Press any key.")
32 #define FCNTL _("fcntl error. Press any key.")
33 #define FORK _("fork error. Press any key.")
34
35 extern WINDOW *main_sub;
36 extern short ap_type;
37
38 void EthStat()
39 {
40     struct EthernetRxStatistics *EthRxStat = NULL;
41     struct EthernetTxStatistics *EthTxStat = NULL;
42
43     char EthRx[] = { 0x2B, 0x06, 0x01, 0x04, 0x01, 0x83, 0x1A, 0x01, 0x01,
44         0x07, 0x01, 0x00
45     };
46
47     char EthTx[] = { 0x2B, 0x06, 0x01, 0x04, 0x01, 0x83, 0x1A, 0x01, 0x01,
48         0x07, 0x02, 0x00
49     };
50     char c;
51     char message[1024];
52     pid_t pid;
53     int j, child_pipe[2];
54     varbind varbinds[2];
55
56     if (ap_type == ATMEL12350) {
57         EthRx[5] = 0xE0;
58         EthRx[6] = 0x3E;
59         EthTx[5] = 0xE0;
60         EthTx[6] = 0x3E;
61     }
62     
63     if (pipe(child_pipe) == -1) {
64         print_helperr(PIPE);
65         goto exit;
66     }
67
68     if (fcntl(child_pipe[0], F_SETFL, O_NONBLOCK) == -1) {
69         print_helperr(FCNTL);
70         goto exit;
71     }
72     print_title(_("Ethernet Statistics"));
73     print_help(QHELP);
74     noecho();
75
76     switch (pid = fork()) {
77     case -1:
78         print_helperr(FORK);
79         goto exit;
80     case 0:
81         close(child_pipe[1]);
82         varbinds[0].oid = EthRx;
83         varbinds[0].len_oid = sizeof(EthRx);
84         varbinds[1].oid = EthTx;
85         varbinds[1].len_oid = sizeof(EthTx);
86
87       start:
88         varbinds[0].value = EthTx;
89         varbinds[0].len_val = 0;
90         varbinds[0].type = NULL_VALUE;
91         varbinds[1].value = EthTx;
92         varbinds[1].len_val = 0;
93         varbinds[1].type = NULL_VALUE;
94
95         if (snmp(varbinds, 2, GET) <= 0) {
96             print_helperr(ERR_RET_PRESS);
97             goto exit_child;
98         }
99
100         if (varbinds[0].len_val == 64) {
101             if (EthRxStat)
102                 free(EthRxStat);
103             EthRxStat =
104                 (struct EthernetRxStatistics *) malloc(varbinds[0].
105                                                        len_val);
106             memcpy(EthRxStat, varbinds[0].value, varbinds[0].len_val);
107         } else {
108             print_helperr(_("EthRxStat packet error. Press Q to continue."));
109             goto exit_child;
110         }
111
112         if (varbinds[1].len_val == 56) {
113             if (EthTxStat)
114                 free(EthTxStat);
115             EthTxStat =
116                 (struct EthernetTxStatistics *) malloc(varbinds[1].
117                                                        len_val);
118             memcpy(EthTxStat, varbinds[1].value, varbinds[1].len_val);
119         } else {
120             print_helperr(_("EthTxStat packet error. Press Q to continue."));
121             goto exit_child;
122         }
123         mvwaddstr(main_sub, 1, 2, _("Received:"));
124         mvwaddstr(main_sub, 1, 30, _("Transmitted:"));
125         sprintf(message, "TotalBytes       %10u TotalBytes         %10u",
126                 swap4(EthRxStat->TotalBytesRx),
127                 swap4(EthTxStat->TotalBytesTx));
128         mvwaddstr(main_sub, 3, 2, message);
129         sprintf(message, "TotalPackets     %10u TotalPackets       %10u",
130                 swap4(EthRxStat->TotalPacketsRx),
131                 swap4(EthTxStat->TotalPacketsTx));
132         mvwaddstr(main_sub, 4, 2, message);
133         sprintf(message, "PacketCRCError   %10u PacketCRCError     %10u",
134                 swap4(EthRxStat->PacketCRCErrorRx),
135                 swap4(EthTxStat->PacketCRCErrorTx));
136         mvwaddstr(main_sub, 5, 2, message);
137         sprintf(message, "FalseCarrier     %10u",
138                 swap4(EthRxStat->FalseCarrierRx));
139         mvwaddstr(main_sub, 6, 2, message);
140
141         sprintf(message, "MulticastPacket  %10u MulticastPacket    %10u",
142                 swap4(EthRxStat->MulticastPacketRx),
143                 swap4(EthTxStat->MulticastPacketTx));
144         mvwaddstr(main_sub, 7, 2, message);
145         sprintf(message, "BroadcastPacket  %10u BroadcastPacket    %10u",
146                 swap4(EthRxStat->BroadcastPacketRx),
147                 swap4(EthTxStat->BroadcastPacketTx));
148         mvwaddstr(main_sub, 8, 2, message);
149
150         sprintf(message, "ControlFrames    %10u UnicastPacket      %10u",
151                 swap4(EthRxStat->ControlFramesRx),
152                 swap4(EthTxStat->UnicastPacketTx));
153         mvwaddstr(main_sub, 9, 2, message);
154         sprintf(message, "PauseFrames      %10u PauseFrames        %10u",
155                 swap4(EthRxStat->PauseFramesRx),
156                 swap4(EthTxStat->PauseFramesTx));
157         mvwaddstr(main_sub, 10, 2, message);
158
159         sprintf(message, "UnknownOPCode    %10u SingleDeferPacket  %10u",
160                 swap4(EthRxStat->UnknownOPCodeRx),
161                 swap4(EthTxStat->SingleDeferPacketTx));
162         mvwaddstr(main_sub, 11, 2, message);
163         sprintf(message, "AlignmentError   %10u MultiDeferPackets  %10u",
164                 swap4(EthRxStat->AlignmentRxError),
165                 swap4(EthTxStat->MultiDeferPacketsTx));
166         mvwaddstr(main_sub, 12, 2, message);
167         sprintf(message, "LengthOutOfRange %10u",
168                 swap4(EthRxStat->LengthOutOfRangeRx));
169         mvwaddstr(main_sub, 13, 2, message);
170         sprintf(message, "CodeError        %10u SingleCollisions   %10u",
171                 swap4(EthRxStat->CodeErrorRx),
172                 swap4(EthTxStat->SingleCollisionsTx));
173         mvwaddstr(main_sub, 14, 2, message);
174         sprintf(message, "TotalFragments   %10u MultiCollisions    %10u",
175                 swap4(EthRxStat->TotalFragmentsRx),
176                 swap4(EthTxStat->MultiCollisionsTx));
177         mvwaddstr(main_sub, 15, 2, message);
178         sprintf(message, "OversizePackets  %10u LateCollisions     %10u",
179                 swap4(EthRxStat->OversizePacketsRx),
180                 swap4(EthTxStat->LateCollisionsTx));
181         mvwaddstr(main_sub, 16, 2, message);
182         sprintf(message, "UndersizePackets %10u ExcessiveCollision %10u",
183                 swap4(EthRxStat->UndersizePacketsRx),
184                 swap4(EthTxStat->ExcessiveCollisionTx));
185         mvwaddstr(main_sub, 17, 2, message);
186         sprintf(message, "TotalJabber      %10u TotalCollisions    %10u",
187                 swap4(EthRxStat->TotalJabberRx),
188                 swap4(EthTxStat->TotalCollisionsTx));
189         mvwaddstr(main_sub, 18, 2, message);
190         wrefresh(main_sub);
191       exit_child:
192         switch (j = read(child_pipe[0], &c, 1)) {
193         case -1:
194             break;
195         default:
196             exit(0);
197         }
198         sleep(1);
199         goto start;
200     default:
201         close(child_pipe[0]);
202         while (getch() != 'q');
203         write(child_pipe[1], "0", 1);
204         wait((int *) 0);
205         close(child_pipe[1]);
206         goto quit;
207     }
208
209   exit:
210     getch();
211   quit:
212     if (EthRxStat)
213         free(EthRxStat);
214     if (EthTxStat)
215         free(EthTxStat);
216
217     wclear(main_sub);
218     print_title("");
219     clear_main(0);
220     return;
221 }
222
223 void WirelessStat()
224 {
225     struct WirelessStatistics *WirelessStat = NULL;
226
227     char Wireless[] =
228         { 0x2B, 0x06, 0x01, 0x04, 0x01, 0x83, 0x1A, 0x01, 0x02, 0x03, 0x01,
229         0x00
230     };
231     char message[80], c;
232     pid_t pid;
233     int j, child_pipe[2];
234
235     varbind varbinds[1];
236
237     if (ap_type == ATMEL12350) {
238         Wireless[5] = 0xE0;
239         Wireless[6] = 0x3E;
240     }
241
242     if (pipe(child_pipe) == -1) {
243         print_helperr(PIPE);
244         goto exit;
245     }
246
247     if (fcntl(child_pipe[0], F_SETFL, O_NONBLOCK) == -1) {
248         print_helperr(FCNTL);
249         goto exit;
250     }
251     print_title(_("Wireless Statistics"));
252     print_help(QHELP);
253     noecho();
254
255     switch (pid = fork()) {
256     case -1:
257         print_helperr(FORK);
258         goto exit_child;
259     case 0:
260         close(child_pipe[1]);
261         varbinds[0].oid = Wireless;
262         varbinds[0].len_oid = sizeof(Wireless);
263
264       start:
265         varbinds[0].value = Wireless;
266         varbinds[0].len_val = 0;
267         varbinds[0].type = NULL_VALUE;
268
269         if (snmp(varbinds, 1, GET) <= 0) {
270             print_helperr(ERR_RET_PRESS);
271             goto exit_child;
272         }
273
274         if (varbinds[0].len_val == 88) {
275             if (WirelessStat)
276                 free(WirelessStat);
277             WirelessStat =
278                 (struct WirelessStatistics *) malloc(varbinds[0].len_val);
279             memcpy(WirelessStat, varbinds[0].value, varbinds[0].len_val);
280         } else {
281             print_helperr
282                 (_("WirelessStat packet error. Press Q to continue."));
283             goto exit;
284         }
285
286         sprintf(message,
287                 "UnicastPacketsTx   %10u UnicastPacketsRx   %10u",
288                 swap4(WirelessStat->UnicastTransmittedPackets),
289                 swap4(WirelessStat->UnicastReceivedPackets));
290         mvwaddstr(main_sub, 1, 1, message);
291         sprintf(message,
292                 "BroadcastPacketsTx %10u BroadcastPacketsRx %10u",
293                 swap4(WirelessStat->BroadcastTransmittedPackets),
294                 swap4(WirelessStat->BroadcastReceivedPackets));
295         mvwaddstr(main_sub, 2, 1, message);
296         sprintf(message,
297                 "MulticastPacketsTx %10u MulticastPacketsRx %10u",
298                 swap4(WirelessStat->MulticastTransmittedPackets),
299                 swap4(WirelessStat->MulticastReceivedPackets));
300         mvwaddstr(main_sub, 3, 1, message);
301         sprintf(message,
302                 "BeaconTx           %10u BeaconRx           %10u",
303                 swap4(WirelessStat->TransmittedBeacon),
304                 swap4(WirelessStat->ReceivedBeacon));
305         mvwaddstr(main_sub, 4, 1, message);
306         sprintf(message,
307                 "ACKTx              %10u ACKRx              %10u",
308                 swap4(WirelessStat->TransmittedACK),
309                 swap4(WirelessStat->ReceivedACK));
310         mvwaddstr(main_sub, 5, 1, message);
311         sprintf(message,
312                 "RTSTx              %10u RTSRx              %10u",
313                 swap4(WirelessStat->TransmittedRTS),
314                 swap4(WirelessStat->ReceivedRTS));
315         mvwaddstr(main_sub, 6, 1, message);
316         sprintf(message,
317                 "CTSTx              %10u CTSRx              %10u",
318                 swap4(WirelessStat->TransmittedCTS),
319                 swap4(WirelessStat->ReceivedCTS));
320         mvwaddstr(main_sub, 7, 1, message);
321         sprintf(message, "ACKFailure         %10u",
322                 swap4(WirelessStat->ACKFailure));
323         mvwaddstr(main_sub, 8, 1, message);
324         sprintf(message, "CTSFailure         %10u",
325                 swap4(WirelessStat->CTSFailure));
326         mvwaddstr(main_sub, 9, 1, message);
327         sprintf(message, "RetryPackets       %10u",
328                 swap4(WirelessStat->RetryPackets));
329         mvwaddstr(main_sub, 10, 1, message);
330         sprintf(message, "ReceivedDuplicate  %10u",
331                 swap4(WirelessStat->ReceivedDuplicate));
332         mvwaddstr(main_sub, 11, 1, message);
333         sprintf(message, "FailedPackets      %10u",
334                 swap4(WirelessStat->FailedPackets));
335         mvwaddstr(main_sub, 12, 1, message);
336         sprintf(message, "AgedPackets        %10u",
337                 swap4(WirelessStat->AgedPackets));
338         mvwaddstr(main_sub, 13, 1, message);
339         sprintf(message, "FCSError           %10u",
340                 swap4(WirelessStat->FCSError));
341         mvwaddstr(main_sub, 14, 1, message);
342         sprintf(message, "InvalidPLCP        %10u",
343                 swap4(WirelessStat->InvalidPLCP));
344         mvwaddstr(main_sub, 15, 1, message);
345
346         wrefresh(main_sub);
347       exit_child:
348         switch (j = read(child_pipe[0], &c, 1)) {
349         case -1:
350             break;
351         default:
352             exit(0);
353         }
354         sleep(1);
355         goto start;
356     default:
357         close(child_pipe[0]);
358         while (getch() != 'q');
359         write(child_pipe[1], "0", 1);
360         wait((int *) 0);
361         close(child_pipe[1]);
362         goto quit;
363     }
364
365   exit:
366     getch();
367   quit:
368     if (WirelessStat)
369         free(WirelessStat);
370     wclear(main_sub);
371     print_title("");
372     clear_main(0);
373 }
374
375
376 void nwn_wireless_stat()
377 {
378     char oid_dot11TransmittedFragmentCount[] =
379         { 0x2a, 0x86, 0x48, 0xce, 0x34, 0x02, 0x02, 0x01, 0x01, 0x01 };
380     char oid_dot11MulticastTransmittedFrameCount[] =
381         { 0x2a, 0x86, 0x48, 0xce, 0x34, 0x02, 0x02, 0x01, 0x02, 0x01 };
382     char oid_dot11FailedCount[] =
383         { 0x2a, 0x86, 0x48, 0xce, 0x34, 0x02, 0x02, 0x01, 0x03, 0x01 };
384     char oid_dot11RetryCount[] =
385         { 0x2a, 0x86, 0x48, 0xce, 0x34, 0x02, 0x02, 0x01, 0x04, 0x01 };
386     char oid_dot11MultipleRetryCount[] =
387         { 0x2a, 0x86, 0x48, 0xce, 0x34, 0x02, 0x02, 0x01, 0x05, 0x01 };
388     char oid_dot11FrameDuplicateCount[] =
389         { 0x2a, 0x86, 0x48, 0xce, 0x34, 0x02, 0x02, 0x01, 0x06, 0x01 };
390     char oid_dot11RTSSuccessCount[] =
391         { 0x2a, 0x86, 0x48, 0xce, 0x34, 0x02, 0x02, 0x01, 0x07, 0x01 };
392     char oid_dot11RTSFailureCount[] =
393         { 0x2a, 0x86, 0x48, 0xce, 0x34, 0x02, 0x02, 0x01, 0x08, 0x01 };
394     char oid_dot11ACKFailureCount[] =
395         { 0x2a, 0x86, 0x48, 0xce, 0x34, 0x02, 0x02, 0x01, 0x09, 0x01 };
396     char oid_dot11ReceivedFragmentCount[] =
397         { 0x2a, 0x86, 0x48, 0xce, 0x34, 0x02, 0x02, 0x01, 0x0a, 0x01 };
398     char oid_dot11MulticastReceivedFrameCount[] =
399         { 0x2a, 0x86, 0x48, 0xce, 0x34, 0x02, 0x02, 0x01, 0x0b, 0x01 };
400     char oid_dot11FCSErrorCount[] =
401         { 0x2a, 0x86, 0x48, 0xce, 0x34, 0x02, 0x02, 0x01, 0x0c, 0x01 };
402     char oid_dot11TransmittedFrameCount[] =
403         { 0x2a, 0x86, 0x48, 0xce, 0x34, 0x02, 0x02, 0x01, 0x0d, 0x01 };
404     char oid_dot11WEPUndecryptableCount[] =
405         { 0x2a, 0x86, 0x48, 0xce, 0x34, 0x02, 0x02, 0x01, 0x0e, 0x01 };
406     char oid_dot11WEPICVErrorCount[] =
407         { 0x2a, 0x86, 0x48, 0xce, 0x34, 0x01, 0x05, 0x01, 0x05, 0x01 };
408     char oid_dot11WEPExcludedCount[] =
409         { 0x2a, 0x86, 0x48, 0xce, 0x34, 0x01, 0x05, 0x01, 0x06, 0x01 };
410
411     char message[80], c;
412     pid_t pid;
413     int j, child_pipe[2], i;
414
415     varbind varbinds[16];
416     curs_set(0);
417
418     if (pipe(child_pipe) == -1) {
419         print_helperr(_("pipe error. Press any key"));
420         goto exit;
421     }
422
423     if (fcntl(child_pipe[0], F_SETFL, O_NONBLOCK) == -1) {
424         print_helperr(_("fcntl error. Press any key"));
425         goto exit;
426     }
427     print_title(_("Wireless Statistics"));
428     print_help(_("Q - quit to menu."));
429     noecho();
430
431     switch (pid = fork()) {
432     case -1:
433         print_helperr(_("fork error. Press any key"));
434         goto exit_child;
435     case 0:
436         close(child_pipe[1]);
437         varbinds[0].oid = oid_dot11TransmittedFragmentCount;
438         varbinds[0].len_oid = sizeof(oid_dot11TransmittedFragmentCount);
439         varbinds[1].oid = oid_dot11MulticastTransmittedFrameCount;
440         varbinds[1].len_oid =
441             sizeof(oid_dot11MulticastTransmittedFrameCount);
442         varbinds[2].oid = oid_dot11FailedCount;
443         varbinds[2].len_oid = sizeof(oid_dot11FailedCount);
444         varbinds[3].oid = oid_dot11RetryCount;
445         varbinds[3].len_oid = sizeof(oid_dot11RetryCount);
446         varbinds[4].oid = oid_dot11MultipleRetryCount;
447         varbinds[4].len_oid = sizeof(oid_dot11MultipleRetryCount);
448         varbinds[5].oid = oid_dot11FrameDuplicateCount;
449         varbinds[5].len_oid = sizeof(oid_dot11FrameDuplicateCount);
450         varbinds[6].oid = oid_dot11RTSSuccessCount;
451         varbinds[6].len_oid = sizeof(oid_dot11RTSSuccessCount);
452         varbinds[7].oid = oid_dot11RTSFailureCount;
453         varbinds[7].len_oid = sizeof(oid_dot11RTSFailureCount);
454         varbinds[8].oid = oid_dot11ACKFailureCount;
455         varbinds[8].len_oid = sizeof(oid_dot11ACKFailureCount);
456         varbinds[9].oid = oid_dot11ReceivedFragmentCount;
457         varbinds[9].len_oid = sizeof(oid_dot11ReceivedFragmentCount);
458         varbinds[10].oid = oid_dot11MulticastReceivedFrameCount;
459         varbinds[10].len_oid =
460             sizeof(oid_dot11MulticastReceivedFrameCount);
461         varbinds[11].oid = oid_dot11FCSErrorCount;
462         varbinds[11].len_oid = sizeof(oid_dot11FCSErrorCount);
463         varbinds[12].oid = oid_dot11TransmittedFrameCount;
464         varbinds[12].len_oid = sizeof(oid_dot11TransmittedFrameCount);
465         varbinds[13].oid = oid_dot11WEPUndecryptableCount;
466         varbinds[13].len_oid = sizeof(oid_dot11WEPUndecryptableCount);
467         varbinds[14].oid = oid_dot11WEPICVErrorCount;
468         varbinds[14].len_oid = sizeof(oid_dot11WEPICVErrorCount);
469         varbinds[15].oid = oid_dot11WEPExcludedCount;
470         varbinds[15].len_oid = sizeof(oid_dot11WEPExcludedCount);
471
472       start:
473         for (i = 0; i < 16; i++) {
474             varbinds[i].value = oid_dot11TransmittedFragmentCount;
475             varbinds[i].len_val = 0;
476             varbinds[i].type = 0x05;
477         }
478         if (snmp(varbinds, 16, GET) <= 0) {
479             print_helperr(ERR_RET_PRESS);
480             goto exit_child;
481         }
482
483         sprintf(message, "FragmentTx       %10lu FragmentRx       %10lu",
484                 (long) swap4(*varbinds[0].value), (long) swap4(*varbinds[9].value));
485         mvwaddstr(main_sub, 1, 1, message);
486         sprintf(message, "TransmittedFrame %10lu",
487                 (long) swap4(*varbinds[12].value));
488         mvwaddstr(main_sub, 2, 1, message);
489         sprintf(message, "MulticasFrameTx  %10lu MulticastFrameRx %10lu",
490                 (long) swap4(*varbinds[1].value), (long) swap4(*varbinds[10].value));
491         mvwaddstr(main_sub, 3, 1, message);
492         sprintf(message, "WEPUndecryptable %10lu WEPExcluded      %10lu",
493                 (long) swap4(*varbinds[13].value), (long) swap4(*varbinds[15].value));
494         mvwaddstr(main_sub, 4, 1, message);
495         sprintf(message, "RTSSuccess       %10lu RTSFailure       %10lu",
496                 (long) swap4(*varbinds[6].value), (long) swap4(*varbinds[7].value));
497         mvwaddstr(main_sub, 5, 1, message);
498         sprintf(message, "ACKFailure       %10lu",
499                 (long) swap4(*varbinds[8].value));
500         mvwaddstr(main_sub, 6, 1, message);
501         sprintf(message, "Retry            %10lu MultipleRetry    %10lu",
502                 (long) swap4(*varbinds[3].value), (long) swap4(*varbinds[4].value));
503         mvwaddstr(main_sub, 7, 1, message);
504         sprintf(message, "FrameDuplicate   %10lu",
505                 (long) swap4(*varbinds[5].value));
506         mvwaddstr(main_sub, 8, 1, message);
507         sprintf(message, "Failed           %10lu",
508                 (long) swap4(*varbinds[2].value));
509         mvwaddstr(main_sub, 9, 1, message);
510         sprintf(message, "FCSError         %10lu WEPICVError      %10lu",
511                 (long) swap4(*(varbinds[11].value)),
512                 (long) swap4(*(varbinds[14].value)));
513         mvwaddstr(main_sub, 10, 1, message);
514         wrefresh(main_sub);
515       exit_child:
516         switch (j = read(child_pipe[0], &c, 1)) {
517         case -1:
518             break;
519         default:
520             exit(0);
521         }
522         sleep(1);
523         goto start;
524     default:
525         close(child_pipe[0]);
526         while (getch() != 'q');
527         write(child_pipe[1], "0", 1);
528         wait((int *) 0);
529         close(child_pipe[1]);
530         goto quit;
531     }
532
533   exit:
534     getch();
535   quit:
536     wclear(main_sub);
537     print_title("");
538     clear_main(0);
539 }