summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorStephen Hemminger <stephen.hemminger@vyatta.com>2010-11-20 12:01:41 -0800
committerStephen Hemminger <stephen.hemminger@vyatta.com>2010-11-24 11:46:30 -0800
commit558d719e47bdc01454321eab142857775403e545 (patch)
treea39c9c6caa21dcdb0b102729e12403245e280f47
parent6298508485f7f78a7a827716a35001b074d47b21 (diff)
downloadvyatta-cfg-558d719e47bdc01454321eab142857775403e545.tar.gz
vyatta-cfg-558d719e47bdc01454321eab142857775403e545.zip
Remove unused net_set
Part of earlier effort to use less sudo. Not currently used.
-rw-r--r--Makefile.am2
-rw-r--r--src/net_set.c79
2 files changed, 0 insertions, 81 deletions
diff --git a/Makefile.am b/Makefile.am
index 5d30019..c848034 100644
--- a/Makefile.am
+++ b/Makefile.am
@@ -71,7 +71,6 @@ sbin_PROGRAMS += src/my_commit
sbin_PROGRAMS += src/exe_action
sbin_PROGRAMS += src/dump
sbin_PROGRAMS += src/check_tmpl
-sbin_PROGRAMS += src/net_set
sbin_PROGRAMS += src/my_cli_bin
sbin_PROGRAMS += src/my_cli_shell_api
@@ -80,7 +79,6 @@ src_my_commit_SOURCES = src/commit2.c
src_exe_action_SOURCES = src/exe_action.c
src_dump_SOURCES = src/dump_session.c
src_check_tmpl_SOURCES = src/check_tmpl.c
-src_net_set_SOURCES = src/net_set.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/net_set.c b/src/net_set.c
deleted file mode 100644
index a84cea4..0000000
--- a/src/net_set.c
+++ /dev/null
@@ -1,79 +0,0 @@
-/*
- * Program to set sysfs value - similar to sysctl commmand
- */
-
-#include <stdio.h>
-#include <limits.h>
-#include <stdlib.h>
-#include <errno.h>
-#include <string.h>
-
-#define SYS "/sys"
-
-static void get(const char *name)
-{
- char path[PATH_MAX];
- char buf[BUFSIZ];
- FILE *f;
-
- snprintf(path, PATH_MAX, SYS "/%s", name);
- f = fopen(path, "r");
- if (f == NULL) {
- fprintf(stderr, "%s : %s\n", path, strerror(errno));
- exit(1);
- }
-
- while (fgets(buf, BUFSIZ, f) != NULL)
- fputs(buf, stdout);
-
- if (ferror(f)) {
- fprintf(stderr, "%s : read %s\n", path, strerror(errno));
- exit(1);
- }
- fclose(f);
-}
-
-static void set(const char *name, const char *val)
-{
- FILE *f;
- char path[PATH_MAX];
-
- snprintf(path, PATH_MAX, SYS "/%s", name);
- f = fopen(path, "w");
- if (f == NULL) {
- fprintf(stderr, "%s : %s\n", path, strerror(errno));
- exit(1);
- }
-
- fprintf(f, "%s\n", val);
- fflush(f);
-
- if (ferror(f)) {
- fprintf(stderr, "%s : read %s\n", path, strerror(errno));
- exit(1);
- }
- fclose(f);
-}
-
-int main(int argc, char **argv)
-{
- if (argc == 1) {
- fprintf(stderr, "Usage: %s variable\n", argv[0]);
- fprintf(stderr, " %s variable=value\n", argv[0]);
- return 1;
- }
-
- while (--argc) {
- char *ep, *arg = *++argv;
-
- ep = strchr(arg, '=');
- if (!ep)
- get(arg);
- else {
- *ep++ = '\0';
- set(arg, ep);
- }
- }
-
- return 0;
-}