+ int opt;
+ while ((opt = getopt(argc, argv, PSTR("s"))) != -1) {
+ switch (opt) {
+ case 's':
+ mode = 1;
+ break;
+ default: /* '?' */
+ return CMD_RET_USAGE;
+ }
+ }
+
+ if (optind == argc) {
+ /* print all env vars */
+ int size = env_print(NULL, mode);
+ if (size < 0)
+ return CMD_RET_FAILURE;
+ if (mode == 0)
+ printf_P(PSTR("\nEnvironment size: %d/%d bytes\n"),
+ size, ENV_SIZE - 1);
+ return CMD_RET_SUCCESS;
+ }
+
+ /* print selected env vars */
+ while (optind < argc) {
+ int rc = env_print(argv[optind], mode);
+ if (rc < 0) {
+ printf_P(PSTR("## Error: \"%s\" not defined\n"), argv[optind]);
+ rc = CMD_RET_FAILURE;
+ }
+ optind++;
+ }
+
+ return rc;
+}
+
+
+command_ret_t do_env_set(cmd_tbl_t *cmdtp UNUSED, uint_fast8_t flag, int argc, char * const argv[])
+{