--- sbbs/src/sbbs3/exec.cpp 2018/04/24 16:41:23 1.1.1.1 +++ sbbs/src/sbbs3/exec.cpp 2018/04/24 16:43:44 1.1.1.2 @@ -2,13 +2,13 @@ /* Synchronet command shell/module interpretter */ -/* $Id: exec.cpp,v 1.1.1.1 2018/04/24 16:41:23 root Exp $ */ +/* $Id: exec.cpp,v 1.1.1.2 2018/04/24 16:43:44 root Exp $ */ /**************************************************************************** * @format.tab-size 4 (Plain Text/Source Code File Header) * * @format.use-tabs true (see http://www.synchro.net/ptsc_hdr.html) * * * - * Copyright 2006 Rob Swindell - http://www.synchro.net/copyright.html * + * Copyright 2011 Rob Swindell - http://www.synchro.net/copyright.html * * * * This program is free software; you can redistribute it and/or * * modify it under the terms of the GNU General Public License * @@ -37,8 +37,9 @@ #include "sbbs.h" #include "cmdshell.h" +#include "js_request.h" -char ** sbbs_t::getstrvar(csi_t *bin, long name) +char ** sbbs_t::getstrvar(csi_t *bin, int32_t name) { uint i; @@ -117,12 +118,13 @@ char ** sbbs_t::getstrvar(csi_t *bin, lo for(i=0;iftp_mode); @@ -434,7 +436,7 @@ long * sbbs_t::getintvar(csi_t *bin, lon return(&bin->socket_error); case 0xA0023A2E: - return((long *)&startup->options); + return((int32_t *)&startup->options); case 0x16E2585F: sysvar_l[sysvar_li]=client_socket; @@ -449,7 +451,8 @@ long * sbbs_t::getintvar(csi_t *bin, lon for(i=0;iint_vars=0; bin->int_var=NULL; bin->int_var_name=NULL; + bin->dirs=0; bin->files=0; bin->loops=0; bin->sockets=0; @@ -484,15 +488,21 @@ void sbbs_t::freevars(csi_t *bin) free(bin->str_var_name); if(bin->int_var_name) free(bin->int_var_name); + for(i=0;idirs;i++) { + if(bin->dir[i]!=NULL) { + closedir(bin->dir[i]); + bin->dir[i]=NULL; + } + } for(i=0;ifiles;i++) { - if(bin->file[i]) { - fclose((FILE *)bin->file[i]); - bin->file[i]=0; + if(bin->file[i]!=NULL) { + fclose(bin->file[i]); + bin->file[i]=NULL; } } for(i=0;isockets;i++) { - if(bin->socket[i]) { - close_socket((SOCKET)bin->socket[i]); + if(bin->socket[i]!=0) { + close_socket(bin->socket[i]); bin->socket[i]=0; } } @@ -516,7 +526,9 @@ char * sbbs_t::copystrvar(csi_t *csi, ch if((np=(char*)realloc(p,strlen(str)+1))==NULL) errormsg(WHERE,ERR_ALLOC,"variable",strlen(str)+1); else - p=np; } } + p=np; + } + } if(p) strcpy(p,str); return(p); @@ -533,7 +545,7 @@ js_BranchCallback(JSContext *cx, JSScrip return(JS_FALSE); if(sbbs->js_branch.auto_terminate && !sbbs->online) { - JS_ReportError(cx,"Disconnected"); + JS_ReportWarning(cx,"Disconnected"); sbbs->js_branch.counter=0; return(JS_FALSE); } @@ -541,14 +553,27 @@ js_BranchCallback(JSContext *cx, JSScrip return(js_CommonBranchCallback(cx,&sbbs->js_branch)); } +#ifdef USE_JS_OPERATION_CALLBACK +static JSBool +js_OperationCallback(JSContext *cx) +{ + JSBool ret; + + JS_SetOperationCallback(cx, NULL); + ret=js_BranchCallback(cx, NULL); + JS_SetOperationCallback(cx, js_OperationCallback); + return ret; +} +#endif + static const char* js_ext(const char* fname) { - if(strchr(fname,'.')==NULL) + if(getfext(fname)==NULL) return(".js"); return(""); } -long sbbs_t::js_execfile(const char *cmd) +long sbbs_t::js_execfile(const char *cmd, const char* startup_dir, JSObject* scope) { char* p; char* args=NULL; @@ -556,15 +581,15 @@ long sbbs_t::js_execfile(const char *cmd int argc=0; char cmdline[MAX_PATH+1]; char path[MAX_PATH+1]; - JSObject* js_scope=NULL; + JSObject* js_scope=scope; JSScript* js_script=NULL; jsval rval; int32 result=0; - + if(js_cx==NULL) { errormsg(WHERE,ERR_CHK,"JavaScript support",0); errormsg(WHERE,ERR_EXEC,cmd,0); - return(-1); + return -1; } SAFECOPY(cmdline,cmd); @@ -575,19 +600,26 @@ long sbbs_t::js_execfile(const char *cmd } fname=cmdline; + path[0]=0; if(strcspn(fname,"/\\")==strlen(fname)) { - sprintf(path,"%s%s%s",cfg.mods_dir,fname,js_ext(fname)); - if(cfg.mods_dir[0]==0 || !fexistcase(path)) - sprintf(path,"%s%s%s",cfg.exec_dir,fname,js_ext(fname)); + if(startup_dir!=NULL && *startup_dir) + SAFEPRINTF3(path,"%s%s%s",startup_dir,fname,js_ext(fname)); + if(path[0]==0 || !fexistcase(path)) { + SAFEPRINTF3(path,"%s%s%s",cfg.mods_dir,fname,js_ext(fname)); + if(cfg.mods_dir[0]==0 || !fexistcase(path)) + SAFEPRINTF3(path,"%s%s%s",cfg.exec_dir,fname,js_ext(fname)); + } } else SAFECOPY(path,fname); if(!fexistcase(path)) { errormsg(WHERE,ERR_OPEN,path,O_RDONLY); - return(-1); + return -1; } - js_scope=JS_NewObject(js_cx, NULL, NULL, js_glob); + JS_BEGINREQUEST(js_cx); + if(js_scope==NULL) + js_scope=JS_NewObject(js_cx, NULL, NULL, js_glob); if(js_scope!=NULL) { @@ -596,6 +628,7 @@ long sbbs_t::js_execfile(const char *cmd JS_DefineProperty(js_cx, js_scope, "argv", OBJECT_TO_JSVAL(argv) ,NULL,NULL,JSPROP_READONLY|JSPROP_ENUMERATE); + /* TODO: Handle quoted "one arg" syntax here? */ if(args!=NULL && argv!=NULL) { while(*args) { p=strchr(args,' '); @@ -624,37 +657,49 @@ long sbbs_t::js_execfile(const char *cmd if(js_scope==NULL || js_script==NULL) { JS_ReportPendingException(js_cx); /* Added Feb-2-2006, rswindell */ + JS_ENDREQUEST(js_cx); errormsg(WHERE,"compiling",path,0); - return(-1); + return -1; } - js_branch.counter=0; // Reset loop counter + if(scope==NULL) { + js_branch.counter=0; // Reset loop counter - JS_SetBranchCallback(js_cx, js_BranchCallback); +#ifdef USE_JS_OPERATION_CALLBACK + JS_SetOperationCallback(js_cx, js_OperationCallback); +#else + JS_SetBranchCallback(js_cx, js_BranchCallback); +#endif + js_PrepareToExecute(js_cx, js_glob, path, startup_dir); + } JS_ExecuteScript(js_cx, js_scope, js_script, &rval); - JS_ReportPendingException(js_cx); /* Added Dec-4-2005, rswindell */ + if(scope==NULL) { + JS_GetProperty(js_cx, js_scope, "exit_code", &rval); + if(rval!=JSVAL_VOID) + JS_ValueToInt32(js_cx,rval,&result); - js_EvalOnExit(js_cx, js_glob, &js_branch); + js_EvalOnExit(js_cx, js_scope, &js_branch); + } - JS_GetProperty(js_cx, js_glob, "exit_code", &rval); + JS_ReportPendingException(js_cx); /* Added Dec-4-2005, rswindell */ JS_DestroyScript(js_cx, js_script); - JS_ClearScope(js_cx, js_scope); + if(scope==NULL) + JS_ClearScope(js_cx, js_scope); JS_GC(js_cx); - if(rval!=JSVAL_VOID) - JS_ValueToInt32(js_cx,rval,&result); - + JS_ENDREQUEST(js_cx); + return(result); } #endif /* Important change as of Nov-16-2006, 'cmdline' may contain args */ -long sbbs_t::exec_bin(const char *cmdline, csi_t *csi) +long sbbs_t::exec_bin(const char *cmdline, csi_t *csi, const char* startup_dir) { char str[MAX_PATH+1]; char mod[MAX_PATH+1]; @@ -671,31 +716,38 @@ long sbbs_t::exec_bin(const char *cmdlin p++; /* skip space */ SKIP_CHAR(p,' '); /* skip more spaces */ } - strcpy(main_csi.str, p); + if(*p) + strcpy(main_csi.str, p); #ifdef JAVASCRIPT if((p=getfext(mod))!=NULL && stricmp(p,".js")==0) - return(js_execfile(cmdline)); + return(js_execfile(cmdline, startup_dir)); + if(p==NULL && startup_dir!=NULL && *startup_dir) { + SAFEPRINTF2(str,"%s%s.js", startup_dir, mod); + if(fexistcase(str)) + return(js_execfile(cmdline, startup_dir)); + } if(cfg.mods_dir[0]) { - sprintf(str,"%s%s.js",cfg.mods_dir,mod); + SAFEPRINTF2(str,"%s%s.js",cfg.mods_dir,mod); if(fexistcase(str)) - return(js_execfile(cmdline)); + return(js_execfile(cmdline, startup_dir)); } - sprintf(str,"%s%s.js",cfg.exec_dir,mod); - if(fexistcase(str)) - return(js_execfile(cmdline)); #endif - memcpy(&bin,csi,sizeof(csi_t)); - clearvars(&bin); - SAFECOPY(modname,mod); if(!strchr(modname,'.')) strcat(modname,".bin"); - sprintf(str,"%s%s",cfg.mods_dir,modname); + SAFEPRINTF2(str,"%s%s",cfg.mods_dir,modname); if(cfg.mods_dir[0]==0 || !fexistcase(str)) { - sprintf(str,"%s%s",cfg.exec_dir,modname); + +#ifdef JAVASCRIPT + SAFEPRINTF2(str,"%s%s.js",cfg.exec_dir,mod); + if(fexistcase(str)) + return(js_execfile(cmdline, startup_dir)); +#endif + + SAFEPRINTF2(str,"%s%s",cfg.exec_dir,modname); fexistcase(str); } if((file=nopen(str,O_RDONLY))==-1) { @@ -703,7 +755,9 @@ long sbbs_t::exec_bin(const char *cmdlin return(-1); } - bin.length=filelength(file); + memcpy(&bin,csi,sizeof(csi_t)); + clearvars(&bin); + bin.length=(uint32_t)filelength(file); if((bin.cs=(uchar *)malloc(bin.length))==NULL) { close(file); errormsg(WHERE,ERR_ALLOC,str,bin.length); @@ -749,7 +803,8 @@ void sbbs_t::skipto(csi_t *csi, uchar in csi->ip++; skipto(csi,CS_ENDIF); csi->ip++; - continue; } + continue; + } if(inst==CS_ELSEORENDIF && (*csi->ip==CS_ELSE || *csi->ip==CS_ENDIF)) @@ -765,29 +820,34 @@ void sbbs_t::skipto(csi_t *csi, uchar in csi->ip+=4; /* Skip variable name */ skipto(csi,CS_END_SWITCH); csi->ip++; - continue; } + continue; + } if(*csi->ip==CS_CASE) { csi->ip++; csi->ip+=4; /* Skip value */ skipto(csi,CS_NEXTCASE); - continue; } + continue; + } if(*csi->ip==CS_CMDKEY || *csi->ip==CS_CMDCHAR) { csi->ip+=2; skipto(csi,CS_END_CMD); csi->ip++; - continue; } + continue; + } if(*csi->ip==CS_CMDSTR || *csi->ip==CS_CMDKEYS) { csi->ip++; /* skip inst */ while(*(csi->ip++)); /* skip string */ skipto(csi,CS_END_CMD); csi->ip++; - continue; } + continue; + } if(*csi->ip>=CS_FUNCTIONS) { csi->ip++; - continue; } + continue; + } if(*csi->ip>=CS_MISC) { switch(*csi->ip) { @@ -864,7 +924,8 @@ void sbbs_t::skipto(csi_t *csi, uchar in csi->ip++; /* Skip length */ default: csi->ip+=8; /* Skip two variable names or var & val */ - continue; } + continue; + } case CS_FIO_FUNCTION: csi->ip++; @@ -913,7 +974,8 @@ void sbbs_t::skipto(csi_t *csi, uchar in default: csi->ip+=4; /* File handle */ csi->ip+=4; /* Variable */ - continue; } + continue; + } case CS_NET_FUNCTION: csi->ip++; @@ -956,7 +1018,8 @@ void sbbs_t::skipto(csi_t *csi, uchar in default: csi->ip+=4; /* socket */ - continue; } + continue; + } case CS_COMPARE_ARS: csi->ip++; @@ -979,8 +1042,10 @@ void sbbs_t::skipto(csi_t *csi, uchar in csi->ip+=7; // inst, var, offset, len break; default: - csi->ip++; } - continue; } + csi->ip++; + } + continue; + } if(*csi->ip==CS_ONE_MORE_BYTE) { if(inst==CS_END_LOOP && *(csi->ip+1)==CS_END_LOOP) @@ -994,40 +1059,48 @@ void sbbs_t::skipto(csi_t *csi, uchar in csi->ip+=2; } - continue; } + continue; + } if(*csi->ip==CS_TWO_MORE_BYTES) { csi->ip++; /* skip extension */ csi->ip++; /* skip instruction */ csi->ip++; /* skip argument */ - continue; } + continue; + } if(*csi->ip==CS_THREE_MORE_BYTES) { csi->ip++; /* skip extension */ csi->ip++; /* skip instruction */ csi->ip+=2; /* skip argument */ - continue; } + continue; + } if(*csi->ip==CS_STR_FUNCTION) { csi->ip++; /* skip extension */ csi->ip++; /* skip instruction */ while(*(csi->ip++)); /* skip string */ - continue; } + continue; + } if(*csi->ip>=CS_ASCIIZ) { csi->ip++; /* skip inst */ while(*(csi->ip++)); /* skip string */ - continue; } + continue; + } if(*csi->ip>=CS_THREE_BYTE) { csi->ip+=3; - continue; } + continue; + } if(*csi->ip>=CS_TWO_BYTE) { csi->ip+=2; - continue; } + continue; + } - csi->ip++; } + csi->ip++; + } } @@ -1046,10 +1119,12 @@ int sbbs_t::exec(csi_t *csi) cursubnum=INVALID_SUB; if(usrlibs) { curdirnum=usrdir[curlib][curdir[curlib]]; /* Used for ARS */ - path=cfg.dir[usrdir[curlib][curdir[curlib]]]->path; } + path=cfg.dir[usrdir[curlib][curdir[curlib]]]->path; + } else { curdirnum=INVALID_DIR; - path=nulstr; } + path=nulstr; + } now=time(NULL); if(csi->ip>=csi->cs+csi->length) @@ -1082,32 +1157,40 @@ int sbbs_t::exec(csi_t *csi) if(text[i]!=text_sav[i]) { if(text[i]!=nulstr) free(text[i]); - text[i]=text_sav[i]; } - sprintf(str,"%s%s.dat" + text[i]=text_sav[i]; + } + SAFEPRINTF2(str,"%s%s.dat" ,cfg.ctrl_dir,cmdstr((char*)csi->ip,path,csi->str,(char*)buf)); if((stream=fnopen(&file,str,O_RDONLY))==NULL) { errormsg(WHERE,ERR_OPEN,str,O_RDONLY); - break; } + break; + } for(i=0;ilogic=LOGIC_TRUE; break; default: errormsg(WHERE,ERR_CHK,"shell instruction",*(csi->ip-1)); - break; } + break; + } while(*(csi->ip++)); /* Find NULL */ return(0); case CS_LOG: @@ -1123,7 +1206,8 @@ int sbbs_t::exec(csi_t *csi) while(*(csi->ip++)); /* Find NULL */ skipto(csi,CS_END_CMD); csi->ip++; - return(0); } + return(0); + } break; case CS_CMDKEYS: for(i=0;csi->ip[i];i++) @@ -1133,7 +1217,8 @@ int sbbs_t::exec(csi_t *csi) while(*(csi->ip++)); /* Find NULL */ skipto(csi,CS_END_CMD); csi->ip++; - return(0); } + return(0); + } break; case CS_GET_TEMPLATE: gettmplt(csi->str,(char*)csi->ip,K_LINE); @@ -1189,7 +1274,7 @@ int sbbs_t::exec(csi_t *csi) external(cmdstr((char*)csi->ip,path,csi->str,(char*)buf),0); break; case CS_EXEC_INT: - external(cmdstr((char*)csi->ip,path,csi->str,(char*)buf),EX_OUTR|EX_INR|EX_OUTL); + external(cmdstr((char*)csi->ip,path,csi->str,(char*)buf),EX_STDIO); break; case CS_EXEC_XTRN: for(i=0;iip,path,csi->str,(char*)buf),csi); + exec_bin(cmdstr((char*)csi->ip,path,csi->str,(char*)buf),csi,/* startup_dir: */NULL); break; case CS_YES_NO: csi->logic=!yesno(cmdstr((char*)csi->ip,path,csi->str,(char*)buf)); @@ -1236,9 +1321,11 @@ int sbbs_t::exec(csi_t *csi) break; default: errormsg(WHERE,ERR_CHK,"shell instruction",*(csi->ip-1)); - break; } + break; + } while(*(csi->ip++)); /* Find NULL */ - return(0); } + return(0); + } if(*csi->ip>=CS_THREE_BYTE) { switch(*(csi->ip++)) { @@ -1293,10 +1380,12 @@ int sbbs_t::exec(csi_t *csi) l=getnum(i); if(l<=0) { csi->str[0]=0; - csi->logic=LOGIC_FALSE; } + csi->logic=LOGIC_FALSE; + } else { sprintf(csi->str,"%lu",l); - csi->logic=LOGIC_TRUE; } + csi->logic=LOGIC_TRUE; + } return(0); case CS_TOGGLE_USER_FLAG: @@ -1335,7 +1424,8 @@ int sbbs_t::exec(csi_t *csi) break; default: errormsg(WHERE,ERR_CHK,"user flag type",*(csi->ip-2)); - return(0); } + return(0); + } return(0); case CS_REVERT_TEXT: i=*(ushort *)csi->ip; @@ -1344,19 +1434,24 @@ int sbbs_t::exec(csi_t *csi) for(i=0;i=TOTAL_TEXT) { errormsg(WHERE,ERR_CHK,"revert text #",i); - return(0); } + return(0); + } if(text[i]!=text_sav[i] && text[i]!=nulstr) free(text[i]); text[i]=text_sav[i]; return(0); default: errormsg(WHERE,ERR_CHK,"shell instruction",*(csi->ip-1)); - return(0); } } + return(0); + } + } if(*csi->ip>=CS_TWO_BYTE) { switch(*(csi->ip++)) { @@ -1376,16 +1471,19 @@ int sbbs_t::exec(csi_t *csi) || ((*csi->ip)==CS_EDIGIT && csi->cmd&0x80 && isdigit(csi->cmd&0x7f))) { csi->ip++; - return(0); } + return(0); + } if(csi->cmd!=*csi->ip) { csi->ip++; - skipto(csi,CS_END_CMD); } /* skip code */ + skipto(csi,CS_END_CMD); /* skip code */ + } csi->ip++; /* skip key */ return(0); case CS_CMDCHAR: if(csi->cmd!=*csi->ip) { csi->ip++; - skipto(csi,CS_END_CMD); } /* skip code */ + skipto(csi,CS_END_CMD); /* skip code */ + } csi->ip++; /* skip key */ return(0); case CS_NODE_ACTION: @@ -1406,7 +1504,8 @@ int sbbs_t::exec(csi_t *csi) getstr(csi->str,*csi->ip++,0); if(sys_status&SS_ABORT) { csi->str[0]=0; - csi->logic=LOGIC_FALSE; } + csi->logic=LOGIC_FALSE; + } if(csi->str[0]=='/' && csi->str[1]) csi->cmd=csi->str[1]|0x80; else @@ -1448,12 +1547,14 @@ int sbbs_t::exec(csi_t *csi) || ((*csi->ip)==CS_EDIGIT && csi->cmd&0x80 && isdigit(csi->cmd&0x7f))) { csi->ip++; - csi->logic=LOGIC_TRUE; } + csi->logic=LOGIC_TRUE; + } else { if(csi->cmd==*(csi->ip++)) csi->logic=LOGIC_TRUE; else - csi->logic=LOGIC_FALSE; } + csi->logic=LOGIC_FALSE; + } return(0); case CS_COMPARE_CHAR: if(csi->cmd==*(csi->ip++)) @@ -1469,7 +1570,8 @@ int sbbs_t::exec(csi_t *csi) csi->logic=LOGIC_FALSE; if(!csi->str[0]) { csi->ip++; - return(0); } + return(0); + } switch(*(csi->ip++)) { case USER_STRING_ALIAS: if(!isalpha(csi->str[0]) || trashcan(csi->str,"name")) @@ -1486,8 +1588,7 @@ int sbbs_t::exec(csi_t *csi) if(trashcan(csi->str,"name")) break; if(cfg.uq&UQ_DUPREAL - && userdatdupe(useron.number,U_NAME,LEN_NAME - ,csi->str,0)) + && userdatdupe(useron.number,U_NAME,LEN_NAME,csi->str)) break; sprintf(useron.name,"%.*s",LEN_NAME,csi->str); putuserrec(&cfg,useron.number,U_NAME,LEN_NAME @@ -1498,8 +1599,7 @@ int sbbs_t::exec(csi_t *csi) if(trashcan(csi->str,"name")) break; if(cfg.uq&UQ_DUPHAND - && userdatdupe(useron.number,U_HANDLE,LEN_HANDLE - ,csi->str,0)) + && userdatdupe(useron.number,U_HANDLE,LEN_HANDLE,csi->str)) break; sprintf(useron.handle,"%.*s",LEN_HANDLE,csi->str); putuserrec(&cfg,useron.number,U_HANDLE,LEN_HANDLE @@ -1578,11 +1678,14 @@ int sbbs_t::exec(csi_t *csi) break; default: errormsg(WHERE,ERR_CHK,"user string type",*(csi->ip-1)); - return(0); } + return(0); + } return(0); default: errormsg(WHERE,ERR_CHK,"shell instruction",*(csi->ip-1)); - return(0); } } + return(0); + } + } /*********************************/ @@ -1634,7 +1737,8 @@ int sbbs_t::exec(csi_t *csi) default: errormsg(WHERE,ERR_CHK,"one byte extended function" ,*(csi->ip-1)); - return(0); } + return(0); + } case CS_CRLF: CRLF; return(0); @@ -1708,7 +1812,8 @@ int sbbs_t::exec(csi_t *csi) if(csi->cmd=='/') { outchar('/'); csi->cmd=getkey(K_UPPER); - csi->cmd|=0x80; } + csi->cmd|=0x80; + } return(0); case CS_GETFILESPEC: if(getfilespec(csi->str)) @@ -1729,11 +1834,12 @@ int sbbs_t::exec(csi_t *csi) csi->logic=LOGIC_TRUE; for(i=0;istr,cfg.shell[i]->code) - && chk_ar(cfg.shell[i]->ar,&useron)) + && chk_ar(cfg.shell[i]->ar,&useron,&client)) break; if(icode); } + putuserrec(&cfg,useron.number,U_SHELL,8,cfg.shell[i]->code); + } else csi->logic=LOGIC_FALSE; return(0); @@ -1745,11 +1851,12 @@ int sbbs_t::exec(csi_t *csi) csi->logic=LOGIC_TRUE; for(i=0;istr,cfg.xedit[i]->code) - && chk_ar(cfg.xedit[i]->ar,&useron)) + && chk_ar(cfg.xedit[i]->ar,&useron,&client)) break; if(icode); } + putuserrec(&cfg,useron.number,U_XEDIT,8,cfg.xedit[i]->code); + } else csi->logic=LOGIC_FALSE; return(0); @@ -1761,7 +1868,8 @@ int sbbs_t::exec(csi_t *csi) i=finduser(csi->str); if(i) { csi->logic=LOGIC_TRUE; - username(&cfg,i,csi->str); } + username(&cfg,i,csi->str); + } else csi->logic=LOGIC_FALSE; return(0); @@ -1795,32 +1903,38 @@ int sbbs_t::exec(csi_t *csi) case CS_IF_TRUE: if(csi->logic!=LOGIC_TRUE) { skipto(csi,CS_ELSEORENDIF); - csi->ip++; } + csi->ip++; + } return(0); case CS_IF_GREATER: if(csi->logic!=LOGIC_GREATER) { skipto(csi,CS_ELSEORENDIF); - csi->ip++; } + csi->ip++; + } return(0); case CS_IF_GREATER_OR_EQUAL: if(csi->logic!=LOGIC_GREATER && csi->logic!=LOGIC_EQUAL) { skipto(csi,CS_ELSEORENDIF); - csi->ip++; } + csi->ip++; + } return(0); case CS_IF_LESS: if(csi->logic!=LOGIC_LESS) { skipto(csi,CS_ELSEORENDIF); - csi->ip++; } + csi->ip++; + } return(0); case CS_IF_LESS_OR_EQUAL: if(csi->logic!=LOGIC_LESS && csi->logic!=LOGIC_EQUAL) { skipto(csi,CS_ELSEORENDIF); - csi->ip++; } + csi->ip++; + } return(0); case CS_IF_FALSE: if(csi->logic==LOGIC_TRUE) { skipto(csi,CS_ELSEORENDIF); - csi->ip++; } + csi->ip++; + } return(0); case CS_ELSE: skipto(csi,CS_ENDIF); @@ -1839,7 +1953,8 @@ int sbbs_t::exec(csi_t *csi) return(0); default: errormsg(WHERE,ERR_CHK,"shell instruction",*(csi->ip-1)); - return(0); } + return(0); + } } bool sbbs_t::select_shell(void) @@ -1847,7 +1962,7 @@ bool sbbs_t::select_shell(void) int i; for(i=0;iname,cfg.shell[i]->ar); + uselect(1,i,text[CommandShellHeading],cfg.shell[i]->name,cfg.shell[i]->ar); if((i=uselect(0,useron.shell,0,0,0))>=0) { useron.shell=i; putuserrec(&cfg,useron.number,U_SHELL,8,cfg.shell[i]->code); @@ -1861,7 +1976,7 @@ bool sbbs_t::select_editor(void) int i; for(i=0;iname,cfg.xedit[i]->ar); + uselect(1,i,text[ExternalEditorHeading],cfg.xedit[i]->name,cfg.xedit[i]->ar); if(useron.xedit) useron.xedit--; if((i=uselect(0,useron.xedit,0,0,0))>=0) { useron.xedit=i+1;