home *** CD-ROM | disk | FTP | other *** search
/ Amiga ISO Collection / AmigaUtilCD2.iso / Misc / DC-POS24.LZX / pOS / pOS_RKRM.lzx / pOS_RKRM / pExec / ShowDebug.c < prev    next >
Encoding:
C/C++ Source or Header  |  1997-03-18  |  3.2 KB  |  135 lines

  1.  
  2. /*******************************************************************
  3.  $CRT 15 Sep 1996 : hb
  4.  
  5.  $AUT Holger Burkarth
  6.  $DAT >>ShowDebug.c<<   19 Nov 1996    12:47:41 - (C) ProDAD
  7. *******************************************************************/
  8.  
  9. //##ex mcpp:cppc -gs -o pos:pos/Ex/ShowDebug p:pLib/StartCode.o p:/pOS_RKRM/pExec/ShowDebug.c p:pLib/StdIO.o -l pOSStub -l pOS
  10.  
  11. /***********************************************************
  12.   pOS programing example - Copyright (C) 1995-97 proDAD
  13.  
  14.   This code was written as an easy to understand example,
  15.   how to program pOS features. It is provided 'as-is',
  16.   without any express or implied warranty.
  17.  
  18.   Permission is hereby granted to use, copy and modify
  19.   this source code for any purpose, without fee, subject
  20.   to the following conditions:
  21.  
  22.     (1) This notice may not be removed or altered from any
  23.         source distribution.
  24.  
  25.     (2) Altered source versions must be plainly marked as
  26.         such, and must not be misrepresented as being
  27.         the original source code.
  28.  
  29.     (3) If only executable code is distributed, then the
  30.         accompanying documentation have to state that
  31.         "this software is based in part on examples of
  32.         the pOS developer packet".
  33.  
  34.     (4) Permission for use of this code is granted only
  35.         if the user accepts full responsibility for any
  36.         undesirable consequences. proDAD accept NO LIABILITY
  37.         for damages of any kind.
  38.  
  39.   ©proDAD
  40. ***********************************************************/
  41.  
  42. /*\
  43. *** Example:
  44. ***
  45. \*/
  46.  
  47.  
  48. #define __COMPUTER_AMIGA 1
  49. #define NOMYDEBUG
  50.  
  51. #include "p:pExec/Types.h"
  52. #include "p:pDOS/ArgTags.h"
  53. #include "p:pDOS/DosSig.h"
  54. #include "p:pDOS/DosErrors.h"
  55. #include "p:pDos/Files.h"
  56. #include "p:proto/pLibExt.h"
  57. #include "p:proto/pExec2.h"
  58. #include "p:proto/pDOS2.h"
  59.  
  60. #ifdef _____ME_____
  61.   #include "grund/inc_string.h"
  62.   #include "grund/inc_stdio.h"
  63. #else
  64.  #ifdef __cplusplus
  65.  extern "C" {
  66.  #endif
  67.   #include <string.h>
  68.   #include <stdio.h>
  69.  #ifdef __cplusplus
  70.  }
  71.  #endif
  72. #endif
  73.  
  74.  
  75. const CHAR *HelpText=
  76. ""
  77. ;
  78.  
  79. const CHAR *PrgHeader=
  80. "";
  81.  
  82. const CHAR *PrgVerText=
  83. "$VER: 1.0 ("__DATE2__") (Copyright 1996 by proDAD) (Created by Holger Burkarth)";
  84.  
  85.  
  86.  
  87. /*----------------------------------
  88. -----------------------------------*/
  89. #ifdef __cplusplus
  90. extern "C"
  91. #endif
  92.  
  93. VOID main()
  94. {
  95.   struct pOS_DosArgs* Args;
  96.   UWORD Err=0;
  97.   ULONG Ops[1]={0};
  98.  
  99.   Args=pOS_ReadDosArgs(
  100. // 0
  101. "",
  102. Ops,sizeof(Ops)/sizeof(ULONG),
  103.  
  104.     ARGTAG_PrgHeaderText, (ULONG)PrgHeader,    /* kurze Programm-Beschreibung */
  105.     ARGTAG_HelpText,      (ULONG)HelpText,     /* Help-Texte */
  106.     ARGTAG_PrgVerText,    (ULONG)PrgVerText,   /* VER-String */
  107.     TAG_END);
  108.  
  109.   if(Args) {
  110.     const CHAR *Name;
  111.     struct pOS_FileHandle *FH;
  112.  
  113.     printf(
  114. "Diese Programm erzeugt absichtlich Fehler.\n"
  115. "Im Debug-pOS werden alle Laufzeitfehler mittels\n"
  116. "kprintf ausgegeben und werden somit nach serial gesendet.\n"
  117. "Mit speziellen Tools kann die Ausgabe auch in ein Window\n"
  118. "umgelenkt werden.\n"
  119. );
  120.  
  121.  
  122.     printf("Aufruf von pOS_OpenFile() mit fileName=NULL...\n");
  123.  
  124.     Name=NULL; // *** Nullzeiger
  125.     if(FH=pOS_OpenFile(NULL,Name,FILEHDMOD_Read)) {
  126.       pOS_CloseFile(FH);
  127.     }
  128.  
  129.     pOS_DeleteDosArgs(Args);
  130.   }
  131.   else Err=DOSFAIL_FAIL;
  132.  
  133.   pOS_SetShellFail(Err);
  134. }
  135.