comparison packages/redboot/current/src/flash.c @ 198:ea3f0bd33a73

Merge from eCos master repository on 2001-12-07-11:40:47-GMT
author jlarmour
date Fri, 07 Dec 2001 14:15:03 +0000
parents 9b55e9c69693
children 353a011b23b8
comparison
equal deleted inserted replaced
197:51b34619b677 198:ea3f0bd33a73
1338 lp += diag_sprintf(lp, "%ld", hold_int_val); 1338 lp += diag_sprintf(lp, "%ld", hold_int_val);
1339 break; 1339 break;
1340 #ifdef CYGPKG_REDBOOT_NETWORKING 1340 #ifdef CYGPKG_REDBOOT_NETWORKING
1341 case CONFIG_IP: 1341 case CONFIG_IP:
1342 lp += diag_sprintf(lp, "%s", inet_ntoa((in_addr_t *)val_ptr)); 1342 lp += diag_sprintf(lp, "%s", inet_ntoa((in_addr_t *)val_ptr));
1343 if (0 == strcmp("0.0.0.0", line) && !(LIST_OPT_LIST_ONLY & list_opt)) {
1344 // then we have a deeply unhelpful starting text - kill it off
1345 // (unless we are just listing all values)
1346 lp = line; *lp = '\0';
1347 }
1343 break; 1348 break;
1344 case CONFIG_ESA: 1349 case CONFIG_ESA:
1345 for (esa_ptr = 0; esa_ptr < sizeof(enet_addr_t); esa_ptr++) { 1350 for (esa_ptr = 0; esa_ptr < sizeof(enet_addr_t); esa_ptr++) {
1346 lp += diag_sprintf(lp, "0x%02X", ((unsigned char *)val_ptr)[esa_ptr]); 1351 lp += diag_sprintf(lp, "0x%02X", ((unsigned char *)val_ptr)[esa_ptr]);
1347 if (esa_ptr < (sizeof(enet_addr_t)-1)) lp += diag_sprintf(lp, ":"); 1352 if (esa_ptr < (sizeof(enet_addr_t)-1)) lp += diag_sprintf(lp, ":");
1370 if (type != CONFIG_SCRIPT) { 1375 if (type != CONFIG_SCRIPT) {
1371 if (NULL != newvalue) { 1376 if (NULL != newvalue) {
1372 ret = strlen(newvalue); 1377 ret = strlen(newvalue);
1373 if (ret > sizeof(line)) 1378 if (ret > sizeof(line))
1374 return CONFIG_BAD; 1379 return CONFIG_BAD;
1380 strcpy(hold_line, line); // Hold the old value for comparison
1375 strcpy(line, newvalue); 1381 strcpy(line, newvalue);
1376 strcpy(hold_line, newvalue);
1377 diag_printf("Setting to %s\n", newvalue); 1382 diag_printf("Setting to %s\n", newvalue);
1378 } else { 1383 } else {
1379 // read from terminal 1384 // read from terminal
1380 strcpy(hold_line, line); 1385 strcpy(hold_line, line);
1381 ret = _rb_gets_preloaded(line, sizeof(line), 0); 1386 ret = _rb_gets_preloaded(line, sizeof(line), 0);
1382 } 1387 }
1383 if (ret < 0) return CONFIG_ABORT; 1388 if (ret < 0) return CONFIG_ABORT;
1389 // empty input - leave value untouched (else DNS goes away for a
1390 // minute to try to look it up) but we must accept empty value for strings.
1391 if (0 == line[0] && CONFIG_STRING != type) return CONFIG_OK;
1384 if (strcmp(line, hold_line) == 0) return CONFIG_OK; // Just a CR - leave value untouched 1392 if (strcmp(line, hold_line) == 0) return CONFIG_OK; // Just a CR - leave value untouched
1385 lp = &line[strlen(line)-1]; 1393 lp = &line[strlen(line)-1];
1386 if (*lp == '.') return CONFIG_DONE; 1394 if (*lp == '.') return CONFIG_DONE;
1387 if (*lp == '^') return CONFIG_BACK; 1395 if (*lp == '^') return CONFIG_BACK;
1388 } 1396 }
1596 dp = &config->config_data[0]; 1604 dp = &config->config_data[0];
1597 continue; 1605 continue;
1598 case CONFIG_BAD: 1606 case CONFIG_BAD:
1599 // Nothing - make him do it again 1607 // Nothing - make him do it again
1600 diag_printf ("** invalid entry\n"); 1608 diag_printf ("** invalid entry\n");
1609 onevalue = NULL; // request a good value be typed in - or abort/whatever
1601 } 1610 }
1602 } 1611 }
1603 1612
1604 done: 1613 done:
1605 if (NULL != onlyone && !doneone) { 1614 if (NULL != onlyone && !doneone) {