void handleRexxCommand(char *cmdName, struct RexxMsg *mess) { if(!strnicmp(cmdName,"sendstring",10)) rexxsendstring(mess); else if(!strnicmp(cmdName,"sendserstring",13)) rexxsendserstring(mess); else if(!strnicmp(cmdName,"getstring",9)) rexxgetstring(mess); else if(!strnicmp(cmdName,"sendtextfile",12)) rexxsendtextfile(mess); // sendfile(rexxargs1=hittaefter(cmdName)); else if(!strnicmp(cmdName,"showtext",8)) rxvisatext(mess); else if(!strnicmp(cmdName,"showletter",10)) rexxvisabrev(mess); else if(!strnicmp(cmdName,"lasttext",8)) senastread(mess); else if(!strnicmp(cmdName,"nikcommand",10)) kommando(mess); else if(!strnicmp(cmdName,"niknrcommand",12)) niknrcommand(mess); else if(!strnicmp(cmdName,"edit",4)) rxedit(mess); else if(!strnicmp(cmdName,"sendbinfile",11)) rexxsendbinfile(mess); else if(!strnicmp(cmdName,"recbinfile",10)) rexxrecbinfile(mess); else if(!strnicmp(cmdName,"getchar",7)) rexxgetchar(mess); else if(!strnicmp(cmdName,"chkbuffer",9)) rexxchkbuffer(mess); else if(!strnicmp(cmdName,"yesno",5)) rexxyesno(mess); else if(!strnicmp(cmdName,"whicharea",9)) whicharea(mess); else if(!strnicmp(cmdName,"whichmeet",9)) whichmeet(mess); else if(!strnicmp(cmdName,"logout",6)) rxlogout(mess); else if(!strnicmp(cmdName,"runfifo",7)) rxrunfifo(mess); else if(!strnicmp(cmdName,"runrawfifo",10)) rxrunrawfifo(mess); else if(!strnicmp(cmdName,"entermeet",9)) rxentermeet(mess); else if(!strnicmp(cmdName,"setlinecount",12)) rxsetlinecount(mess); else if(!strnicmp(cmdName,"extratime",9)) rxextratime(mess); else if(!strnicmp(cmdName,"gettime",7)) rxgettime(mess); else if(!strnicmp(cmdName,"sendchar",8)) rxsendchar(mess); else if(!strnicmp(cmdName,"sendserchar",11)) rxsendserchar(mess); else if(!strnicmp(cmdName,"setnodeaction",13)) rxsetnodeaction(mess); else if(!strnicmp(cmdName,"sendrawfile",11)) rxsendrawfile(mess); else if(!strnicmp(cmdName,"changelatestinfo",16)) rxchglatestinfo(mess); else if(!strnicmp(cmdName,"getnumber",9)) rxgetnumber(mess); else { LogEvent(SYSTEM_LOG, WARN, "Unknown command from ARexx script: '%s'", cmdName); SetRexxErrorResult(mess, 10); } }
int commonsendrexx(int komnr,int hasarg) { char macronamn[1081],*rexxargs1; int going = TRUE; struct RexxMsg *nikrexxmess,*tempmess; struct MsgPort *rexxmastport; sendrexxrc=-5; if(!hasarg) sprintf(macronamn,"NiKom:rexx/ExtKom%d %d %d",komnr,nodnr,inloggad); else sprintf(macronamn,"NiKom:rexx/ExtKom%d %d %d %s",komnr,nodnr,inloggad,argument); if(!(nikrexxmess=(struct RexxMsg *)CreateRexxMsg(rexxport,"nik",rexxport->mp_Node.ln_Name))) { puttekn("\r\n\nKunde inte allokera ett RexxMsg!\r\n\n",-1); return(-5); } if(!(nikrexxmess->rm_Args[0]=(STRPTR)CreateArgstring(macronamn,strlen(macronamn)))) { DeleteRexxMsg(nikrexxmess); puttekn("\r\n\nKunde inte allokera en ArgString1\r\n\n",-1); return(-5); } nikrexxmess->rm_Action=RXCOMM | RXFB_TOKEN; Forbid(); if(!(rexxmastport=(struct MsgPort *)FindPort("REXX"))) { Permit(); puttekn("\r\n\nRexxMast är inte igång!\r\n\n",-1); return(-5); } PutMsg(rexxmastport,(struct Message *)nikrexxmess); Permit(); while(going) { tempmess = (struct RexxMsg *)WaitPort(rexxport); if(!tempmess) printf("*** Something's fishy around here... ***\n"); while(tempmess=(struct RexxMsg *)GetMsg(rexxport)) { if(tempmess->rm_Node.mn_Node.ln_Type==NT_REPLYMSG) { DeleteArgstring(nikrexxmess->rm_Args[0]); if(nikrexxmess->rm_Result1) { sprintf(outbuffer,"\r\n\nRexx: Return-code %d\r\n\n",nikrexxmess->rm_Result1); puttekn(outbuffer,-1); } DeleteRexxMsg(nikrexxmess); if(!rxlinecount) { rxlinecount=TRUE; radcnt = 0; } return(sendrexxrc); } if(!strnicmp(tempmess->rm_Args[0],"sendstring",10)) rexxsendstring(tempmess); else if(!strnicmp(tempmess->rm_Args[0],"sendserstring",13)) rexxsendserstring(tempmess); else if(!strnicmp(tempmess->rm_Args[0],"getstring",9)) rexxgetstring(tempmess); else if(!strnicmp(tempmess->rm_Args[0],"sendtextfile",12)) sendfile(rexxargs1=hittaefter(tempmess->rm_Args[0])); else if(!strnicmp(tempmess->rm_Args[0],"showtext",8)) rxvisatext(tempmess); else if(!strnicmp(tempmess->rm_Args[0],"showletter",10)) rexxvisabrev(tempmess); else if(!strnicmp(tempmess->rm_Args[0],"lasttext",8)) senastread(tempmess); else if(!strnicmp(tempmess->rm_Args[0],"nikcommand",10)) kommando(tempmess); else if(!strnicmp(tempmess->rm_Args[0],"niknrcommand",12)) niknrcommand(tempmess); else if(!strnicmp(tempmess->rm_Args[0],"edit",4)) rxedit(tempmess); else if(!strnicmp(tempmess->rm_Args[0],"sendbinfile",11)) rexxsendbinfile(tempmess); else if(!strnicmp(tempmess->rm_Args[0],"recbinfile",10)) rexxrecbinfile(tempmess); else if(!strnicmp(tempmess->rm_Args[0],"getchar",7)) rexxgettekn(tempmess); else if(!strnicmp(tempmess->rm_Args[0],"chkbuffer",9)) rexxchkbuffer(tempmess); else if(!strnicmp(tempmess->rm_Args[0],"yesno",5)) rexxyesno(tempmess); else if(!strnicmp(tempmess->rm_Args[0],"whicharea",9)) whicharea(tempmess); else if(!strnicmp(tempmess->rm_Args[0],"whichmeet",9)) whichmeet(tempmess); else if(!strnicmp(tempmess->rm_Args[0],"logout",6)) rxlogout(tempmess); else if(!strnicmp(tempmess->rm_Args[0],"runfifo",7)) rxrunfifo(tempmess); else if(!strnicmp(tempmess->rm_Args[0],"runrawfifo",10)) rxrunrawfifo(tempmess); else if(!strnicmp(tempmess->rm_Args[0],"entermeet",9)) rxentermeet(tempmess); else if(!strnicmp(tempmess->rm_Args[0],"setlinecount",12)) rxsetlinecount(tempmess); else if(!strnicmp(tempmess->rm_Args[0],"extratime",9)) rxextratime(tempmess); else if(!strnicmp(tempmess->rm_Args[0],"gettime",7)) rxgettime(tempmess); else if(!strnicmp(tempmess->rm_Args[0],"sendchar",8)) rxsendchar(tempmess); else if(!strnicmp(tempmess->rm_Args[0],"sendserchar",11)) rxsendserchar(tempmess); else if(!strnicmp(tempmess->rm_Args[0],"setnodeaction",13)) rxsetnodeaction(tempmess); else if(!strnicmp(tempmess->rm_Args[0],"sendrawfile",11)) rxsendrawfile(tempmess); else if(!strnicmp(tempmess->rm_Args[0],"changelatestinfo",16)) rxchglatestinfo(tempmess); else if(!strnicmp(tempmess->rm_Args[0],"getnumber",9)) rxgetnumber(tempmess); else { sprintf(outbuffer,"\r\n\nKan inte hantera: %s\r\n",tempmess->rm_Args[0]); puttekn(outbuffer,-1); tempmess->rm_Result1=5; tempmess->rm_Result2=NULL; } ReplyMsg((struct Message *)tempmess); } } if(carrierdropped()) return(-8); return(sendrexxrc); }