mirror of
git://projects.qi-hardware.com/openwrt-xburst.git
synced 2024-12-02 00:16:16 +02:00
add changes to nvram from #254/#266, resolves problems on older wap54g, thx for report
git-svn-id: svn://svn.openwrt.org/openwrt/trunk@3089 3c298f89-4303-0410-b956-a3cf2f4a3e73
This commit is contained in:
parent
ff015b7af7
commit
246ab1375b
@ -26,6 +26,15 @@ usage(void)
|
|||||||
exit(0);
|
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 */
|
/* NVRAM utility */
|
||||||
int
|
int
|
||||||
main(int argc, char **argv)
|
main(int argc, char **argv)
|
||||||
@ -44,8 +53,9 @@ main(int argc, char **argv)
|
|||||||
for (; *argv; argv++) {
|
for (; *argv; argv++) {
|
||||||
if (!strncmp(*argv, "get", 3)) {
|
if (!strncmp(*argv, "get", 3)) {
|
||||||
if (*++argv) {
|
if (*++argv) {
|
||||||
if ((value = nvram_get(*argv)))
|
if ((value = nvram_get(*argv))) {
|
||||||
puts(value);
|
puts_trim_cr(value);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else if (!strncmp(*argv, "set", 3)) {
|
else if (!strncmp(*argv, "set", 3)) {
|
||||||
@ -66,7 +76,7 @@ main(int argc, char **argv)
|
|||||||
!strncmp(*argv, "getall", 6)) {
|
!strncmp(*argv, "getall", 6)) {
|
||||||
nvram_getall(buf, sizeof(buf));
|
nvram_getall(buf, sizeof(buf));
|
||||||
for (name = buf; *name; name += strlen(name) + 1)
|
for (name = buf; *name; name += strlen(name) + 1)
|
||||||
puts(name);
|
puts_trim_cr(name);
|
||||||
size = sizeof(struct nvram_header) + (int) name - (int) buf;
|
size = sizeof(struct nvram_header) + (int) name - (int) buf;
|
||||||
fprintf(stderr, "size: %d bytes (%d left)\n", size, NVRAM_SPACE - size);
|
fprintf(stderr, "size: %d bytes (%d left)\n", size, NVRAM_SPACE - size);
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user