home *** CD-ROM | disk | FTP | other *** search
/ Amiga ISO Collection / AmigaUtilCD2.iso / Programming / C / SASC6571.LZX / source / autoopenfail.c < prev    next >
Encoding:
C/C++ Source or Header  |  1996-12-24  |  916 b   |  43 lines

  1. #include <proto/dos.h>
  2. #include <proto/exec.h>
  3. #include <string.h>
  4.  
  5. extern struct WBStartup *_WBenchMsg;
  6. extern char __stdiowin[];
  7. extern long __oslibversion;
  8.  
  9. void __regargs __autoopenfail(char *lib)
  10. {
  11.    struct DOSBase *DOSBase;
  12.    long fh;
  13.    char buf[50];
  14.    
  15.    DOSBase = (struct DOSBase *)OpenLibrary("dos.library",0);
  16.    if (_WBenchMsg == NULL)
  17.       fh = Output();
  18.    else
  19.       fh = Open(__stdiowin, MODE_NEWFILE);
  20.  
  21.    if (fh)
  22.    {
  23.        RawDoFmt("Can't open version %ld of ",
  24.                 &__oslibversion, (void (*))"\x16\xC0\x4E\x75", buf);
  25.    
  26.        Write(fh, buf, strlen(buf));
  27.        Write(fh, lib, strlen(lib));
  28.        Write(fh, "\n", 1);
  29.    
  30.        if (_WBenchMsg)
  31.        {
  32.            Delay(200);
  33.            Close(fh);
  34.        }
  35.    }   
  36.  
  37.    
  38.    CloseLibrary((struct Library *)DOSBase);
  39.    ((struct Process *)FindTask(NULL))->pr_Result2 = 
  40.                       ERROR_INVALID_RESIDENT_LIBRARY;
  41.  
  42. }
  43.