kernel: add md5sum of kernel
[openwrt.git] / package / nvram / src / cli.c
index 953910c..66ef904 100644 (file)
@@ -111,6 +111,7 @@ static int do_info(nvram_handle_t *nvram)
        /* Show info */
        printf("Magic:         0x%08X\n",   hdr->magic);
        printf("Length:        0x%08X\n",   hdr->len);
+       printf("Offset:        0x%08X\n",   nvram->offset);
 
        printf("CRC8:          0x%02X (calculated: 0x%02X)\n",
                hdr->crc_ver_init & 0xFF, crc);
@@ -165,20 +166,32 @@ int main( int argc, const char *argv[] )
                                stat = do_info(nvram);
                                done++;
                        }
-                       else if( !strcmp(argv[i], "get") && ++i < argc )
+                       else if( !strcmp(argv[i], "get") || !strcmp(argv[i], "unset") || !strcmp(argv[i], "set") )
                        {
-                               stat = do_get(nvram, argv[i]);
-                               done++;
-                       }
-                       else if( !strcmp(argv[i], "unset") && ++i < argc )
-                       {
-                               stat = do_unset(nvram, argv[i]);
-                               done++;
-                       }
-                       else if( !strcmp(argv[i], "set") && ++i < argc )
-                       {
-                               stat = do_set(nvram, argv[i]);
-                               done++;
+                               if( (i+1) < argc )
+                               {
+                                       switch(argv[i++][0])
+                                       {
+                                               case 'g':
+                                                       stat = do_get(nvram, argv[i]);
+                                                       break;
+
+                                               case 'u':
+                                                       stat = do_unset(nvram, argv[i]);
+                                                       break;
+
+                                               case 's':
+                                                       stat = do_set(nvram, argv[i]);
+                                                       break;
+                                       }
+                                       done++;
+                               }
+                               else
+                               {
+                                       fprintf(stderr, "Command '%s' requires an argument!\n", argv[i]);
+                                       done = 0;
+                                       break;
+                               }
                        }
                        else if( !strcmp(argv[i], "commit") )
                        {
This page took 0.025332 seconds and 4 git commands to generate.