home *** CD-ROM | disk | FTP | other *** search
/ Amiga MA Magazine 1998 #6 / amigamamagazinepolishissue1998.iso / coders / barfly / hello.c < prev    next >
C/C++ Source or Header  |  1977-12-31  |  695b  |  43 lines

  1. #include    "exec/execbase.h"
  2. #include    "dos/dosextens.h"
  3. #include    "proto/dos.h"
  4.  
  5. typedef struct CommandLineInterface    CLI;
  6. typedef struct Process            PROCESS;
  7.  
  8. extern struct ExecBase            *SysBase;
  9.  
  10. PROCESS    *p;
  11. CLI    *cli;
  12.  
  13. void    testfunc() {
  14.     printf("testfunc()\n");
  15. }
  16.  
  17. void    main(ac, av) 
  18. int    ac;
  19. char    *av[];
  20. {
  21.     short    i;
  22.     char    s[256], *ps;
  23.  
  24.     testfunc();
  25.     if (GetProgramName(s, 256))
  26.         printf("Program name = '%s'\n", s);
  27.     else
  28.         printf("No program name\n");
  29.  
  30.     p = (PROCESS *)SysBase->ThisTask;
  31.     cli = BADDR(p->pr_CLI);
  32.  
  33.     ps = BADDR(cli->cli_CommandName);
  34.     printf("hello, world\n");
  35.     printf("Command Line = '%s'\n", ps);
  36.     for (i=0; i<ac; i++)
  37.         printf("arg %d = '%s'\n", i, av[i]);
  38. }
  39.  
  40. abort() {
  41.     exit(0);
  42. }
  43.