diff options
| author | Daniil Baturin <daniil@vyos.io> | 2025-12-08 12:27:56 +0000 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2025-12-08 12:27:56 +0000 |
| commit | b0fc9ef4e1c9466feea2b43d6d8828150358fa62 (patch) | |
| tree | 667099507a321b789e5be510f4b5f4bdc970bc3d | |
| parent | 5c80ca0393e07961c7956cc7c6eb63084372865d (diff) | |
| parent | 538df158dd532737395222ca747e0fe8c6ac3acf (diff) | |
| download | vyatta-cfg-b0fc9ef4e1c9466feea2b43d6d8828150358fa62.tar.gz vyatta-cfg-b0fc9ef4e1c9466feea2b43d6d8828150358fa62.zip | |
Merge pull request #119 from dmbaturin/T8066-remove-exe_action
misc: T8066: remove the oudated and dangerous exe_action utility
| -rw-r--r-- | Makefile.am | 4 | ||||
| -rw-r--r-- | src/exe_action.c | 111 |
2 files changed, 1 insertions, 114 deletions
diff --git a/Makefile.am b/Makefile.am index ac842db..402e2d2 100644 --- a/Makefile.am +++ b/Makefile.am @@ -80,12 +80,10 @@ vninc_HEADERS += src/cnode/cnode-algorithm.hpp vpincdir = $(vincludedir)/cparse vpinc_HEADERS = src/cparse/cparse.hpp -sbin_PROGRAMS = src/exe_action -sbin_PROGRAMS += src/dump +sbin_PROGRAMS = src/dump sbin_PROGRAMS += src/my_cli_bin sbin_PROGRAMS += src/my_cli_shell_api -src_exe_action_SOURCES = src/exe_action.c src_dump_SOURCES = src/dump_session.c src_my_cli_bin_SOURCES = src/cli_bin.cpp src_my_cli_shell_api_SOURCES = src/cli_shell_api.cpp diff --git a/src/exe_action.c b/src/exe_action.c deleted file mode 100644 index 87aee26..0000000 --- a/src/exe_action.c +++ /dev/null @@ -1,111 +0,0 @@ -#include <sys/types.h> -#include <sys/stat.h> -#include <string.h> -#include <stdio.h> -#include <stdlib.h> -#include <unistd.h> -#include <glib-object.h> /* g_type_init */ -#include "common/common.h" - -boolean g_debug = FALSE; - -/** - * - * - **/ -void -usage() -{ - printf("exe_action\n"); - printf("-p\t\trelative path to node.def\n"); - printf("-a\t\taction (integer value)\n"); - printf("-d\t\tdebug mode\n"); - printf("-h\t\thelp\n"); -} - -/** - * - * - **/ -int -main(int argc, char** argv) -{ - int ch; - char *path = NULL; - unsigned long act = 0; - - /* this is needed before calling certain glib functions */ - #if !GLIB_CHECK_VERSION(2,35,0) - g_type_init(); - #endif - - //grab inputs - while ((ch = getopt(argc, argv, "dhp:a:")) != -1) { - switch (ch) { - case 'd': - g_debug = TRUE; - break; - case 'h': - usage(); - exit(0); - break; - case 'p': - path = optarg; - break; - case 'a': - act = strtoul(optarg,NULL,10); - break; - default: - usage(); - exit(0); - } - } - - - vtw_def def; - struct stat s; - const char *root = get_tmpp(); - char buf[2048]; - sprintf(buf,"%s/%snode.def",root,path); - printf("%s\n",buf); - initialize_output(NULL); - init_paths(TRUE); - - printf("[path: %s][act: %lu]\n",buf,act); - - if ((lstat(buf,&s) == 0) && S_ISREG(s.st_mode)) { - if (parse_def(&def,buf,FALSE) == 0) { - //execute - int status; - if (def.actions[act].vtw_list_head) { - set_in_commit(TRUE); - - char foo[1024]; - sprintf(foo,"b"); - set_at_string(foo); - - //BROKEN--NEEDS TO BE FIX BELOW FOR DPATH AND CPATH - common_set_context(path,path); - - status = execute_list(def.actions[act].vtw_list_head, &def, NULL); - if (status == FALSE) { - printf("command failed! status: %d\n", status); - } - else { - printf("SUCCESS!\n"); - } - set_in_commit(FALSE); - } - else { - printf("no action for this node\n"); - } - } - else { - printf("failure to parse defination file\n"); - } - } - else { - printf("node.def not found at: %s\n",buf); - } - return 0; -} |
