home *** CD-ROM | disk | FTP | other *** search
/ Aminet 18 / aminetcdnumber181997.iso / Aminet / misc / emu / AROSdev.lha / AROS / rom / dos / printfault.c < prev    next >
Encoding:
C/C++ Source or Header  |  1997-01-27  |  2.1 KB  |  100 lines

  1. /*
  2.     (C) 1995-96 AROS - The Amiga Replacement OS
  3.     $Id: printfault.c,v 1.6 1997/01/27 00:36:27 ldp Exp $
  4.     $Log: printfault.c,v $
  5.     Revision 1.6  1997/01/27 00:36:27  ldp
  6.     Polish
  7.  
  8.     Revision 1.5  1996/12/09 13:53:37  aros
  9.     Added empty templates for all missing functions
  10.  
  11.     Moved #include's into first column
  12.  
  13.     Revision 1.4  1996/10/24 15:50:34  aros
  14.     Use the official AROS macros over the __AROS versions.
  15.  
  16.     Revision 1.3  1996/08/13 13:52:49  digulla
  17.     Replaced <dos/dosextens.h> by "dos_intern.h" or added "dos_intern.h"
  18.     Replaced AROS_LA by AROS_LHA
  19.  
  20.     Revision 1.2  1996/08/01 17:40:55  digulla
  21.     Added standard header for all files
  22.  
  23.     Desc:
  24.     Lang: english
  25. */
  26. #include <proto/exec.h>
  27. #include "dos_intern.h"
  28.  
  29. /*****************************************************************************
  30.  
  31.     NAME */
  32. #include <proto/dos.h>
  33.  
  34.     AROS_LH2(BOOL, PrintFault,
  35.  
  36. /*  SYNOPSIS */
  37.     AROS_LHA(LONG,   code,   D1),
  38.     AROS_LHA(STRPTR, header, D2),
  39.  
  40. /*  LOCATION */
  41.     struct DosLibrary *, DOSBase, 79, Dos)
  42.  
  43. /*  FUNCTION
  44.     Prints the header and the text associated with the error code to
  45.     the console (buffered), then sets the value returned by IoErr() to
  46.     the error code given.
  47.  
  48.     INPUTS
  49.     code   - Error code.
  50.     header - Text to print before the error message.
  51.  
  52.     RESULT
  53.     !=0 if all went well. 0 on failure.
  54.  
  55.     NOTES
  56.  
  57.     EXAMPLE
  58.  
  59.     BUGS
  60.  
  61.     SEE ALSO
  62.  
  63.     INTERNALS
  64.  
  65.     HISTORY
  66.     29-10-95    digulla automatically created from
  67.                 dos_lib.fd and clib/dos_protos.h
  68.  
  69. *****************************************************************************/
  70. {
  71.     AROS_LIBFUNC_INIT
  72.     AROS_LIBBASE_EXT_DECL(struct DosLibrary *,DOSBase)
  73.  
  74.     struct Process *me=(struct Process *)FindTask(NULL);
  75.     BPTR stream=me->pr_CES?me->pr_CES:me->pr_COS;
  76.     struct EString *es=EString;
  77.     BOOL ret=0;
  78.  
  79.     /* First find error string */
  80.     while(es->Number)
  81.     {
  82.     if(es->Number==code)
  83.         break;
  84.     es++;
  85.     }
  86.  
  87.     /* Print everything */
  88.     if(!FPuts(stream,header)&&
  89.        !FPuts(stream,": ")&&
  90.        !FPuts(stream,es->String)&&
  91.        !FPuts(stream,"\n"))
  92.     ret=1;
  93.  
  94.     /* All done. */
  95.     me->pr_Result2=code;
  96.     return ret;
  97.  
  98.     AROS_LIBFUNC_EXIT
  99. } /* PrintFault */
  100.