Skip to content
Snippets Groups Projects
Commit fe7a8aaf authored by deuce's avatar deuce
Browse files

Fix off-by-one erros cause by adding the System Opions item.

Don't try to diddle node 0.
parent 9604e504
No related branches found
No related tags found
No related merge requests found
......@@ -955,53 +955,125 @@ int main(int argc, char** argv) {
continue;
}
if(j==0) {
/* System Options */
i=0;
strcpy(opt[i++],"Run SCFG");
strcpy(opt[i++],"View logs");
strcpy(opt[i++],"Force QWK Net callout");
strcpy(opt[i++],"Run event");
strcpy(opt[i++],"Recycle servers");
strcpy(opt[i++],"Edit CFG files");
strcpy(opt[i++],"Edit trashcan files");
opt[i][0]=0;
uifc.helpbuf= "`System Options:`\n"
"\nToDo: Add help";
done=0;
i=0;
while(!done) {
switch(uifc.list(WIN_MID|WIN_SAV,0,0,0,&i,0,"System Options",opt)) {
case -1:
done=1;
break;
case 0:
sprintf(str,"%sscfg ",cfg.exec_dir);
for(j=1; j<argc; j++) {
strcat(str,"'");
strcat(str,argv[j]);
strcat(str,"' ");
}
do_cmd(str);
break;
case 1:
view_logs(&cfg);
break;
case 2:
qwk_callouts(&cfg);
break;
case 3:
run_events(&cfg);
break;
case 4:
recycle_servers(&cfg);
break;
case 5:
edit_cfg(&cfg);
break;
case 6:
edit_can(&cfg);
break;
}
}
continue;
}
if(j==-1) {
i=0;
strcpy(opt[0],YesStr);
strcpy(opt[1],NoStr);
opt[2][0]=0;
uifc.helpbuf= "`Exit Synchronet UNIX Monitor:`\n"
"\n"
"\nIf you want to exit the Synchronet UNIX monitor utility,"
"\nselect `Yes`. Otherwise, select `No` or hit ~ ESC ~.";
i=uifc.list(WIN_MID,0,0,0,&i,0,"Exit Synchronet Monitor",opt);
if(!i)
bail(0);
continue;
}
/* Everything after this point is invalid for the System Options */
if(main_dflt==0)
continue;
if(j==-2-KEY_DC) { /* Clear errors */
clearerrors(&cfg, main_dflt+1,&node);
clearerrors(&cfg, main_dflt,&node);
continue;
}
if(j==-2-KEY_F(10)) { /* Chat */
if(getnodedat(&cfg,main_dflt+1,&node,NULL)) {
if(getnodedat(&cfg,main_dflt,&node,NULL)) {
uifc.msg("Error reading node data!");
continue;
}
if((node.status==NODE_INUSE) && node.useron)
chat(&cfg,main_dflt+1,&node,&boxch,uifc.timedisplay);
chat(&cfg,main_dflt,&node,&boxch,uifc.timedisplay);
continue;
}
if(j==-2-KEY_F(11)) { /* Send message */
sendmessage(&cfg, main_dflt+1,&node);
sendmessage(&cfg, main_dflt,&node);
continue;
}
if(j==-2-KEY_F(12)) { /* Spy */
dospy(main_dflt+1,&bbs_startup);
dospy(main_dflt,&bbs_startup);
continue;
}
if(j==-2-CTRL('l')) { /* Lock node */
if(getnodedat(&cfg,main_dflt+1,&node,&nodefile)) {
if(getnodedat(&cfg,main_dflt,&node,&nodefile)) {
uifc.msg("Error reading node data!");
continue;
}
node.misc^=NODE_LOCK;
putnodedat(&cfg,main_dflt+1,&node,nodefile);
putnodedat(&cfg,main_dflt,&node,nodefile);
continue;
}
if(j==-2-CTRL('r')) { /* Rerun node */
if(getnodedat(&cfg,main_dflt+1,&node,&nodefile)) {
if(getnodedat(&cfg,main_dflt,&node,&nodefile)) {
uifc.msg("Error reading node data!");
continue;
}
node.misc^=NODE_RRUN;
putnodedat(&cfg,main_dflt+1,&node,nodefile);
putnodedat(&cfg,main_dflt,&node,nodefile);
continue;
}
if(j==-2-CTRL('d')) { /* Down node */
if(getnodedat(&cfg,main_dflt+1,&node,&nodefile)) {
if(getnodedat(&cfg,main_dflt,&node,&nodefile)) {
uifc.msg("Error reading node data!");
continue;
}
......@@ -1013,92 +1085,24 @@ int main(int argc, char** argv) {
else
node.status=NODE_WFC;
}
putnodedat(&cfg,main_dflt+1,&node,nodefile);
putnodedat(&cfg,main_dflt,&node,nodefile);
continue;
}
if(j==-2-CTRL('i')) { /* Interrupt node */
if(getnodedat(&cfg,main_dflt+1,&node,&nodefile)) {
if(getnodedat(&cfg,main_dflt,&node,&nodefile)) {
uifc.msg("Error reading node data!");
continue;
}
node.misc^=NODE_INTR;
putnodedat(&cfg,main_dflt+1,&node,nodefile);
putnodedat(&cfg,main_dflt,&node,nodefile);
continue;
}
if(j <= -2)
continue;
if(j==-1) {
i=0;
strcpy(opt[0],YesStr);
strcpy(opt[1],NoStr);
opt[2][0]=0;
uifc.helpbuf= "`Exit Synchronet UNIX Monitor:`\n"
"\n"
"\nIf you want to exit the Synchronet UNIX monitor utility,"
"\nselect `Yes`. Otherwise, select `No` or hit ~ ESC ~.";
i=uifc.list(WIN_MID,0,0,0,&i,0,"Exit Synchronet Monitor",opt);
if(!i)
bail(0);
continue;
}
if(j==0) {
/* System Options */
i=0;
strcpy(opt[i++],"Run SCFG");
strcpy(opt[i++],"View logs");
strcpy(opt[i++],"Force QWK Net callout");
strcpy(opt[i++],"Run event");
strcpy(opt[i++],"Recycle servers");
strcpy(opt[i++],"Edit CFG files");
strcpy(opt[i++],"Edit trashcan files");
opt[i][0]=0;
uifc.helpbuf= "`System Options:`\n"
"\nToDo: Add help";
done=0;
i=0;
while(!done) {
switch(uifc.list(WIN_MID|WIN_SAV,0,0,0,&i,0,"System Options",opt)) {
case -1:
done=1;
break;
case 0:
sprintf(str,"%sscfg ",cfg.exec_dir);
for(j=1; j<argc; j++) {
strcat(str,"'");
strcat(str,argv[j]);
strcat(str,"' ");
}
do_cmd(str);
break;
case 1:
view_logs(&cfg);
break;
case 2:
qwk_callouts(&cfg);
break;
case 3:
run_events(&cfg);
break;
case 4:
recycle_servers(&cfg);
break;
case 5:
edit_cfg(&cfg);
break;
case 6:
edit_can(&cfg);
break;
}
}
continue;
}
if(j<cfg.sys_nodes && j>0) {
if(j<=cfg.sys_nodes && j>0) {
i=0;
strcpy(opt[i++],"Spy on node");
strcpy(opt[i++],"Node toggles");
......@@ -1145,7 +1149,7 @@ int main(int argc, char** argv) {
break;
case 6:
chat(&cfg,main_dflt+1,&node,&boxch,uifc.timedisplay);
chat(&cfg,main_dflt,&node,&boxch,uifc.timedisplay);
break;
case -1:
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment