Previously only a function with usage or help functions is regarded as
the entry of eppic script. This constraint makes no sense because main()
is widely accepted, and people can easily get confused when writing eppic
script and blocked by the constraint. This patch will support main() as
an entry.
Signed-off-by: Tao Liu <ltao(a)redhat.com>
---
extension_eppic.c | 7 +++++++
1 file changed, 7 insertions(+)
diff --git a/extension_eppic.c b/extension_eppic.c
index 8aa9ed2..c4a13b9 100644
--- a/extension_eppic.c
+++ b/extension_eppic.c
@@ -49,6 +49,8 @@ static int apigetctype(int, char *, type_t *);
* entry point and user will not have any option to execute the usage
* or help functions. However they are required to identify the entry
* points in the eppic macro.
+ *
+ * "main" can also work as the entry point of eppic macro.
*/
void
reg_callback(char *name, int load)
@@ -59,6 +61,11 @@ reg_callback(char *name, int load)
if (!load)
return;
+ if (!strcmp(name, "main")) {
+ eppic_cmd(name, NULL, 0);
+ return;
+ }
+
snprintf(fname, sizeof(fname), "%s_help", name);
if (eppic_chkfname(fname, 0)) {
snprintf(fname, sizeof(fname), "%s_usage", name);
--
2.47.0