home *** CD-ROM | disk | FTP | other *** search
/ Fish 'n' More 2 / fishmore-publicdomainlibraryvol.ii1991xetec.iso / fish / applications / xlispstat / src / src1.lzh / Amiga / get_fname.c < prev    next >
C/C++ Source or Header  |  1990-10-08  |  18KB  |  449 lines

  1. /************************************************************************
  2. req.c
  3.     This file contains a general-purpose <requester> that
  4. will prompt the user for a filename input.
  5.     The program actually uses a window instead of a 'Requester'
  6. for greater flexibility. It will take control of your window's
  7. IDCMP Port when called.
  8.  
  9. ***     This material is copyright (c) 1986 by C. Heath of Microsmiths, Inc.
  10. Permission is granted to use these files in any way with the following
  11. exceptions:
  12.  
  13. 1) The files shall not be posted on any telecommunications service, public
  14. or private, except for BIX until January 15, 1987.
  15.  
  16. 2) The files may only be distributed in archive format, with no modifications.
  17. If you make any improvements on the file requester and would like to
  18. generally distribute them, please contact "cheath" on BIX, or write to:
  19.     Microsmiths Inc, PO Box 561, Cambridge, MA 02140
  20.  
  21. 3) The requester may be used in any commercial product, but must be in
  22. object code format.  You are free to make modifications for use in your
  23. product.  Permission is granted to Lattice, Inc, and to Manx, Inc, to
  24. include the source files in archive format.
  25.  
  26.     Thank you, and enjoy.
  27.         ...cheath
  28.  
  29. ************************************************************************/
  30. /*#include <libraries/dosextens.h>
  31.  #include <exec/libraries.h>
  32.  #include <graphics/text.h> */
  33. #include <proto/exec.h>
  34. #include <proto/intuition.h>
  35. #include <proto/graphics.h>
  36. #include <proto/dos.h>
  37. #include <string.h>
  38. #include <time.h>
  39. /* #include "safeclose.h" */
  40.  
  41. #define FAST register
  42. #define NL NULL
  43.  
  44. static struct FileLock *pdir = NL;
  45. static struct FileInfoBlock *dir_info;
  46. /*static struct Window *eW;                       Parent Window. Uck   */
  47. static struct TextAttr MyFont={"topaz.font",TOPAZ_EIGHTY,FS_NORMAL,FPF_ROMFONT };
  48.  
  49. /* FGAD requires a few unique gadget-ids, origined at FGAD      */
  50. /* In the unlikely event this conflicts with any of your gadgets, */
  51. /* change this equate to allow 16 contiguous unique ID's    */
  52.  
  53. #define FGAD    0x76c0L
  54. #define FCHARS  32L     /* Number of chars allowed in file name */
  55. #define DIR_SIZ 50L     /* Number of chars in a dir name...     */
  56. #define MAX_STR DIR_SIZ+2L
  57. #define DENTS   5L      /* Number of entries on screen   */
  58.                         /* It's not as simple as changing 'DENTS'... */
  59. #define DSIZE   FCHARS+1L       /* Size of a directory entry   */
  60. #define DBUFSIZ 3000L   /* Number of bytes to allocate for all ents */
  61. #define BCOL    0L      /* Background color     */
  62. #define FCOL    1L      /* Foreground color     */
  63. #define RHGHT   130L
  64. #define RWDTH   320L
  65. #define ZWDTH   270L
  66.  
  67. static char *pext;  /* added by JKL */
  68. static char ubuf[MAX_STR];                  /* Undo buffer  */
  69. static struct dirent {struct dirent *next; BOOL isfile; char dE[DSIZE+2];};
  70. static struct dirent *FirstEntry;
  71. static struct dirent *NextEntry;
  72. static struct dirhead {struct dirent *next;};
  73. static struct dirhead ListHead;
  74. static long   curent,maxent;
  75. static long   more;
  76. static struct Window    *wRq = NL;          /* Requester window   */
  77. static struct RastPort  *wRp;
  78.                                            /* Requester "Hailing" prompt */
  79. static struct IntuiText oTxt={2,2,JAM1,10,11,&MyFont,NL,NL};
  80. static struct IntuiText saydir={0,1,JAM2,0,1,&MyFont,(UBYTE *)"(dir) ",NL};
  81. static struct IntuiText rname[DENTS]={            /* File name list */
  82.    {1,0,JAM2,48,1,&MyFont,NL, NL},
  83.    {1,0,JAM2,48,1,&MyFont,NL, NL},
  84.    {1,0,JAM2,48,1,&MyFont,NL, NL},
  85.    {1,0,JAM2,48,1,&MyFont,NL, NL},
  86.    {1,0,JAM2,48,1,&MyFont,NL, NL}};
  87.                                               /* Display for file name ... */
  88. static SHORT oXY2[]={-2,-2,RWDTH-78,-2,RWDTH-78,9,-2,9,-2,-2};
  89. static struct Border thebd={0,0,2,3,JAM1,5,oXY2,NL};
  90. static struct IntuiText otxt={2,2,JAM1,-40,0,&MyFont,(UBYTE *)"file",NL};
  91. static struct StringInfo osx={NL,ubuf,NL,DSIZE,NL,NL,NL,NL,NL,NL,NL,NL,NL};
  92. static SHORT oXY3[]={0,0,50,0,50,9,0,9,0,0};
  93. static SHORT oXY4[]={2,-2,48,-2,52,2,52,7,48,11,2,11,-2,7,-2,2,2,-2};/* CANCEL box */
  94. static struct Border obd2={0,0,2,3,JAM1,9,oXY4,NL};
  95. static struct Border obd1={0,0,3,2,JAM1,5,oXY3,&obd2};  /* OTAY */
  96. static struct IntuiText ot3={1,0,JAM1,1,1,&MyFont,(UBYTE *)"Parent",NL};
  97. static struct Gadget og12={0,RWDTH/2-25,RHGHT-20,50,10,   /* PARENT */
  98.    GADGHCOMP,RELVERIFY,BOOLGADGET,
  99.    (APTR)&obd1,NL,&ot3,NL,NL,FGAD+12,NL};
  100. static struct Gadget ogx={&og12,60,RHGHT-35,RWDTH-80,10,     /* File name gadget */
  101.    GADGHCOMP,RELVERIFY,STRGADGET,(APTR)&thebd,NL,&otxt,NL,(APTR)&osx,FGAD+11,NL};
  102. static struct Gadget oga={&ogx,10,RHGHT-50,ZWDTH,10,            /* Gadgets For   */
  103.    GADGHCOMP,RELVERIFY,BOOLGADGET,                        /* Directory entries   */
  104.    NL,NL,&rname[4],NL,NL,FGAD+10,NL};
  105. static struct Gadget og9={&oga,10,RHGHT-60,ZWDTH,10,
  106.    GADGHCOMP,RELVERIFY,BOOLGADGET,
  107.    NL,NL,&rname[3],NL,NL,FGAD+9,NL};
  108. static struct Gadget og8={&og9,10,RHGHT-70,ZWDTH,10,
  109.    GADGHCOMP,RELVERIFY,BOOLGADGET,
  110.    NL,NL,&rname[2],NL,NL,FGAD+8,NL};
  111. static struct Gadget og7={&og8,10,RHGHT-80,ZWDTH,10,
  112.    GADGHCOMP,RELVERIFY,BOOLGADGET,
  113.    NL,NL,&rname[1],NL,NL,FGAD+7,NL};
  114. static struct Gadget og6={&og7,10,RHGHT-90,ZWDTH,10,
  115.    GADGHCOMP,RELVERIFY,BOOLGADGET,
  116.    NL,NL, &rname[0],NL,NL,FGAD+6,NL};
  117.                                                    /* Gadjets for requester  */
  118. static struct IntuiText ot1={1,0,JAM1,1,1,&MyFont,(UBYTE *)"  OK  ",NL};
  119. static struct IntuiText ot2={1,0,JAM1,1,1,&MyFont,(UBYTE *)"Cancel",NL};
  120. static SHORT oXY1[]={-2,-2,RWDTH-128,-2,RWDTH-128,9,-2,9,-2,-2};
  121. static struct Border thebd2={0,0,2,3,JAM1,5,oXY1,NL};
  122. static struct IntuiText dtxt={2,2,JAM1,-60,0,&MyFont,(UBYTE *)"drawer",NL};
  123. static struct StringInfo os5={NL,ubuf,NL,DIR_SIZ,NL,NL,NL,NL,NL,NL,NL,NL,NL};
  124. static struct Gadget og5={&og6,RWDTH/2-80,RHGHT-106,RWDTH-130,10,  /* Directory */
  125.    GADGHCOMP,RELVERIFY,STRGADGET,(APTR)&thebd2,
  126.    NL,&dtxt,NL,(APTR)&os5,FGAD+5,NL};
  127. static struct Image cc_img;
  128. static struct PropInfo cc_prop={AUTOKNOB|FREEVERT,0,0,0,0x1000,0,0,0,0,0,0 };
  129. static struct Gadget og3={&og5,RWDTH-39,RHGHT-100,20,60,      /* Scroll Bar   */
  130.     GADGHCOMP,GADGIMMEDIATE|FOLLOWMOUSE,PROPGADGET,
  131.     (APTR)&cc_img,NL,NL,NL,(APTR)&cc_prop,FGAD+3,NL};
  132. static struct Gadget og2={&og3,RWDTH-70,RHGHT-20,50,10,   /* CANCEL */
  133.    GADGHCOMP,RELVERIFY,BOOLGADGET,
  134.    (APTR)&obd1,NL,&ot2,NL,NL,FGAD+2,NL};
  135. static struct Gadget og1={&og2,20,RHGHT-20,50,10,         /* OTAY   */
  136.    GADGHCOMP,       /* Flags    */
  137.    RELVERIFY,       /* Activation   */
  138.    BOOLGADGET,
  139.    (APTR)&obd1,NL,  /* GadgetRender, SelectRender   */
  140.    &ot1,NL,NL,      /* IntuiText, MutualExclude,SpecialInfo   */
  141.    FGAD+1,NL };     /* Gadget Id, UserData  */
  142. static struct NewWindow NewFiles={          /* Open a requester "Window" */
  143.    NL,NL,RWDTH,RHGHT,BCOL,FCOL,/*NL,*/          /* Fill in AFTER opening ... */
  144.    MOUSEBUTTONS|GADGETDOWN|GADGETUP|MOUSEMOVE|DISKINSERTED,
  145.    SMART_REFRESH|ACTIVATE|RMBTRAP|WINDOWDRAG,
  146.    &og1,NL,NL,NL,
  147.    NL,RWDTH,RHGHT,RWDTH,RHGHT,WBENCHSCREEN};
  148. IMPORT struct /* Library */ IntuitionBase *IntuitionBase;
  149.  
  150. void free_pdir(void),cxxx(void),rfnam(char *,char *),notify(char *),
  151.      CloseWindowSafely(struct Window *);
  152. char *dinit(char *),*dmore(void);
  153. int alpha_lower(struct dirent *,struct dirent *);
  154. char *get_fname(struct Window *,struct Screen *,unsigned char *,
  155.      unsigned char *,unsigned char *,unsigned char *);
  156.  
  157. /***************************************************
  158. *  get_fname(window,screen,hail,ddef,ddir);
  159. *
  160. *   Displays a window/requester that
  161. * gets a file name for device,directory,default file, extension
  162. *
  163. *   Calling args:
  164. * window:   Window making the request
  165. * screen:   Screen, if NULL assummed workbench
  166. * hail:   Text prompt at top of requester
  167. * ddef:   Input default file-name. Has NO DIRECTORY OR EXTENSION.
  168. * ddir:   Directory of file, may be null
  169.  
  170. /* Set a file-requester with prompt 'hail'   */
  171.  
  172. char *get_fname(cW,screen,hail,ddef,ddir,fext)
  173. struct Window *cW;           /* Calling Window   */
  174. struct Screen *screen;       /* screen .... if null assumed workbench */
  175. unsigned char *hail;         /* Hailing prompt   */
  176. unsigned char *ddef;         /* Probable file-name   */
  177. unsigned char *ddir;         /* Directory in which to search   */
  178. unsigned char *fext;{        /* File extension (null if none) added by JKL */
  179.    FAST struct IntuiMessage *imes;   /* Wait for message in HERE   */
  180.    FAST struct Gadget *igad;         /* Get Gadjet Mumbo Jumbo   */
  181.    FAST long i,class,id,oid;
  182.    FAST TEXT *pnam;
  183.    FAST char *retval;
  184.    FAST BOOL dir_flag;
  185.    FAST BOOL keepon;
  186.    unsigned int osec,omsec,sec,msec;
  187.    struct FileLock *ppdir;
  188.    unsigned char buffer[80];
  189.    static top=10,left=320;
  190.  
  191.    struct Library *IBase;
  192.    IBase=(struct Library *)IntuitionBase;
  193.  
  194.    pext=fext;  /* added by JKL */
  195.    id=sec=msec=0;
  196.    if(!(/*eW=*/cW))return(NL);
  197.    osx.Buffer=ddef;   /* Set default file name   */
  198.    os5.Buffer=ddir;   /* Set default device name   */
  199.    for(i=0;i<DENTS;i++){
  200.       rname[i].IText="";
  201.       rname[i].NextText=NL;};
  202.  
  203.    NewFiles.Title=/*eW*/cW->Title;
  204.    NewFiles.TopEdge= /*eW*/top;  /* added by JKL */
  205.    NewFiles.LeftEdge= /*eW*/left;
  206.    if((dir_info=(struct FileInfoBlock *)
  207.    AllocMem((long)sizeof(struct FileInfoBlock),0L))==NULL)return(NL);
  208.  
  209.    if(screen){      /* User supplied a screen */
  210.       NewFiles.Type=CUSTOMSCREEN;
  211.       NewFiles.Screen=screen;}
  212.  
  213.    if(!(FirstEntry=(struct dirent *)AllocMem((long)DBUFSIZ,0L))||
  214.    !(wRq=(struct Window *)OpenWindow(&NewFiles))){
  215.       if(FirstEntry)FreeMem((char *)FirstEntry,(long)DBUFSIZ);
  216.                                      /* notify("Can't Open Requester..."); */
  217.       FreeMem((char *)dir_info,(long)sizeof(struct FileInfoBlock));
  218.       return(NL);}
  219.  
  220.                                /* Set up directory, notify any errors...   */
  221.    if(pnam=(char *)dinit(ddir))notify(pnam);
  222.  
  223.                       /* This optional line will activate a string gadget  */
  224.    if(IBase->lib_Version>32)ActivateGadget(&ogx,wRq,0L);
  225.  
  226.    wRp=wRq->RPort;
  227. /*   wRq->UserPort=cW->UserPort;
  228.    ModifyIDCMP(wRq,(long)(MOUSEBUTTONS|GADGETDOWN|GADGETUP|MOUSEMOVE));*/
  229.  
  230.    SetAPen(wRp,0L);
  231.    RectFill(wRp,4L,10L,(long)(RWDTH-5),(long)(RHGHT-4));
  232.  
  233.    oTxt.IText=hail;                                   /* Set calling arg   */
  234.    oTxt.LeftEdge=(RWDTH-IntuiTextLength(&oTxt))>>1L;
  235.    PrintIText(wRp,&oTxt,0L,0L);
  236.  
  237.    RefreshGadgets(&og1,wRq,(long)NL);
  238.    dir_flag=TRUE;                                          /* added by JKL */
  239.    for(retval=NL,keepon=TRUE;keepon;){
  240.       while(!(imes=(struct IntuiMessage *)GetMsg(wRq->UserPort))){
  241.          i=(maxent>DENTS)?(MAXBODY*DENTS)/maxent:MAXBODY; /* next line added JKL */
  242.          NewModifyProp(&og3,wRq,0,AUTOKNOB|FREEVERT,0,cc_prop.VertPot,MAXBODY,i,1);
  243.          if(dir_flag){
  244.             i=(maxent-DENTS)*cc_prop.VertPot/MAXBODY;
  245.             if(i>(maxent-DENTS))i=maxent-DENTS;
  246.             if(i<0)i=0;
  247.             curent=i;
  248.             cxxx();
  249.             dir_flag=FALSE;}
  250.          if(more){
  251.             if(pnam=(char *)dmore()){   /* Continue to read the directory */
  252.                notify(pnam);}           /* Yucko error   */
  253.             if(maxent<=DENTS)dir_flag=TRUE;}
  254.          else WaitPort(wRq->UserPort);}
  255.       igad=(struct Gadget *)imes->IAddress; /* next 6 lines added JKL */
  256.       oid=id;
  257.       id=igad->GadgetID;
  258.       osec=sec;
  259.       omsec=msec;
  260.       sec=imes->Seconds;
  261.       msec=imes->Micros;
  262.       class=imes->Class;
  263.       ReplyMsg((struct Message *)imes);
  264.  
  265.       switch(class){  /* next 4 lines added JKL */
  266.          case DISKINSERTED: {
  267.             if(pnam=(char *)dinit(ddir))notify(pnam);
  268.             dir_flag=TRUE;
  269.             break;}
  270.          case MOUSEMOVE: dir_flag=TRUE; break;
  271.          case GADGETUP:
  272.          case GADGETDOWN: {
  273.             switch(i=id){
  274.                case FGAD+6:
  275.                case FGAD+7:
  276.                case FGAD+8:
  277.                case FGAD+9:
  278.                case FGAD+10:
  279.                case FGAD+12: {      /* Replace file or directory name   */
  280.                   if(i==FGAD+12){
  281.                      ddir[0]=0;
  282.                      while(ppdir=(struct FileLock *)ParentDir((BPTR)pdir)){
  283.                         free_pdir();
  284.                         pdir=ppdir;
  285.                         if(Examine((BPTR)pdir,dir_info)){
  286.                            strcpy(buffer,dir_info->fib_FileName);
  287.                            if(!ParentDir((BPTR)pdir))strcat(buffer,":");
  288.                            rfnam(buffer,ddir);
  289.                            strcpy(ddir,buffer);}
  290.                         else break;}}
  291.                   else {
  292.                      i-=FGAD+6;
  293.                      pnam=rname[i].IText;
  294.                      if(rname[i].NextText==NL){
  295.                         RemoveGadget(wRq,&ogx);
  296.                         for(i=0;i<DSIZE;i++)ddef[i]=*pnam++;
  297.                         AddGadget(wRq,&ogx,-1L);
  298.                         RefreshGadgets(&ogx,wRq,(long)NL); /* next 3 lines added JKL */
  299.                         if(oid==id&&DoubleClick(osec,omsec,sec,msec)){
  300.                            retval=ddef;
  301.                            keepon=FALSE;}
  302.                         break;}
  303.                      rfnam(ddir,pnam);}
  304.                   RemoveGadget(wRq,&og5);
  305.                   AddGadget(wRq,&og5,-1L);
  306.                   RefreshGadgets(&og5,wRq,(long)NL);}
  307.                case FGAD+5: if(pnam=(char *)dinit(ddir))notify(pnam);
  308.                case FGAD+3: dir_flag=TRUE; break;
  309.                case FGAD+11:      /* Name gadget, OTAY gadget   */
  310.                case FGAD+1: retval = ddef;
  311.                case FGAD+2: keepon = FALSE;}}}}      /* Cancel gadget   */
  312.  
  313.    FreeMem((char *)FirstEntry,(long)DBUFSIZ);
  314.    FreeMem((char *)dir_info,(long)sizeof(struct FileInfoBlock));
  315.    free_pdir();
  316.    top=wRq->TopEdge;  /* keep current position JKL */
  317.    left=wRq->LeftEdge;
  318.    CloseWindow/*Safely*/(wRq);
  319.    return(retval);}
  320.  
  321. static void free_pdir(){
  322.    if(pdir){
  323.       UnLock((BPTR)pdir);
  324.       pdir=NL;}}
  325.  
  326. /*****************************************************************
  327. * dinit()
  328. *   Initialize the fib for directory muck.  Null return
  329. * is good, else return is a pointer to an error string      */
  330.  
  331. static char *dinit(subdir)
  332. char *subdir;{
  333.    more=FALSE;
  334.    curent=maxent=0;
  335.    NextEntry=FirstEntry;      /* Allocate from here   */
  336.    ListHead.next=NL;          /* Clear the boogie     */
  337.    free_pdir();               /* Unlock any old lock... */
  338.    if(!(pdir=(struct FileLock *)Lock(subdir,(ULONG)ACCESS_READ))){
  339.       return("Wrong Diskette?");}
  340.    if(!Examine((BPTR)pdir,dir_info))return("Wierd Disk Error");
  341.    if(dir_info->fib_DirEntryType<0L)return("Bizzare Alert!!");
  342.    more=TRUE;
  343.    return(dmore());}
  344.  
  345. static char *dmore(){
  346.    FAST struct dirent *p_D=NextEntry;
  347.    FAST struct dirent *ptr=(struct dirent *)&ListHead;
  348.    FAST struct dirent *plink;
  349.    FAST TEXT *p_mung;
  350.    FAST long i;
  351.    char *mmm;
  352.  
  353.    if(!more)return(NL);
  354.    if(ExNext((BPTR)pdir,dir_info)){
  355.       if((ULONG)p_D>=
  356.       ((ULONG)FirstEntry+(ULONG)DBUFSIZ-(ULONG)sizeof(struct dirent))){
  357.          more=FALSE;
  358.          return("Directory Truncated!");}
  359.  
  360.                     /* Here you can add a file/directory filter   */
  361.                     /* filename text string is at &p_D->dE[0]   */
  362.  
  363.       p_D->isfile=(dir_info->fib_DirEntryType<0L);  /* next line added by JKL */
  364.       if(p_D->isfile&&(stcpm(dir_info->fib_FileName,pext,&mmm)!=strlen(pext)
  365.       ||stcpm(dir_info->fib_FileName,".info",&mmm)==5))return(NL);
  366.       p_mung=&p_D->dE[0];
  367.       for(i=0;i<FCHARS;i++)if(!(*p_mung++=dir_info->fib_FileName[i]))break;
  368.       i=(long)p_mung;
  369.       NextEntry=(struct dirent *)((i+5L)&~3L);
  370.       for(i=maxent++;i>=0;i--){
  371.          if(!(plink=ptr->next))break;
  372.          if(alpha_lower(p_D,plink))break;
  373.          ptr=plink;}
  374.       p_D->next=plink;
  375.       ptr->next=p_D;
  376.       return(NL);}
  377.    else return(IoErr()==ERROR_NO_MORE_ENTRIES)?
  378.        (char *)(more=(long)NL):"Error Reading Directory!!!";}
  379.  
  380. /* dedicated alphabetizing function for dmore()   */
  381.  
  382. static alpha_lower(snew,sold)
  383. struct dirent *snew,*sold;{
  384.    FAST struct dirent *pnew=snew;
  385.    FAST TEXT *ps1,*ps2,c,d;
  386.  
  387.    if(pnew->isfile==sold->isfile){
  388.       ps1=&pnew->dE[0];
  389.       ps2=&sold->dE[0];
  390.       while((c=*ps1++)){
  391.          if(c>(d=*ps2++))return(FALSE);
  392.          else if(c<d)break;}
  393.       return(TRUE);}
  394.    return((int)pnew->isfile);}
  395.  
  396. /* Display directory stuff   */
  397.  
  398. static void cxxx(){
  399.    FAST long   i,new;
  400.    FAST long   x,y;
  401.    FAST struct dirent *ohboy=(struct dirent *)&ListHead;
  402.  
  403.    new=curent;
  404.    for(i=0;i<new;i++)ohboy=ohboy->next;
  405.    y=RHGHT-100;
  406.    for(i=0;i<DENTS;i++){
  407.       y+=(x=10);
  408.       rname[i].NextText=NL;
  409.       rname[i].IText="";
  410.       rname[i].LeftEdge=0;
  411.       if((new+i)<maxent){
  412.          ohboy=ohboy->next;
  413.          rname[i].IText=&ohboy->dE[0];
  414.          if(ohboy->isfile)PrintIText(wRp,&rname[i],10L,y);
  415.          else {
  416.             rname[i].LeftEdge=48;
  417.             PrintIText(wRp,&saydir,10L,y);
  418.             PrintIText(wRp,&rname[i],10L,y);
  419.             rname[i].NextText = &saydir;}
  420.          x=wRp->cp_x;}
  421.       if(x<ZWDTH+10)RectFill(wRp,x,y,(long)(ZWDTH+10),(long)(y+8L));}}
  422.  
  423. /**************************************************
  424. * rfnam()
  425. *   Combines dir, plus name into dir   */
  426.  
  427. static void rfnam(dir,fil_nam)
  428. char *dir,*fil_nam;{
  429.    FAST char *pdst=dir;
  430.    FAST char *psrc=fil_nam;
  431.    FAST char c=':';
  432.  
  433.    while(*pdst)c=*pdst++;
  434.    if(c!=':'&&c!='/')*pdst++='/';
  435.    while(*pdst++=*psrc++);}
  436.  
  437. static struct IntuiText b_txt={0,1,JAM2,5,20,NL,NL,NL};
  438. static struct IntuiText p_txt={0,1,JAM2,5,3,NL,"OK", NL};
  439.  
  440. /****************************************************************/
  441. /* notify(txt)             */
  442. /*   Prompts for Yes/No response        */
  443.  
  444. static void notify(txt)
  445. char *txt;{
  446.    b_txt.IText=txt;
  447.    AutoRequest(wRq,&b_txt,0L,&p_txt,0L,0L,
  448.    (long)(IntuiTextLength(&b_txt)+50L),70L);}
  449.