summaryrefslogtreecommitdiff
path: root/src
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 /src
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.
Diffstat (limited to 'src')
-rw-r--r--src/net_set.c79
1 files changed, 0 insertions, 79 deletions
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;
-}