FreeCalypso > hg > freecalypso-tools
comparison loadtools/ltscript.c @ 227:6616f4e35579
fc-loadtool: exec command now looks for scripts in the current directory
| author | Mychaela Falconia <falcon@freecalypso.org> |
|---|---|
| date | Thu, 03 Aug 2017 01:21:45 +0000 |
| parents | e7502631a0f9 |
| children |
comparison
equal
deleted
inserted
replaced
| 226:e7d5ce499693 | 227:6616f4e35579 |
|---|---|
| 9 #include <strings.h> | 9 #include <strings.h> |
| 10 #include <stdlib.h> | 10 #include <stdlib.h> |
| 11 | 11 |
| 12 extern char default_helpers_dir[]; | 12 extern char default_helpers_dir[]; |
| 13 | 13 |
| 14 loadtool_exec_script(script_name) | 14 loadtool_exec_script(script_name, is_init_script) |
| 15 char *script_name; | 15 char *script_name; |
| 16 { | 16 { |
| 17 char pathbuf[MAXPATHLEN], *openfname; | 17 char pathbuf[MAXPATHLEN], *openfname; |
| 18 FILE *f; | 18 FILE *f; |
| 19 char linebuf[512], *cp; | 19 char linebuf[512], *cp; |
| 20 int lineno, retval = 0; | 20 int lineno, retval = 0; |
| 21 | 21 |
| 22 if (index(script_name, '/')) | 22 if (!is_init_script || index(script_name, '/')) |
| 23 openfname = script_name; | 23 openfname = script_name; |
| 24 else { | 24 else { |
| 25 sprintf(pathbuf, "%s/%s", default_helpers_dir, script_name); | 25 sprintf(pathbuf, "%s/%s", default_helpers_dir, script_name); |
| 26 openfname = pathbuf; | 26 openfname = pathbuf; |
| 27 } | 27 } |
| 48 } | 48 } |
| 49 | 49 |
| 50 cmd_exec(argc, argv) | 50 cmd_exec(argc, argv) |
| 51 char **argv; | 51 char **argv; |
| 52 { | 52 { |
| 53 return loadtool_exec_script(argv[1]); | 53 return loadtool_exec_script(argv[1], 0); |
| 54 } | 54 } |
