home *** CD-ROM | disk | FTP | other *** search
/ The Fred Fish Collection 1.5 / ffcollection-1-5-1992-11.iso / ff_disks / 200-299 / ff236.lzh / DiskHandler / request.c < prev    next >
C/C++ Source or Header  |  1989-08-09  |  3KB  |  80 lines

  1. /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
  2. /* |_o_o|\\ Copyright (c) 1988 The Software Distillery.  All Rights Reserved */
  3. /* |. o.| || This program may not be distributed without the permission of   */
  4. /* | .  | || the authors:                             BBS: (919) 481-6436    */
  5. /* | o  | ||   John Toebes     John Mainwaring    Jim Cooper                 */
  6. /* |  . |//    Bruce Drake     Gordon Keener      Dave Baker                 */
  7. /* ======                                                                    */
  8. /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
  9.  
  10. #include "handler.h"
  11. #include <proto/intuition.h>
  12.  
  13. int request(global, reqnum, msg)
  14. GLOBAL global;
  15. int reqnum;
  16. char *msg;
  17. {
  18. /* Possible requesters that we can see at this time */
  19. /* 1: 
  20.       You MUST replace volume
  21.        xxxxx
  22.       in Unit 0 !!!
  23.  
  24.    2: I/O Error on volume
  25.        xxxxx
  26.       in Unit 0
  27.  
  28.    ?: Unknown Error with volume
  29.        xxxxx
  30.       in Unit 0
  31. */
  32.  
  33.    if (global->volume == NULL)
  34.       {
  35.       *(long *)&global->line3.LeftEdge     = 0x0004000EL;  /* 4,4  */
  36.       global->line1.NextText = &global->line2;
  37.       }
  38.    else
  39.       {
  40.       global->line1.NextText = &global->line2;
  41.       global->line2.IText = (UBYTE *)BADDR(global->volume->dl_Name)+1;
  42.       global->line2.NextText = &global->line3;
  43.       }
  44.    global->line3.IText = (UBYTE *)&global->buf3;
  45.    *(long *)&global->buf3[0] = ('i'<<24)|('n'<<16)|(' '<<8)|'U';
  46.    *(long *)&global->buf3[4] = ('n'<<24)|('i'<<16)|('t'<<8)|' ';
  47.    *(long *)&global->buf3[8] = ('0'<<24)|(' '<<16)|('!'<<8)|'!';
  48.    global->buf3[8] += global->unitnum;
  49.    global->buf3[12] = 0;
  50.  
  51.    switch(reqnum)
  52.       {
  53.       case REQ_MUST:
  54.          global->line1.IText = "You MUST replace volume";
  55.          break;
  56.       case REQ_ERROR:
  57.          global->line1.IText = "I/O Error on volume";
  58.          global->buf3[9] = 0;
  59.          break;
  60.       case REQ_GENERAL:
  61.          global->line1.IText = msg;
  62.          global->buf3[9] = 0;
  63.          break;
  64.       default:
  65.          global->line1.IText = "Unknown error on volume";
  66.          break;
  67.       }
  68.  
  69.    /* Now we need to put up the requester */
  70.    if (IntuitionBase == NULL)
  71.       IntuitionBase = (struct IntuitionBase *)OpenLibrary("intuition.library",0);
  72.    /* We probably should check and put up an alert.. but later on that */
  73.  
  74.    /* Now display the requester */
  75.    return(AutoRequest(NULL, &global->line1,
  76.                             &global->retrytxt,   &global->canceltxt,
  77.                             DISKINSERTED,        0,
  78.                             320,                 72));
  79. }
  80.