+ if (!strncmp (imagename, "conf", 4)) {
+
+ // imagename = "conf file=blah dev=bleh part=blih"
+ DEBUG_F("Loading user-specified config file: %s\n",imagename);
+ if (password) {
+ check_password ("Restricted command.");
+ return 1;
+ }
+
+ // args= "file=blah dev=bleh part=blih"
+ char *args = params->args;
+
+ if (strlen(args)){
+
+ // set a pointer to the first space in args
+ char *space = strchr(args,' ');
+
+ int loop = 3;
+ while (loop > 0){
+ char temp[1024] = "0";
+
+ // copy next argument to temp
+ strncpy(temp, args, space-args);
+
+ // parse temp and set boot arguments
+ if (!strncmp (temp, "file=", 5)){
+ DEBUG_F("conf file: %s\n", temp+5);
+ strcpy(boot.file, temp+5);
+ } else if (!strncmp (temp, "device=", 7)){
+ DEBUG_F("conf device: %s\n", temp+7);
+ strcpy(boot.dev, temp+7);
+ } else if (!strncmp (temp, "partition=", 10)){
+ DEBUG_F("conf partition: %s\n", temp+10);
+ boot.part=simple_strtol(temp+10,NULL,10);
+ } else
+ space = NULL;
+
+ // set the pointer to the next space in args;
+ // set the loop control variable
+ if (strlen(space)>1){
+ // Go to the next argument
+ args = space+1;
+
+ loop--;
+ if (strchr(args,' ') == NULL)
+ space = &args[strlen(args)];
+ else
+ space = strchr(args,' ');
+ } else {
+ loop = -1;
+ space = NULL;
+ }
+ }
+
+ prom_printf("Loading config file...\n");
+ useconf = load_config_file(&boot);
+ if (useconf > 0){
+ if ((q = cfg_get_strg(0, "timeout")) != 0 && *q != 0)
+ timeout = simple_strtol(q, NULL, 0);
+ } else {
+ prom_printf("Restoring default values.\n");
+ strcpy(boot.file,"");
+ strcpy(boot.dev, defdevice_bak);
+ boot.part = defpart;
+ }
+
+ } else {
+ prom_printf("Current configuration:\n");
+ prom_printf("device: %s\n", boot.dev);
+ if (boot.part < 0)
+ prom_printf("partition: auto\n");
+ else
+ prom_printf("partition: %d\n", boot.part);
+ if (strlen(boot.file))
+ prom_printf("file: %s\n", boot.file);
+ else
+ prom_printf("file: /etc/%s\n",CONFIG_FILE_NAME);
+ }
+
+ imagename = "\0";
+ params->args = "\0";
+
+ return 0;
+ }
+