|
|
1.1 root 1: /* umonitor.c */
2:
3: /* Synchronet for *nix node activity monitor */
4:
1.1.1.2 ! root 5: /* $Id: umonitor.c,v 1.72 2010/02/24 02:06:14 rswindell Exp $ */
1.1 root 6:
7: /****************************************************************************
8: * @format.tab-size 4 (Plain Text/Source Code File Header) *
9: * @format.use-tabs true (see http://www.synchro.net/ptsc_hdr.html) *
10: * *
1.1.1.2 ! root 11: * Copyright 2010 Rob Swindell - http://www.synchro.net/copyright.html *
1.1 root 12: * *
13: * This program is free software; you can redistribute it and/or *
14: * modify it under the terms of the GNU General Public License *
15: * as published by the Free Software Foundation; either version 2 *
16: * of the License, or (at your option) any later version. *
17: * See the GNU General Public License for more details: gpl.txt or *
18: * http://www.fsf.org/copyleft/gpl.html *
19: * *
20: * Anonymous FTP access to the most recent released source is available at *
21: * ftp://vert.synchro.net, ftp://cvs.synchro.net and ftp://ftp.synchro.net *
22: * *
23: * Anonymous CVS access to the development source and modification history *
24: * is available at cvs.synchro.net:/cvsroot/sbbs, example: *
25: * cvs -d :pserver:[email protected]:/cvsroot/sbbs login *
26: * (just hit return, no password is necessary) *
27: * cvs -d :pserver:[email protected]:/cvsroot/sbbs checkout src *
28: * *
29: * For Synchronet coding style and modification guidelines, see *
30: * http://www.synchro.net/source.html *
31: * *
32: * You are encouraged to submit any modifications (preferably in Unix diff *
33: * format) via e-mail to [email protected] *
34: * *
35: * Note: If this box doesn't appear square, then you need to fix your tabs. *
36: ****************************************************************************/
37:
38: #include <signal.h>
39: #include <sys/types.h>
40: #include <time.h>
41: #include <sys/time.h>
42: #ifdef __QNX__
43: #include <string.h>
44: #endif
45: #include <stdio.h>
46: #include <unistd.h>
47:
48: #include "ciolib.h"
49: #include "keys.h"
50: #define __COLORS /* Disable the colour macros in sbbsdefs.h ToDo */
51: #include "sbbs.h"
52: #include "genwrap.h"
53: #include "uifc.h"
54: #include "sbbsdefs.h"
55: #include "genwrap.h" /* stricmp */
56: #include "dirwrap.h" /* lock/unlock/sopen */
57: #include "filewrap.h" /* lock/unlock/sopen */
58: #include "sbbs_ini.h" /* INI parsing */
59: #include "scfglib.h" /* SCFG files */
60: #include "ars_defs.h" /* needed for SCFG files */
61: #include "userdat.h" /* getnodedat() */
62: #include "spyon.h"
63: #include "chat.h"
64:
65: #define CTRL(x) (x&037)
66:
67: /********************/
68: /* Global Variables */
69: /********************/
70: uifcapi_t uifc; /* User Interface (UIFC) Library API */
71: const char *YesStr="Yes";
72: const char *NoStr="No";
73:
74: int lprintf(char *fmt, ...)
75: {
76: va_list argptr;
77: char sbuf[1024];
78: int len;
79:
80: va_start(argptr,fmt);
81: len=vsnprintf(sbuf,sizeof(sbuf),fmt,argptr);
82: sbuf[sizeof(sbuf)-1]=0;
83: va_end(argptr);
84: uifc.msg(sbuf);
85: return(len);
86: }
87:
88: void bail(int code)
89: {
90: if(code) {
91: puts("\nHit a key...");
92: getch();
93: }
94: uifc.bail();
95:
96: exit(code);
97: }
98:
99: void allocfail(uint size)
100: {
101: printf("\7Error allocating %u bytes of memory.\n",size);
102: bail(1);
103: }
104:
105: void node_toggles(scfg_t *cfg,int nodenum) {
106: int nodefile;
107: char** opt;
108: int i,j;
109: node_t node;
110: int save=0;
111:
112: if((opt=(char **)alloca(sizeof(char *)*(4+1)))==NULL)
113: allocfail(sizeof(char *)*(4+1));
114: for(i=0;i<(4+1);i++)
115: if((opt[i]=(char *)alloca(MAX_OPLN))==NULL)
116: allocfail(MAX_OPLN);
117:
118: i=0;
119: uifc.helpbuf= "`Node Toggles\n"
120: "`------------`\n\n"
121: "`The following are `Yes/No `options. Hitting Enter toggles between.\n\n"
122: "`Locked for SysOps only : `Locks the node so that only SysOps may \n"
123: " logon to them.\n"
124: "`Interrupt (Hangup) : `The current user will be kicked as soon as it \n"
125: " is safe to do so. A brief message is given\n"
126: " to user.\n"
127: "`Re-run on logoff : `Toggles the system to reload the configuration\n"
128: " files when the current user logs off.\n"
129: "`Down node after logoff : `Takes the node offline after current user logs\n"
130: " off.\n\n"
131: "`[Note] `These toggles take effect immediately.";
132: while(save==0) {
133: if(getnodedat(cfg,nodenum,&node,&nodefile)) {
134: uifc.msg("Error reading node data!");
135: break;
136: }
137: j=0;
138: sprintf(opt[j++],"%-30s%3s","Locked for SysOps only",node.misc&NODE_LOCK ? YesStr : NoStr);
139: sprintf(opt[j++],"%-30s%3s","Interrupt (Hangup)",node.misc&NODE_INTR ? YesStr : NoStr);
140: sprintf(opt[j++],"%-30s%3s","Re-run on logoff",node.misc&NODE_RRUN ? YesStr : NoStr);
141: sprintf(opt[j++],"%-30s%3s","Down node after logoff"
142: ,(node.misc&NODE_DOWN || (node.status==NODE_OFFLINE)) ? YesStr : NoStr);
143: opt[j][0]=0;
144:
145: switch(uifc.list(WIN_MID|WIN_SAV,0,0,0,&i,0,"Node Toggles",opt)) {
146: case 0: /* Locked */
147: node.misc ^= NODE_LOCK;
148: break;
149:
150: case 1: /* Interrupt */
151: node.misc ^= NODE_INTR;
152: break;
153:
154: case 2: /* Re-run */
155: node.misc ^= NODE_RRUN;
156: break;
157:
158: case 3: /* Down */
159: if(node.status != NODE_WFC && node.status != NODE_OFFLINE)
160: node.misc ^= NODE_DOWN;
161: else {
162: if(node.status!=NODE_OFFLINE)
163: node.status=NODE_OFFLINE;
164: else
165: node.status=NODE_WFC;
166: }
167: break;
168:
169: case -1:
170: save=1;
171: break;
172:
173: default:
174: uifc.msg("Option not implemented");
175: continue;
176: }
177: putnodedat(cfg,nodenum,&node,nodefile);
178: }
179: }
180:
181: int dospy(int nodenum, bbs_startup_t *bbs_startup) {
182: char str[80],str2[80];
183: int i;
184:
185: if(bbs_startup->temp_dir[0])
186: snprintf(str,sizeof(str),"%slocalspy%d.sock", bbs_startup->temp_dir, nodenum);
187: else
188: snprintf(str,sizeof(str),"%slocalspy%d.sock", bbs_startup->ctrl_dir, nodenum);
189: i=spyon(str);
190: switch(i) {
191: case SPY_NOSOCKET:
192: uifc.msg("Could not create socket");
193: return(-1);
194:
195: case SPY_NOCONNECT:
196: sprintf(str2,"Failed to connect to %s",str);
197: uifc.msg(str2);
198: return(-1);
199:
200: case SPY_SELECTFAILED:
201: uifc.msg("select() failed, connection terminated.");
202: return(-1);
203:
204: case SPY_SOCKETLOST:
205: uifc.msg("Spy socket lost");
206: return(-1);
207:
208: case SPY_STDINLOST:
209: uifc.msg("STDIN has gone away... you probably can't close this window. :-)");
210: return(-1);
211:
212: case SPY_CLOSED:
213: break;
214:
215: default:
216: sprintf(str,"Unknown return code %d",i);
217: uifc.msg(str);
218: return(-1);
219: }
220: return(0);
221: }
222:
223: int sendmessage(scfg_t *cfg, int nodenum,node_t *node) {
224: char str[80],str2[80];
225:
226: uifc.input(WIN_MID|WIN_SAV,0,0,"Telegram",str2,58,K_WRAP|K_MSG);
227: sprintf(str,"\1n\1y\1hMessage From Sysop:\1w %s\r\n",str2);
228: if(getnodedat(cfg,nodenum,node,NULL))
229: return(-1);
230: if(node->useron==0)
231: return(-1);
232: putsmsg(cfg, node->useron, str);
233: return(0);
234: }
235:
236: int clearerrors(scfg_t *cfg, int nodenum, node_t *node) {
237: int nodefile;
238: if(getnodedat(cfg,nodenum,node,&nodefile)) {
239: uifc.msg("getnodedat() failed! (Nothing done)");
240: return(-1);
241: }
242: node->errors=0;
243: putnodedat(cfg,nodenum,node,nodefile);
244: uifc.msg("Error count cleared for this node.");
245: return(0);
246: }
247:
248: /* Assumes a 12 char outstr */
249: char *getsizestr(char *outstr, long size, BOOL bytes) {
250: if(bytes) {
251: if(size < 1000) { /* Bytes */
252: snprintf(outstr,12,"%ld bytes",size);
253: return(outstr);
254: }
255: if(size<10000) { /* Bytes with comma */
256: snprintf(outstr,12,"%ld,%03ld bytes",(size/1000),(size%1000));
257: return(outstr);
258: }
259: size = size/1024;
260: }
261: if(size<1000) { /* KB */
262: snprintf(outstr,12,"%ld KB",size);
263: return(outstr);
264: }
265: if(size<999999) { /* KB With comma */
266: snprintf(outstr,12,"%ld,%03ld KB",(size/1000),(size%1000));
267: return(outstr);
268: }
269: size = size/1024;
270: if(size<1000) { /* MB */
271: snprintf(outstr,12,"%ld MB",size);
272: return(outstr);
273: }
274: if(size<999999) { /* MB With comma */
275: snprintf(outstr,12,"%ld,%03ld MB",(size/1000),(size%1000));
276: return(outstr);
277: }
278: size = size/1024;
279: if(size<1000) { /* GB */
280: snprintf(outstr,12,"%ld GB",size);
281: return(outstr);
282: }
283: if(size<999999) { /* GB With comma */
284: snprintf(outstr,12,"%ld,%03ld GB",(size/1000),(size%1000));
285: return(outstr);
286: }
287: size = size/1024;
288: if(size<1000) { /* TB (Yeah, right) */
289: snprintf(outstr,12,"%ld TB",size);
290: return(outstr);
291: }
292: sprintf(outstr,"Plenty");
293: return(outstr);
294: }
295:
296: /* Assumes a 12 char outstr */
297: char *getnumstr(char *outstr, ulong size) {
298: if(size < 1000) {
299: snprintf(outstr,12,"%ld",size);
300: return(outstr);
301: }
302: if(size<1000000) {
303: snprintf(outstr,12,"%ld,%03ld",(size/1000),(size%1000));
304: return(outstr);
305: }
306: if(size<1000000000) {
307: snprintf(outstr,12,"%ld,%03ld,%03ld",(size/1000000),((size/1000)%1000),(size%1000));
308: return(outstr);
309: }
310: size=size/1000000;
311: if(size<1000000) {
312: snprintf(outstr,12,"%ld,%03ld M",(size/1000),(size%1000));
313: return(outstr);
314: }
315: if(size<10000000) {
316: snprintf(outstr,12,"%ld,%03ld,%03ld M",(size/1000000),((size/1000)%1000),(size%1000));
317: return(outstr);
318: }
319: sprintf(outstr,"Plenty");
320: return(outstr);
321: }
322:
323: int drawstats(scfg_t *cfg, int nodenum, node_t *node, int *curp, int *barp) {
324: stats_t sstats;
325: stats_t nstats;
326: char statbuf[6*78]; /* Buffer to hold the stats for passing to uifc.showbuf() */
327: char str[4][4][12];
328: char usrname[128];
329: ulong free;
330: uint i,l,m;
331: time_t t;
332: int shownode=1;
333:
334: if(getnodedat(cfg,nodenum,node,NULL)) {
335: shownode=0;
336: }
337: else {
338: getstats(cfg, nodenum, &nstats);
339: }
340: username(cfg,node->useron,usrname);
341:
342: getstats(cfg, 0, &sstats);
343: t=time(NULL);
344: strftime(str[0][0],12,"%b %e",localtime(&t));
345: free=getfreediskspace(cfg->temp_dir,1024);
346: if(free<1000) {
347: free=getfreediskspace(cfg->temp_dir,0);
348: getsizestr(str[0][1],free,TRUE);
349: }
350: else
351: getsizestr(str[0][1],free,FALSE);
352: if(shownode) {
353: snprintf(str[1][0],12,"%s/%s",getnumstr(str[3][2],nstats.ltoday),getnumstr(str[3][3],sstats.ltoday));
354: getnumstr(str[1][1],sstats.logons);
355: snprintf(str[1][2],12,"%s/%s",getnumstr(str[3][2],nstats.ttoday),getnumstr(str[3][3],sstats.ttoday));
356: getnumstr(str[1][3],sstats.timeon);
357: snprintf(str[2][0],12,"%s/%s",getnumstr(str[3][2],sstats.etoday),getnumstr(str[3][3],getmail(cfg,0,0)));
358: l=m=0;
359: for(i=0;i<cfg->total_subs;i++)
360: l+=getposts(cfg,i); /* l=total posts */
361: for(i=0;i<cfg->total_dirs;i++)
362: m+=getfiles(cfg,i); /* m=total files */
363: snprintf(str[2][1],12,"%s/%s",getnumstr(str[3][2],sstats.ptoday),getnumstr(str[3][3],l));
364: snprintf(str[2][2],12,"%s/%s",getnumstr(str[3][2],sstats.ftoday),getnumstr(str[3][3],getmail(cfg,1,0)));
365: snprintf(str[2][3],12,"%s/%s",getnumstr(str[3][2],sstats.nusers),getnumstr(str[3][3],total_users(cfg)));
366: getsizestr(str[3][0],sstats.ulb,TRUE);
367: snprintf(str[3][1],12,"%s/%s",getnumstr(str[3][2],sstats.uls),getnumstr(str[3][3],m));
368: getsizestr(str[3][2],sstats.dlb,TRUE);
369: getnumstr(str[3][3],sstats.dls);
370: }
371: else {
372: snprintf(str[1][0],12,"%s",getnumstr(str[3][3],sstats.ltoday));
373: getnumstr(str[1][1],sstats.logons);
374: snprintf(str[1][2],12,"%s",getnumstr(str[3][3],sstats.ttoday));
375: getnumstr(str[1][3],sstats.timeon);
376: snprintf(str[2][0],12,"%s/%s",getnumstr(str[3][2],sstats.etoday),getnumstr(str[3][3],getmail(cfg,0,0)));
377: l=m=0;
378: for(i=0;i<cfg->total_subs;i++)
379: l+=getposts(cfg,i); /* l=total posts */
380: for(i=0;i<cfg->total_dirs;i++)
381: m+=getfiles(cfg,i); /* m=total files */
382: snprintf(str[2][1],12,"%s/%s",getnumstr(str[3][2],sstats.ptoday),getnumstr(str[3][3],l));
383: snprintf(str[2][2],12,"%s/%s",getnumstr(str[3][2],sstats.ftoday),getnumstr(str[3][3],getmail(cfg,1,0)));
384: snprintf(str[2][3],12,"%s/%s",getnumstr(str[3][2],sstats.nusers),getnumstr(str[3][3],total_users(cfg)));
385: getsizestr(str[3][0],sstats.ulb,TRUE);
386: snprintf(str[3][1],12,"%s/%s",getnumstr(str[3][2],sstats.uls),getnumstr(str[3][3],m));
387: getsizestr(str[3][2],sstats.dlb,TRUE);
388: getnumstr(str[3][3],sstats.dls);
389: }
390: snprintf(statbuf,sizeof(statbuf),"`Node #`: %-3d %6s `Space`: %s"
391: "\n`Logons`: %-11s `Total`: %-11s `Timeon`: %-11s `Total`: %-11s"
392: "\n`Emails`: %-11s `Posts`: %-11s `Fbacks`: %-11s `Users`: %-11s"
393: "\n`Uloads`: %-11s `Files`: %-11s `Dloads`: %-11s `Files`: %-11s",
394: nodenum,str[0][0],str[0][1],
395: str[1][0],str[1][1],str[1][2],str[1][3],
396: str[2][0],str[2][1],str[2][2],str[2][3],
397: str[3][0],str[3][1],str[3][2],str[3][3]);
398:
399: uifc.showbuf(WIN_HLP|WIN_L2R|WIN_DYN|WIN_PACK,1,1,80,6,"Statistics",statbuf,curp,barp);
400: /* Node 5 : Mar 11 Space: 162,024k
401: Logons: 23/103 Total: 62,610 Timeon: 322/2430 Total: 5,321,900
402: Emails: 4/265 Posts: 4/12811 Fbacks: 2/17 Users: 1/592
403: Uloads: 324k Files: 1/2195 Dloads: 9,308k Files: 52 */
404: return(0);
405: }
406:
407: int view_log(char *filename, char *title)
408: {
409: char str[1024];
410: int buffile;
411: int j;
412: char *buf;
413:
414: if(fexist(filename)) {
415: if((buffile=sopen(filename,O_RDONLY,SH_DENYWR))>=0) {
416: j=filelength(buffile);
417: if((buf=(char *)alloca(j+1))!=NULL) {
418: read(buffile,buf,j);
419: close(buffile);
420: *(buf+j)=0;
421: uifc.showbuf(WIN_MID,0,0,76,uifc.scrn_len-2,title,buf,NULL,NULL);
422: return(0);
423: }
424: close(buffile);
425: uifc.msg("Error allocating memory for the error log");
426: return(3);
427: }
428: sprintf(str,"Error opening %s",title);
429: uifc.msg(str);
430: return(1);
431: }
432: sprintf(str,"%s does not exists",title);
433: uifc.msg(str);
434: return(2);
435: }
436:
437: int view_logs(scfg_t *cfg)
438: {
439: char** opt;
440: int i;
441: char str[1024];
442: struct tm tm;
443: struct tm tm_yest;
444: time_t now;
445:
446: now=time(NULL);
447: localtime_r(&now,&tm);
448: now -= 60*60*24;
449: localtime_r(&now,&tm_yest);
450: if((opt=(char **)alloca(sizeof(char *)*(9+1)))==NULL)
451: allocfail(sizeof(char *)*(9+1));
452: for(i=0;i<(9+1);i++)
453: if((opt[i]=(char *)alloca(MAX_OPLN))==NULL)
454: allocfail(MAX_OPLN);
455:
456: i=0;
457: strcpy(opt[i++],"Today's callers");
458: strcpy(opt[i++],"Yesterday's callers");
459: strcpy(opt[i++],"Error log");
460: strcpy(opt[i++],"Today's log");
461: strcpy(opt[i++],"Yesterday's log");
462: strcpy(opt[i++],"Spam log");
463: strcpy(opt[i++],"SBBSEcho log");
464: strcpy(opt[i++],"Guru log");
465: strcpy(opt[i++],"Hack log");
466: opt[i][0]=0;
467: i=0;
468: uifc.helpbuf= "`View Logs\n"
469: "`---------\n\n"
470: "`Today's callers : `View a list of Today's callers.\n"
471: "`Yesterday's callers : `View a list of Yesterday's callers.\n"
472: "`Error log : `View the Error log.\n"
473: "`Today's log : `View Today's system activity.\n"
474: "`Yesterday's log : `View Yesterday's system activity.\n"
475: "`Spam log : `View the log of Spam E-Mail sent to the system.\n"
476: "`SBBSEcho log : `View the SBBSecho tosser log.\n"
477: "`Guru log : `View the transcriptions of chats with the Guru.\n"
478: "`Hack log : `View the Hack attempt log.";
479:
480: while(1) {
481: switch(uifc.list(WIN_MID|WIN_SAV,0,0,0,&i,0,"View Logs",opt)) {
482: case -1:
483: return(0);
484: case 0:
485: sprintf(str,"%slogs/%2.2d%2.2d%2.2d.lol",cfg->logs_dir,tm.tm_mon+1,tm.tm_mday
486: ,TM_YEAR(tm.tm_year));
487: view_log(str,"Todays Callers");
488: break;
489: case 1:
490: sprintf(str,"%slogs/%2.2d%2.2d%2.2d.lol",cfg->logs_dir,tm_yest.tm_mon+1
491: ,tm_yest.tm_mday,TM_YEAR(tm_yest.tm_year));
492: view_log(str,"Yesterdays Callers");
493: break;
494: case 2:
495: sprintf(str,"%s/error.log",cfg->logs_dir);
496: view_log(str,"Error Log");
497: break;
498: case 3:
499: sprintf(str,"%slogs/%2.2d%2.2d%2.2d.log",cfg->logs_dir,tm.tm_mon+1,tm.tm_mday
500: ,TM_YEAR(tm.tm_year));
501: view_log(str,"Todays Log");
502: break;
503: case 4:
504: sprintf(str,"%slogs/%2.2d%2.2d%2.2d.log",cfg->logs_dir,tm_yest.tm_mon+1
505: ,tm_yest.tm_mday,TM_YEAR(tm_yest.tm_year));
506: view_log(str,"Yesterdays Log");
507: break;
508: case 5:
509: sprintf(str,"%sspam.log",cfg->logs_dir);
510: view_log(str,"SPAM Log");
511: break;
512: case 6:
513: sprintf(str,"%ssbbsecho.log",cfg->logs_dir);
514: view_log(str,"SBBSEcho Log");
515: break;
516: case 7:
517: sprintf(str,"%sguru.log",cfg->logs_dir);
518: view_log(str,"Guru Log");
519: break;
520: case 8:
521: sprintf(str,"%shack.log",cfg->logs_dir);
522: view_log(str,"Hack Log");
523: break;
524: }
525: }
526: }
527:
528: int do_cmd(char *cmd)
529: {
530: int i;
531: struct text_info ti;
532: char *p;
533:
534: gettextinfo(&ti);
535: p=alloca(ti.screenheight*ti.screenwidth*2);
536: gettext(1,1,ti.screenwidth,ti.screenheight,p);
537: i=system(cmd);
538: puttext(1,1,ti.screenwidth,ti.screenheight,p);
539: return(i);
540: }
541:
542: int qwk_callouts(scfg_t *cfg)
543: {
544: char** opt;
545: int i,j;
546: char str[1024];
547:
548: if(cfg->total_qhubs<1) {
549: uifc.msg("No QWK hubs configured!");
550: return(1);
551: }
552:
553: if((opt=(char **)alloca(sizeof(char *)*(cfg->total_qhubs+1)))==NULL)
554: allocfail(sizeof(char *)*(cfg->total_qhubs+1));
555: for(i=0;i<(cfg->total_qhubs+1);i++)
556: if((opt[i]=(char *)alloca(MAX_OPLN))==NULL)
557: allocfail(MAX_OPLN);
558:
559:
560: uifc.helpbuf= "`QWK Callouts\n"
561: "`------------\n\n"
562: "Select the Hub and press enter to initiate a call out to\n"
563: "the highlighted system.";
564:
565: j=0;
566: while(1) {
567: for(i=0;i<cfg->total_qhubs;i++) {
568: strcpy(opt[i],cfg->qhub[i]->id);
569: sprintf(str,"%sqnet/%s.now",cfg->data_dir,cfg->qhub[i]->id);
570: if(fexist(str))
571: strcat(opt[i]," (pending)");
572: }
573: opt[i][0]=0;
574: switch(uifc.list(WIN_MID|WIN_SAV,0,0,0,&j,0,"QWK Callouts",opt)) {
575: case -1:
576: return(0);
577: break;
578: default:
579: sprintf(str,"%sqnet/%s.now",cfg->data_dir,cfg->qhub[j]->id);
580: ftouch(str);
581: }
582: }
583: return(0);
584: }
585:
586: int run_events(scfg_t *cfg)
587: {
588: char** opt;
589: int i,j;
590: char str[1024];
591:
592: if((opt=(char **)alloca(sizeof(char *)*(cfg->total_events+1)))==NULL)
593: allocfail(sizeof(char *)*(cfg->total_events+1));
594: for(i=0;i<(cfg->total_events+1);i++)
595: if((opt[i]=(char *)alloca(MAX_OPLN))==NULL)
596: allocfail(MAX_OPLN);
597:
598: if(cfg->total_events<1) {
599: uifc.msg("No events configured!");
600: return(1);
601: }
602: j=0;
603:
604: uifc.helpbuf= "`Run Events\n"
605: "`----------\n\n"
606: "To run and event, highlight it and press Enter";
607:
608: while(1) {
609: for(i=0;i<cfg->total_events;i++) {
610: strcpy(opt[i],cfg->event[i]->code);
611: sprintf(str,"%s%s.now",cfg->data_dir,cfg->event[i]->code);
612: if(fexist(str))
613: strcat(opt[i]," (pending)");
614: }
615: opt[i][0]=0;
616: switch(uifc.list(WIN_MID|WIN_SAV,0,0,0,&j,0,"Run Events",opt)) {
617: case -1:
618: return(0);
619: break;
620: default:
621: sprintf(str,"%s%s.now",cfg->data_dir,cfg->event[j]->code);
622: ftouch(str);
623: }
624: }
625: return(0);
626: }
627:
628: int recycle_servers(scfg_t *cfg)
629: {
630: char str[1024];
631: char **opt;
632: int i=0;
633:
634: if((opt=(char **)alloca(sizeof(char *)*(5+1)))==NULL)
635: allocfail(sizeof(char *)*(5+1));
636: for(i=0;i<(5+1);i++)
637: if((opt[i]=(char *)alloca(MAX_OPLN))==NULL)
638: allocfail(MAX_OPLN);
639:
640: i=0;
641: strcpy(opt[i++],"FTP server");
642: strcpy(opt[i++],"Mail server");
643: strcpy(opt[i++],"Services");
644: strcpy(opt[i++],"Telnet server");
645: strcpy(opt[i++],"Web server");
646: opt[i][0]=0;
647:
648: uifc.helpbuf= "`Recycle Servers\n"
649: "`---------------\n\n"
650: "To rerun a server, highlight it and press Enter.\n"
651: "This will reload the configuration files for selected\n"
652: "server.";
653:
654: i=0;
655: while(1) {
656: switch(uifc.list(WIN_MID|WIN_SAV,0,0,0,&i,0,"Recycle Servers",opt)) {
657: case -1:
658: return(0);
659: break;
660: case 0:
661: sprintf(str,"%sftpsrvr.rec",cfg->ctrl_dir);
662: ftouch(str);
663: break;
664: case 1:
665: sprintf(str,"%smailsrvr.rec",cfg->ctrl_dir);
666: ftouch(str);
667: break;
668: case 2:
669: sprintf(str,"%sservices.rec",cfg->ctrl_dir);
670: ftouch(str);
671: break;
672: case 3:
673: sprintf(str,"%stelnet.rec",cfg->ctrl_dir);
674: ftouch(str);
675: break;
676: case 4:
677: sprintf(str,"%swebsrvr.rec",cfg->ctrl_dir);
678: ftouch(str);
679: break;
680: }
681: }
682: return(0);
683: }
684:
685: char *geteditor(char *edit)
686: {
687: if(getenv("EDITOR")==NULL && (getenv("VISUAL")==NULL || getenv("DISPLAY")==NULL))
688: strcpy(edit,"vi");
689: else {
690: if(getenv("DISPLAY")!=NULL && getenv("VISUAL")!=NULL)
691: strcpy(edit,getenv("VISUAL"));
692: else
693: strcpy(edit,getenv("EDITOR"));
694: }
695: return(edit);
696: }
697:
698:
699: int edit_cfg(scfg_t *cfg)
700: {
701: char** opt;
702: int i;
703: char cmd[1024];
704: char editcmd[1024];
705:
706: if((opt=(char **)alloca(sizeof(char *)*(17+1)))==NULL)
707: allocfail(sizeof(char *)*(17+1));
708: for(i=0;i<(17+1);i++)
709: if((opt[i]=(char *)alloca(MAX_OPLN))==NULL)
710: allocfail(MAX_OPLN);
711:
712: i=0;
713: strcpy(opt[i++],"sbbs.ini");
714: strcpy(opt[i++],"alias.cfg");
715: strcpy(opt[i++],"attr.cfg");
716: strcpy(opt[i++],"dns_blacklist.cfg");
717: strcpy(opt[i++],"dnsbl_exempt.cfg");
718: strcpy(opt[i++],"domains.cfg");
1.1.1.2 ! root 719: strcpy(opt[i++],"mailproc.ini");
! 720: strcpy(opt[i++],"mime_types.ini");
1.1 root 721: strcpy(opt[i++],"relay.cfg");
722: strcpy(opt[i++],"sbbsecho.cfg");
723: strcpy(opt[i++],"services.ini");
724: strcpy(opt[i++],"ftpalias.cfg");
1.1.1.2 ! root 725: strcpy(opt[i++],"sockopts.ini");
1.1 root 726: strcpy(opt[i++],"spambait.cfg");
727: strcpy(opt[i++],"spamblock.cfg");
728: strcpy(opt[i++],"twitlist.cfg");
729: opt[i][0]=0;
730: uifc.helpbuf= "Highlight desired file and hit Enter to edit it.";
731: i=0;
732: while(1) {
733: switch(uifc.list(WIN_MID|WIN_SAV,0,0,0,&i,0,"System Options",opt)) {
734: case -1:
735: return(0);
736: break;
737: default:
738: sprintf(cmd,"%s %s%s",geteditor(editcmd),cfg->ctrl_dir,opt[i]);
739: do_cmd(cmd);
740: break;
741: }
742: }
743: return(0);
744: }
745:
746: int edit_can(scfg_t *cfg)
747: {
748: char** opt;
749: int i;
750: char cmd[1024];
751: char editcmd[1024];
752:
753: if((opt=(char **)alloca(sizeof(char *)*(9+1)))==NULL)
754: allocfail(sizeof(char *)*(9+1));
755: for(i=0;i<(9+1);i++)
756: if((opt[i]=(char *)alloca(MAX_OPLN))==NULL)
757: allocfail(MAX_OPLN);
758:
759: i=0;
760: strcpy(opt[i++],"email.can");
761: strcpy(opt[i++],"file.can");
762: strcpy(opt[i++],"host.can");
763: strcpy(opt[i++],"ip.can");
764: strcpy(opt[i++],"ip-silent.can");
765: strcpy(opt[i++],"name.can");
766: strcpy(opt[i++],"phone.can");
767: strcpy(opt[i++],"rlogin.can");
768: strcpy(opt[i++],"subject.can");
769: opt[i][0]=0;
770: uifc.helpbuf="Highlight desired file and hit Enter to edit it.";
771: i=0;
772: while(1) {
773: switch(uifc.list(WIN_MID|WIN_SAV,0,0,0,&i,0,"System Options",opt)) {
774: case -1:
775: return(0);
776: break;
777: default:
778: sprintf(cmd,"%s %s%s",geteditor(editcmd),cfg->text_dir,opt[i]);
779: do_cmd(cmd);
780: break;
781: }
782: }
783: return(0);
784: }
785:
786: int main(int argc, char** argv) {
787:
788: char** opt;
789: char** mopt;
790: int main_dflt=0;
791: int main_bar=0;
792: char revision[16];
793: char str[256],ctrl_dir[41],*p;
794: char title[256];
795: int i,j;
796: node_t node;
797: int nodefile;
798: box_t boxch;
799: scfg_t cfg;
800: int done;
801: int ciolib_mode=CIOLIB_MODE_AUTO;
802:
803: /******************/
804: /* Ini file stuff */
805: /******************/
806: char ini_file[MAX_PATH+1];
807: FILE* fp;
808: bbs_startup_t bbs_startup;
809:
1.1.1.2 ! root 810: sscanf("$Revision: 1.72 $", "%*s %s", revision);
1.1 root 811:
812: printf("\nSynchronet UNIX Monitor %s-%s Copyright %s "
813: "Rob Swindell\n",revision,PLATFORM_DESC,__DATE__+7);
814:
815: p=getenv("SBBSCTRL");
816: if(p==NULL) {
817: printf("\7\nSBBSCTRL environment variable is not set.\n");
818: printf("This environment variable must be set to your CTRL directory.");
819: printf("\nExample: SET SBBSCTRL=/sbbs/ctrl\n");
820: exit(1); }
821:
822: sprintf(ctrl_dir,"%.40s",p);
823: if(ctrl_dir[strlen(ctrl_dir)-1]!='\\'
824: && ctrl_dir[strlen(ctrl_dir)-1]!='/')
825: strcat(ctrl_dir,"/");
826:
827: gethostname(str,sizeof(str)-1);
828:
829: sbbs_get_ini_fname(ini_file, ctrl_dir, str);
830:
831: /* Initialize BBS startup structure */
832: memset(&bbs_startup,0,sizeof(bbs_startup));
833: bbs_startup.size=sizeof(bbs_startup);
834: strcpy(bbs_startup.ctrl_dir,ctrl_dir);
835:
836: /* Read .ini file here */
837: if(ini_file[0]!=0 && (fp=fopen(ini_file,"r"))!=NULL) {
838: printf("Reading %s\n",ini_file);
839: }
840: /* We call this function to set defaults, even if there's no .ini file */
841: sbbs_read_ini(fp,
842: NULL, /* global_startup */
843: NULL, &bbs_startup,
844: NULL, NULL, /* ftp_startup */
845: NULL, NULL, /* web_startup */
846: NULL, NULL, /* mail_startup */
847: NULL, NULL /* services_startup */
848: );
849:
850: /* close .ini file here */
851: if(fp!=NULL)
852: fclose(fp);
853:
854: chdir(bbs_startup.ctrl_dir);
855:
856: /* Read .cfg files here */
857: memset(&cfg,0,sizeof(cfg));
858: cfg.size=sizeof(cfg);
859: SAFECOPY(cfg.ctrl_dir,bbs_startup.ctrl_dir);
860: if(!load_cfg(&cfg, NULL, TRUE, str)) {
861: printf("ERROR! %s\n",str);
862: exit(1);
863: }
864: prep_dir(cfg.data_dir, cfg.temp_dir, sizeof(cfg.temp_dir));
865:
866: memset(&uifc,0,sizeof(uifc));
867: uifc.mode|=UIFC_NOCTRL;
868:
869: uifc.esc_delay=500;
870:
871: boxch.ls=186;
872: boxch.rs=186;
873: boxch.ts=205;
874: boxch.bs=205;
875: boxch.tl=201;
876: boxch.tr=187;
877: boxch.bl=200;
878: boxch.br=188;
879: for(i=1;i<argc;i++) {
880: if(argv[i][0]=='-'
881: )
882: switch(toupper(argv[i][1])) {
883: case 'C':
884: uifc.mode|=UIFC_COLOR;
885: break;
886: case 'L':
887: uifc.scrn_len=atoi(argv[i]+2);
888: break;
889: case 'E':
890: uifc.esc_delay=atoi(argv[i]+2);
891: break;
892: case 'I':
893: switch(toupper(argv[i][2])) {
894: case 'A':
895: ciolib_mode=CIOLIB_MODE_ANSI;
896: break;
897: case 'C':
898: ciolib_mode=CIOLIB_MODE_CURSES;
899: break;
900: case 0:
901: printf("NOTICE: The -i option is depreciated, use -if instead\r\n");
902: SLEEP(2000);
903: case 'F':
904: ciolib_mode=CIOLIB_MODE_CURSES_IBM;
905: break;
906: case 'X':
907: ciolib_mode=CIOLIB_MODE_X;
908: break;
909: case 'W':
910: ciolib_mode=CIOLIB_MODE_CONIO;
911: break;
912: default:
913: goto USAGE;
914: }
915: break;
916: default:
917: USAGE:
918: printf("\nusage: %s [ctrl_dir] [options]"
919: "\n\noptions:\n\n"
920: "-c = force color mode\n"
921: "-e# = set escape delay to #msec\n"
922: "-iX = set interface mode to X (default=auto) where X is one of:\r\n"
923: #ifdef __unix__
924: " X = X11 mode\r\n"
925: " C = Curses mode\r\n"
926: " F = Curses mode with forced IBM charset\r\n"
927: #else
928: " W = Win32 native mode\r\n"
929: #endif
930: " A = ANSI mode\r\n"
931: "-l# = set screen lines to #\n"
932: ,argv[0]
933: );
934: exit(0);
935: }
936: }
937:
938: signal(SIGPIPE, SIG_IGN);
939:
940: uifc.size=sizeof(uifc);
941: i=initciolib(ciolib_mode);
942: if(i!=0) {
943: printf("ciolib library init returned error %d\n",i);
944: exit(1);
945: }
946: i=uifcini32(&uifc); /* curses */
947: if(i!=0) {
948: printf("uifc library init returned error %d\n",i);
949: exit(1);
950: }
951:
952: if((opt=(char **)alloca(sizeof(char *)*(10+1)))==NULL)
953: allocfail(sizeof(char *)*(10+1));
954: for(i=0;i<(10+1);i++)
955: if((opt[i]=(char *)alloca(MAX_OPLN))==NULL)
956: allocfail(MAX_OPLN);
957:
958: if((mopt=(char **)alloca(sizeof(char *)*cfg.sys_nodes+2))==NULL)
959: allocfail(sizeof(char *)*cfg.sys_nodes+2);
960: for(i=0;i<cfg.sys_nodes+2;i++)
961: if((mopt[i]=(char *)alloca(MAX_OPLN))==NULL)
962: allocfail(MAX_OPLN);
963:
964: sprintf(title,"Synchronet UNIX Monitor %s-%s",revision,PLATFORM_DESC);
965: if(uifc.scrn(title)) {
966: printf(" USCRN (len=%d) failed!\n",uifc.scrn_len+1);
967: bail(1);
968: }
969:
970: while(1) {
971: strcpy(mopt[0],"System Options");
972: for(i=1;i<=cfg.sys_nodes;i++) {
973: if((j=getnodedat(&cfg,i,&node,NULL)))
974: sprintf(mopt[i],"Error reading node data (%d)!",j);
975: else
976: sprintf(mopt[i],"%3d: %s",i,nodestatus(&cfg,&node,str,71));
977: }
978: mopt[i][0]=0;
979:
980: uifc.helpbuf= "`Synchronet UNIX Monitor\n"
981: "`------------------\n"
982: "Welcome to the Synchronet UNIX Monitor.\n"
983: "Displayed on this screen are the statitics for the BBS\n"
984: "You can scroll through the list starting at \"System Options\" \n"
985: "Pressing Enter on each will give a menu of option to perform.\n"
986: "Additionally these keys are available from this screen:\n\n"
987: "`CTRL-E : `Displays the error log\n"
988: "`F12 : `Spys on the currently selected node\n"
989: "`F11 : `Send message to the currently selected node\n"
990: "`F10 : `Chats with the user on the currently selected node\n"
991: "`DEL : `Clear errors on currently selected node\n"
992: "`CTRL-L : `Lock node toggle\n"
993: "`CTRL-R : `Rerun node\n"
994: "`CTRL-D : `Down node toggle\n"
995: "`CTRL-I : `Interrupt node\n";
996:
997: drawstats(&cfg, main_dflt, &node, &main_dflt, &main_bar);
998:
999: j=uifc.list(WIN_L2R|WIN_ESC|WIN_ACT|WIN_DYN,0,5,70,&main_dflt,&main_bar
1000: ,title,mopt);
1001:
1002: if(j == -2)
1003: continue;
1004:
1005: if(j==-7) { /* CTRL-E */
1006: sprintf(str,"%s/error.log",cfg.data_dir);
1007: view_log(str,"Error Log");
1008: continue;
1009: }
1010:
1011: if(j==0) {
1012: /* System Options */
1013: i=0;
1014: strcpy(opt[i++],"Run SCFG");
1015: strcpy(opt[i++],"Run User Editor");
1016: strcpy(opt[i++],"Run SyncTERM");
1017: strcpy(opt[i++],"View logs");
1018: strcpy(opt[i++],"Force QWK Net callout");
1019: strcpy(opt[i++],"Run event");
1020: strcpy(opt[i++],"Recycle servers");
1021: strcpy(opt[i++],"Edit CFG/INI files");
1022: strcpy(opt[i++],"Edit trashcan files");
1023: opt[i][0]=0;
1024: uifc.helpbuf= "`System Options`\n"
1025: "`------------`\n\n"
1026: "`Run SCFG : `Run the Synchronet Configuration Utility.\n"
1027: "`Run User Editor : `Call up the User Editor.\n"
1028: "`Run SynchTERM : `Run SyncTERM for RLogin. SyncTERM must be\n"
1029: " in the exec directory.\n"
1030: "`View logs : `View the various system logs.\n"
1031: "`Force QWK Net callout : `Force a callout to QWK Net Hub. Select which\n"
1032: " Hub from a popup list of configured Hubs.\n"
1033: "`Run Event : `Call up a menu of system events that can be\n"
1034: " manually.\n"
1035: "`Recycle Servers : `Have the Servers reload their configuration \n"
1036: " files.\n"
1037: "`Edit trashcan files : `Edit the various .can files. i.e.; ip.can";
1038:
1039: done=0;
1040: i=0;
1041: while(!done) {
1042: switch(uifc.list(WIN_MID|WIN_SAV,0,0,0,&i,0,"System Options",opt)) {
1043: case -1:
1044: done=1;
1045: break;
1046: case 0:
1047: sprintf(str,"%sscfg ",cfg.exec_dir);
1048: for(j=1; j<argc; j++) {
1049: strcat(str,"'");
1050: strcat(str,argv[j]);
1051: strcat(str,"' ");
1052: }
1053: do_cmd(str);
1054: break;
1055: case 1:
1056: sprintf(str,"%suedit ",cfg.exec_dir);
1057: for(j=1; j<argc; j++) {
1058: strcat(str,"'");
1059: strcat(str,argv[j]);
1060: strcat(str,"' ");
1061: }
1062: do_cmd(str);
1063: break;
1064: case 2:
1065: sprintf(str,"%ssyncterm",cfg.exec_dir);
1066: for(j=1; j<argc; j++) {
1067: strcat(str,"'");
1068: strcat(str,argv[j]);
1069: strcat(str,"' ");
1070: }
1071: do_cmd(str);
1072: break;
1073: case 3:
1074: view_logs(&cfg);
1075: break;
1076: case 4:
1077: qwk_callouts(&cfg);
1078: break;
1079: case 5:
1080: run_events(&cfg);
1081: break;
1082: case 6:
1083: recycle_servers(&cfg);
1084: break;
1085: case 7:
1086: edit_cfg(&cfg);
1087: break;
1088: case 8:
1089: edit_can(&cfg);
1090: break;
1091: }
1092: }
1093: continue;
1094: }
1095:
1096: if(j==-1) {
1097: i=0;
1098: strcpy(opt[0],YesStr);
1099: strcpy(opt[1],NoStr);
1100: opt[2][0]=0;
1101: uifc.helpbuf= "`Exit Synchronet UNIX Monitor:`\n"
1102: "\n"
1103: "\nIf you want to exit the Synchronet UNIX monitor utility,"
1104: "\nselect `Yes`. Otherwise, select `No` or hit ~ ESC ~.";
1105: i=uifc.list(WIN_MID,0,0,0,&i,0,"Exit Synchronet Monitor",opt);
1106: if(!i)
1107: bail(0);
1108: continue;
1109: }
1110:
1111: /* Everything after this point is invalid for the System Options */
1112: if(main_dflt==0)
1113: continue;
1114:
1115: if(j==-2-CIO_KEY_DC) { /* Clear errors */
1116: clearerrors(&cfg, main_dflt,&node);
1117: continue;
1118: }
1119:
1120: if(j==-2-CIO_KEY_F(10)) { /* Chat */
1121: if(getnodedat(&cfg,main_dflt,&node,NULL)) {
1122: uifc.msg("Error reading node data!");
1123: continue;
1124: }
1125: if((node.status==NODE_INUSE) && node.useron)
1126: chat(&cfg,main_dflt,&node,&boxch,NULL);
1127: continue;
1128: }
1129:
1130: if(j==-2-CIO_KEY_F(11)) { /* Send message */
1131: sendmessage(&cfg, main_dflt,&node);
1132: continue;
1133: }
1134:
1135: if(j==-2-CIO_KEY_F(12)) { /* Spy */
1136: dospy(main_dflt,&bbs_startup);
1137: continue;
1138: }
1139:
1140: if(j==-2-CTRL('l')) { /* Lock node */
1141: if(getnodedat(&cfg,main_dflt,&node,&nodefile)) {
1142: uifc.msg("Error reading node data!");
1143: continue;
1144: }
1145: node.misc^=NODE_LOCK;
1146: putnodedat(&cfg,main_dflt,&node,nodefile);
1147: continue;
1148: }
1149:
1150: if(j==-2-CTRL('r')) { /* Rerun node */
1151: if(getnodedat(&cfg,main_dflt,&node,&nodefile)) {
1152: uifc.msg("Error reading node data!");
1153: continue;
1154: }
1155: node.misc^=NODE_RRUN;
1156: putnodedat(&cfg,main_dflt,&node,nodefile);
1157: continue;
1158: }
1159:
1160: if(j==-2-CTRL('d')) { /* Down node */
1161: if(getnodedat(&cfg,main_dflt,&node,&nodefile)) {
1162: uifc.msg("Error reading node data!");
1163: continue;
1164: }
1165: if(node.status != NODE_WFC && node.status != NODE_OFFLINE)
1166: node.misc ^= NODE_DOWN;
1167: else {
1168: if(node.status!=NODE_OFFLINE)
1169: node.status=NODE_OFFLINE;
1170: else
1171: node.status=NODE_WFC;
1172: }
1173: putnodedat(&cfg,main_dflt,&node,nodefile);
1174: continue;
1175: }
1176:
1177: if(j==-2-CTRL('i')) { /* Interrupt node */
1178: if(getnodedat(&cfg,main_dflt,&node,&nodefile)) {
1179: uifc.msg("Error reading node data!");
1180: continue;
1181: }
1182: node.misc^=NODE_INTR;
1183: putnodedat(&cfg,main_dflt,&node,nodefile);
1184: continue;
1185: }
1186:
1187: if(j <= -2)
1188: continue;
1189:
1190: if(j<=cfg.sys_nodes && j>0) {
1191: if((node.status==NODE_INUSE) && node.useron) {
1192: i=0;
1193: strcpy(opt[i++],"Edit User");
1194: strcpy(opt[i++],"Spy on node");
1195: strcpy(opt[i++],"Send message to user");
1196: strcpy(opt[i++],"Chat with user");
1197: strcpy(opt[i++],"Node toggles");
1198: strcpy(opt[i++],"Clear Errors");
1199: strcpy(opt[i++],"View node log");
1200: strcpy(opt[i++],"View crash log");
1201:
1202: opt[i][0]=0;
1203: i=0;
1204: uifc.helpbuf= "`Node Options\n"
1205: "`------------\n\n"
1206: "`Edit User : `Call up the user editor to edit current user.\n"
1207: "`Spy on User : `Spy on current user.\n"
1208: "`Send message to user : `Send on online message to user.\n"
1209: "`Chat with user : `Initiate private split-screen chat wityh user.\n"
1210: "`Node Toggles : `Call up Node Toggles menu to set various toggles\n"
1211: " for current node.\n"
1212: "`Clear Errors : `Clears the error count for node.\n"
1213: "`View node log : `View activity log for current node.\n"
1214: "`View crash log : `View the crash log for current node.";
1215: done=0;
1216: while(!done) {
1217: switch(uifc.list(WIN_MID|WIN_SAV,0,0,0,&i,0,"Node Options",opt)) {
1218:
1219: case 0: /* Edit Users */
1220: sprintf(str,"%suedit %d",cfg.exec_dir,node.useron);
1221: for(j=1; j<argc; j++) {
1222: strcat(str,"'");
1223: strcat(str,argv[j]);
1224: strcat(str,"' ");
1225: }
1226: do_cmd(str);
1227: break;
1228:
1229: case 1: /* Spy */
1230: dospy(j,&bbs_startup);
1231: break;
1232:
1233: case 2: /* Send message */
1234: sendmessage(&cfg, j,&node);
1235: break;
1236:
1237: case 3: /* Chat with User */
1238: chat(&cfg,main_dflt,&node,&boxch,NULL);
1239: break;
1240:
1241: case 4: /* Node Toggles */
1242: node_toggles(&cfg, j);
1243: break;
1244:
1245: case 5:
1246: clearerrors(&cfg, j,&node);
1247: break;
1248:
1249: case 6: /* Node log */
1250: sprintf(str,"%snode.log",cfg.node_path[j-1]);
1251: view_log(str,"Node Log");
1252: break;
1253:
1254: case 7: /* Crash log */
1255: sprintf(str,"%scrash.log",cfg.node_path[j-1]);
1256: view_log(str,"Crash Log");
1257: break;
1258:
1259: case -1:
1260: done=1;
1261: break;
1262:
1263: default:
1264: uifc.msg("Option not implemented");
1265: break;
1266: }
1267: }
1268: }
1269: }
1270: if(j<=cfg.sys_nodes && j>0) {
1271: if(!((node.status==NODE_INUSE) && node.useron)) {
1272:
1273: i=0;
1274: strcpy(opt[i++],"Node toggles");
1275: strcpy(opt[i++],"Clear Errors");
1276: strcpy(opt[i++],"View node log");
1277: strcpy(opt[i++],"View crash log");
1278:
1279: opt[i][0]=0;
1280: i=0;
1281: uifc.helpbuf= "`Node Options\n"
1282: "`------------\n\n"
1283: "`Node Toggles : `Call up Node Toggles menu to set various toggles\n"
1284: " for current node.\n"
1285: "`Clear Errors : `Clears the error count for node.\n"
1286: "`View node log : `View activity log for current node.\n"
1287: "`View crash log : `View the crash log for current node.";
1288: done=0;
1289: while(!done) {
1290: switch(uifc.list(WIN_MID|WIN_SAV,0,0,0,&i,0,"Node Options",opt)) {
1291:
1292: case 0: /* Node Toggles */
1293: node_toggles(&cfg, j);
1294: break;
1295:
1296: case 1:
1297: clearerrors(&cfg, j,&node);
1298: break;
1299:
1300: case 2: /* Node log */
1301: sprintf(str,"%snode.log",cfg.node_path[j-1]);
1302: view_log(str,"Node Log");
1303: break;
1304:
1305: case 3: /* Crash log */
1306: sprintf(str,"%scrash.log",cfg.node_path[j-1]);
1307: view_log(str,"Crash Log");
1308: break;
1309:
1310: case -1:
1311: done=1;
1312: break;
1313:
1314: default:
1315: uifc.msg("Option not implemented");
1316: break;
1317: }
1318: }
1319: }
1320: }
1321: }
1322: }
1323:
1324:
1325:
1326:
1327:
1328:
1329:
This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.