2 * Frontend command-line utility for Linux NVRAM layer
4 * Copyright 2004, Broadcom Corporation
7 * THIS SOFTWARE IS OFFERED "AS IS", AND BROADCOM GRANTS NO WARRANTIES OF ANY
8 * KIND, EXPRESS OR IMPLIED, BY STATUTE, COMMUNICATION OR OTHERWISE. BROADCOM
9 * SPECIFICALLY DISCLAIMS ANY IMPLIED WARRANTIES OF MERCHANTABILITY, FITNESS
10 * FOR A SPECIFIC PURPOSE OR NONINFRINGEMENT CONCERNING THIS SOFTWARE.
25 fprintf(stderr
, "usage: nvram [get name] [set name=value] [unset name] [show]\n");
31 main(int argc
, char **argv
)
33 char *name
, *value
, buf
[NVRAM_SPACE
];
36 /* Skip program name */
43 /* Process the remaining arguments. */
44 for (; *argv
; argv
++) {
45 if (!strncmp(*argv
, "get", 3)) {
47 if ((value
= nvram_get(*argv
)))
51 else if (!strncmp(*argv
, "set", 3)) {
53 strncpy(value
= buf
, *argv
, sizeof(buf
));
54 name
= strsep(&value
, "=");
55 nvram_set(name
, value
);
58 else if (!strncmp(*argv
, "unset", 5)) {
62 else if (!strncmp(*argv
, "commit", 5)) {
65 else if (!strncmp(*argv
, "show", 4) ||
66 !strncmp(*argv
, "getall", 6)) {
67 nvram_getall(buf
, sizeof(buf
));
68 for (name
= buf
; *name
; name
+= strlen(name
) + 1)
70 size
= sizeof(struct nvram_header
) + (int) name
- (int) buf
;
71 fprintf(stderr
, "size: %d bytes (%d left)\n", size
, NVRAM_SPACE
- size
);
This page took 0.041574 seconds and 5 git commands to generate.