carolyn@cbmvax.UUCP (06/08/87)
Changes to Cmd.c for v2 ======================= It was brought to my attention that my Cmd program hung when used with Textcraft (symptom = wrote file to disk forever). This made me realize that I had forgotten to change CMD_WRITE requests with a length of -1 (write data until a NULL is encountered). Many devices understand a -1 length write, but AmigaDOS does not. I modified MyBeginIO() to replace any -1 write length with the actual length, and also to skip any 0 length writes. In addition, I discovered a very dumb typo in my u1[] usage string. Here are the corrections to the source. I will attempt to send new complete source and executable postings to doc. [] (correct this string defined above main) char u1[]={"\nCLI Usage: [run] Cmd [-s] [-m] [-n] devicename filename\n"}; [] (new MyBeginIO - changes are before and after if((!Skip)...) VOID MyBeginIO(ior) struct IOStdReq *ior; { reqcnt += 1; if(ior->io_Command == CMD_WRITE) { if(!writecnt) { while(MainBusy); MainBusy = TRUE; Signal(mainTask,OPEN_SIG); while(MainBusy); } /* If device CMD_WRITE uses length -1, convert to actual length */ if(ior->io_Length==-1) ior->io_Length = strlen(ior->io_Data); if((!Skip)||(writecnt>0)||(ior->io_Length > SHORT_WRITE)) { if(ior->io_Length) { while(MainBusy); MainBusy = TRUE; ioR = ior; Signal(mainTask,WRITE_SIG); /* Signal write */ while(MainBusy); } } writecnt += 1; ior->io_Actual = ior->io_Length; } if(!(ior->io_Flags & IOF_QUICK)) ReplyMsg(ior); } [] -- =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-= Carolyn Scheppner -- CBM >>Amiga Technical Support<< UUCP ...{allegra,caip,ihnp4,seismo}!cbmvax!carolyn PHONE 215-431-9180 =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=