From aa08a2da683ae6138e9207328cd41fbf680a7c1e Mon Sep 17 00:00:00 2001 From: "Wolfgang (Blub) Bumiller" Date: Tue, 26 Jun 2012 13:22:37 +0200 Subject: [PATCH] Searching for 'main' --- exec.c | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/exec.c b/exec.c index d1844bd..a3c04eb 100644 --- a/exec.c +++ b/exec.c @@ -264,6 +264,7 @@ qcint prog_tempstring(qc_program *prog, const char *_str) int main(int argc, char **argv) { size_t i; + qcint fnmain = -1; qc_program *prog; if (argc != 2) { @@ -278,8 +279,16 @@ int main(int argc, char **argv) } for (i = 1; i < prog->functions_count; ++i) { - printf("Found function: %s\n", prog_getstring(prog, prog->functions[i].name)); + const char *name = prog_getstring(prog, prog->functions[i].name); + printf("Found function: %s\n", name); + if (!strcmp(name, "main")) + fnmain = (qcint)i; } + if (fnmain > 0) + { + } + else + printf("No main function found\n"); prog_delete(prog); return 0;