Changeset 3427
- Timestamp:
- 07/18/08 16:08:18 (3 months ago)
- Location:
- trunk/payloads/coreinfo
- Files:
-
- 2 modified
-
coreinfo.c (modified) (7 diffs)
-
lar_module.c (modified) (9 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/payloads/coreinfo/coreinfo.c
r3419 r3427 78 78 }; 79 79 80 81 80 static WINDOW *modwin; 82 81 static WINDOW *menuwin; … … 122 121 struct tm tm; 123 122 124 while (nvram_updating())123 while (nvram_updating()) 125 124 mdelay(10); 126 125 … … 128 127 129 128 mvwprintw(menuwin, 0, 57, "%02d/%02d/%04d - %02d:%02d:%02d", 130 tm.tm_mon, tm.tm_mday, 1900+tm.tm_year, tm.tm_hour,131 tm.tm_min, tm.tm_sec);129 tm.tm_mon, tm.tm_mday, 1900+tm.tm_year, tm.tm_hour, 130 tm.tm_min, tm.tm_sec); 132 131 } 133 132 #endif … … 185 184 ptr += sprintf(ptr, "[ %s ]", str); 186 185 187 188 189 186 for (i = ((SCREEN_X - len) / 2) + len; i < SCREEN_X; i++) 190 187 ptr += sprintf(ptr, "="); … … 208 205 if (key >= 'a' && key <= 'z') { 209 206 int index = key - 'a'; 210 211 207 if (index < cat->count) { 212 213 cat->cur = index; 208 cat->cur = index; 214 209 redraw_module(cat); 215 210 return; … … 297 292 298 293 for (i = 0; i < ARRAY_SIZE(categories); i++) { 299 for (j = 0; j < categories[i].count; j++)294 for (j = 0; j < categories[i].count; j++) 300 295 categories[i].modules[j]->init(); 301 296 … … 307 302 } 308 303 309 PAYLOAD_INFO(name, "coreinfo");310 PAYLOAD_INFO(listname, "System Information");311 PAYLOAD_INFO(desc, "Display information about the system");304 PAYLOAD_INFO(name, "coreinfo"); 305 PAYLOAD_INFO(listname, "System Information"); 306 PAYLOAD_INFO(desc, "Display information about the system"); -
trunk/payloads/coreinfo/lar_module.c
r3289 r3427 23 23 24 24 static struct LAR *lar; 25 static int lcount ;25 static int lcount, selected; 26 26 static char **lnames; 27 static const char *compression_table[4] = {"none", "LZMA", "NRV2B", "zeroes"}; 27 28 28 29 static int lar_module_init(void) … … 36 37 return 0; 37 38 38 while ((larent = readlar(lar)))39 while ((larent = readlar(lar))) 39 40 lcount++; 40 41 … … 46 47 rewindlar(lar); 47 48 48 while ((larent = readlar(lar)))49 while ((larent = readlar(lar))) 49 50 lnames[index++] = strdup((const char *) larent->name); 50 51 … … 52 53 } 53 54 54 static int selected;55 56 55 static int lar_module_redraw(WINDOW *win) 57 56 { 58 int i; 59 int row = 2; 57 int i, row = 2; 60 58 struct larstat stat; 61 59 … … 63 61 64 62 if (lar == 0) { 65 mvwprintw(win, 11, 61 /2, "Bad or missing LAR");63 mvwprintw(win, 11, 61 / 2, "Bad or missing LAR"); 66 64 return 0; 67 65 } 68 66 69 /* Draw a line down the middle */ 67 /* Draw a line down the middle. */ 68 for (i = 2; i < 21; i++) 69 mvwaddch(win, i, 30, '\263'); 70 70 71 for(i = 2; i < 20; i++) { 72 wmove(win, i, 30); 73 waddch(win, '\263'); 74 } 75 76 /* Draw the names down the left side */ 77 78 for(i = 0; i < lcount; i++) { 71 /* Draw the names down the left side. */ 72 for (i = 0; i < lcount; i++) { 79 73 if (i == selected) 80 74 wattrset(win, COLOR_PAIR(3) | A_BOLD); … … 85 79 } 86 80 87 /* Get the information for the LAR */ 88 81 /* Get the information for the LAR. */ 89 82 if (larstat(lar, lnames[selected], &stat)) { 90 83 printf("larstat failed\n"); … … 97 90 98 91 if (stat.compression) { 99 switch(stat.compression) { 100 case ALGO_LZMA: 101 mvwprintw(win, row++, 32, "Compression: LZMA"); 102 break; 103 case ALGO_NRV2B: 104 mvwprintw(win, row++, 32, "Compression: NRV2B"); 105 break; 106 case ALGO_ZEROES: 107 mvwprintw(win, row++, 32, "Compression: zeroes"); 108 break; 109 } 110 92 mvwprintw(win, row++, 32, "Compression: %s", 93 compression_table[stat.compression]); 111 94 mvwprintw(win, row++, 32, "Compressed length: %d", stat.len); 112 mvwprintw(win, row++, 32, "Compressed checksum: 0x%x", stat.compchecksum); 95 mvwprintw(win, row++, 32, "Compressed checksum: 0x%x", 96 stat.compchecksum); 113 97 } 114 98 115 99 mvwprintw(win, row++, 32, "Length: %d", stat.reallen); 116 100 mvwprintw(win, row++, 32, "Checksum: 0x%x", stat.checksum); 117 mvwprintw(win, row++, 32, "Load Address: 0x%llx", stat.loadaddress);118 mvwprintw(win, row++, 32, "Entry Point: 0x%llx", stat.entry);101 mvwprintw(win, row++, 32, "Load address: 0x%llx", stat.loadaddress); 102 mvwprintw(win, row++, 32, "Entry point: 0x%llx", stat.entry); 119 103 120 104 return 0; … … 152 136 .handle = lar_module_handle 153 137 }; 138 154 139 #else 155 140 … … 158 143 159 144 #endif 160 161 162 163
