Use TARGET_STRIP instead of STRIP. Needed on OS X.
[AROS.git] / compiler / include / aros / shcommands_embedded.h
blob37d79a08dc03dc7d58d4ee9ec9e8679a12f602f8
1 #ifndef SHCOMMANDS_EMBEDDED_H
3 /*
4 Copyright © 1995-2001, The AROS Development Team. All rights reserved.
5 $Id$
6 */
8 #include <dos/dos.h>
9 #include <proto/dos.h>
10 #include <proto/exec.h>
11 #include <aros/symbolsets.h>
13 /* This defines many of the macros we will be using.
15 #include <aros/shcommands_notembedded.h>
17 DECLARESET(SHCOMMANDS)
19 struct shcommand
21 STRPTR sh_Name;
22 IPTR sh_Command;
23 ULONG sh_NumArgs;
24 STRPTR sh_Template;
27 /* We only need to override __AROS_SH_ARGS */
28 #undef __AROS_SH_ARGS
29 #define __AROS_SH_ARGS(name, version, numargs, defl, templ, help) \
30 static ULONG name##_main(CONST_STRPTR , IPTR *, \
31 struct ExecBase *SysBase, \
32 struct DosLibrary *); \
33 AROS_UFP2S(LONG, name##_entry, \
34 AROS_UFPA(char *,argstr,A0), \
35 AROS_UFPA(ULONG,argsize,D0) \
36 ); \
37 static const struct shcommand __##name##_##shcommand = \
38 { \
39 .sh_Name = stringify(name), \
40 .sh_Command = (IPTR)name##_entry, \
41 .sh_NumArgs = numargs, \
42 .sh_Template = templ \
43 }; \
45 ADD2SET(__##name##_##shcommand, SHCOMMANDS, 0); \
47 AROS_UFH2S(LONG, name##_entry, \
48 AROS_UFHA(char *,argstr,A0), \
49 AROS_UFHA(ULONG,argsize,D0) \
50 ) \
51 { \
52 AROS_USERFUNC_INIT \
53 extern struct ExecBase *SysBase; \
54 APTR DOSBase; \
56 LONG __retcode = RETURN_FAIL; \
57 IPTR __shargs[numargs] = defl; \
58 struct RDArgs *__rda = NULL; \
59 struct RDArgs *__rda2 = NULL; \
61 DOSBase = OpenLibrary(DOSNAME, 0); \
63 if (!DOSBase) \
64 { \
65 /* Can't use SetIOErr(), since DOSBase is not open! */ \
66 ((struct Process *)FindTask(NULL))->pr_Result2 = \
67 ERROR_INVALID_RESIDENT_LIBRARY; \
68 goto __exit; \
69 } \
71 if (help[0]) \
72 { \
73 __rda2 = (struct RDArgs *)AllocDosObject(DOS_RDARGS, NULL); \
74 if (!__rda2) \
75 { \
76 PrintFault(IoErr(), stringify(name)); \
77 goto __exit; \
78 } \
79 __rda2->RDA_ExtHelp = help; \
80 } \
82 __rda = ReadArgs(templ, __shargs, __rda2); \
84 if (!__rda) \
85 { \
86 PrintFault(IoErr(), stringify(name)); \
87 goto __exit; \
88 } \
90 __retcode = name##_main(argstr, __shargs, SysBase, DOSBase); \
92 __exit: \
93 if (__rda) FreeArgs(__rda); \
94 if (help[0] && __rda2) FreeDosObject(DOS_RDARGS, __rda2); \
95 if (DOSBase) CloseLibrary(DOSBase); \
97 return __retcode; \
99 AROS_USERFUNC_EXIT \
101 static ULONG name##_main(CONST_STRPTR __argstr, \
102 IPTR *__shargs, \
103 struct ExecBase *SysBase, \
104 struct DosLibrary *DOSBase) \
107 #endif