diff options
author | jow <jow@3c298f89-4303-0410-b956-a3cf2f4a3e73> | 2009-04-27 12:57:57 +0000 |
---|---|---|
committer | jow <jow@3c298f89-4303-0410-b956-a3cf2f4a3e73> | 2009-04-27 12:57:57 +0000 |
commit | 32fce976bd2e1bf710d5486f7168b8a73b2aaf5d (patch) | |
tree | 3fb0e5d3a87b0b277f33fb40965732cfe33a5ff1 /package/nvram/src/main.c | |
parent | a5de2f131a7d4f0b9cfa3c2d827e76ae12afb328 (diff) |
[package] remove old nvram package
git-svn-id: svn://svn.openwrt.org/openwrt/trunk@15436 3c298f89-4303-0410-b956-a3cf2f4a3e73
Diffstat (limited to 'package/nvram/src/main.c')
-rw-r--r-- | package/nvram/src/main.c | 87 |
1 files changed, 0 insertions, 87 deletions
diff --git a/package/nvram/src/main.c b/package/nvram/src/main.c deleted file mode 100644 index 44ecd10d1c..0000000000 --- a/package/nvram/src/main.c +++ /dev/null @@ -1,87 +0,0 @@ -/* - * Frontend command-line utility for Linux NVRAM layer - * - * Copyright 2004, Broadcom Corporation - * All Rights Reserved. - * - * THIS SOFTWARE IS OFFERED "AS IS", AND BROADCOM GRANTS NO WARRANTIES OF ANY - * KIND, EXPRESS OR IMPLIED, BY STATUTE, COMMUNICATION OR OTHERWISE. BROADCOM - * SPECIFICALLY DISCLAIMS ANY IMPLIED WARRANTIES OF MERCHANTABILITY, FITNESS - * FOR A SPECIFIC PURPOSE OR NONINFRINGEMENT CONCERNING THIS SOFTWARE. - * - */ - -#include <stdio.h> -#include <stdlib.h> -#include <string.h> - -#include <typedefs.h> -#include <bcmnvram.h> - -static void -usage(void) -{ - fprintf(stderr, "usage: nvram [get name] [set name=value] [unset name] [commit] [show]\n"); - exit(0); -} - -/* hack for some PMON default nvram values which have '\r' appended */ -void -puts_trim_cr(char *str) -{ - int len= strlen(str); - if (len && (str[len-1] == '\r')) len--; - printf("%.*s\n", len, str); -} - -/* NVRAM utility */ -int -main(int argc, char **argv) -{ - char *name, *value, buf[NVRAM_SPACE]; - int size; - - /* Skip program name */ - --argc; - ++argv; - - if (!*argv) - usage(); - - /* Process the remaining arguments. */ - for (; *argv; argv++) { - if (!strncmp(*argv, "get", 3)) { - if (*++argv) { - if ((value = nvram_get(*argv))) { - puts_trim_cr(value); - } - } - } - else if (!strncmp(*argv, "set", 3)) { - if (*++argv) { - strncpy(value = buf, *argv, sizeof(buf)); - name = strsep(&value, "="); - nvram_set(name, value); - } - } - else if (!strncmp(*argv, "unset", 5)) { - if (*++argv) - nvram_unset(*argv); - } - else if (!strncmp(*argv, "commit", 5)) { - nvram_commit(); - } - else if (!strncmp(*argv, "show", 4) || - !strncmp(*argv, "getall", 6)) { - nvram_getall(buf, sizeof(buf)); - for (name = buf; *name; name += strlen(name) + 1) - puts_trim_cr(name); - size = sizeof(struct nvram_header) + (int) name - (int) buf; - fprintf(stderr, "size: %d bytes (%d left)\n", size, NVRAM_SPACE - size); - } - if (!*argv) - break; - } - - return 0; -} |