home *** CD-ROM | disk | FTP | other *** search
/ Fish 'n' More 2 / fishmore-publicdomainlibraryvol.ii1991xetec.iso / dirs / convert_451.lzh / 'Liner / Source / arexx.c next >
C/C++ Source or Header  |  1991-02-06  |  16KB  |  616 lines

  1. #include "globals.h"
  2. #include "minrexx.h"
  3. #include "NewARexxWdw.h"
  4.  
  5. extern struct RxsLib *RexxSysBase;
  6. struct RexxMsg *LinerRexxMsg;
  7. int LinerDispatch();
  8.  
  9. extern void ModSearchWdw();
  10.  
  11. /*Function definitions private to arexx.c*/
  12. void DoOpen(),DoSave(),DoDoubClick(),DoSetTitleMsg();
  13. void DoGetStats(),DoPrintDisk(),DoGetChar(),DoGetWord(),DoGetLineText();
  14. void DoCursorRight(),DoCursorLeft(),DoDoubSpacing(),DoInterlaced();
  15. void DoIcons(),DoScrnSize(),DoStartingLevel(),DoLoadPrefs(),DoARexxSearch();
  16. void DoInsertText();
  17. void DoGetLine(),DoStartLine(),DoEndLine(),DoPushIn(),DoPullOut();
  18. void DoFakeReturn(),SpecReplyToRexx();
  19. void DoGetFilename(),DoPutPrefs(),DoExtendedModes();
  20.  
  21. struct rexxCommandList rcl[]= /*The list of all the ARexx commands and*/
  22. {     /*their associated functions*/
  23.    { "open" , (APTR)&DoOpen},
  24.    { "save" , (APTR)&DoSave},
  25.    { "getfilename" , (APTR)&DoGetFilename},
  26.    { "new" , (APTR)&NewAll},
  27.    { "printprinter", (APTR)&HandlePrintPrinter},
  28.    { "printdisk" , (APTR)&DoPrintDisk},
  29.    { "quit" , (APTR)&CloseStuff },
  30.    { "doubclick" , (APTR) &DoDoubClick},
  31.    { "settitlemsg" , (APTR) &DoSetTitleMsg},
  32.    { "getstats" , (APTR) &DoGetStats},
  33.    { "getchar" , (APTR) &DoGetChar},
  34.    { "getword" , (APTR) &DoGetWord},
  35.    { "getlinetext" , (APTR) &DoGetLineText},
  36.    { "cut" , (APTR) &HandleCut},
  37.    { "copy" , (APTR) &HandleCopy},
  38.    { "paste" , (APTR) &HandlePaste},
  39.    { "erase" , (APTR) &HandleErase},
  40.    { "cursorup" , (APTR) &CursorUp},
  41.    { "cursordown" , (APTR) &CursorDown},
  42.    { "cursorright" , (APTR) &DoCursorRight},
  43.    { "cursorleft" , (APTR) &DoCursorLeft},
  44.    { "totop" , (APTR) &JumpToTop},
  45.    { "tobottom" , (APTR) &JumpToBottom},
  46.    { "upscreen" , (APTR) &WholeScreenUp},
  47.    { "downscreen" , (APTR) &WholeScreenDown},
  48.    { "doubspacing" , (APTR) &DoDoubSpacing},
  49.    { "interlaced" , (APTR) &DoInterlaced},
  50.    { "extmodes" , (APTR) &DoExtendedModes},
  51.    { "icons" , (APTR) &DoIcons },
  52.    { "scrnsize" , (APTR)&DoScrnSize},
  53.    { "startinglevel" , (APTR)&DoStartingLevel},
  54.    { "loadprefs" , (APTR)&HandleReloadPrefs},
  55.    { "sveprefs" , (APTR)&DoPutPrefs},
  56.    { "search" , (APTR)&DoARexxSearch},
  57.    { "instext" , (APTR)&DoInsertText},
  58.    { "getline" , (APTR)&DoGetLine},
  59.    { "fakereturn" , (APTR)&DoFakeReturn},
  60.    { "fakebs" , (APTR)&HandleBS},
  61.    { "pushin" , (APTR)&DoPushIn},
  62.    { "pullout" , (APTR)&DoPullOut},
  63.    { "startline" , (APTR)&DoStartLine},
  64.    { "endline" , (APTR) &DoEndLine},
  65.    { NULL , NULL}
  66. };
  67.  
  68. void OpenARexx() /*Open the ARexx port*/
  69. {
  70.    ARexxSigBit=upRexxPort("liner",rcl,"liner",&LinerDispatch);
  71. }
  72.  
  73. void CloseARexx() /*Close the ARexx port*/
  74. {
  75.    dnRexxPort();
  76. }
  77.  
  78. void CheckRexxPort() /*Check the ARexx port for commands*/
  79. {
  80.    dispRexxPort();
  81. }
  82.  
  83. int LinerDispatch(msg,rcl,p) /*The minrexx userdisp function*/
  84. struct RexxMsg *msg;
  85. struct rexxCommandList *rcl;
  86. char *p;
  87. {
  88.  
  89.    LinerRexxMsg=(struct RexxMsg *)msg;
  90.  
  91.    ((int(*)())(rcl->userdata))(p); /*Call the function associated with the */
  92.                /*ARexx command received*/
  93.  
  94.       /*If the function is one of those that returns something to ARexx*/
  95.    if(stricmp(rcl->name,"open")==0 || stricmp(rcl->name,"printdisk")==0 ||
  96.      stricmp(rcl->name,"getlinetext")==0 || stricmp(rcl->name,"getline")==0 ||
  97.      stricmp(rcl->name,"getchar")==0 || stricmp(rcl->name,"linersearch")==0 ||
  98.      stricmp(rcl->name,"getstats")==0 || stricmp(rcl->name,"getword")==0 ||
  99.      stricmp(rcl->name,"startinglevel")==0||stricmp(rcl->name,"fakereturn")==0
  100.      || stricmp(rcl->name,"pushin") || stricmp(rcl->name,"pullout") ||
  101.      stricmp(rcl->name,"getfilename") || stricmp(rcl->name,"sveprefs") )
  102.       return(1);  /*Tell minrexx not to replyRexxCmd()*/
  103.    else
  104.       return(0);
  105. }
  106.  
  107. void DoOpen(p)   /*Open a file under ARexx control*/
  108. char *p;
  109. {
  110.  
  111.    /*Setup the filename*/
  112.    strcpy(FileName,&p[1]);
  113.    if(ReadItemList(FileName,TRUE))  /*Do the read*/
  114.    {
  115.       Modified=FALSE;
  116.       TitleErrorCancel();
  117.       SplitFilename(FileName,SFileName,SDirName);
  118.       replyRexxCmd(LinerRexxMsg,0,0,"true");
  119.    }
  120.    else
  121.       replyRexxCmd(LinerRexxMsg,0,0,"false");
  122. }
  123.  
  124. void DoSave(p)   /*Save a file under ARexx*/
  125. char *p;
  126. {
  127.    strcpy(FileName,&p[1]);
  128.    SplitFilename(FileName,SFileName,SDirName);
  129.    Save(TRUE);  /*Write the file out*/
  130. }
  131.  
  132. void DoGetFilename()
  133. {
  134.    char filename[183];
  135.  
  136.    strcpy(filename,SDirName);
  137.    if(filename[strlen(filename)-1]!=':' && filename[strlen(filename)-1]!=NULL)
  138.       strcat(filename,"/");   /*Append a / if not at the root*/
  139.    strcat(filename,SFileName);
  140.    replyRexxCmd(LinerRexxMsg,0,0,filename);
  141. }
  142.  
  143. void DoPrintDisk(p)  /*Print a file to disk*/
  144. char *p;
  145. {
  146.    SplitFilename(++p,PFileName,PDirName);
  147.    SpecReplyToRexx(HandlePrintDisk(TRUE,p));
  148. }
  149.  
  150. void DoDoubClick(p)  /*Fake a double click (good for highlighting blocks)*/
  151. char *p;
  152. {
  153.    p++;
  154.    PtrY=CurY;
  155.    if(stricmp(p,"true")==0) /*if the click is meant to be outside a line*/
  156.       PtrX=1;
  157.    else
  158.       PtrX=CurX;
  159.    HandleInvs();
  160.    BLastX=CurX;
  161. }
  162.  
  163. void DoSetTitleMsg(p) /*Print message in 'p' in title bar*/
  164. char *p;
  165. {
  166.    TitleError(&p[1]);
  167. }
  168.  
  169. void DoGetStats()  /*Tell ARexx the CurrentItem's level, number, and */
  170. {             /*whether or not it's a continuation*/
  171.    char buffer1[7];
  172.    static char buffer2[12];
  173.  
  174.    stci_d(buffer2,CurrentItem->Level); /*Convert the numbers into text*/
  175.    strcat(buffer2," ");
  176.    stci_d(buffer1,CurrentItem->ItemNumber);
  177.    strcat(buffer2,buffer1);
  178.    if(CurrentItem->cont)
  179.       strcat(buffer2," true");   /*true==continuation*/
  180.    else
  181.       strcat(buffer2," false");
  182.  
  183.    replyRexxCmd(LinerRexxMsg,0,0,buffer2);
  184.  
  185.  
  186. }
  187.  
  188. void DoGetChar() /*Send the character under the cursor to ARexx*/
  189. {
  190.    char letter[2];
  191.  
  192.    letter[1]=NULL;
  193.    letter[0]=CurrentItem->Text[PosInText(CurrentItem->Level)];/*Get the letter*/
  194.    replyRexxCmd(LinerRexxMsg,0,0,letter);
  195. }
  196.  
  197. void DoGetWord() /*Send the word under the cursor to ARexx*/
  198. {
  199.    static char result[80];
  200.    BYTE c;
  201.  
  202.    for(c=0;c<80;result[c++]=NULL); /*Clear the string (weird things happen*/
  203.              /*if I don't, and I don't know why...)*/
  204.    strcpy(result,"");
  205.    GetWord(result,CurrentItem);
  206.    replyRexxCmd(LinerRexxMsg,0,0,result);
  207. }
  208.  
  209. void DoGetLineText() /*Send the current line's text to ARexx*/
  210. {
  211.    static char buffer[100];
  212.    strcpy(buffer,CurrentItem->Text);
  213.    replyRexxCmd(LinerRexxMsg,0,0,buffer);
  214. }
  215.  
  216. void DoCursorRight()   /*Move the cursor to the right*/
  217. {
  218.    CursorRight(0);
  219. }
  220.  
  221. void DoCursorLeft() /*Move the cursor to the left*/
  222. {
  223.    CursorLeft(0);
  224. }
  225.  
  226. void DoDoubSpacing(p) /*Set the spacing*/
  227. char *p;
  228. {
  229.    p++;
  230.    if(stricmp(p,"true")==0) /*Set double spacing*/
  231.    {
  232.       if(!prefs.DS)  /*If not double spaced*/
  233.       {
  234.      DoubleSpacing();
  235.      ModifyMenus(32+StartingLevel); /*Change menus appropriately*/
  236.       }
  237.    }
  238.    else  /*Unset double spacing*/
  239.       if(prefs.DS) /*If double spaced*/
  240.       {
  241.      DoubleSpacing();
  242.      ModifyMenus(StartingLevel);
  243.       }
  244. }
  245.  
  246. void DoInterlaced(p) /*Determine whether the screen is/isn't interlaced*/
  247. char *p;
  248. {
  249.    p++;
  250.  
  251.    if(stricmp(p,"true")==0)
  252.       switch(prefs.ScreenType)
  253.       {
  254.      case HIRES_KEY:
  255.         prefs.ScreenType=HIRESLACE_KEY;
  256.         break;
  257.      case VGAPRODUCT_KEY:
  258.         prefs.ScreenType=VGAPRODUCTLACE_KEY;
  259.       }
  260.    else
  261.       switch(prefs.ScreenType)
  262.       {
  263.      case HIRESLACE_KEY:
  264.         prefs.ScreenType=HIRES_KEY;
  265.         break;
  266.      case VGAPRODUCTLACE_KEY:
  267.         prefs.ScreenType=VGAPRODUCT_KEY;
  268.       }
  269.  
  270.    PutScreenTypeInMenu();
  271.    ChangeDisplay();
  272. }
  273.  
  274.    /*Added in 'Liner 2.10:  used to choose between screen modes*/
  275. void DoExtendedModes(p)
  276. char *p;
  277. {
  278.    p++;
  279.  
  280.    switch(*(p+2))
  281.    {
  282.       case '0':
  283.      prefs.ScreenType |= DEFAULT_MONITOR_ID;
  284.      break;
  285.       case '1':
  286.      prefs.ScreenType |= NTSC_MONITOR_ID;
  287.      break;
  288.       case '2':
  289.      prefs.ScreenType |= PAL_MONITOR_ID;
  290.    }
  291.  
  292.    switch(*p)
  293.    {
  294.       case '0':
  295.      prefs.ScreenType|=HIRES_KEY;
  296.      break;
  297.       case '1':
  298.      prefs.ScreenType|=HIRESLACE_KEY;
  299.      break;
  300.       case '2':
  301.      prefs.ScreenType=VGAPRODUCT_KEY;
  302.      break;
  303.       case '3':
  304.      prefs.ScreenType=VGAPRODUCTLACE_KEY;
  305.      break;
  306.       case '4':
  307.      prefs.ScreenType=A2024TENHERTZ_KEY;
  308.      break;
  309.       case '5':
  310.      prefs.ScreenType=A2024FIFTEENHERTZ_KEY;
  311.    }
  312.  
  313.    PutScreenTypeInMenu();
  314.    ChangeDisplay();
  315. }
  316.  
  317.  
  318. void DoIcons(p)   /*Set program to create/not create icons*/
  319. char *p;
  320. {
  321.    p++;
  322.    prefs.Icons=(stricmp(p,"true")==0);
  323.    ModifyIconMenu();
  324. }
  325.  
  326.  
  327. void DoScrnSize(p) /*In pre-2.10 versions of 'Liner, this was used to*/
  328. char *p;       /*toggle between standard-sized and workbench-sized */
  329. {           /*screens.  Under 2.10, it no longer has any meaning,*/
  330. }           /*but this routine remains for compatability reasons*/
  331.  
  332. void DoStartingLevel(p) /*Set the starting level*/
  333. char *p;
  334. {
  335.    int level;
  336.    p++;
  337.    p[1]=NULL;
  338.    stcd_i(p,&level); /*Get the level (as a number)*/
  339.    if(level < 0 || level > 5)
  340.       SpecReplyToRexx(FALSE);
  341.    if(level == StartingLevel)
  342.       SpecReplyToRexx(TRUE);
  343.  
  344.    if(prefs.DS)   /*If double spaced*/
  345.       level+=32;  /*Alter level for ModifyMenus()*/
  346.    ModifyMenus(level);
  347.    StartingLevel=level; /*Record the new starting level*/
  348.    Refresh();  /*And update the display*/
  349.       SpecReplyToRexx(TRUE);
  350.  
  351. }
  352.  
  353. Interp(p) /*Used by DoARexxSearch.  Determines if a parameter sent by*/
  354. char p;   /*ARexx specified setting a search variable to TRUE, FALSE, or*/
  355. {      /*leaving it unchanged*/
  356.    switch(p)
  357.    {
  358.       case 't':
  359.       case 'T':
  360.      return(TRUE);
  361.       case 'f':
  362.       case 'F':
  363.      return(FALSE);
  364.       case 'u':
  365.       case 'U':
  366.      return(100);   /*Unchanged*/
  367.    }
  368.    return(100); /*If none of the above, something's screwy.  Best to not*/
  369. }        /*change anything*/
  370.  
  371. void DoInsertText(p) /*Insert a text string into the line after the cursor*/
  372. char *p;
  373. {
  374.    char WorkString[160];
  375.    UBYTE TempX;
  376.  
  377.    WorkString[0]=NULL;
  378.  
  379.    strcpy(WorkString,CurrentItem->Text);
  380.    WorkString[PosInText(CurrentItem->Level)]=NULL;
  381.    strcat(WorkString,&p[1]);
  382.    strcat(WorkString,&CurrentItem->Text[PosInText(CurrentItem->Level)]);
  383.    WorkString[MaxLen(CurrentItem->Level)]=NULL;
  384.    strcpy(CurrentItem->Text,WorkString);
  385.    TempX=CurX;
  386.    PlotCursor(1,CurY);
  387.    PrintItem(CurrentItem);
  388.    PlotCursor(TempX,CurY);
  389.  
  390. }
  391.  
  392. void DoGetLine() /*Return an entire line to ARexx (incl. line number)*/
  393. {
  394.    static char buffer[100]; /*static to make sure it doesn't disappear*/
  395.          /*before the calling macro has had a chance to chew on it*/
  396.  
  397.    MakeTextLine(buffer,CurrentItem); /*ARexx gets it*/
  398.    replyRexxCmd(LinerRexxMsg,0,0,buffer);
  399. }
  400.  
  401. void DoFakeReturn(p) /*Let ARexx push the return button (i.e. create a line)*/
  402. char *p;
  403. {
  404.    BYTE stat;
  405.    p++;
  406.    if(stricmp(p,"shift")==0 || stricmp(p,"true")==0)
  407.       stat=HandleReturn(3);
  408.    else
  409.       stat=HandleReturn(0);
  410.    SpecReplyToRexx(stat);
  411. }
  412.  
  413. void DoStartLine()
  414. {
  415.    CursorLeft(8); /*Fake a SHIFT-CURSOR-LEFT*/
  416. }
  417.  
  418. void DoEndLine()
  419. {
  420.    CursorRight(8); /*Fake a SHIFT-CURSOR-RIGHT*/
  421. }
  422.  
  423. void DoPushIn()   /*Fake a TAB*/
  424. {
  425.    SpecReplyToRexx(HandleTAB(0));
  426. }
  427.  
  428. void DoPullOut()  /*Fake a SHIFT-TAB*/
  429. {
  430.    SpecReplyToRexx(HandleTAB(3));
  431. }
  432.  
  433. void DoPutPrefs()
  434. {
  435.    SpecReplyToRexx(PutPrefs("liner:liner.prefs",TRUE));
  436. }
  437.  
  438. void SpecReplyToRexx(stat) /*Send a 'true' or 'false' to ARexx*/
  439. BYTE stat;
  440. {
  441.    if(stat)
  442.       replyRexxCmd(LinerRexxMsg,0,0,"true");
  443.    else
  444.       replyRexxCmd(LinerRexxMsg,0,0,"false");
  445. }
  446.  
  447. void GetWord(result,item) /*Get the word under the cursor*/
  448. char *result;
  449. struct LineItem *item;
  450. {
  451.    BYTE start,end,pos;
  452.  
  453.    pos=PosInText(CurrentItem->Level);
  454.    if(pos>=strlen(CurrentItem->Text))
  455.    {
  456.       strcpy(result,"");
  457.       return;
  458.    }
  459.  
  460.    start=pos;
  461.    if(pos!=0)
  462.    {
  463.       for(start--;CurrentItem->Text[start]!=' ' && start >= 0;start--);
  464.       start++;
  465.    }
  466.  
  467.    if(CurrentItem->Text[pos]!=NULL) /*Not at the end of the line...*/
  468.       for(end=pos;CurrentItem->Text[end]!=' ' && CurrentItem->Text[end]!=NULL;
  469.         end++);
  470.  
  471.    strncpy(result,&CurrentItem->Text[start],end-start);
  472. }
  473.  
  474. void EngageMacro(name) /*Start an external ARexx macro ('ENGAGE!' - J-LP :-)*/
  475. char *name;
  476. {
  477.    asyncRexxCmd(name);
  478. }
  479.  
  480. void GetMacroInfo() /*Open the window to get the macro names*/
  481. {
  482.    struct Window *MacroWdw;
  483.    struct IntuiMessage *mesg;
  484.    struct Gadget junk,*gadg,*StrStart;
  485.    struct StringInfo *si;
  486.    BYTE c;
  487.    ULONG add;
  488.  
  489.    add=Screen->Font->ta_YSize-Topaz.ta_YSize;
  490.  
  491.    gadg=(struct Gadget *)MakeButtonGadgets(&junk,ARexxButtons,VisInfo,
  492.                   &Topaz,AREXXBUTTONS,add);
  493.    MakeStringGadgets(gadg,ARexxStrings,VisInfo,&Topaz,AREXXSTRINGS,
  494.              ss,add);
  495.    gadg=StrStart=(struct Gadget *)gadg->NextGadget;
  496.  
  497.    for(c=0;c<4;c++,gadg=(struct Gadget *)gadg->NextGadget->NextGadget)
  498.    {
  499.       si=(struct StringInfo *)gadg->SpecialInfo;
  500.       strcpy(si->Buffer,prefs.Macro[c]);
  501.       si=(struct StringInfo *)gadg->NextGadget->SpecialInfo;
  502.       strcpy(si->Buffer,prefs.Name[c]);
  503.    }
  504.  
  505.    NewWindowStructure1.Screen=(struct Screen *) Screen;
  506.    NewWindowStructure1.FirstGadget=(struct Gadget *)junk.NextGadget;
  507.  
  508.       /*Make room for title bar*/
  509.    NewWindowStructure1.Height+=add;
  510.  
  511.    MacroWdw=(struct Window *)OpenWindow(&NewWindowStructure1);
  512.    if(MacroWdw==NULL)
  513.    {
  514.       Leave(0,"Couldn't open the window!");
  515.       return;
  516.    }
  517.  
  518.       /*Restore old value*/
  519.    NewWindowStructure1.Height-=add;
  520.  
  521.    PrintIText(MacroWdw->RPort,&IntuiTextList1,4,4+add); /*Print the text*/
  522.  
  523.       /*Draw some bevel boxes*/
  524.    DrawBevelBoxA(MacroWdw->RPort,10,14+add,430,71,&beveltag[0]);
  525.    DrawBevelBoxA(MacroWdw->RPort,10,88+add,430,25,&beveltag[0]);
  526.  
  527.    ActivateGadget(StrStart,MacroWdw,NULL);
  528.    Wait(1<<MacroWdw->UserPort->mp_SigBit);   /*Wait for a gadget to be*/
  529.             /*pressed, or return to be hit while in a string gadget*/
  530.    mesg=(struct IntuiMessage *)GetMsg(MacroWdw->UserPort);
  531.    gadg=(APTR)mesg->IAddress;
  532.    ReplyMsg(mesg);
  533.  
  534.    while(gadg->GadgetID < 9)/*While the gadget is a string gadget*/
  535.    {
  536.       if(gadg->NextGadget != NULL) /*Advance to the next string gadget*/
  537.      ActivateGadget(gadg->NextGadget,MacroWdw,NULL); /*(if one exists)*/
  538.  
  539.       /*And wait again...*/
  540.       Wait(1<<MacroWdw->UserPort->mp_SigBit);
  541.       mesg=(struct IntuiMessage *)GetMsg(MacroWdw->UserPort);
  542.       gadg=(APTR)mesg->IAddress;
  543.       ReplyMsg(mesg);
  544.    }
  545.  
  546.    if(gadg->GadgetID == 9) /*OK was pressed*/
  547.    {
  548.       for(gadg=(struct Gadget *)StrStart,c=0;c<4;
  549.            gadg=(struct Gadget *)gadg->NextGadget->NextGadget,c++)
  550.       {
  551.      si=(struct StringInfo *)gadg->SpecialInfo;
  552.      strcpy(prefs.Macro[c],si->Buffer);
  553.      si=(struct StringInfo *)gadg->NextGadget->SpecialInfo;
  554.      strcpy(prefs.Name[c],si->Buffer);
  555.       }
  556.       CopyPrefsToMenus();
  557.    }
  558.  
  559.    CloseWindow(MacroWdw);
  560.    FreeGadgets(junk.NextGadget);
  561. }
  562.  
  563. void SplitFilename(Filename,file,dir) /*Split a full filename into */
  564. char *Filename,*file,*dir; /*path, filename, and extension*/
  565. {
  566.    char path[150];
  567.    char ext[150];
  568.  
  569.    strsfn(Filename,dir,path,file,ext);
  570.    strcat(dir,path);
  571.    strcpy(file,&Filename[strlen(dir)+((Filename[strlen(dir)]=='/') ? 1 : 0)]);
  572. }
  573.  
  574. void DoARexxSearch(p)   /*Do a search/replace*/
  575. char *p;
  576. {
  577.    BYTE cse,partial,repl,c,i,old;
  578.    char search[80],replace[80];
  579.    search[0]=replace[0]=NULL;
  580.  
  581.    for(c=0;c<80;search[c++]=NULL)
  582.       replace[c]=NULL;
  583.  
  584.    cse=Interp(p[1]);
  585.    partial=Interp(p[2]);
  586.    repl=Interp(p[3]);
  587.  
  588.    if(!(p[4]==NULL || p[5]==NULL)) /*If there is a word to search for*/
  589.    {     /*use it.  Otherwise, use what the user has specified*/
  590.       for(c=5,i=0;p[c] != NULL && p[c]!=' ';i++,c++);
  591.       strncpy(search,&p[5],i);
  592.       if(p[c]!=NULL && p[c+1]!=NULL)
  593.       {
  594.      for(old=++c,i=0;p[c]!=NULL && p[c]!=' ';++i,c++);
  595.      strncpy(replace,&p[old],i);
  596.       }
  597.    }
  598.  
  599.    /*Set the appropriate search variables*/
  600.    ModifyParams(search,replace,cse,partial,repl);
  601.    ModSearchWdw();
  602.  
  603.    if(DoSearch(TRUE,TRUE))  /*Do the actual search*/
  604.       strcpy(search,"true");
  605.    else
  606.       strcpy(search,"false");
  607.  
  608.    /*Give ARexx the result*/
  609.    replyRexxCmd(LinerRexxMsg,0,0,search);
  610.  
  611. }
  612.  
  613.  
  614. /*~~~End of arexx.c*/
  615.  
  616.