home *** CD-ROM | disk | FTP | other *** search
/ Amiga ISO Collection / AmigaUtilCD2.iso / Programming / Misc / CLISP-1.LHA / CLISP960530-sr.lha / amiga / jchlib / test.c < prev   
Encoding:
C/C++ Source or Header  |  1996-07-09  |  1.1 KB  |  46 lines

  1. /* test file for the Tiny GCC Library */
  2. #include <exec/types.h>
  3. #include <libraries/dos.h>
  4. #include <stdlib.h>
  5. #include <string.h>
  6. #include <libgoodies.h>    /* for BPTRfprintf() */
  7.  
  8. #define __CONSTLIBBASEDECL__ const /* better code with GCC inlines */
  9. extern struct DosLibrary * const DOSBase;
  10. #include <proto/dos.h>
  11.  
  12. /* This comes from the startup code */
  13. extern BPTR Output_handle;
  14.  
  15. const char *usage = "Usage:
  16. Please try this from WorkBench also, using the ARGS tooltype."
  17. #if 0
  18. "When called with four arguments, does setjmp() test."
  19. #endif
  20. ;
  21.  
  22. int main(int argc, char *argv[])
  23. {
  24.   /* the startup code should have initialised this */
  25.   if (Output_handle == NULL) exit(RETURN_FAIL);
  26.  
  27.   Write(Output_handle,"Hello World!\n",13);
  28.   switch (argc)
  29.     {
  30.     case 0:
  31.       Write(Output_handle,"argc is 0!",10);
  32.       break;
  33.     default:
  34.       BPTRfprintf(Output_handle,"Argc is %ld:\n",argc);
  35.     }
  36.   if (argc > 0)
  37.     { int i;
  38.       for (i=0; i<argc; i++)
  39.         { BPTRfprintf(Output_handle,"%ld: %s\n",i,argv[i]); }
  40.     }
  41.   if (argc == 1)
  42.     { Write(Output_handle,usage,strlen(usage)); }
  43.   /* TODO argc=5 and setjmp() test */
  44.   exit(RETURN_WARN-1); /* test return code */
  45. }
  46.